Skip to content
Open
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: 14 additions & 4 deletions src/modules/feature/board-file-element/FileContentElement.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
</BoardMenu>
</FileContent>
<FileUpload
v-else
v-else-if="!alerts.includes(FileAlert.FILE_STORAGE_ERROR)"
:element-id="element.id"
:is-edit-mode="isEditMode"
:is-uploading="isUploading"
Expand All @@ -51,10 +51,12 @@
<KebabMenuActionDelete scope-language-key="components.cardElement.fileElement" @click="onDelete" />
</BoardMenu>
</FileUpload>
<FileAlerts :alerts="alerts" @on-status-reload="onFetchFile" />
</VCard>
</template>

<script setup lang="ts">
import FileAlerts from "./content/alert/FileAlerts.vue";
import { useFileAlerts } from "./content/alert/useFileAlerts.composable";
import FileContent from "./content/FileContent.vue";
import { FileAlert } from "./shared/types/FileAlert.enum";
Expand Down Expand Up @@ -143,12 +145,12 @@ const isOutlined = computed(() => {

watch(element.value, async () => {
isLoadingFileRecord.value = true;
await fetchFiles(element.value.id, FileRecordParentType.BOARDNODES);
await tryFetchFiles(element.value.id, FileRecordParentType.BOARDNODES);
isLoadingFileRecord.value = false;
});

onMounted(async () => {
await fetchFiles(element.value.id, FileRecordParentType.BOARDNODES);
await tryFetchFiles(element.value.id, FileRecordParentType.BOARDNODES);
isLoadingFileRecord.value = false;
});

Expand All @@ -169,7 +171,15 @@ const onUploadFile = async (file: File): Promise<void> => {
};

const onFetchFile = async (): Promise<void> => {
await fetchFiles(element.value.id, FileRecordParentType.BOARDNODES);
await tryFetchFiles(element.value.id, FileRecordParentType.BOARDNODES);
};

const tryFetchFiles = async (id: string, parentType: FileRecordParentType) => {
try {
return await fetchFiles(id, parentType);
} catch {
addAlert(FileAlert.FILE_STORAGE_ERROR);
}
};

const onUpdateAlternativeText = (value: string) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
@update:name="onUpdateName"
/>
<ContentElementFooter :file-properties="fileProperties" />
<FileAlerts :alerts="alerts" @on-status-reload="onFetchFile" />
</div>
</div>
</template>
Expand All @@ -49,7 +48,6 @@
import { FileProperties } from "../shared/types/file-properties";
import { FileAlert } from "../shared/types/FileAlert.enum";
import FileInputs from "././inputs/FileInputs.vue";
import FileAlerts from "./alert/FileAlerts.vue";
import FileDescription from "./display/file-description/FileDescription.vue";
import ContentElementFooter from "./footer/ContentElementFooter.vue";
import { isAudioMimeType, isPdfMimeType, isVideoMimeType } from "@/utils/fileHelper";
Expand All @@ -70,7 +68,7 @@

const emit = defineEmits(["fetch:file", "update:alternativeText", "update:caption", "update:name", "add:alert"]);

const onFetchFile = () => {

Check warning on line 71 in src/modules/feature/board-file-element/content/FileContent.vue

View workflow job for this annotation

GitHub Actions / lint

'onFetchFile' is assigned a value but never used
emit("fetch:file");
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
<WarningAlert v-if="alerts.includes(FileAlert.SCAN_STATUS_ERROR)">
{{ t("common.file.scanError") }}
</WarningAlert>

<WarningAlert v-if="alerts.includes(FileAlert.FILE_STORAGE_ERROR)">
{{ t("Diese Datei ist gerade nicht verfügbar. Lade den Bereich neu.") }}
</WarningAlert>
</div>
</template>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ export enum FileAlert {
SCAN_STATUS_BLOCKED,
SCAN_STATUS_ERROR,
EXCEEDS_COLLABORA_EDITABLE_FILE_SIZE,
FILE_STORAGE_ERROR,
}
Loading