feat: implemented basic new folder action in move dialog (#2659)

This commit is contained in:
ArthurMousatov 2023-08-23 15:28:09 -04:00
parent 8b4b2d6656
commit 46445a2392
3 changed files with 25 additions and 5 deletions

View File

@ -9,17 +9,17 @@
</div> </div>
<div class="card-action"> <div class="card-action">
<div v-if="user.perm.create"> <template v-if="user.perm.create">
<button <button
class="button button--flat" class="button button--flat"
@click="$store.commit('showHover', 'newDir')" @click="createDir()"
:aria-label="$t('sidebar.newFolder')" :aria-label="$t('sidebar.newFolder')"
:title="$t('sidebar.newFolder')" :title="$t('sidebar.newFolder')"
> >
<i class="material-icons">create_new_folder</i> <i class="material-icons">create_new_folder</i>
<span>{{ $t("sidebar.newFolder") }}</span> <span>{{ $t("sidebar.newFolder") }}</span>
</button> </button>
</div> </template>
<button <button
class="button button--flat button--grey" class="button button--flat button--grey"
@click="$store.commit('closeHovers')" @click="$store.commit('closeHovers')"
@ -110,6 +110,16 @@ export default {
action(overwrite, rename); action(overwrite, rename);
}, },
createDir: async function (){
this.$store.commit('showHover', {
prompt: 'newDir',
action: null,
confirm: null,
props:{
redirect: false
}
})
}
}, },
}; };
</script> </script>

View File

@ -43,6 +43,9 @@ import url from "@/utils/url";
export default { export default {
name: "new-dir", name: "new-dir",
props: {
redirect: Boolean,
},
data: function () { data: function () {
return { return {
name: "", name: "",
@ -68,7 +71,13 @@ export default {
try { try {
await api.post(uri); await api.post(uri);
this.$router.push({ path: uri }); if (this.redirect) {
this.$router.push({ path: uri });
}else{
console.log(uri);
const res = await api.fetch(url.removeLastDir(uri) + "/");
this.$store.commit("updateRequest", res);
}
} catch (e) { } catch (e) {
this.$showError(e); this.$showError(e);
} }

View File

@ -20,7 +20,7 @@ const mutations = {
prompt: value, prompt: value,
confirm: null, confirm: null,
action: null, action: null,
props: {} props: {},
}); });
return; return;
} }
@ -88,6 +88,7 @@ const mutations = {
updateRequest: (state, value) => { updateRequest: (state, value) => {
state.oldReq = state.req; state.oldReq = state.req;
state.req = value; state.req = value;
console.log(state.req)
}, },
updateClipboard: (state, value) => { updateClipboard: (state, value) => {
state.clipboard.key = value.key; state.clipboard.key = value.key;