Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow child bucket sub-path to contains forward slashes #205

Merged
merged 3 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
18 changes: 12 additions & 6 deletions frontend/src/components/bucket/BucketChildConfig.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
bucketName: string().required().max(255).label('Folder display name'),
subKey: string()
.required()
.matches(/^[^/\\]+$/, 'Folder sub-path must not contain back or forward slashes')
.label('Folder sub-path')
.matches(/^[^\\]+$/, { excludeEmptyString: true, message: 'Path must not contain backslashes' })
});

// Actions
Expand Down Expand Up @@ -102,17 +101,19 @@
</Message>
<TextInput
name="subKey"
label="Folder sub-path"
label="Path"
placeholder="my-documents"
help-text="The directory will be created if it does not already exist.
Sub-paths are supported using '/' between levels.
This value cannot be changed after it is set."
:help-text="`The relative path of the subfolder. You can pick a new path or choose an existing object storage path,

Check warning on line 106 in frontend/src/components/bucket/BucketChildConfig.vue

View workflow job for this annotation

GitHub Actions / Unit Tests (Frontend) (16.x)

This line has a length of 123. Maximum allowed is 120

Check warning on line 106 in frontend/src/components/bucket/BucketChildConfig.vue

View workflow job for this annotation

GitHub Actions / Unit Tests (Frontend) (18.x)

This line has a length of 123. Maximum allowed is 120

Check warning on line 106 in frontend/src/components/bucket/BucketChildConfig.vue

View workflow job for this annotation

GitHub Actions / Unit Tests (Frontend) (16.x)

This line has a length of 123. Maximum allowed is 120

Check warning on line 106 in frontend/src/components/bucket/BucketChildConfig.vue

View workflow job for this annotation

GitHub Actions / Unit Tests (Frontend) (20.x)

This line has a length of 123. Maximum allowed is 120

Check warning on line 106 in frontend/src/components/bucket/BucketChildConfig.vue

View workflow job for this annotation

GitHub Actions / Unit Tests (Frontend) (18.x)

This line has a length of 123. Maximum allowed is 120

Check warning on line 106 in frontend/src/components/bucket/BucketChildConfig.vue

View workflow job for this annotation

GitHub Actions / Unit Tests (Frontend) (20.x)

This line has a length of 123. Maximum allowed is 120
but it can't be changed after it is set.<br />
Folder levels are supported using '/' between levels (for example: 2024/January/my-documents).`"
class="child-input"
/>
<TextInput
name="bucketName"
label="Folder display name *"
placeholder="My Documents"
help-text="Your custom display name for the subfolder - any name as you would like to see it listed in BCBox."
class="child-input"
autofocus
/>
<Button
Expand All @@ -128,3 +129,8 @@
</Form>
</Dialog>
</template>
<style scoped lang="scss">
.child-input:deep(input) {
width: 70%;
}
</style>
21 changes: 10 additions & 11 deletions frontend/src/components/bucket/BucketConfigForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,8 @@ const schema = object({
bucketName: string().max(255).required().label('Folder name'),
endpoint: string().max(255).required().label('Endpoint'),
key: string()
.matches(/^[^\\]+$/, 'Sub-path must not contain backslashes')
.max(255)
.label('Key'),
.matches(/^[^\\]+$/, { excludeEmptyString: true, message: 'Path must not contain backslashes' })
.max(255),
secretAccessKey: string().max(255).required().label('Secret Access Key')
});

Expand Down Expand Up @@ -99,8 +98,9 @@ const onSubmit = async (values: any) => {
toast.success('Configuring storage location source', 'Configuration successful');

if ((bucketChanges.accessKeyId || bucketChanges.secretAccessKey) && hasChildren) {
toast.info('Child storage locations exist',
'Remember to update their credentials where applicable', { life: 10000 });
toast.info('Subfolders exist', 'Remember to update their credentials where applicable', {
life: 10000
});
}
} catch (error: any) {
toast.error('Configuring storage location source', error);
Expand Down Expand Up @@ -136,7 +136,7 @@ const onCancel = () => {
<TextInput
name="endpoint"
label="Endpoint *"
placeholder="https://example.com/"
placeholder="https://example.com"
help-text="The URL of your object storage namespace without the bucket identifier/name."
/>
<Password
Expand All @@ -153,12 +153,11 @@ const onCancel = () => {
/>
<TextInput
name="key"
label="Sub-path"
label="Path"
placeholder="/"
help-text="Optionally sets the bucket storage location source to mount at a specific subdirectory / subfolder.
The directory will be created if it does not already exist.
This will default to the root '/' if not provided.
This value cannot be changed after the storage location source is configured."
help-text="Optionally mounts the storage location at a specific path.
A folder will be created if it does not already exist.<br />
This will default to the root '/' if not provided."
:disabled="!!props.bucket"
/>
<Button
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/components/form/TextInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ const { errorMessage, value } = useField<string>(toRef(props, 'name'));
:class="{ 'p-invalid': errorMessage }"
:disabled="disabled"
/>
<small :id="`${name}-help`">{{ helpText }}</small>
<!-- eslint-disable-next-line vue/no-v-html -->
<small :id="`${name}-help`"><span v-html="helpText" /></small>
<ErrorMessage :name="name" />
</div>
</template>
Expand Down
1 change: 0 additions & 1 deletion frontend/src/views/list/ListObjectsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ onBeforeMount(async () => {

<template>
<div v-if="ready">
<h1>Files</h1>
<h2
v-if="bucket"
class="mb-3 flex overflow-hidden"
Expand Down
Loading