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

Add Tab Navigation to upload button #221

Merged
merged 1 commit into from
Jul 9, 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
6 changes: 5 additions & 1 deletion frontend/src/components/object/ObjectList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ import {
ObjectUpload
} from '@/components/object';
import { Button } from '@/lib/primevue';
import { useAuthStore, useObjectStore, usePermissionStore } from '@/store';
import { useAuthStore, useObjectStore, useNavStore, usePermissionStore } from '@/store';
import { Permissions } from '@/utils/constants';
import { ButtonMode } from '@/utils/enums';
import { onDialogHide } from '@/utils/utils';

import type { Ref } from 'vue';

Expand All @@ -28,6 +29,7 @@ const props = withDefaults(defineProps<Props>(), {
//const navStore = useNavStore();
const objectStore = useObjectStore();
const permissionStore = usePermissionStore();
const { focusedElement } = storeToRefs(useNavStore());

const { getSelectedObjects } = storeToRefs(objectStore);
const { getUserId } = storeToRefs(useAuthStore());
Expand All @@ -51,9 +53,11 @@ const closeObjectInfo = () => {

const showUpload = () => {
displayUpload.value = true;
focusedElement.value = document.activeElement;
};

const closeUpload = () => {
onDialogHide();
displayUpload.value = false;
objectTableKey.value += 1;
};
Expand Down
19 changes: 16 additions & 3 deletions frontend/src/components/object/ObjectUpload.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { storeToRefs } from 'pinia';
import { ref } from 'vue';
import { ref, onMounted } from 'vue';

import ObjectUploadFile from '@/components/object/ObjectUploadFile.vue';
import { Button, FileUpload, useToast } from '@/lib/primevue';
Expand Down Expand Up @@ -63,7 +63,7 @@ const onUpload = async (event: any) => {
);
successfulFiles.value.push(file);
} catch (error: any) {
toast.error(`Failed to upload file ${file.name}`, error, {life: 0});
toast.error(`Failed to upload file ${file.name}`, error, { life: 0 });
failedFiles.value.push(file);
} finally {
appStore.endUploading();
Expand Down Expand Up @@ -96,6 +96,10 @@ const onRemoveFailedFile = async (index: number) => {
const noFilesChosen = (files?: Array<File>): boolean => !files?.length;

const submitObjectMetaTagConfig = (values: Array<ObjectMetadataTagFormType>) => (formData = values);

onMounted(() => {
document.getElementById('upload-panel')?.focus();
});
</script>

<template>
Expand All @@ -108,7 +112,14 @@ const submitObjectMetaTagConfig = (values: Array<ObjectMetadataTagFormType>) =>
>
<template #header="{ chooseCallback, uploadCallback, clearCallback, files }">
<div class="flex flex-wrap justify-content-between align-items-center flex-1 gap-2">
<div class="flex gap-2">
<div
id="upload-panel"
tabindex="0"
role="dialog"
aria-modal="true"
aria-labelledby="upload-panel-label"
class="flex gap-2"
>
<Button
:class="{ 'p-button-outlined': !noFilesChosen(files) }"
@click="chooseCallback()"
Expand All @@ -125,12 +136,14 @@ const submitObjectMetaTagConfig = (values: Array<ObjectMetadataTagFormType>) =>
@click="uploadCallback()"
>
<font-awesome-icon
id="upload-panel-label"
icon="fa-solid fa-upload"
class="mr-1"
/>
Start upload
</Button>
<Button
aria-label="Close"
class="p-button-outlined"
@click="
() => {
Expand Down
Loading