@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.
@@ -0,0 +1 @@
1
+ export declare const showUploadFilesDialog: (selectedLocation: string, initialFiles?: File[]) => import("quasar").DialogChainObject;
@@ -0,0 +1,11 @@
1
+ import { defineAsyncComponent } from "vue";
2
+ import { Dialog } from "quasar";
3
+ export const showUploadFilesDialog = (selectedLocation, initialFiles) => {
4
+ return Dialog.create({
5
+ component: defineAsyncComponent(() => import("../components/l-dialog-upload-files.vue")),
6
+ componentProps: {
7
+ selectedLocation,
8
+ ...initialFiles && { initialFiles }
9
+ }
10
+ });
11
+ };
@@ -6,12 +6,15 @@ const $q = useQuasar();
6
6
  const { data: app, refresh } = await useAsyncData(async () => {
7
7
  return await q({
8
8
  app: {
9
- driveTypes: true,
10
- listFileSystem: true
9
+ fs: {
10
+ list: true,
11
+ types: true
12
+ },
13
+ driveTypes: true
11
14
  }
12
15
  }).then((res) => res.app);
13
16
  });
14
- const items = computed(() => app.value.listFileSystem);
17
+ const items = computed(() => app.value.fs.list);
15
18
  const dialog = ref(false);
16
19
  const value = ref({});
17
20
  const onSubmit = async (data) => {
@@ -89,11 +92,14 @@ const columns = [
89
92
  ];
90
93
  const selected = ref([]);
91
94
  const loading = ref(false);
95
+ const getType = (type) => {
96
+ if (!type) return null;
97
+ return app.value.fs.types.find((t) => t.name == type);
98
+ };
92
99
  </script>
93
100
 
94
101
  <template>
95
102
  <l-page title="File system">
96
-
97
103
  <q-dialog v-model="dialog" persistent>
98
104
  <q-card style="width: 500px;">
99
105
 
@@ -106,53 +112,17 @@ const loading = ref(false);
106
112
 
107
113
  <form-kit type="l-form" :value="value" @submit="onSubmit" #default="{ value }">
108
114
  <form-kit type="l-input" label="Name" name="name" validation="required"></form-kit>
109
- <form-kit type="l-select" label="Type" name="type" validation="required" :options="[
110
- { label: 'Local', value: 'local', disable: !app.driveTypes.includes('local') },
111
- { label: 'S3', value: 's3', disable: !app.driveTypes.includes('s3') },
112
- { label: 'HostLink storage', value: 'hostlink', disable: !app.driveTypes.includes('hostlink') },
113
- { label: 'Aliyun OSS', value: 'aliyun-oss', disable: !app.driveTypes.includes('aliyun-oss') },
114
- ]"></form-kit>
115
-
116
- <form-kit type="group" name="data">
117
- <form-kit type="l-input" label="Url" name="url"
118
- hint="URL is used to generate the full URL of the file."
119
- placeholder="https://example.com/api/"></form-kit>
115
+ <form-kit type="l-select" label="Type" name="type" validation="required" :options="app.fs.types"
116
+ option-value="name"></form-kit>
120
117
 
121
- <template v-if="value.type == 'local'">
122
- <form-kit type="l-input" label="Location" name="location" validation="required"
123
- hint="Location is the path to the directory where the files are stored."></form-kit>
124
- </template>
125
-
126
- <template v-if="value.type == 's3'">
127
- <form-kit type="l-input" label="Bucket" name="bucket" validation="required"></form-kit>
128
- <form-kit type="l-input" label="Access Key" name="accessKey"
129
- validation="required"></form-kit>
130
- <form-kit type="l-input" label="Secret Key" name="secretKey"
131
- validation="required"></form-kit>
132
- <form-kit type="l-input" label="Region" name="region" validation="required"></form-kit>
133
- <form-kit type="l-input" label="Endpoint" name="endpoint" validation="required"></form-kit>
134
- <form-kit type="l-input" label="Prefix" name="prefix"></form-kit>
135
- <form-kit type="l-select" label="Visibility" name="visibility" validation="required"
136
- :options="[
137
- { label: 'Public', value: 'public' },
138
- { label: 'Private', value: 'private' }
139
- ]"></form-kit>
140
- </template>
118
+ <form-kit type="group" name="data" v-if="value.type">
119
+ <template v-for="(option, name) in getType(value.type).options">
120
+ <form-kit type="l-input" :name="name" :label="name"
121
+ :validation="option.required ? 'required' : ''" :help="option.description"
122
+ :placeholder="option.placeholder"></form-kit>
141
123
 
142
- <template v-if="value.type == 'hostlink'">
143
- <form-kit type="l-input" label="Endpoint" name="endpoint" validation="required"></form-kit>
144
- <form-kit type="l-input" label="Token" name="token" validation="required"></form-kit>
145
124
  </template>
146
125
 
147
- <template v-if="value.type == 'aliyun-oss'">
148
- <form-kit type="l-input" label="Access Key" name="access_key_id" validation="required">
149
- </form-kit>
150
- <form-kit type="l-input" label="Secret Key" name="access_key_secret" validation="required">
151
- </form-kit>
152
- <form-kit type="l-input" label="Endpoint" name="endpoint" validation="required"></form-kit>
153
- <form-kit type="l-input" label="Bucket" name="bucket" validation="required"></form-kit>
154
- <form-kit type="l-input" label="Prefix" name="prefix"></form-kit>
155
- </template>
156
126
  </form-kit>
157
127
 
158
128
  </form-kit>
@@ -164,9 +134,7 @@ const loading = ref(false);
164
134
  v-model:selected="selected" row-key="uuid" :loading="loading">
165
135
  <template #top-left>
166
136
  <q-btn icon="sym_o_add" @click="value = {
167
- data: {
168
- url: '',
169
- }
137
+ data: {}
170
138
  }; dialog = true" flat round dense>
171
139
  <q-tooltip>Add File System</q-tooltip>
172
140
  </q-btn>
@@ -180,7 +148,14 @@ const loading = ref(false);
180
148
 
181
149
  <template #body-cell-data="props">
182
150
  <q-td>
183
- <pre>{{ props.row.data }}</pre>
151
+ <q-list flat dense>
152
+ <q-item v-for="(value, key) in props.row.data" :key="key">
153
+ <q-item-section>
154
+ <q-item-label caption>{{ key }}</q-item-label>
155
+ <q-item-label>{{ value }}</q-item-label>
156
+ </q-item-section>
157
+ </q-item>
158
+ </q-list>
184
159
  </q-td>
185
160
  </template>
186
161
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostlink/nuxt-light",
3
- "version": "1.61.0",
3
+ "version": "1.62.0",
4
4
  "description": "HostLink Nuxt Light Framework",
5
5
  "repository": {
6
6
  "type": "git",
@@ -32,7 +32,7 @@
32
32
  "dependencies": {
33
33
  "@azure/msal-browser": "^4.26.2",
34
34
  "@formkit/drag-and-drop": "^0.5.3",
35
- "@hostlink/light": "^3.1.0",
35
+ "@hostlink/light": "^3.2.7",
36
36
  "@nuxt/module-builder": "^1.0.1",
37
37
  "@quasar/extras": "^1.17.0",
38
38
  "@quasar/quasar-ui-qmarkdown": "^2.0.5",