feature: hide hidden files in config files

Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
Stefan Dej 2020-12-05 16:56:51 +01:00
parent caead858fe
commit 53049b79a6
2 changed files with 34 additions and 0 deletions

View File

@ -36,6 +36,16 @@
<v-btn color="" v-if="currentPath !== '' && currentPath !== '/config_examples'" class="flex-grow-1" @click="createFile"><v-icon>mdi-file-plus</v-icon></v-btn>
<v-btn color="" v-if="currentPath !== '' && currentPath !== '/config_examples'" class="flex-grow-1" @click="createFolder"><v-icon>mdi-folder-plus</v-icon></v-btn>
<v-btn color="primary" class="flex-grow-1" @click="refreshFileList"><v-icon>mdi-refresh</v-icon></v-btn>
<v-menu :offset-y="true" title="Setup current list">
<template v-slot:activator="{ on, attrs }">
<v-btn class="flex-grow-1" v-bind="attrs" v-on="on"><v-icon class="">mdi-cog</v-icon></v-btn>
</template>
<v-list>
<v-list-item class="minHeight36">
<v-checkbox class="mt-0" hide-details v-model="showHiddenFiles" label="Hidden files"></v-checkbox>
</v-list-item>
</v-list>
</v-menu>
</v-item-group>
</v-card-title>
<v-card-subtitle>Current path: {{ this.currentPath === "" ? "/" : this.currentPath }}</v-card-subtitle>
@ -250,6 +260,14 @@
return this.$store.dispatch("gui/setSettings", { settings: { configfiles: { countPerPage: newVal } } });
}
},
showHiddenFiles: {
get: function() {
return this.$store.state.gui.settings.configfiles.showHiddenFiles
},
set: function(newVal) {
return this.$store.dispatch("gui/setSettings", { settings: { configfiles: { showHiddenFiles: newVal } } })
}
},
},
created() {
this.loadPath();
@ -321,6 +339,10 @@
if (dirArray.length === 1 && this.currentPath === "") {
this.files = this.files.filter(element => element.filename !== "gcodes");
}
if (!this.showHiddenFiles) {
this.files = this.files.filter(file => file.filename.substr(0, 1) !== ".");
}
},
clickRow: function(item) {
if (!item.isDirectory) {
@ -485,10 +507,21 @@
this.loadPath();
}
},
filetree: {
deep: true,
handler() {
this.loadPath();
}
},
currentPath: {
handler() {
this.loadPath();
}
},
showHiddenFiles: {
handler() {
this.loadPath();
}
}
}
}

View File

@ -38,6 +38,7 @@ export function getDefaultState() {
settings: {
configfiles: {
countPerPage: 10,
showHiddenFiles: false,
}
}
}