Merge pull request #6157 from richard-cox/update-ns-create-process

NameNsDescription Updates
This commit is contained in:
Richard Cox 2022-06-15 09:31:59 +01:00 committed by GitHub
commit b2cac564e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 17 deletions

View File

@ -1,7 +1,7 @@
<script>
import isEmpty from 'lodash/isEmpty';
import { createYaml } from '@shell/utils/create-yaml';
import { clone } from '@shell/utils/object';
import { clone, get } from '@shell/utils/object';
import { SCHEMA } from '@shell/config/types';
import ResourceYaml from '@shell/components/ResourceYaml';
import { Banner } from '@components/Banner';
@ -100,11 +100,10 @@ export default {
default: ''
},
// Used to allow creating namespaces that are not
// for Kubernetes resources, for example, an Epinio namespace.
// Location of `namespace` value within the resource. Used when creating the namespace
namespaceKey: {
type: String,
default: ''
default: 'metadata.namespace'
}
},
@ -299,13 +298,7 @@ export default {
if (this.createNamespace) {
try {
let newNamespace = null;
if (this.namespaceKey) {
newNamespace = await this.$store.dispatch(`${ inStore }/createNamespace`, { name: this.resource[this.namespaceKey] }, { root: true });
} else {
newNamespace = await this.$store.dispatch(`${ inStore }/createNamespace`, { name: this.resource.metadata.namespace }, { root: true });
}
const newNamespace = await this.$store.dispatch(`${ inStore }/createNamespace`, { name: get(this.resource, this.namespaceKey) }, { root: true });
newNamespace.applyDefaults();
await newNamespace.save();

View File

@ -1,4 +1,5 @@
<script>
import Vue from 'vue';
import { mapGetters } from 'vuex';
import { get, set } from '@shell/utils/object';
import { sortBy } from '@shell/utils/sort';
@ -326,6 +327,7 @@ export default {
if (e.value === '') { // The blank value in the dropdown is labeled "Create a New Namespace"
this.createNamespace = true;
this.$parent.$emit('createNamespace', true);
Vue.nextTick(() => this.$refs.namespace.focus());
} else {
this.createNamespace = false;
this.$parent.$emit('createNamespace', false);
@ -423,10 +425,9 @@ button {
position: relative;
top: -35px;
float: right;
margin-right: 10px;
margin-right: 7px;
cursor: pointer;
color: rgb(255, 0, 0);
}
.row {

View File

@ -901,8 +901,8 @@ export default {
:mode="mode"
@change="name=value.metadata.name"
/>
<div class="row mb-10">
<div v-if="isCronJob" class="col span-4">
<div v-if="isCronJob || isReplicable || isStatefulSet || containerOptions.length > 1" class="row mb-20">
<div v-if="isCronJob" class="col span-3">
<LabeledInput
v-model="spec.schedule"
type="cron"
@ -912,7 +912,7 @@ export default {
placeholder="0 * * * *"
/>
</div>
<div v-if="isStatefulSet || isDeployment" class="col span-4">
<div v-if="isReplicable" class="col span-3">
<LabeledInput
v-model.number="spec.replicas"
type="number"
@ -922,7 +922,7 @@ export default {
:label="t('workload.replicas')"
/>
</div>
<div v-if="isStatefulSet" class="col span-4">
<div v-if="isStatefulSet" class="col span-3">
<LabeledSelect
v-model="spec.serviceName"
option-label="metadata.name"