|
35 | 35 | class="ion-padding"
|
36 | 36 | v-if="(files.cwd || files.collection_id) && connectionState"
|
37 | 37 | >
|
38 |
| - <ion-list> |
39 |
| - <ion-item @click="onPrevDirectoryClicked" v-if="files.prevDir"> |
40 |
| - <ion-icon :icon="folder" slot="start"></ion-icon> |
41 |
| - ... |
42 |
| - </ion-item> |
43 |
| - <ion-item |
| 38 | + <!-- <ion-item |
44 | 39 | v-for="(entry, index) in browsableFiles"
|
45 | 40 | :key="index"
|
46 | 41 | @click="onEntryClicked(entry)"
|
|
66 | 61 | <ion-icon v-else :icon="decideIcon(entry)" slot="start"></ion-icon>
|
67 | 62 | <ion-label class="ion-text-wrap">{{ entry.name }}</ion-label>
|
68 | 63 | </ion-item>
|
| 64 | + </ion-list> --> |
| 65 | + <ion-list> |
| 66 | + <div class="row" @click="onPrevDirectoryClicked" v-if="files.prevDir"> |
| 67 | + <div class="columnIcon"> |
| 68 | + <ion-icon :icon="folder"> </ion-icon> |
| 69 | + </div> |
| 70 | + <div class="column">...</div> |
| 71 | + </div> |
| 72 | + |
| 73 | + <div |
| 74 | + class="row" |
| 75 | + v-for="(entry, index) in browsableFiles" |
| 76 | + :key="index" |
| 77 | + @click="onEntryClicked(entry)" |
| 78 | + > |
| 79 | + <div class="columnIcon"> |
| 80 | + <ion-icon |
| 81 | + slot="start" |
| 82 | + v-if="entry.mediaStatus && entry.mediaStatus.finished === 0" |
| 83 | + class="mediaStatusProgress" |
| 84 | + :icon="decideIcon(entry)" |
| 85 | + ></ion-icon> |
| 86 | + <ion-icon |
| 87 | + slot="start" |
| 88 | + v-else-if="entry.mediaStatus && entry.mediaStatus.finished === 1" |
| 89 | + class="mediaStatusFinished" |
| 90 | + :icon="decideIcon(entry)" |
| 91 | + ></ion-icon> |
| 92 | + <ion-icon |
| 93 | + v-else-if="entry.type === 'subtitle'" |
| 94 | + class="fileformatSubtitle" |
| 95 | + :icon="journalOutline" |
| 96 | + slot="start" |
| 97 | + ></ion-icon> |
| 98 | + <ion-icon v-else :icon="decideIcon(entry)" slot="start"></ion-icon> |
| 99 | + </div> |
| 100 | + <div class="column"> |
| 101 | + {{ entry.name }} |
| 102 | + </div> |
| 103 | + </div> |
69 | 104 | </ion-list>
|
70 | 105 | <ion-infinite-scroll
|
71 | 106 | @ionInfinite="onInfiniteScroll($event)"
|
|
84 | 119 | Lost connection to server.
|
85 | 120 | </ion-content>
|
86 | 121 | <ion-content v-else-if="!loading">
|
| 122 | + <ion-label>Kurva</ion-label> |
87 | 123 | <ion-list-header>Collections</ion-list-header>
|
88 | 124 | <ion-list>
|
89 | 125 | <ion-item
|
|
127 | 163 | </template>
|
128 | 164 |
|
129 | 165 | <script>
|
| 166 | +/*eslint no-unused-vars: "error"*/ |
130 | 167 | import { ref, computed } from "vue";
|
131 | 168 | import { useStore } from "vuex";
|
132 | 169 | import { apiInstance, openToast } from "../api";
|
@@ -211,23 +248,50 @@ export default {
|
211 | 248 | return "Filebrowser";
|
212 | 249 | });
|
213 | 250 |
|
214 |
| - // Get paths or drives |
215 |
| - if (store.state.simpleapi.MPVInfo.mpvremoteConfig.unsafefilebrowsing) { |
216 |
| - apiInstance.get("/drives").then((response) => { |
217 |
| - drives.value = response.data; |
218 |
| - }); |
219 |
| - } else { |
220 |
| - apiInstance |
221 |
| - .get("filebrowser/paths") |
222 |
| - .then((response) => (drives.value = response.data)); |
223 |
| - } |
224 |
| -
|
225 |
| - // Get collections. |
226 |
| - if (store.state.simpleapi.MPVInfo.mpvremoteConfig.uselocaldb) { |
227 |
| - apiInstance |
228 |
| - .get("/collections") |
229 |
| - .then((response) => (collections.value = response.data)); |
230 |
| - } |
| 251 | + const loadFilebrowserSettings = async () => { |
| 252 | + // Get paths or drives |
| 253 | + if (store.state.simpleapi.MPVInfo.mpvremoteConfig.unsafefilebrowsing) { |
| 254 | + await apiInstance.get("/drives").then((response) => { |
| 255 | + drives.value = response.data; |
| 256 | + }); |
| 257 | + } else { |
| 258 | + await apiInstance |
| 259 | + .get("filebrowser/paths") |
| 260 | + .then((response) => (drives.value = response.data)); |
| 261 | + } |
| 262 | +
|
| 263 | + // Get collections. |
| 264 | + if (store.state.simpleapi.MPVInfo.mpvremoteConfig.uselocaldb) { |
| 265 | + await apiInstance |
| 266 | + .get("/collections") |
| 267 | + .then((response) => (collections.value = response.data)); |
| 268 | + } |
| 269 | + }; |
| 270 | +
|
| 271 | + const loadFileBrowser = async () => { |
| 272 | + await loadFilebrowserSettings(); |
| 273 | + if (filemanLastPath) { |
| 274 | + console.log("Fileman last path exists "); |
| 275 | + if (filemanLastPath.type == "collection") { |
| 276 | + console.log("Collection should be loaded"); |
| 277 | + getDirectoryContents(null, filemanLastPath.collection_id).catch( |
| 278 | + () => { |
| 279 | + console.log("Got error, loading basic"); |
| 280 | + getDirectoryContents(); |
| 281 | + } |
| 282 | + ); |
| 283 | + } else if (filemanLastPath.type == "directory") { |
| 284 | + getDirectoryContents(filemanLastPath.cwd).catch(() => { |
| 285 | + getDirectoryContents(); |
| 286 | + }); |
| 287 | + } else { |
| 288 | + // No valid directory content detected |
| 289 | + loading.value = false; |
| 290 | + } |
| 291 | + } else { |
| 292 | + loading.value = false; |
| 293 | + } |
| 294 | + }; |
231 | 295 |
|
232 | 296 | const saveLastPath = async () => {
|
233 | 297 | let filemanLastPath = {};
|
@@ -257,7 +321,7 @@ export default {
|
257 | 321 | let loadingTimeout = setTimeout(() => {
|
258 | 322 | loading.value = true;
|
259 | 323 | }, 150);
|
260 |
| - return apiInstance |
| 324 | + return await apiInstance |
261 | 325 | .post("filebrowser/browse", data)
|
262 | 326 | .then((response) => {
|
263 | 327 | files.value = response.data;
|
@@ -299,25 +363,6 @@ export default {
|
299 | 363 | ev.target.complete();
|
300 | 364 | };
|
301 | 365 |
|
302 |
| - if (filemanLastPath) { |
303 |
| - console.log("Fileman last path exists "); |
304 |
| - if (filemanLastPath.type == "collection") { |
305 |
| - console.log("Collection should be loaded"); |
306 |
| - getDirectoryContents(null, filemanLastPath.collection_id).catch(() => { |
307 |
| - console.log("Got error, loading basic"); |
308 |
| - getDirectoryContents(); |
309 |
| - }); |
310 |
| - } else if (filemanLastPath.type == "directory") { |
311 |
| - getDirectoryContents(filemanLastPath.cwd).catch(() => { |
312 |
| - getDirectoryContents(); |
313 |
| - }); |
314 |
| - } else { |
315 |
| - getDirectoryContents(); |
316 |
| - } |
317 |
| - } else { |
318 |
| - loading.value = false; |
319 |
| - } |
320 |
| -
|
321 | 366 | const onCancelClicked = () => {
|
322 | 367 | saveLastPath().then(() => props.modalController.dismiss());
|
323 | 368 | };
|
@@ -546,6 +591,7 @@ export default {
|
546 | 591 | }
|
547 | 592 | };
|
548 | 593 |
|
| 594 | + loadFileBrowser(); |
549 | 595 | return {
|
550 | 596 | onCancelClicked,
|
551 | 597 | onPrevDirectoryClicked,
|
@@ -626,4 +672,30 @@ ion-footer ion-button {
|
626 | 672 | .mediaStatusProgress {
|
627 | 673 | color: yellow;
|
628 | 674 | }
|
| 675 | +
|
| 676 | +.row { |
| 677 | + display: flex; |
| 678 | + background-color: #172246; |
| 679 | + align-items: center; |
| 680 | + justify-content: center; |
| 681 | + padding-top: 10px; |
| 682 | + padding-bottom: 10px; |
| 683 | + font-size: 15px; |
| 684 | + border-bottom: 1px solid rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.3); |
| 685 | +} |
| 686 | +
|
| 687 | +.columnIcon { |
| 688 | + padding-left: 17px; |
| 689 | + padding-right: 30px; |
| 690 | + flex: 10%; |
| 691 | + min-width: 72px; |
| 692 | + font-size: 25px; |
| 693 | + color: rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.54); |
| 694 | +} |
| 695 | +
|
| 696 | +.column { |
| 697 | + flex: 90%; |
| 698 | + min-width: 0px; |
| 699 | + padding-right: 10px; |
| 700 | +} |
629 | 701 | </style>
|
0 commit comments