Set container to be the default tab in workload screens. (#6955)

* Set container to be the default tab in workload screens. #6644
This commit is contained in:
Shavindra 2022-09-22 13:24:30 +02:00 committed by GitHub
parent d7659cc3c4
commit cbfaaf7a3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 11 deletions

View File

@ -148,7 +148,6 @@ export default {
},
data() {
let defaultTab;
let type = this.$route.params.resource;
const createSidecar = !!this.$route.query.sidecar;
const isInitContainer = !!this.$route.query.init;
@ -165,18 +164,12 @@ export default {
name: `container-0`,
}];
defaultTab = 'container-0';
const podSpec = { template: { spec: { containers: podContainers, initContainers: [] } } };
this.$set(this.value, 'spec', podSpec);
}
}
if (this.mode === _CREATE) {
defaultTab = 'container-0';
}
if ((this.mode === _EDIT || this.mode === _VIEW ) && this.value.type === 'pod' ) {
const podSpec = { ...this.value.spec };
@ -214,7 +207,6 @@ export default {
imagePullPolicy: 'Always',
name: `container-${ allContainers.length }`,
});
defaultTab = 'container-0';
containers = podTemplateSpec.initContainers;
}
@ -224,8 +216,6 @@ export default {
name: `container-${ allContainers.length }`,
};
defaultTab = 'container-0';
containers.push(container);
} else {
container = containers[0];
@ -261,7 +251,6 @@ export default {
path: 'image', rootObject: this.container, rules: ['required'], translationKey: 'workload.container.image'
}],
fvReportedValidationPaths: ['spec'],
defaultTab
};
},
@ -271,6 +260,14 @@ export default {
return { general: this.fvGetPathErrors(['image'])?.length > 0 };
},
defaultTab() {
if (!!this.$route.query.sidecar || this.$route.query.init || this.mode === _CREATE) {
return 'container-0';
}
return this.allContainers.length ? this.allContainers[0].name : '';
},
isEdit() {
return this.mode === _EDIT;
},