@hostlink/nuxt-light 1.61.0 → 1.62.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module.json +1 -1
- package/dist/runtime/components/l-dialog-upload-files.d.vue.ts +29 -0
- package/dist/runtime/components/l-dialog-upload-files.vue +178 -0
- package/dist/runtime/components/l-dialog-upload-files.vue.d.ts +29 -0
- package/dist/runtime/components/l-file-manager-breadcrumbs.d.vue.ts +10 -0
- package/dist/runtime/components/l-file-manager-breadcrumbs.vue +37 -0
- package/dist/runtime/components/l-file-manager-breadcrumbs.vue.d.ts +10 -0
- package/dist/runtime/components/l-file-manager-move.d.vue.ts +7 -3
- package/dist/runtime/components/l-file-manager-move.vue +68 -29
- package/dist/runtime/components/l-file-manager-move.vue.d.ts +7 -3
- package/dist/runtime/components/l-file-manager-preview.d.vue.ts +3 -13
- package/dist/runtime/components/l-file-manager-preview.vue +33 -23
- package/dist/runtime/components/l-file-manager-preview.vue.d.ts +3 -13
- package/dist/runtime/components/l-file-manager.vue +173 -256
- package/dist/runtime/composables/showUploadFilesDialog.d.ts +1 -0
- package/dist/runtime/composables/showUploadFilesDialog.js +11 -0
- package/dist/runtime/pages/System/fs.vue +26 -51
- package/package.json +2 -2
package/dist/module.json
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
declare const _default: typeof __VLS_export;
|
|
2
|
+
export default _default;
|
|
3
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
|
+
selectedLocation: {
|
|
5
|
+
type: StringConstructor;
|
|
6
|
+
required: true;
|
|
7
|
+
};
|
|
8
|
+
initialFiles: {
|
|
9
|
+
type: ArrayConstructor;
|
|
10
|
+
default: () => never[];
|
|
11
|
+
};
|
|
12
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
13
|
+
hide: (...args: any[]) => void;
|
|
14
|
+
ok: (...args: any[]) => void;
|
|
15
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
16
|
+
selectedLocation: {
|
|
17
|
+
type: StringConstructor;
|
|
18
|
+
required: true;
|
|
19
|
+
};
|
|
20
|
+
initialFiles: {
|
|
21
|
+
type: ArrayConstructor;
|
|
22
|
+
default: () => never[];
|
|
23
|
+
};
|
|
24
|
+
}>> & Readonly<{
|
|
25
|
+
onHide?: ((...args: any[]) => any) | undefined;
|
|
26
|
+
onOk?: ((...args: any[]) => any) | undefined;
|
|
27
|
+
}>, {
|
|
28
|
+
initialFiles: unknown[];
|
|
29
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useDialogPluginComponent } from "quasar";
|
|
3
|
+
import { ref, onMounted } from "vue";
|
|
4
|
+
import { useQuasar } from "quasar";
|
|
5
|
+
import { fs } from "@hostlink/light";
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
selectedLocation: {
|
|
8
|
+
type: String,
|
|
9
|
+
required: true
|
|
10
|
+
},
|
|
11
|
+
initialFiles: {
|
|
12
|
+
type: Array,
|
|
13
|
+
default: () => []
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
defineEmits([
|
|
17
|
+
...useDialogPluginComponent.emits
|
|
18
|
+
]);
|
|
19
|
+
const { dialogRef, onDialogHide, onDialogOK, onDialogCancel } = useDialogPluginComponent();
|
|
20
|
+
const $q = useQuasar();
|
|
21
|
+
const uploadFiles = ref([]);
|
|
22
|
+
const uploadProgress = ref({});
|
|
23
|
+
onMounted(() => {
|
|
24
|
+
if (props.initialFiles && props.initialFiles.length > 0) {
|
|
25
|
+
uploadFiles.value = props.initialFiles;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
const initializeUploadProgress = () => {
|
|
29
|
+
uploadProgress.value = {};
|
|
30
|
+
uploadFiles.value.forEach((file, index) => {
|
|
31
|
+
uploadProgress.value[index] = {
|
|
32
|
+
name: file.name,
|
|
33
|
+
status: "pending",
|
|
34
|
+
// pending, uploading, completed, failed
|
|
35
|
+
error: null,
|
|
36
|
+
progress: 0
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
const onUploadFiles = async () => {
|
|
41
|
+
initializeUploadProgress();
|
|
42
|
+
try {
|
|
43
|
+
const uploadPromises = uploadFiles.value.map(
|
|
44
|
+
(file, index) => (async () => {
|
|
45
|
+
try {
|
|
46
|
+
uploadProgress.value[index].status = "uploading";
|
|
47
|
+
await fs.uploadFile(props.selectedLocation, file);
|
|
48
|
+
uploadProgress.value[index].status = "completed";
|
|
49
|
+
uploadProgress.value[index].progress = 100;
|
|
50
|
+
} catch (error) {
|
|
51
|
+
uploadProgress.value[index].status = "failed";
|
|
52
|
+
uploadProgress.value[index].error = error?.message || String(error);
|
|
53
|
+
}
|
|
54
|
+
})()
|
|
55
|
+
);
|
|
56
|
+
await Promise.allSettled(uploadPromises);
|
|
57
|
+
const failedUploads = Object.values(uploadProgress.value).filter((p) => p.status === "failed");
|
|
58
|
+
if (failedUploads.length === 0) {
|
|
59
|
+
setTimeout(() => {
|
|
60
|
+
onDialogOK(uploadFiles.value);
|
|
61
|
+
uploadProgress.value = {};
|
|
62
|
+
}, 1e3);
|
|
63
|
+
}
|
|
64
|
+
} catch (e) {
|
|
65
|
+
$q.dialog({
|
|
66
|
+
title: "Error",
|
|
67
|
+
message: e.message
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
const onCancel = () => {
|
|
72
|
+
uploadProgress.value = {};
|
|
73
|
+
uploadFiles.value = [];
|
|
74
|
+
onDialogCancel();
|
|
75
|
+
};
|
|
76
|
+
</script>
|
|
77
|
+
|
|
78
|
+
<template>
|
|
79
|
+
<q-dialog ref="dialogRef" @hide="onDialogHide">
|
|
80
|
+
<q-card style="min-width: 400px;">
|
|
81
|
+
<q-toolbar>
|
|
82
|
+
<q-toolbar-title>{{ $t('Upload Files') }}</q-toolbar-title>
|
|
83
|
+
<q-space></q-space>
|
|
84
|
+
<q-btn
|
|
85
|
+
flat
|
|
86
|
+
round
|
|
87
|
+
dense
|
|
88
|
+
icon="sym_o_close"
|
|
89
|
+
v-close-popup
|
|
90
|
+
:disable="uploadFiles.length > 0 && Object.values(uploadProgress).some(p => p.status === 'uploading')"
|
|
91
|
+
></q-btn>
|
|
92
|
+
</q-toolbar>
|
|
93
|
+
<q-card-section>
|
|
94
|
+
<!-- 顯示上傳進度 -->
|
|
95
|
+
<div v-if="Object.keys(uploadProgress).length > 0" class="q-mb-md">
|
|
96
|
+
<q-list bordered separator>
|
|
97
|
+
<q-item v-for="(progress, index) in uploadProgress" :key="index">
|
|
98
|
+
<q-item-section avatar>
|
|
99
|
+
<q-icon
|
|
100
|
+
v-if="progress.status === 'completed'"
|
|
101
|
+
name="sym_o_check_circle"
|
|
102
|
+
color="positive"
|
|
103
|
+
size="md"
|
|
104
|
+
/>
|
|
105
|
+
<q-icon
|
|
106
|
+
v-else-if="progress.status === 'failed'"
|
|
107
|
+
name="sym_o_error"
|
|
108
|
+
color="negative"
|
|
109
|
+
size="md"
|
|
110
|
+
/>
|
|
111
|
+
<q-icon
|
|
112
|
+
v-else-if="progress.status === 'uploading'"
|
|
113
|
+
name="sym_o_cloud_upload"
|
|
114
|
+
color="primary"
|
|
115
|
+
size="md"
|
|
116
|
+
/>
|
|
117
|
+
<q-icon
|
|
118
|
+
v-else
|
|
119
|
+
name="sym_o_schedule"
|
|
120
|
+
color="grey"
|
|
121
|
+
size="md"
|
|
122
|
+
/>
|
|
123
|
+
</q-item-section>
|
|
124
|
+
|
|
125
|
+
<q-item-section>
|
|
126
|
+
<q-item-label>{{ progress.name }}</q-item-label>
|
|
127
|
+
<q-item-label caption v-if="progress.status === 'uploading'">
|
|
128
|
+
上傳中...
|
|
129
|
+
</q-item-label>
|
|
130
|
+
<q-item-label caption v-else-if="progress.status === 'completed'" class="text-positive">
|
|
131
|
+
上傳完成
|
|
132
|
+
</q-item-label>
|
|
133
|
+
<q-item-label caption v-else-if="progress.status === 'failed'" class="text-negative">
|
|
134
|
+
{{ progress.error }}
|
|
135
|
+
</q-item-label>
|
|
136
|
+
<q-item-label caption v-else>
|
|
137
|
+
等待中...
|
|
138
|
+
</q-item-label>
|
|
139
|
+
|
|
140
|
+
<q-linear-progress
|
|
141
|
+
v-if="progress.status === 'uploading' || progress.status === 'completed'"
|
|
142
|
+
:value="progress.progress / 100"
|
|
143
|
+
:color="progress.status === 'completed' ? 'positive' : 'primary'"
|
|
144
|
+
class="q-mt-xs"
|
|
145
|
+
stripe
|
|
146
|
+
rounded
|
|
147
|
+
/>
|
|
148
|
+
</q-item-section>
|
|
149
|
+
</q-item>
|
|
150
|
+
</q-list>
|
|
151
|
+
</div>
|
|
152
|
+
|
|
153
|
+
<!-- 未上傳時顯示檔案選擇 -->
|
|
154
|
+
<div v-else>
|
|
155
|
+
<q-file v-model="uploadFiles" multiple name="file" :label="$t('Files')" color="primary" outlined />
|
|
156
|
+
</div>
|
|
157
|
+
</q-card-section>
|
|
158
|
+
|
|
159
|
+
<q-card-actions align="right">
|
|
160
|
+
<q-btn
|
|
161
|
+
flat
|
|
162
|
+
:label="$t('Cancel')"
|
|
163
|
+
color="primary"
|
|
164
|
+
v-close-popup
|
|
165
|
+
@click="onCancel"
|
|
166
|
+
:disable="uploadFiles.length > 0 && Object.values(uploadProgress).some(p => p.status === 'uploading')"
|
|
167
|
+
></q-btn>
|
|
168
|
+
<q-btn
|
|
169
|
+
flat
|
|
170
|
+
:label="$t('Upload')"
|
|
171
|
+
color="primary"
|
|
172
|
+
@click="onUploadFiles"
|
|
173
|
+
:disable="uploadFiles.length === 0 || Object.keys(uploadProgress).length > 0"
|
|
174
|
+
></q-btn>
|
|
175
|
+
</q-card-actions>
|
|
176
|
+
</q-card>
|
|
177
|
+
</q-dialog>
|
|
178
|
+
</template>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
declare const _default: typeof __VLS_export;
|
|
2
|
+
export default _default;
|
|
3
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
|
+
selectedLocation: {
|
|
5
|
+
type: StringConstructor;
|
|
6
|
+
required: true;
|
|
7
|
+
};
|
|
8
|
+
initialFiles: {
|
|
9
|
+
type: ArrayConstructor;
|
|
10
|
+
default: () => never[];
|
|
11
|
+
};
|
|
12
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
13
|
+
hide: (...args: any[]) => void;
|
|
14
|
+
ok: (...args: any[]) => void;
|
|
15
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
16
|
+
selectedLocation: {
|
|
17
|
+
type: StringConstructor;
|
|
18
|
+
required: true;
|
|
19
|
+
};
|
|
20
|
+
initialFiles: {
|
|
21
|
+
type: ArrayConstructor;
|
|
22
|
+
default: () => never[];
|
|
23
|
+
};
|
|
24
|
+
}>> & Readonly<{
|
|
25
|
+
onHide?: ((...args: any[]) => any) | undefined;
|
|
26
|
+
onOk?: ((...args: any[]) => any) | undefined;
|
|
27
|
+
}>, {
|
|
28
|
+
initialFiles: unknown[];
|
|
29
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare const _default: typeof __VLS_export;
|
|
2
|
+
export default _default;
|
|
3
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
4
|
+
"update:modelValue": (value: any) => any;
|
|
5
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
6
|
+
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
7
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
8
|
+
type __VLS_ModelProps = {
|
|
9
|
+
modelValue?: any;
|
|
10
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
const modelValue = defineModel();
|
|
4
|
+
const breadcrumbs = computed(() => {
|
|
5
|
+
if (!modelValue.value) {
|
|
6
|
+
return [];
|
|
7
|
+
}
|
|
8
|
+
const path = modelValue.value;
|
|
9
|
+
const protocolMatch = path.match(/^([a-zA-Z0-9]+):\/\/(.*)$/);
|
|
10
|
+
if (!protocolMatch) {
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
const protocol = protocolMatch[1];
|
|
14
|
+
const pathParts = protocolMatch[2].split("/").filter((part) => part.length > 0);
|
|
15
|
+
let breadcrumbs2 = [{
|
|
16
|
+
label: protocol,
|
|
17
|
+
location: `${protocol}://`
|
|
18
|
+
}];
|
|
19
|
+
let currentPath = `${protocol}://`;
|
|
20
|
+
for (let part of pathParts) {
|
|
21
|
+
currentPath += part;
|
|
22
|
+
breadcrumbs2.push({
|
|
23
|
+
label: part,
|
|
24
|
+
location: currentPath
|
|
25
|
+
});
|
|
26
|
+
currentPath += "/";
|
|
27
|
+
}
|
|
28
|
+
return breadcrumbs2;
|
|
29
|
+
});
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<template>
|
|
33
|
+
<q-breadcrumbs>
|
|
34
|
+
<q-breadcrumbs-el v-for="(b, index) in breadcrumbs" :label="b.label" :key="index"
|
|
35
|
+
@click="$emit('update:modelValue', b.location)" href="javascript:void(0)"></q-breadcrumbs-el>
|
|
36
|
+
</q-breadcrumbs>
|
|
37
|
+
</template>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare const _default: typeof __VLS_export;
|
|
2
|
+
export default _default;
|
|
3
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
4
|
+
"update:modelValue": (value: any) => any;
|
|
5
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
6
|
+
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
7
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
8
|
+
type __VLS_ModelProps = {
|
|
9
|
+
modelValue?: any;
|
|
10
|
+
};
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
declare const _default: typeof __VLS_export;
|
|
2
2
|
export default _default;
|
|
3
3
|
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
|
-
|
|
4
|
+
current_location: StringConstructor;
|
|
5
|
+
allow_cross_fs: BooleanConstructor;
|
|
5
6
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
6
7
|
selected: (...args: any[]) => void;
|
|
7
8
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
8
|
-
|
|
9
|
+
current_location: StringConstructor;
|
|
10
|
+
allow_cross_fs: BooleanConstructor;
|
|
9
11
|
}>> & Readonly<{
|
|
10
12
|
onSelected?: ((...args: any[]) => any) | undefined;
|
|
11
|
-
}>, {
|
|
13
|
+
}>, {
|
|
14
|
+
allow_cross_fs: boolean;
|
|
15
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -1,35 +1,79 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { ref,
|
|
2
|
+
import { ref, watch } from "vue";
|
|
3
3
|
import { useQuasar } from "quasar";
|
|
4
|
-
import {
|
|
4
|
+
import { fs, query } from "@hostlink/light";
|
|
5
5
|
const props = defineProps({
|
|
6
|
-
|
|
6
|
+
current_location: String,
|
|
7
|
+
allow_cross_fs: Boolean
|
|
7
8
|
});
|
|
8
|
-
const api = getApiClient();
|
|
9
9
|
const emit = defineEmits(["selected"]);
|
|
10
|
-
const
|
|
10
|
+
const protocolMatch = props.current_location.match(/^([a-zA-Z0-9]+):\/\/(.*)$/);
|
|
11
|
+
const filesystem = ref(protocolMatch ? protocolMatch[1] : "");
|
|
12
|
+
const fss = await query({
|
|
13
|
+
app: {
|
|
14
|
+
fs: {
|
|
15
|
+
list: true
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}).then((res) => res.app.fs.list.map((f) => ({ label: f.name, value: f.name + "://" })));
|
|
19
|
+
const data = await query({
|
|
20
|
+
app: {
|
|
21
|
+
fs: {
|
|
22
|
+
node: {
|
|
23
|
+
__args: {
|
|
24
|
+
location: props.current_location
|
|
25
|
+
},
|
|
26
|
+
__on: {
|
|
27
|
+
__typeName: "Folder",
|
|
28
|
+
children: {
|
|
29
|
+
__typename: true,
|
|
30
|
+
__on: {
|
|
31
|
+
__typeName: "Folder",
|
|
32
|
+
name: true,
|
|
33
|
+
location: true
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}).then((res) => res.app.fs.node.children.filter((n) => n.__typename === "Folder"));
|
|
11
41
|
const folders = ref(data);
|
|
12
42
|
const mode = ref("move");
|
|
13
|
-
const folder = ref(
|
|
14
|
-
const parent = ref("/");
|
|
43
|
+
const folder = ref(props.current_location);
|
|
15
44
|
const qua = useQuasar();
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
45
|
+
watch(filesystem, async () => {
|
|
46
|
+
console.log(filesystem.value);
|
|
47
|
+
folder.value = filesystem.value;
|
|
19
48
|
});
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
49
|
+
watch(folder, async () => {
|
|
50
|
+
folders.value = await query({
|
|
51
|
+
app: {
|
|
52
|
+
fs: {
|
|
53
|
+
node: {
|
|
54
|
+
__args: {
|
|
55
|
+
location: folder.value
|
|
56
|
+
},
|
|
57
|
+
__on: {
|
|
58
|
+
__typeName: "Folder",
|
|
59
|
+
children: {
|
|
60
|
+
__typename: true,
|
|
61
|
+
__on: {
|
|
62
|
+
__typeName: "Folder",
|
|
63
|
+
name: true,
|
|
64
|
+
location: true
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}).then((res) => res.app.fs.node.children.filter((n) => n.__typename === "Folder"));
|
|
28
72
|
});
|
|
29
73
|
const newFolder = ref(null);
|
|
30
74
|
const onClickCreate = async () => {
|
|
31
75
|
let f = folder.value + "/" + newFolder.value;
|
|
32
|
-
|
|
76
|
+
fs.createFolder(f);
|
|
33
77
|
folder.value = f;
|
|
34
78
|
mode.value = "move";
|
|
35
79
|
};
|
|
@@ -43,9 +87,6 @@ const onClickMove = async () => {
|
|
|
43
87
|
}).onOk(async () => {
|
|
44
88
|
menu.value.hide();
|
|
45
89
|
emit("selected", folder.value);
|
|
46
|
-
folder.value = "/";
|
|
47
|
-
parent.value = null;
|
|
48
|
-
folder.value = "/";
|
|
49
90
|
});
|
|
50
91
|
};
|
|
51
92
|
</script>
|
|
@@ -53,6 +94,9 @@ const onClickMove = async () => {
|
|
|
53
94
|
<template>
|
|
54
95
|
<q-menu transition-show="jump-down" transition-hide="jump-up" ref="menu">
|
|
55
96
|
<q-card>
|
|
97
|
+
<q-card-section v-if="allow_cross_fs">
|
|
98
|
+
<q-select label="Filesystem" :options="fss" v-model="filesystem" dense emit-value map-options />
|
|
99
|
+
</q-card-section>
|
|
56
100
|
<q-toolbar>
|
|
57
101
|
<template v-if="mode == 'create'">
|
|
58
102
|
<q-btn flat dense round @click="mode = 'move'" icon="sym_o_arrow_back" class="q-mr-sm">
|
|
@@ -61,12 +105,7 @@ const onClickMove = async () => {
|
|
|
61
105
|
|
|
62
106
|
</template>
|
|
63
107
|
<template v-else>
|
|
64
|
-
<
|
|
65
|
-
<q-tooltip>Back</q-tooltip>
|
|
66
|
-
</q-btn>
|
|
67
|
-
<q-toolbar-title>
|
|
68
|
-
{{ title }}
|
|
69
|
-
</q-toolbar-title>
|
|
108
|
+
<l-file-manager-breadcrumbs v-model="folder" />
|
|
70
109
|
|
|
71
110
|
</template>
|
|
72
111
|
|
|
@@ -91,7 +130,7 @@ const onClickMove = async () => {
|
|
|
91
130
|
|
|
92
131
|
<template v-if="mode == 'move'">
|
|
93
132
|
<q-list>
|
|
94
|
-
<q-item v-for="(b, index) in folders" :key="index" clickable @click="
|
|
133
|
+
<q-item v-for="(b, index) in folders" :key="index" clickable @click="folder = b.location;">
|
|
95
134
|
|
|
96
135
|
<q-item-section avatar>
|
|
97
136
|
<q-icon name="sym_o_folder"></q-icon>
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
declare const _default: typeof __VLS_export;
|
|
2
2
|
export default _default;
|
|
3
3
|
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
|
-
|
|
4
|
+
current_location: StringConstructor;
|
|
5
|
+
allow_cross_fs: BooleanConstructor;
|
|
5
6
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
6
7
|
selected: (...args: any[]) => void;
|
|
7
8
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
8
|
-
|
|
9
|
+
current_location: StringConstructor;
|
|
10
|
+
allow_cross_fs: BooleanConstructor;
|
|
9
11
|
}>> & Readonly<{
|
|
10
12
|
onSelected?: ((...args: any[]) => any) | undefined;
|
|
11
|
-
}>, {
|
|
13
|
+
}>, {
|
|
14
|
+
allow_cross_fs: boolean;
|
|
15
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -1,23 +1,13 @@
|
|
|
1
1
|
declare const _default: typeof __VLS_export;
|
|
2
2
|
export default _default;
|
|
3
3
|
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
|
-
|
|
4
|
+
location: {
|
|
5
5
|
type: StringConstructor;
|
|
6
6
|
required: true;
|
|
7
7
|
};
|
|
8
|
-
driveIndex: {
|
|
9
|
-
type: NumberConstructor;
|
|
10
|
-
default: number;
|
|
11
|
-
};
|
|
12
8
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
13
|
-
|
|
9
|
+
location: {
|
|
14
10
|
type: StringConstructor;
|
|
15
11
|
required: true;
|
|
16
12
|
};
|
|
17
|
-
|
|
18
|
-
type: NumberConstructor;
|
|
19
|
-
default: number;
|
|
20
|
-
};
|
|
21
|
-
}>> & Readonly<{}>, {
|
|
22
|
-
driveIndex: number;
|
|
23
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
13
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -1,30 +1,39 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { format, useQuasar } from "quasar";
|
|
2
|
+
import { format, useQuasar, date } from "quasar";
|
|
3
3
|
import { computed } from "vue";
|
|
4
|
-
import { getApiClient } from "@hostlink/light";
|
|
4
|
+
import { getApiClient, query } from "@hostlink/light";
|
|
5
5
|
const api = getApiClient();
|
|
6
6
|
const { humanStorageSize } = format;
|
|
7
7
|
const quasar = useQuasar();
|
|
8
8
|
const props = defineProps({
|
|
9
|
-
|
|
9
|
+
location: {
|
|
10
10
|
type: String,
|
|
11
11
|
required: true
|
|
12
|
-
},
|
|
13
|
-
driveIndex: {
|
|
14
|
-
type: Number,
|
|
15
|
-
default: 0
|
|
16
12
|
}
|
|
17
13
|
});
|
|
18
|
-
const file = await
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
14
|
+
const file = await query({
|
|
15
|
+
app: {
|
|
16
|
+
fs: {
|
|
17
|
+
node: {
|
|
18
|
+
__args: {
|
|
19
|
+
location: props.location
|
|
20
|
+
},
|
|
21
|
+
__typename: true,
|
|
22
|
+
__on: {
|
|
23
|
+
__typeName: "File",
|
|
24
|
+
name: true,
|
|
25
|
+
size: true,
|
|
26
|
+
path: true,
|
|
27
|
+
mimeType: true,
|
|
28
|
+
lastModified: true,
|
|
29
|
+
publicUrl: true
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}).then((res) => res.app.fs.node);
|
|
27
35
|
const size = humanStorageSize(file.size);
|
|
36
|
+
const lastModifiedHuman = date.formatDate(file.lastModified * 1e3, "YYYY-MM-DD HH:mm:ss");
|
|
28
37
|
const copyToClipboard = (text) => {
|
|
29
38
|
let urlToCopy = text;
|
|
30
39
|
if (!text.startsWith("https://") && !text.startsWith("http://")) {
|
|
@@ -43,33 +52,34 @@ const copyToClipboard = (text) => {
|
|
|
43
52
|
});
|
|
44
53
|
};
|
|
45
54
|
const isImage = computed(() => {
|
|
46
|
-
return file.
|
|
55
|
+
return file.mimeType.startsWith("image/");
|
|
47
56
|
});
|
|
48
57
|
const isVideo = computed(() => {
|
|
49
|
-
return file.
|
|
58
|
+
return file.mimeType.startsWith("video/");
|
|
50
59
|
});
|
|
51
60
|
</script>
|
|
52
61
|
|
|
53
62
|
<template>
|
|
54
|
-
<q-img :src="file.
|
|
55
|
-
<q-video :src="file.
|
|
63
|
+
<q-img :src="file.publicUrl" v-if="isImage"></q-img>
|
|
64
|
+
<q-video :src="file.publicUrl" v-else-if="isVideo"></q-video>
|
|
56
65
|
|
|
57
66
|
<q-list dense>
|
|
58
67
|
<l-item label="Name">{{ file.name }}</l-item>
|
|
59
68
|
<l-item label="Size">{{ size }} ({{ file.size }})</l-item>
|
|
60
69
|
<l-item label="Location">{{ file.path }}</l-item>
|
|
61
|
-
<l-item label="Last modified">{{
|
|
70
|
+
<l-item label="Last modified">{{ lastModifiedHuman }}</l-item>
|
|
71
|
+
<l-item label="MIME type">{{ file.mimeType }}</l-item>
|
|
62
72
|
|
|
63
73
|
<q-item>
|
|
64
74
|
<q-item-section side>
|
|
65
75
|
<q-item-label>URL</q-item-label>
|
|
66
76
|
</q-item-section>
|
|
67
77
|
<q-item-section style="align-items: flex-end;">
|
|
68
|
-
<q-item-label lines="1">{{ file.
|
|
78
|
+
<q-item-label lines="1">{{ file.publicUrl }}</q-item-label>
|
|
69
79
|
</q-item-section>
|
|
70
80
|
|
|
71
81
|
<q-item-section side>
|
|
72
|
-
<q-btn size="md" flat dense round icon="sym_o_content_copy" @click="copyToClipboard(file.
|
|
82
|
+
<q-btn size="md" flat dense round icon="sym_o_content_copy" @click="copyToClipboard(file.publicUrl)"></q-btn>
|
|
73
83
|
</q-item-section>
|
|
74
84
|
</q-item>
|
|
75
85
|
</q-list>
|
|
@@ -1,23 +1,13 @@
|
|
|
1
1
|
declare const _default: typeof __VLS_export;
|
|
2
2
|
export default _default;
|
|
3
3
|
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
|
-
|
|
4
|
+
location: {
|
|
5
5
|
type: StringConstructor;
|
|
6
6
|
required: true;
|
|
7
7
|
};
|
|
8
|
-
driveIndex: {
|
|
9
|
-
type: NumberConstructor;
|
|
10
|
-
default: number;
|
|
11
|
-
};
|
|
12
8
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
13
|
-
|
|
9
|
+
location: {
|
|
14
10
|
type: StringConstructor;
|
|
15
11
|
required: true;
|
|
16
12
|
};
|
|
17
|
-
|
|
18
|
-
type: NumberConstructor;
|
|
19
|
-
default: number;
|
|
20
|
-
};
|
|
21
|
-
}>> & Readonly<{}>, {
|
|
22
|
-
driveIndex: number;
|
|
23
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
13
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|