This commit is contained in:
Louis Lam 2023-11-13 18:09:36 +08:00
parent 54e8484efd
commit d76442434f
3 changed files with 14 additions and 5 deletions

View file

@ -72,9 +72,9 @@ export class Stack {
} }
validate() { validate() {
// Check name, allows [a-z][A-Z][0-9] _ - only // Check name, allows [a-z][0-9] _ - only
if (!this.name.match(/^[a-zA-Z0-9_-]+$/)) { if (!this.name.match(/^[a-z0-9_-]+$/)) {
throw new ValidationError("Stack name can only contain [a-z][A-Z][0-9] _ - only"); throw new ValidationError("Stack name can only contain [a-z][0-9] _ - only");
} }
// Check YAML format // Check YAML format

View file

@ -68,9 +68,10 @@
<h4 class="mb-3">{{ $t("general") }}</h4> <h4 class="mb-3">{{ $t("general") }}</h4>
<div class="shadow-box big-padding mb-3"> <div class="shadow-box big-padding mb-3">
<!-- Stack Name --> <!-- Stack Name -->
<div class="mb-3"> <div>
<label for="name" class="form-label">{{ $t("stackName") }}</label> <label for="name" class="form-label">{{ $t("stackName") }}</label>
<input id="name" v-model="stack.name" type="text" class="form-control" required> <input id="name" v-model="stack.name" type="text" class="form-control" required @blur="stackNameToLowercase">
<div class="form-text">Lowercase only</div>
</div> </div>
</div> </div>
</div> </div>
@ -582,6 +583,10 @@ export default {
}); });
}, },
stackNameToLowercase() {
this.stack.name = this.stack?.name?.toLowerCase();
},
} }
}; };
</script> </script>

View file

@ -680,6 +680,10 @@ code {
} }
} }
.form-text {
color: $dark-font-color3;
}
// Vue Prism Editor bug - workaround // Vue Prism Editor bug - workaround
// https://github.com/koca/vue-prism-editor/issues/87 // https://github.com/koca/vue-prism-editor/issues/87
/* /*