@christianriedl/media 1.0.12 → 1.0.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@christianriedl/media",
3
- "version": "1.0.12",
3
+ "version": "1.0.15",
4
4
  "description": "RIC media interfaces",
5
5
 
6
6
  "main": "dist/index.js",
@@ -19,7 +19,7 @@
19
19
  "license": "ISC",
20
20
  "dependencies": {
21
21
  "@christianriedl/utils": "^1.0.57",
22
- "@christianriedl/rest": "^1.0.26"
22
+ "@christianriedl/rest": "^1.0.28"
23
23
  },
24
24
  "devDependencies": {
25
25
  "typescript": "^4.6.3",
@@ -5,34 +5,36 @@
5
5
 
6
6
  const getMediaService = inject<() => MediaService>('get-media')!;
7
7
  const mediaService = getMediaService();
8
- const fileInput = ref<HTMLInputElement | null>(null);
9
- const loadResult = ref("");
8
+ const feedBack = ref("");
9
+ const name = ref("");
10
10
 
11
11
  async function onFileInput(event: any) {
12
- const files = event.target.files
13
- const formData = new FormData()
14
- formData.append('upload', files[0]);
15
- loadResult.value = "Start upload";
16
- const rc = await mediaService.upload(formData);
17
- loadResult.value = rc ? "Upload successful" : "Upload failed";
18
- }
19
- /*
20
- function onUpload(ev : InputEvent) {
21
- const file = fileInput.value!.files![0];
22
- const reader = new FileReader();
23
- loadResult.value = "start upload ...";
24
- reader.onload = async (e) => {
25
- var text = reader.result;
26
- var res = await stocks.upload(text as string);
27
- loadResult.value = res;
12
+ const files = event.target.files as string[];
13
+ feedBack.value = "Start Upload";
14
+ let count = 0;
15
+ for (let i = 0; i < files.length; i++) {
16
+ const formData = new FormData()
17
+ formData.append(name.value, files[i]);
18
+ const rc = await mediaService.upload(formData);
19
+ if (rc)
20
+ count++;
21
+ feedBack.value = `${files[i]} : ${rc ? "OK" : "FAILED" }`;
28
22
  }
29
- reader.readAsText(file);
23
+ feedBack.value = `${count} von ${files.length} erfolgreich hochgeladen ! (Close : Upload Icon)`;
30
24
  }
31
- */
32
25
  </script>
33
26
 
34
27
  <template>
35
- <input ref="fileInput" type="file" style="width:25%" @change="onFileInput">
28
+ <v-row>
29
+ <v-col cols="2">
30
+ <v-text-field name="directory" label="Name (Directory)" type="text" v-model="name" density="compact" hide-details></v-text-field>
31
+ </v-col>
32
+ <v-col cols="4">
33
+ <input type="file" multiple @change="onFileInput">
34
+ </v-col>
35
+ <v-col cols="6">{{feedBack}}
36
+ </v-col>
37
+ </v-row>
36
38
  <!--
37
39
  <v-col cols="2">
38
40
  <v-btn @click="onUpload">
@@ -18,6 +18,7 @@
18
18
  const selected = reactive<IPhotoSelection>(mediaService.photoSelection);
19
19
  const listHeight = ref(0);
20
20
  const listhead = ref<any>(null);
21
+ const uploadVisible = ref(true);
21
22
 
22
23
  const roots: string[] = ['Jahr', 'Orte', 'Ereignisse', 'Personen'];
23
24
  const criterias: string[] = ['ye', 'lo', 'ev', 'pe'];
@@ -161,15 +162,19 @@
161
162
  <v-icon large>{{$vuetify.icons.values.back}}</v-icon>Back
162
163
  </v-btn>
163
164
  <v-rating clearable length="2" v-model="selected.rating" @update:modelValue="onRating" />
164
- <v-select v-model="selected.root"
165
- :items="roots"
166
- persistent-hint
167
- @update:modelValue="onRootChange"
168
- dense solo hide-details single-line>
165
+ <v-select v-model="selected.root"
166
+ :items="roots"
167
+ persistent-hint
168
+ @update:modelValue="onRootChange"
169
+ dense solo hide-details single-line>
169
170
  </v-select>
170
- <file-upload></file-upload>
171
+ <v-btn v-if="!isMobile" @click="uploadVisible.value = !uploadVisible.value">
172
+ UPLOAD
173
+ <v-icon>{{$vuetify.icons.values.upload}}</v-icon>
174
+ </v-btn>
171
175
  </v-card-actions>
172
176
  </v-card>
177
+ <file-upload v-if="uploadVisible"></file-upload>
173
178
  <v-card :max-height="listHeight" class="overflow-y-auto">
174
179
  <v-list v-if="!grouped" class="bg-media" >
175
180
  <v-list-item-group v-model="itemIndex" color="primary">