feat: implemented basic new folder action in move dialog (#2659)
This commit is contained in:
parent
8b4b2d6656
commit
46445a2392
@ -9,17 +9,17 @@
|
||||
</div>
|
||||
|
||||
<div class="card-action">
|
||||
<div v-if="user.perm.create">
|
||||
<template v-if="user.perm.create">
|
||||
<button
|
||||
class="button button--flat"
|
||||
@click="$store.commit('showHover', 'newDir')"
|
||||
@click="createDir()"
|
||||
:aria-label="$t('sidebar.newFolder')"
|
||||
:title="$t('sidebar.newFolder')"
|
||||
>
|
||||
<i class="material-icons">create_new_folder</i>
|
||||
<span>{{ $t("sidebar.newFolder") }}</span>
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
<button
|
||||
class="button button--flat button--grey"
|
||||
@click="$store.commit('closeHovers')"
|
||||
@ -110,6 +110,16 @@ export default {
|
||||
|
||||
action(overwrite, rename);
|
||||
},
|
||||
createDir: async function (){
|
||||
this.$store.commit('showHover', {
|
||||
prompt: 'newDir',
|
||||
action: null,
|
||||
confirm: null,
|
||||
props:{
|
||||
redirect: false
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
@ -43,6 +43,9 @@ import url from "@/utils/url";
|
||||
|
||||
export default {
|
||||
name: "new-dir",
|
||||
props: {
|
||||
redirect: Boolean,
|
||||
},
|
||||
data: function () {
|
||||
return {
|
||||
name: "",
|
||||
@ -68,7 +71,13 @@ export default {
|
||||
|
||||
try {
|
||||
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) {
|
||||
this.$showError(e);
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@ const mutations = {
|
||||
prompt: value,
|
||||
confirm: null,
|
||||
action: null,
|
||||
props: {}
|
||||
props: {},
|
||||
});
|
||||
return;
|
||||
}
|
||||
@ -88,6 +88,7 @@ const mutations = {
|
||||
updateRequest: (state, value) => {
|
||||
state.oldReq = state.req;
|
||||
state.req = value;
|
||||
console.log(state.req)
|
||||
},
|
||||
updateClipboard: (state, value) => {
|
||||
state.clipboard.key = value.key;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user