Skip to content
Snippets Groups Projects
Commit 9b15e44b authored by Daniel Göbel's avatar Daniel Göbel
Browse files

Merge branch 'bugfix/7-bucket-description-input-validation' into 'development'

Resolve "Bucket description input validation"

Closes #7

See merge request denbi/object-storage-access-ui!20
parents be974a2d 4f013fc5
No related branches found
No related tags found
2 merge requests!22Version 1.0.0,!20Resolve "Bucket description input validation"
...@@ -48,7 +48,7 @@ const props = defineProps<{ ...@@ -48,7 +48,7 @@ const props = defineProps<{
</tr> </tr>
<tr> <tr>
<th scope="row">Description</th> <th scope="row">Description</th>
<td>{{ props.bucket.description }}</td> <td class="text-break">{{ props.bucket.description }}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
......
...@@ -34,6 +34,8 @@ function createBucket() { ...@@ -34,6 +34,8 @@ function createBucket() {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const form = document.getElementById("bucketCreateForm")! as HTMLFormElement; const form = document.getElementById("bucketCreateForm")! as HTMLFormElement;
formState.bucketNameTaken = false; formState.bucketNameTaken = false;
bucket.description = bucket.description.trim();
bucket.name = bucket.name.trim();
if (form.checkValidity()) { if (form.checkValidity()) {
formState.loading = true; formState.loading = true;
BucketService.bucketCreateBucket(bucket) BucketService.bucketCreateBucket(bucket)
...@@ -94,7 +96,7 @@ function modalClosed() { ...@@ -94,7 +96,7 @@ function modalClosed() {
minlength="3" minlength="3"
maxlength="63" maxlength="63"
pattern="(?!(^((2(5[0-5]|[0-4]\d)|[01]?\d{1,2})\.){3}(2(5[0-5]|[0-4]\d)|[01]?\d{1,2})$))^[a-z\d][a-z\d.-]{1,61}[a-z\d]$" pattern="(?!(^((2(5[0-5]|[0-4]\d)|[01]?\d{1,2})\.){3}(2(5[0-5]|[0-4]\d)|[01]?\d{1,2})$))^[a-z\d][a-z\d.-]{1,61}[a-z\d]$"
v-model.trim="bucket.name" v-model="bucket.name"
/> />
<div class="invalid-feedback"> <div class="invalid-feedback">
Requirements Requirements
...@@ -109,7 +111,7 @@ function modalClosed() { ...@@ -109,7 +111,7 @@ function modalClosed() {
</div> </div>
<div class="mb-3"> <div class="mb-3">
<label for="bucketDescriptionInput" class="form-label"> <label for="bucketDescriptionInput" class="form-label">
Description Description {{ bucket.description.length }} / 126
</label> </label>
<div class="input-group"> <div class="input-group">
<textarea <textarea
...@@ -119,7 +121,7 @@ function modalClosed() { ...@@ -119,7 +121,7 @@ function modalClosed() {
rows="5" rows="5"
minlength="126" minlength="126"
maxlength="65536" maxlength="65536"
v-model.trim="bucket.description" v-model="bucket.description"
placeholder="Describe the purpose of the bucket" placeholder="Describe the purpose of the bucket"
></textarea> ></textarea>
<div class="invalid-feedback"> <div class="invalid-feedback">
......
...@@ -74,6 +74,9 @@ const filteredBuckets: ComputedRef<BucketOut[]> = computed(() => { ...@@ -74,6 +74,9 @@ const filteredBuckets: ComputedRef<BucketOut[]> = computed(() => {
function addBucket(bucket: BucketOut) { function addBucket(bucket: BucketOut) {
bucketsState.buckets.push(bucket); bucketsState.buckets.push(bucket);
bucketsState.buckets.sort((bucketA, bucketB) =>
bucketA.name >= bucketB.name ? 1 : -1
);
} }
function deleteBucket(bucketName: string) { function deleteBucket(bucketName: string) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment