Skip to content
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
2 changes: 2 additions & 0 deletions .github/config/.finnishwords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ löydy
löytää
löytävät
löytynyt
luettelo
luku
lukuoikeus
luo
Expand Down Expand Up @@ -496,6 +497,7 @@ tulisi
tuloksia
tunniste
tunnisteet
tunnisteista
tunnisteita
tunnukselle
tunnuksen
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- (GH #601) Implement new visual style using `csc-ui` in rest of the login and error pages
- (GH #601) Add a language selector to login page menu bar, using `csc-ui`
- (GH #920) Optimize docker builds, making them faster by leveraging more caching mechanisms and removing unnecessary package installation
- (GH #1007) Create new Taginput component to replace Buefy's taginput component

### Fixed

Expand Down
2 changes: 1 addition & 1 deletion swift_browser_ui_frontend/src/common/conv.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ export function makeGetObjectsMetaURL(project, container, objects) {
);
}

export const taginputConfirmKeys = [",", ";", ":", ".", " ", "Tab", "Enter"];
export const taginputConfirmKeys = ["Tab", "Enter", " ", ",", ";", ".", ":"];

export function truncate(value, length) {
if (!value) {
Expand Down
18 changes: 18 additions & 0 deletions swift_browser_ui_frontend/src/common/globalFunctions.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import store from "@/common/store";
import { taginputConfirmKeys } from "@/common/conv";

export function toggleCreateFolderModal(folderName) {
store.commit("toggleCreateFolderModal", true);
Expand Down Expand Up @@ -69,5 +70,22 @@ export async function getAccessDetails (
: [];
}

export function addNewTag (event, currentTags, onBlur) {
if (taginputConfirmKeys.includes(event.key) || onBlur) {
event.preventDefault();
const newTag = event.target.value.trim();
event.target.value = "";
if (newTag !== "" && !currentTags.includes(newTag)) {
currentTags.push(newTag);
}
}
return currentTags;
}

export function deleteTag (event, tag, currentTags) {
event.preventDefault();
return currentTags.filter(el => el !== tag);
}



4 changes: 4 additions & 0 deletions swift_browser_ui_frontend/src/common/lang.js
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,9 @@ let default_translations = {
list_of_shareids: "list of share ids",
folder_tabs: "different types of folder",
searchbox: "search for folders",
tagsList: "list of tags",
edit_tag: "modify current tags",
delete_tag: "delete tag",
footer: "copyright information",
},
},
Expand Down Expand Up @@ -962,7 +964,9 @@ let default_translations = {
list_of_shareids: "lista jaa tunnuksista",
folder_tabs: "erityyppisiä kansioita",
searchbox: "etsi kansioita",
tagsList: "luettelo tunnisteista",
edit_tag: "muokata nykyisiä tunnisteita",
delete_tag: "poista tunniste",
footer: "tekijänoikeustiedot",
},
},
Expand Down
44 changes: 24 additions & 20 deletions swift_browser_ui_frontend/src/components/CopyFolderModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,18 @@
:loading="loadingFoldername"
/>
</b-field>
<b-field
custom-class="has-text-dark"
:label="$t('message.tagName')"
<label
class="taginput-label"
label-for="copy-folder-taginput"
>
<b-taginput
id="copy-folder-taginput"
v-model="tags"
ellipsis
maxlength="20"
has-counter
rounded
type="is-primary"
:placeholder="$t('message.tagPlaceholder')"
:confirm-keys="taginputConfirmKeys"
:on-paste-separators="taginputConfirmKeys"
/>
</b-field>
{{ $t('message.tagName') }}
</label>
<TagInput
id="copy-folder-taginput"
:tags="tags"
@addTag="addingTag"
@deleteTag="deletingTag"
/>
</c-card-content>
</div>
<c-card-actions justify="space-between">
Expand Down Expand Up @@ -73,24 +67,28 @@
import { debounce, delay } from "lodash";
import {
swiftCopyContainer,
taginputConfirmKeys,
updateContainerMeta,
} from "@/common/api";

import { modifyBrowserPageStyles } from "@/common/globalFunctions";
import {
addNewTag,
deleteTag,
modifyBrowserPageStyles,
} from "@/common/globalFunctions";
import escapeRegExp from "lodash/escapeRegExp";
import { useObservable } from "@vueuse/rxjs";
import { liveQuery } from "dexie";
import TagInput from "@/components/TagInput.vue";

export default {
name: "CopyFolderModal",
components: { TagInput },
data() {
return {
folderExists: false,
folderName: "",
loadingFoldername: true,
tags: [],
taginputConfirmKeys,
folders: [],
};
},
Expand Down Expand Up @@ -256,6 +254,12 @@ export default {
);
});
},
addingTag: function (e, onBlur) {
this.tags = addNewTag(e, this.tags, onBlur);
},
deletingTag: function (e, tag) {
this.tags = deleteTag(e, tag, this.tags);
},
},
};
</script>
Expand Down Expand Up @@ -303,4 +307,4 @@ c-card-actions {
c-card-actions > c-button {
margin: 0;
}
</style>
</style>
45 changes: 23 additions & 22 deletions swift_browser_ui_frontend/src/components/CreateFolderModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,19 @@
data-testid="folder-name"
/>
</b-field>
<b-field
custom-class="has-text-dark"
:label="$t('message.tagName')"
label-for="folder-taginput"
<label
class="taginput-label"
label-for="create-folder-taginput"
>
<b-taginput
id="folder-taginput"
v-model="tags"
aria-close-label="delete-tag"
ellipsis
maxlength="20"
has-counter
rounded
type="is-primary"
:placeholder="$t('message.tagPlaceholder')"
:confirm-keys="taginputConfirmKeys"
:on-paste-separators="taginputConfirmKeys"
data-testid="folder-tag"
/>
</b-field>
{{ $t('message.tagName') }}
</label>
<TagInput
id="create-folder-taginput"
:tags="tags"
data-testid="folder-tag"
@addTag="addingTag"
@deleteTag="deletingTag"
/>
<p class="info-text is-size-6">
{{ $t("message.container_ops.createdFolder") }}
<b>{{ active.name }}</b>.
Expand Down Expand Up @@ -82,22 +75,24 @@
<script>
import { swiftCreateContainer } from "@/common/api";
import {
taginputConfirmKeys,
tokenize,
} from "@/common/conv";

import {
addNewTag,
deleteTag,
modifyBrowserPageStyles,
getProjectNumber,
} from "@/common/globalFunctions";
import TagInput from "@/components/TagInput.vue";

export default {
name: "CreateFolderModal",
components: { TagInput },
data() {
return {
folderName: "",
tags: [],
taginputConfirmKeys,
projectNumber: "",
};
},
Expand Down Expand Up @@ -152,6 +147,12 @@ export default {
this.create = true;
modifyBrowserPageStyles();
},
addingTag: function (e, onBlur) {
this.tags = addNewTag(e, this.tags, onBlur);
},
deletingTag: function (e, tag) {
this.tags = deleteTag(e, tag, this.tags);
},
},
};
</script>
Expand All @@ -174,7 +175,7 @@ export default {
}
}

@media screen and (max-height: 580px) and (max-width: 773px),
@media screen and (max-height: 580px) and (max-width: 773px),
(max-width: 533px) {
.add-folder {
top: -9rem;
Expand Down
42 changes: 22 additions & 20 deletions swift_browser_ui_frontend/src/components/EditTagsModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,11 @@
{{ $t('message.editTags') }}
</h2>
<c-card-content>
<b-field
custom-class="has-text-dark"
>
<b-taginput
v-model="tags"
:aria-label="$t('label.edit_tag')"
aria-close-label="delete-tag"
ellipsis
maxlength="20"
has-counter
rounded
type="is-primary"
:placeholder="$t('message.tagPlaceholder')"
:confirm-keys="taginputConfirmKeys"
:on-paste-separators="taginputConfirmKeys"
/>
</b-field>
<TagInput
:tags="tags"
@addTag="addingTag"
@deleteTag="deletingTag"
/>
</c-card-content>
<c-card-actions justify="space-between">
<c-button
Expand Down Expand Up @@ -49,22 +37,28 @@ import {
} from "@/common/api";
import {
taginputConfirmKeys,
getTagsForObjects,
getTagsForContainer,
} from "@/common/conv";
import { modifyBrowserPageStyles } from "@/common/globalFunctions";
import {
addNewTag,
deleteTag,
modifyBrowserPageStyles,
} from "@/common/globalFunctions";
import TagInput from "@/components/TagInput.vue";
import { mdiClose } from "@mdi/js";
export default {
name: "EditTagsModal",
components: { TagInput },
data() {
return {
container: null,
object: null,
tags: [],
isObject: false,
taginputConfirmKeys,
mdiClose,
};
},
computed: {
Expand Down Expand Up @@ -188,6 +182,12 @@ export default {
});
this.toggleEditTagsModal();
},
addingTag: function (e, onBlur) {
this.tags = addNewTag(e, this.tags, onBlur);
},
deletingTag: function (e, tag) {
this.tags = deleteTag(e, tag, this.tags);
},
},
};
</script>
Expand All @@ -204,6 +204,7 @@ export default {
max-height: 75vh;
}
h2 { margin: 0 !important; }
c-card-content {
color: var(--csc-dark-grey);
Expand All @@ -214,4 +215,5 @@ c-card-actions {
padding: 0;
}
</style>
Loading