Unverified Commit 8aade45d authored by Marius van den Beek's avatar Marius van den Beek Committed by GitHub
Browse files

Merge pull request #20853 from davelopez/explore_file_source_hashes

Support remote file source hashes
parents b2beae57 b9762711
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -18631,6 +18631,11 @@ export interface components {
             * @description The creation time of the file.
             */
            ctime: string;
            /**
             * Hashes
             * @description List of precomputed hashes for the file, if available.
             */
            hashes?: components["schemas"]["RemoteFileHash"][] | null;
            /**
             * Name
             * @description The name of the entry.
@@ -18652,6 +18657,16 @@ export interface components {
             */
            uri: string;
        };
        /** RemoteFileHash */
        RemoteFileHash: {
            /**
             * Hash Function
             * @enum {string}
             */
            hash_function: "MD5" | "SHA-1" | "SHA-256" | "SHA-512";
            /** Hash Value */
            hash_value: string;
        };
        /**
         * RemoteFilesDisableMode
         * @enum {string}
+2 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ const filesSources = useFileSources();

interface FilesDialogProps {
    /** Callback function to be called passing the results when selection is complete */
    callback?: (files: any) => void;
    callback?: (files: SelectionItem | SelectionItem[]) => void;
    /** Options to filter the file sources */
    filterOptions?: FilterFileSourcesOptions;
    /** Decide wether to keep the underlying modal static or dynamic */
@@ -388,6 +388,7 @@ function entryToRecord(entry: RemoteEntry): SelectionItem {
        isLeaf: entry.class === "File",
        url: entry.uri,
        size: entry.class === "File" ? entry.size : 0,
        entry: entry,
    };
    return result;
}
+2 −6
Original line number Diff line number Diff line
@@ -15,10 +15,6 @@ interface Props {
    selectedItem?: SelectionItem;
}

interface SelectableFile {
    url: string;
}

const props = withDefaults(defineProps<Props>(), {
    mode: "file",
    requireWritable: false,
@@ -46,8 +42,8 @@ const selectFile = () => {
        filterOptions: props.filterOptions,
        selectedItem: props.selectedItem,
    };
    filesDialog((selected: SelectableFile) => {
        currentValue.value = selected?.url;
    filesDialog((selected: SelectionItem) => {
        currentValue.value = selected.url;
    }, dialogProps);
};

+1 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ export function fileSourcePluginToItem(plugin: BrowsableFilesSourcePlugin): Sele
        details: plugin.doc || "",
        isLeaf: false,
        url: plugin.uri_root,
        entry: plugin,
    };
    return result;
}
+12 −6
Original line number Diff line number Diff line
@@ -6,6 +6,10 @@ import { errorMessageAsString } from "@/utils/simple-error";

import SelectionDialog from "@/components/SelectionDialog/SelectionDialog.vue";

interface BasicItem extends SelectionItem {
    time: string | null;
}

interface Props {
    detailsKey?: string;
    getData: () => Promise<Array<object> | undefined>;
@@ -54,17 +58,19 @@ async function load() {
        // this could potentially load quite a lot of items
        const incoming = await props.getData();
        if (incoming) {
            items.value = incoming.map((item: any) => {
                const timeStamp = item[props.timeKey];
            items.value = incoming.map((entry: any) => {
                const timeStamp = entry[props.timeKey];
                showTime.value = !!timeStamp;
                return {
                    id: item.id,
                    label: item[props.labelKey] || null,
                    details: item[props.detailsKey] || null,
                const item: BasicItem = {
                    id: entry.id,
                    label: entry[props.labelKey] || null,
                    details: entry[props.detailsKey] || null,
                    time: timeStamp || null,
                    entry: entry,
                    isLeaf: true,
                    url: "",
                };
                return item;
            });
        }
        optionsShow.value = true;
Loading