Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions src/components/filebrowser/FilePanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@
</b-field>
</div>
<div class="view-btns is-flex-shrink-0">
<b-tooltip :label="$t('Show Hidden Files')" position="is-left" type="is-dark">
<p class="is-clickable none-line-height mr-2" :class="{ 'has-text-primary': showHiddenFiles }" role="button" @click="toggleHiddenFiles">

Check warning on line 136 in src/components/filebrowser/FilePanel.vue

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use <button> or <input> instead of the button role to ensure accessibility across all devices.

See more on https://sonarcloud.io/project/issues?id=IceWhaleTech_CasaOS-UI&issues=AZ27zGDeuB1-peS2fFqr&open=AZ27zGDeuB1-peS2fFqr&pullRequest=269

Check warning on line 136 in src/components/filebrowser/FilePanel.vue

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Add a 'onKeyPress|onKeyDown|onKeyUp' attribute to this <p> tag.

See more on https://sonarcloud.io/project/issues?id=IceWhaleTech_CasaOS-UI&issues=AZ27zGDeuB1-peS2fFqq&open=AZ27zGDeuB1-peS2fFqq&pullRequest=269

Check warning on line 136 in src/components/filebrowser/FilePanel.vue

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Non-interactive elements should not be assigned interactive roles.

See more on https://sonarcloud.io/project/issues?id=IceWhaleTech_CasaOS-UI&issues=AZ27zGDeuB1-peS2fFqp&open=AZ27zGDeuB1-peS2fFqp&pullRequest=269
<b-icon icon="eye-outline"></b-icon>
</p>
</b-tooltip>
<b-tooltip :label="$t('Change View')" position="is-left" type="is-dark">
<p class="is-clickable none-line-height" role="button" @click="changeView">
<b-icon :icon="viewIcon"></b-icon>
Expand Down Expand Up @@ -382,6 +387,9 @@
? "view-grid-outline"
: "format-list-bulleted";
},
showHiddenFiles() {
return this.$store.state.showHiddenFiles;
},
listView() {
return this.$store.state.isViewGird ? "gird-view" : "list-view";
},
Expand Down Expand Up @@ -578,10 +586,9 @@
extensions: item.extensions,
};
});
// filter hidden files
const filterList = newFileList.filter((item) => {
return !item.name.startsWith(".");
});
const filterList = this.showHiddenFiles
? newFileList
: newFileList.filter((item) => !item.name.startsWith("."));
this.listData = orderBy(filterList, ["is_dir"], ["desc"]);
this.handelListChange(this.listData);
this.errorMsg = "";
Expand Down Expand Up @@ -616,6 +623,10 @@
this.isViewGird = !this.$store.state.isViewGird;
this.$store.commit("SET_IS_VIEW_GRID", this.isViewGird);
},
toggleHiddenFiles() {
this.$store.commit('SET_SHOW_HIDDEN_FILES', !this.$store.state.showHiddenFiles);
this.reload();
},

/**
* @description: Handle Select All Action
Expand Down Expand Up @@ -796,7 +807,7 @@
showDetailModal(item) {
this.isModalOpen = true;
this.panelType = this.getPanelType(item);
if (this.panelType !== null) {

Check warning on line 810 in src/components/filebrowser/FilePanel.vue

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unexpected negated condition.

See more on https://sonarcloud.io/project/issues?id=IceWhaleTech_CasaOS-UI&issues=AZ27zGDeuB1-peS2fFqs&open=AZ27zGDeuB1-peS2fFqs&pullRequest=269
this.currentItem = item;
this.isShowDetial = true;
} else {
Expand Down
2 changes: 2 additions & 0 deletions src/components/filebrowser/viewers/CodeEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@
import jsonlint from "jsonlint-mod";
import jsyaml from "js-yaml";

window.CSSLint = CSSLint;

Check warning on line 132 in src/components/filebrowser/viewers/CodeEditor.vue

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Prefer `globalThis` over `window`.

See more on https://sonarcloud.io/project/issues?id=IceWhaleTech_CasaOS-UI&issues=AZ27zGBQuB1-peS2fFql&open=AZ27zGBQuB1-peS2fFql&pullRequest=269
window.JSHINT = JSHINT;

Check warning on line 133 in src/components/filebrowser/viewers/CodeEditor.vue

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Prefer `globalThis` over `window`.

See more on https://sonarcloud.io/project/issues?id=IceWhaleTech_CasaOS-UI&issues=AZ27zGBQuB1-peS2fFqm&open=AZ27zGBQuB1-peS2fFqm&pullRequest=269
window.jsonlint = jsonlint;

Check warning on line 134 in src/components/filebrowser/viewers/CodeEditor.vue

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Prefer `globalThis` over `window`.

See more on https://sonarcloud.io/project/issues?id=IceWhaleTech_CasaOS-UI&issues=AZ27zGBQuB1-peS2fFqn&open=AZ27zGBQuB1-peS2fFqn&pullRequest=269
window.jsyaml = jsyaml;

Check warning on line 135 in src/components/filebrowser/viewers/CodeEditor.vue

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Prefer `globalThis` over `window`.

See more on https://sonarcloud.io/project/issues?id=IceWhaleTech_CasaOS-UI&issues=AZ27zGBQuB1-peS2fFqo&open=AZ27zGBQuB1-peS2fFqo&pullRequest=269

export default {
mixins: [mixin],
Expand Down Expand Up @@ -219,6 +219,8 @@
mode = 'text/x-go'
} else if (ext.toLowerCase() == "vue") {
mode = 'text/x-vue'
} else if (ext.toLowerCase() === 'env' || this.item.name.toLowerCase().startsWith('.env')) {
mode = 'text/x-sh'
}
this.codemirror.setOption("mode", mode);
this.$api.file.download(this.item.path).then(res => {
Expand Down
4 changes: 4 additions & 0 deletions src/store/mutations.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ const mutations = {
state.isViewGird = val
},

SET_SHOW_HIDDEN_FILES(state, val) {
state.showHiddenFiles = val
},

SET_OPERATE_OBJECT(state, val) {
state.operateObject = val
},
Expand Down
1 change: 1 addition & 0 deletions src/store/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const state = {
operateObject: null,
currentPath: '',
isViewGird: true,
showHiddenFiles: false,

// Wallpaper
wallpaperObject: {
Expand Down