Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions shell/components/Drawer/ResourceDetailDrawer/ConfigTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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"
/>
</div>
Expand Down
1 change: 1 addition & 0 deletions shell/components/Drawer/ResourceDetailDrawer/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ const canEdit = computed(() => {
<ConfigTab
v-if="configTabProps"
v-bind="configTabProps"
:default-tab="props.defaultTab"
/>
<YamlTab
v-if="yamlTabProps"
Expand Down
3 changes: 2 additions & 1 deletion shell/components/Drawer/ResourceDetailDrawer/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ export interface ConfigProps {
resource: any;
component: any;
resourceType: string;
defaultTab?: string;
}

export interface ResourceDetailDrawerProps {
resource: any;

defaultTab?: string;
onClose?: () => void;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export type Annotation = Row;
export interface AnnotationsProps {
annotations: Annotation[];

onShowConfiguration?: (returnFocusSelector: string) => void;
onShowConfiguration?: (returnFocusSelector: string, defaultTab: string) => void;
}

</script>
Expand All @@ -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')"
/>
</template>
4 changes: 2 additions & 2 deletions shell/components/Resource/Detail/Metadata/Labels/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export type Label = Row;
export interface LabelsProps {
labels: Label[];

onShowConfiguration?: (returnFocusSelector: string) => void;
onShowConfiguration?: (returnFocusSelector: string, defaultTab: string) => void;
}

</script>
Expand All @@ -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')"
/>
</template>
6 changes: 3 additions & 3 deletions shell/components/Resource/Detail/Metadata/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
/>
</div>
<!-- I'm not using v-else here so I can maintain the spacing correctly with the other columns in other rows. -->
Expand All @@ -58,7 +58,7 @@ const showBothEmpty = computed(() => labels.length === 0 && annotations.length =
>
<Labels
:labels="labels"
@show-configuration="(returnFocusSelector: string) => emit('show-configuration', returnFocusSelector)"
@show-configuration="(returnFocusSelector: string, defaultTab: string) => emit('show-configuration', returnFocusSelector, defaultTab)"
/>
</div>
<div
Expand All @@ -67,7 +67,7 @@ const showBothEmpty = computed(() => labels.length === 0 && annotations.length =
>
<Annotations
:annotations="annotations"
@show-configuration="(returnFocusSelector: string) => emit('show-configuration', returnFocusSelector)"
@show-configuration="(returnFocusSelector: string, defaultTab: string) => emit('show-configuration', returnFocusSelector, defaultTab)"
/>
</div>
</SpacedRow>
Expand Down
4 changes: 2 additions & 2 deletions shell/components/Resource/Detail/composables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ export const useResourceDetailBannerProps = (resource: any): Ref<BannerProps | u
};

export const useOnShowConfiguration = (resource: any) => {
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);
};
};
1 change: 1 addition & 0 deletions shell/edit/autoscaling.horizontalpodautoscaler/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ export default {
<Tabbed
:side-tabs="true"
:use-hash="useTabbedHash"
:default-tab="defaultTab"
>
<Tab
name="target"
Expand Down
1 change: 1 addition & 0 deletions shell/edit/configmap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export default {
<Tabbed
:side-tabs="true"
:use-hash="useTabbedHash"
:default-tab="defaultTab"
>
<Tab
name="data"
Expand Down
2 changes: 2 additions & 0 deletions shell/edit/constraints.gatekeeper.sh.constraint/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,8 @@ export default {
<Tabbed
:side-tabs="true"
:use-hash="useTabbedHash"
:default-tab="defaultTab"

@changed="onTabChanged"
>
<Tab
Expand Down
1 change: 1 addition & 0 deletions shell/edit/helm.cattle.io.projecthelmchart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ export default {
ref="tabs"
:side-tabs="true"
:use-hash="useTabbedHash"
:default-tab="defaultTab"
>
<Questions
v-model:value="value.spec.values"
Expand Down
1 change: 1 addition & 0 deletions shell/edit/k8s.cni.cncf.io.networkattachmentdefinition.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export default {
class="mt-15"
:side-tabs="true"
:use-hash="useTabbedHash"
:default-tab="defaultTab"
>
<Tab
name="basics"
Expand Down
2 changes: 2 additions & 0 deletions shell/edit/logging-flow/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,8 @@ export default {
<Tabbed
:side-tabs="true"
:use-hash="useTabbedHash"
:default-tab="defaultTab"

@changed="tabChanged($event)"
>
<Tab
Expand Down
2 changes: 2 additions & 0 deletions shell/edit/logging.banzaicloud.io.output/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@ export default {
ref="tabbed"
:side-tabs="true"
:use-hash="useTabbedHash"
:default-tab="defaultTab"

@changed="tabChanged($event)"
>
<Tab
Expand Down
2 changes: 1 addition & 1 deletion shell/edit/management.cattle.io.fleetworkspace.vue
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export default {

<Tabbed
:side-tabs="true"
default-tab="members"
:default-tab="defaultTab || 'members'"
:use-hash="useTabbedHash"
>
<!-- <Tab name="members" label-key="generic.members" :weight="2">
Expand Down
1 change: 1 addition & 0 deletions shell/edit/management.cattle.io.project.vue
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ export default {
<Tabbed
:side-tabs="true"
:use-hash="useTabbedHash"
:default-tab="defaultTab"
>
<Tab
v-if="canViewMembers"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,10 @@ export default {
@input="$emit('input', $event)"
/>

<Tabbed :use-hash="useTabbedHash">
<Tabbed
:use-hash="useTabbedHash"
:default-tab="defaultTab"
>
<Tab
:label="t('monitoring.route.label')"
:weight="1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,9 @@ export default {
<Tabbed
ref="tabbed"
:side-tabs="true"
default-tab="overview"
:default-tab="defaultTab || 'overview'"
:use-hash="useTabbedHash"

@changed="tabChanged"
>
<Tab
Expand Down
2 changes: 2 additions & 0 deletions shell/edit/monitoring.coreos.com.prometheusrule/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ export default {
:side-tabs="true"
:show-tabs-add-remove="mode !== 'view'"
:use-hash="useTabbedHash"
:default-tab="defaultTab"

@addTab="addRuleGroup"
@removeTab="removeGroupRule"
>
Expand Down
3 changes: 2 additions & 1 deletion shell/edit/monitoring.coreos.com.receiver/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,9 @@ export default {
<Tabbed
ref="tabbed"
:side-tabs="true"
default-tab="overview"
:default-tab="defaultTab || 'overview'"
:use-hash="useTabbedHash"

@changed="tabChanged"
>
<Tab
Expand Down
2 changes: 1 addition & 1 deletion shell/edit/monitoring.coreos.com.route.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export default {
<Tabbed
ref="tabbed"
:side-tabs="true"
default-tab="overview"
:default-tab="defaultTab || 'overview'"
:use-hash="useTabbedHash"
>
<Tab
Expand Down
2 changes: 2 additions & 0 deletions shell/edit/namespace.vue
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ export default {
:mode="mode"
:side-tabs="true"
:use-hash="useTabbedHash"
:default-tab="defaultTab"

@update:value="$emit('input', $event)"
>
<Tab
Expand Down
1 change: 1 addition & 0 deletions shell/edit/networking.istio.io.destinationrule/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export default {
<Tabbed
:side-tabs="true"
:use-hash="useTabbedHash"
:default-tab="defaultTab"
>
<Tab
name="subsets"
Expand Down
1 change: 1 addition & 0 deletions shell/edit/networking.k8s.io.ingress/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ export default {
<Tabbed
:side-tabs="true"
:use-hash="useTabbedHash"
:default-tab="defaultTab"
>
<Tab
:label="firstTabLabel"
Expand Down
2 changes: 2 additions & 0 deletions shell/edit/networking.k8s.io.networkpolicy/PolicyRules.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ export default {
:side-tabs="true"
:show-tabs-add-remove="mode !== 'view'"
:use-hash="useTabbedHash"
:default-tab="defaultTab"

@addTab="addPolicyRule"
@removeTab="removePolicyRule"
>
Expand Down
1 change: 1 addition & 0 deletions shell/edit/networking.k8s.io.networkpolicy/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ export default {
<Tabbed
:side-tabs="true"
:use-hash="useTabbedHash"
:default-tab="defaultTab"
>
<Tab
name="ingress"
Expand Down
2 changes: 2 additions & 0 deletions shell/edit/node.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ export default {
:value="value"
:mode="mode"
:use-hash="useTabbedHash"
:default-tab="defaultTab"

@update:value="$emit('input', $event)"
>
<Tab
Expand Down
1 change: 1 addition & 0 deletions shell/edit/persistentvolume/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ export default {
<Tabbed
:side-tabs="true"
:use-hash="useTabbedHash"
:default-tab="defaultTab"
>
<Tab
name="plugin-configuration"
Expand Down
2 changes: 2 additions & 0 deletions shell/edit/provisioning.cattle.io.cluster/rke2.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2440,6 +2440,8 @@ export default {
:side-tabs="true"
class="min-height"
:use-hash="useTabbedHash"
:default-tab="defaultTab"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just out of curiosity, is this our new code style to seperate event handlers?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I think it was just autoformatting.

I'll fix it after you review the rest so I can include it with other changes.

@changed="handleTabChange"
>
<Tab
Expand Down
2 changes: 1 addition & 1 deletion shell/edit/secret/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ export default {
v-else
:side-tabs="true"
:use-hash="useTabbedHash"
default-tab="data"
:default-tab="defaultTab || 'data'"
>
<Tab
name="data"
Expand Down
1 change: 1 addition & 0 deletions shell/edit/service.vue
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ export default {
<Tabbed
:side-tabs="true"
:use-hash="useTabbedHash"
:default-tab="defaultTab"
>
<Tab
v-if="checkTypeIs('ExternalName')"
Expand Down
1 change: 1 addition & 0 deletions shell/edit/serviceaccount.vue
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ export default {
<Tabbed
:side-tabs="true"
:use-hash="useTabbedHash"
:default-tab="defaultTab"
>
<Tab
name="data"
Expand Down
1 change: 1 addition & 0 deletions shell/edit/storage.k8s.io.storageclass/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ export default {
<Tabbed
:side-tabs="true"
:use-hash="useTabbedHash"
:default-tab="defaultTab"
>
<Tab
name="parameters"
Expand Down
3 changes: 2 additions & 1 deletion shell/edit/workload/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,10 @@ export default {
ref="containersTabbed"
class="deployment-tabs"
:show-tabs-add-remove="true"
:default-tab="defaultTab"
:default-tab="defaultTab || defaultWorkloadTab"
:flat="true"
:use-hash="useTabbedHash"

data-testid="workload-horizontal-tabs"
@changed="changed"
>
Expand Down
2 changes: 1 addition & 1 deletion shell/edit/workload/mixins/workload.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ export default {
return { general: this.fvGetPathErrors(['image'])?.length > 0 };
},

defaultTab() {
defaultWorkloadTab() {
if (!!this.$route.query.sidecar || this.$route.query.init || this.mode === _CREATE) {
const container = this.allContainers.find((c) => c.__active);

Expand Down
5 changes: 5 additions & 0 deletions shell/mixins/create-edit-view/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ export default defineComponent({
useTabbedHash: {
type: Boolean,
default: undefined
},

defaultTab: {
type: String,
default: undefined
}
},
});
5 changes: 3 additions & 2 deletions shell/plugins/dashboard-store/resource-class.js
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,7 @@ export default class Resource {
return out;
}

showConfiguration(returnFocusSelector) {
showConfiguration(returnFocusSelector, defaultTab) {
const onClose = () => this.$ctx.commit('slideInPanel/close', undefined, { root: true });

this.$ctx.commit('slideInPanel/open', {
Expand All @@ -920,7 +920,8 @@ export default class Resource {
'z-index': 101, // We want this to be above the main side menu
closeOnRouteChange: ['name', 'params', 'query'], // We want to ignore hash changes, tables in extensions can trigger the drawer to close while opening
triggerFocusTrap: true,
returnFocusSelector
returnFocusSelector,
defaultTab
}
}, { root: true });
}
Expand Down