diff --git a/_assets/src/components/Main.vue b/_assets/src/components/Main.vue
index 6b766d42..ed802fe1 100644
--- a/_assets/src/components/Main.vue
+++ b/_assets/src/components/Main.vue
@@ -34,6 +34,10 @@
error
You're not welcome here.
+
+ error_outline
+ Something really went wrong.
+
@@ -132,7 +136,7 @@ export default {
window.addEventListener('keydown', (event) => {
// Esc!
if (event.keyCode === 27) {
- this.$store.commit('resetPrompts')
+ this.$store.commit('closePrompts')
// Unselect all files and folders.
if (this.req.kind === 'listing') {
@@ -150,20 +154,20 @@ export default {
// Del!
if (event.keyCode === 46) {
if (this.showDeleteButton()) {
- this.$store.commit('showDelete', true)
+ this.$store.commit('showPrompt', 'delete')
}
}
// F1!
if (event.keyCode === 112) {
event.preventDefault()
- this.$store.commit('showHelp', true)
+ this.$store.commit('showPrompt', 'help')
}
// F2!
if (event.keyCode === 113) {
if (this.showRenameButton()) {
- this.$store.commit('showRename', true)
+ this.$store.commit('showPrompt', 'rename')
}
}
@@ -185,11 +189,14 @@ export default {
},
methods: {
fetchData () {
+ // Set loading to true and reset the error.
this.loading = true
this.error = null
+
// Reset selected items and multiple selection.
this.$store.commit('resetSelected')
this.$store.commit('multiple', false)
+ this.$store.commit('closePrompts')
let url = this.$route.path
if (url === '') url = '/'
diff --git a/_assets/src/components/Sidebar.vue b/_assets/src/components/Sidebar.vue
index 6895eef9..1db4c1ee 100644
--- a/_assets/src/components/Sidebar.vue
+++ b/_assets/src/components/Sidebar.vue
@@ -6,12 +6,12 @@
-
diff --git a/_assets/src/components/prompts/Info.vue b/_assets/src/components/prompts/Info.vue
index 55631929..3d54d797 100644
--- a/_assets/src/components/prompts/Info.vue
+++ b/_assets/src/components/prompts/Info.vue
@@ -21,7 +21,7 @@
- OK
+ OK
diff --git a/_assets/src/components/prompts/Move.vue b/_assets/src/components/prompts/Move.vue
index 538cb52f..eb2cff33 100644
--- a/_assets/src/components/prompts/Move.vue
+++ b/_assets/src/components/prompts/Move.vue
@@ -11,7 +11,7 @@
Move
- Cancel
+ Cancel
diff --git a/_assets/src/components/prompts/NewDir.vue b/_assets/src/components/prompts/NewDir.vue
index 1d19f373..ce841967 100644
--- a/_assets/src/components/prompts/NewDir.vue
+++ b/_assets/src/components/prompts/NewDir.vue
@@ -5,7 +5,7 @@
Create
- Cancel
+ Cancel
@@ -45,7 +45,7 @@ export default {
console.log(error)
})
- this.$store.commit('showNewDir', false)
+ this.$store.commit('closePrompts')
}
}
}
diff --git a/_assets/src/components/prompts/NewFile.vue b/_assets/src/components/prompts/NewFile.vue
index fa40e4e7..ada54f30 100644
--- a/_assets/src/components/prompts/NewFile.vue
+++ b/_assets/src/components/prompts/NewFile.vue
@@ -5,7 +5,7 @@
Create
- Cancel
+ Cancel
@@ -45,7 +45,7 @@ export default {
console.log(error)
})
- this.$store.commit('showNewFile', false)
+ this.$store.commit('closePrompts')
}
}
}
diff --git a/_assets/src/components/prompts/Prompts.vue b/_assets/src/components/prompts/Prompts.vue
index 78a43308..468ddf08 100644
--- a/_assets/src/components/prompts/Prompts.vue
+++ b/_assets/src/components/prompts/Prompts.vue
@@ -21,7 +21,7 @@ import Download from './Download'
import Move from './Move'
import NewFile from './NewFile'
import NewDir from './NewDir'
-import {mapGetters, mapState} from 'vuex'
+import {mapGetters} from 'vuex'
export default {
name: 'prompts',
@@ -37,9 +37,7 @@ export default {
},
computed: {
...mapGetters([
- 'showOverlay'
- ]),
- ...mapState([
+ 'showOverlay',
'showInfo',
'showHelp',
'showDelete',
@@ -52,7 +50,7 @@ export default {
},
methods: {
resetPrompts () {
- this.$store.commit('resetPrompts')
+ this.$store.commit('closePrompts')
}
}
}
diff --git a/_assets/src/components/prompts/Rename.vue b/_assets/src/components/prompts/Rename.vue
index d2eca795..39caabd8 100644
--- a/_assets/src/components/prompts/Rename.vue
+++ b/_assets/src/components/prompts/Rename.vue
@@ -25,7 +25,7 @@ export default {
computed: mapState(['req', 'selected', 'selectedCount']),
methods: {
cancel: function (event) {
- this.$store.commit('showRename', false)
+ this.$store.commit('closePrompts')
},
oldName: function () {
if (this.req.kind !== 'listing') {
@@ -68,7 +68,7 @@ export default {
console.log(error)
})
- this.$store.commit('showRename', false)
+ this.$store.commit('closePrompts')
return
}
}
diff --git a/_assets/src/store/getters.js b/_assets/src/store/getters.js
index 9ac780b6..e1fbfe56 100644
--- a/_assets/src/store/getters.js
+++ b/_assets/src/store/getters.js
@@ -1,14 +1,13 @@
const getters = {
- showOverlay: state => {
- return state.showInfo ||
- state.showHelp ||
- state.showDelete ||
- state.showRename ||
- state.showMove ||
- state.showNewFile ||
- state.showNewDir ||
- state.showDownload
- },
+ showInfo: state => (state.prompt === 'info'),
+ showHelp: state => (state.prompt === 'help'),
+ showDelete: state => (state.prompt === 'delete'),
+ showRename: state => (state.prompt === 'rename'),
+ showMove: state => (state.prompt === 'move'),
+ showNewFile: state => (state.prompt === 'newFile'),
+ showNewDir: state => (state.prompt === 'newDir'),
+ showDownload: state => (state.prompt === 'download'),
+ showOverlay: state => (state.prompt !== null),
selectedCount: state => state.selected.length
}
diff --git a/_assets/src/store/mutations.js b/_assets/src/store/mutations.js
index 9bbdf092..075c8fd8 100644
--- a/_assets/src/store/mutations.js
+++ b/_assets/src/store/mutations.js
@@ -1,23 +1,7 @@
const mutations = {
- showInfo: (state, value) => (state.showInfo = value),
- showHelp: (state, value) => (state.showHelp = value),
- showDelete: (state, value) => (state.showDelete = value),
- showRename: (state, value) => (state.showRename = value),
- showMove: (state, value) => (state.showMove = value),
- showNewFile: (state, value) => (state.showNewFile = value),
- showNewDir: (state, value) => (state.showNewDir = value),
- showDownload: (state, value) => (state.showDownload = value),
- resetPrompts: (state) => {
- state.showHelp = false
- state.showInfo = false
- state.showDelete = false
- state.showRename = false
- state.showMove = false
- state.showNewFile = false
- state.showNewDir = false
- state.showDownload = false
- },
- setReload: (state, value) => (state.reload = value),
+ closePrompts: (state) => { state.prompt = null },
+ showPrompt: (state, value) => { state.prompt = value },
+ setReload: (state, value) => { state.reload = value },
setUser: (state, value) => (state.user = value),
setJWT: (state, value) => (state.jwt = value),
multiple: (state, value) => (state.multiple = value),
diff --git a/_assets/src/store/store.js b/_assets/src/store/store.js
index 82436a9e..6e7268bc 100644
--- a/_assets/src/store/store.js
+++ b/_assets/src/store/store.js
@@ -14,14 +14,7 @@ const state = {
reload: false,
selected: [],
multiple: false,
- showInfo: false,
- showHelp: false,
- showDelete: false,
- showRename: false,
- showMove: false,
- showNewFile: false,
- showNewDir: false,
- showDownload: false
+ prompt: null
}
export default new Vuex.Store({