Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions shell/components/ResourceDetail/Masthead/latest.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script lang="ts">
/* eslint-disable */
import { Banner } from '@components/Banner';
import TitleBar from '@shell/components/Resource/Detail/TitleBar/index.vue';
import { useDefaultTitleBarProps } from '@shell/components/Resource/Detail/TitleBar/composables';
Expand All @@ -7,6 +8,7 @@ import { useDefaultMetadataForLegacyPagesProps } from '@shell/components/Resourc
import { useResourceDetailBannerProps } from '@shell/components/Resource/Detail/composables';
import { computed } from 'vue';

// We are disabling eslint for this script to allow the use of the Props interface
export interface Props {
value?: Object;
resourceSubtype?: string;
Expand All @@ -15,18 +17,45 @@ export interface Props {
</script>

<script lang="ts" setup>
import { useStore } from 'vuex';

const props = withDefaults(defineProps<Props>(), { value: () => ({}), resourceSubtype: undefined });

const uiCtxResource = computed(() => {
const {
name, metadata, kind, state
} = (props.value || {}) as any;

return {
name,
namespace: metadata?.namespace,
kind,
state,
};
});
const resourceSubtype = computed(() => props.resourceSubtype);
const titleBarProps = useDefaultTitleBarProps(props.value, resourceSubtype);
const metadataProps = useDefaultMetadataForLegacyPagesProps(props.value);
const bannerProps = useResourceDetailBannerProps(props.value);

const store = useStore();
</script>

<template>
<TitleBar v-bind="titleBarProps" />
<Banner
v-if="bannerProps"
v-ui-context="{
store: store,
icon: 'icon-info',
hookable: true,
value: {
bannerProps,
resource: uiCtxResource
},
tag: '__details-state-banner',
description: 'Status Message'
}"
class="new state-banner"
v-bind="bannerProps"
/>
Expand Down
10 changes: 8 additions & 2 deletions shell/directives/ui-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ export default {
}

if (!isValid(context)) {
throw new Error(`Invalid ui-context value: ${ JSON.stringify({ tag: (context as Context).tag, description: (context as Context).description }) }`);
// eslint-disable-next-line no-console
console.warn(`[ui-context] invalid value: ${ JSON.stringify({ tag: (context as Context).tag, description: (context as Context).description }) }`);

return;
}

if (context.path === undefined && context.value === undefined) {
Expand All @@ -64,7 +67,10 @@ export default {
const value = get(binding.instance, context.path);

if (value === undefined) {
throw new Error(`[ui-context] path "${ context.path }" is undefined on the component instance`);
// eslint-disable-next-line no-console
console.warn(`[ui-context] path "${ context.path }" is undefined on the component instance`);

return;
}

context.value = value;
Expand Down
2 changes: 1 addition & 1 deletion shell/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rancher/shell",
"version": "3.0.8-rc.2",
"version": "3.0.8-rc.3",
"description": "Rancher Dashboard Shell",
"repository": "https://github.com/rancherlabs/dashboard",
"license": "Apache-2.0",
Expand Down
Loading