diff --git a/cypress/e2e/po/pages/explorer/workloads/workloads-deployments.po.ts b/cypress/e2e/po/pages/explorer/workloads/workloads-deployments.po.ts index 03e839f7703..5e5a2eba0f9 100644 --- a/cypress/e2e/po/pages/explorer/workloads/workloads-deployments.po.ts +++ b/cypress/e2e/po/pages/explorer/workloads/workloads-deployments.po.ts @@ -7,6 +7,14 @@ export class WorkloadsDeploymentsDetailsPagePo extends WorkloadDetailsPageBasePo constructor(workloadId: string, protected clusterId: string = 'local', workloadType = 'apps.deployment', namespaceId = 'default', queryParams?: Record) { super(workloadId, clusterId, workloadType, queryParams, namespaceId); } + + openEmptyShowConfigurationAnnotationsLink() { + return this.self().find('[data-testid="empty-show-configuration_annotations"]').click(); + } + + labelsAndAnnotationsTab() { + return this.self().find('[data-testid="btn-labels"]'); + } } export class WorkloadsDeploymentsListPagePo extends WorkloadsListPageBasePo { diff --git a/cypress/e2e/tests/pages/explorer2/workloads/deployments.spec.ts b/cypress/e2e/tests/pages/explorer2/workloads/deployments.spec.ts index eaf5e6bf42c..d7e32788b03 100644 --- a/cypress/e2e/tests/pages/explorer2/workloads/deployments.spec.ts +++ b/cypress/e2e/tests/pages/explorer2/workloads/deployments.spec.ts @@ -96,6 +96,16 @@ describe('Deployments', { testIsolation: 'off', tags: ['@explorer2'] }, () => { }); }); + it('Should show configuration drawer with the labels/annotations tab open', () => { + const workloadDetailsPage = new WorkloadsDeploymentsDetailsPagePo(scaleTestDeploymentName, localCluster, 'apps.deployment', scaleTestNamespace); + + workloadDetailsPage.goTo(); + workloadDetailsPage.waitForDetailsPage(scaleTestDeploymentName); + + workloadDetailsPage.openEmptyShowConfigurationAnnotationsLink(); + workloadDetailsPage.labelsAndAnnotationsTab().should('be.visible'); + }); + it('Should be able to scale the number of pods', () => { const workloadDetailsPage = new WorkloadsDeploymentsDetailsPagePo(scaleTestDeploymentName, localCluster, 'apps.deployment', scaleTestNamespace); diff --git a/shell/components/Drawer/ResourceDetailDrawer/ConfigTab.vue b/shell/components/Drawer/ResourceDetailDrawer/ConfigTab.vue index abd7aa47a93..7e7cbb0c201 100644 --- a/shell/components/Drawer/ResourceDetailDrawer/ConfigTab.vue +++ b/shell/components/Drawer/ResourceDetailDrawer/ConfigTab.vue @@ -25,6 +25,7 @@ const i18n = useI18n(store); :real-mode="_VIEW" :initial-value="props.resource" :use-tabbed-hash="false /* Have to disable hashing on child components or it modifies the url and closes the drawer */" + :default-tab="props.defaultTab" as="config" /> diff --git a/shell/components/Drawer/ResourceDetailDrawer/index.vue b/shell/components/Drawer/ResourceDetailDrawer/index.vue index c5d0f5da2cb..95a53c77081 100644 --- a/shell/components/Drawer/ResourceDetailDrawer/index.vue +++ b/shell/components/Drawer/ResourceDetailDrawer/index.vue @@ -79,6 +79,7 @@ const canEdit = computed(() => { void; } diff --git a/shell/components/Resource/Detail/Metadata/Annotations/index.vue b/shell/components/Resource/Detail/Metadata/Annotations/index.vue index 6cb8614b308..0c841eaedb2 100644 --- a/shell/components/Resource/Detail/Metadata/Annotations/index.vue +++ b/shell/components/Resource/Detail/Metadata/Annotations/index.vue @@ -8,7 +8,7 @@ export type Annotation = Row; export interface AnnotationsProps { annotations: Annotation[]; - onShowConfiguration?: (returnFocusSelector: string) => void; + onShowConfiguration?: (returnFocusSelector: string, defaultTab: string) => void; } @@ -26,6 +26,6 @@ const i18n = useI18n(store); :rows="annotations" type="active" - @show-configuration="(returnFocusSelector: string) => emit('show-configuration', returnFocusSelector)" + @show-configuration="(returnFocusSelector: string) => emit('show-configuration', returnFocusSelector, 'labels-and-annotations')" /> diff --git a/shell/components/Resource/Detail/Metadata/Labels/index.vue b/shell/components/Resource/Detail/Metadata/Labels/index.vue index db3e763b3ad..f1576c3bfca 100644 --- a/shell/components/Resource/Detail/Metadata/Labels/index.vue +++ b/shell/components/Resource/Detail/Metadata/Labels/index.vue @@ -8,7 +8,7 @@ export type Label = Row; export interface LabelsProps { labels: Label[]; - onShowConfiguration?: (returnFocusSelector: string) => void; + onShowConfiguration?: (returnFocusSelector: string, defaultTab: string) => void; } @@ -27,6 +27,6 @@ const i18n = useI18n(store); :propertyName="i18n.t('component.resource.detail.metadata.labels.title')" :rows="labels" type="active" - @show-configuration="(returnFocusSelector: string) => emit('show-configuration', returnFocusSelector)" + @show-configuration="(returnFocusSelector: string) => emit('show-configuration', returnFocusSelector, 'labels-and-annotations')" /> diff --git a/shell/components/Resource/Detail/Metadata/index.vue b/shell/components/Resource/Detail/Metadata/index.vue index 2e1ddea7bd5..6efb70a2bd2 100644 --- a/shell/components/Resource/Detail/Metadata/index.vue +++ b/shell/components/Resource/Detail/Metadata/index.vue @@ -48,7 +48,7 @@ const showBothEmpty = computed(() => labels.length === 0 && annotations.length = type="active" :rows="[]" :propertyName="i18n.t('component.resource.detail.metadata.labelsAndAnnotations')" - @show-configuration="(returnFocusSelector: string) => emit('show-configuration', returnFocusSelector)" + @show-configuration="(returnFocusSelector: string, defaultTab: string) => emit('show-configuration', returnFocusSelector, defaultTab)" /> @@ -58,7 +58,7 @@ const showBothEmpty = computed(() => labels.length === 0 && annotations.length = >
labels.length === 0 && annotations.length = >
diff --git a/shell/components/Resource/Detail/composables.ts b/shell/components/Resource/Detail/composables.ts index 0cfa8704df3..b09fb934448 100644 --- a/shell/components/Resource/Detail/composables.ts +++ b/shell/components/Resource/Detail/composables.ts @@ -46,12 +46,12 @@ export const useResourceDetailBannerProps = (resource: any): Ref { - return (returnFocusSelector?: string) => { + return (returnFocusSelector?: string, defaultTab?: string) => { const resourceValue = toValue(resource); // Because extensions can make a copy of the resource-class it's possible that an extension will have a resource-class which predates the inclusion of showConfiguration // to still the rest of shell to consume const showConfiguration = resourceValue.showConfiguration ? resourceValue.showConfiguration.bind(resourceValue) : ResourceClass.prototype.showConfiguration.bind(resourceValue); - showConfiguration(returnFocusSelector); + showConfiguration(returnFocusSelector, defaultTab); }; }; diff --git a/shell/edit/autoscaling.horizontalpodautoscaler/index.vue b/shell/edit/autoscaling.horizontalpodautoscaler/index.vue index 4078814bb93..dc7db8d51dc 100644 --- a/shell/edit/autoscaling.horizontalpodautoscaler/index.vue +++ b/shell/edit/autoscaling.horizontalpodautoscaler/index.vue @@ -209,6 +209,7 @@ export default {