fix: improve archive loading indicator

pull/3756/head
Laurynas Gadliauskas 2023-01-17 14:46:27 +02:00
parent 63d4bfcf27
commit 5a380b79d2
4 changed files with 24 additions and 5 deletions

View File

@ -12,17 +12,25 @@
type="text"
@keyup.enter="submit"
v-model.trim="name"
:disabled="loading"
required
/>
<button
v-for="(ext, format) in formats"
:key="format"
:disabled="loading"
class="button button--block"
@click="archive(format)"
v-focus
>
{{ ext }}
<i
v-if="loading && format === loadingFormat"
class="material-icons spin"
>
autorenew
</i>
<span v-else>{{ ext }}</span>
</button>
</div>
</div>
@ -48,12 +56,19 @@ export default {
tarlz4: "tar.lz4",
tarsz: "tar.sz",
},
loading: false,
loadingFormat: "",
};
},
computed: {
...mapState(["req", "selected"]),
...mapGetters(["isFiles", "isListing"]),
},
mounted() {
if (this.selected.length > 0) {
this.name = this.req.items[this.selected[0]].name;
}
},
methods: {
cancel: function () {
this.$store.commit("closeHovers");
@ -75,6 +90,8 @@ export default {
uri = uri.replace("//", "/");
try {
this.loading = true;
this.loadingFormat = format;
buttons.loading("archive");
await api.archive(uri, this.name, format, ...items);
this.$store.commit("closeHovers");
@ -83,6 +100,8 @@ export default {
} catch (e) {
this.$showError(e);
} finally {
this.loading = false;
this.loadingFormat = "";
buttons.done("archive");
}
},

View File

@ -44,7 +44,7 @@ video {
}
i.spin {
animation: 1s spin linear infinite, 1s pulse linear infinite;
animation: 1s spin linear infinite;
}
i.pulse-spin {

View File

@ -10,7 +10,7 @@
"delete": "حذف",
"directorySizes": "حساب أحجام الدليل",
"download": "تحميل",
"edit": "Edit",
"edit": "تعديل",
"file": "ملف",
"folder": "مجلّد",
"hideDotfiles": "إخفاء dotfiles",

View File

@ -39,7 +39,7 @@
"submit": "Submit",
"switchView": "Switch view",
"toggleSidebar": "Toggle sidebar",
"unarchive": "Unarchive",
"unarchive": "Extract",
"update": "Update",
"upload": "Upload"
},
@ -171,7 +171,7 @@
"show": "Show",
"size": "Size",
"skipTrashMessage": "Skip trash bin and delete immediately",
"unarchive": "Unarchive",
"unarchive": "Extract",
"unarchiveDestinationLocationMessage": "Select the destination:",
"unarchiveFolderNameMessage": "Choose folder name:",
"unarchiveMessage": "Choose the destination folder name:",