can show columns from selected input

This commit is contained in:
Peter Olu 2022-05-21 15:06:52 +01:00
parent 9d3c417a49
commit 8a15b9882d
2 changed files with 15 additions and 3 deletions

View File

@ -61,6 +61,14 @@ export const logStore = defineStore({
loadLogs: false,
}),
actions: {
showColumns(columnsLabel: string[]) {
// TODO: add a parameter column type too
this.serviceLogColumn.forEach((col: any) => {
if (columnsLabel.includes(col.value)) {
col.isVisible = true
}
})
},
hideColumns(columnsLabel: string[]) {
// TODO: add a parameter column type too
this.serviceLogColumn.forEach((col: any) => {

View File

@ -42,7 +42,7 @@ limitations under the License. -->
content="Add selected columns"
placement="bottom-start"
>
<el-button class="toggle-btn mx-3" @click="setVisbleColumn">
<el-button class="toggle-btn mx-3" @click="showColumns">
<Icon iconSize="sm" iconName="save" />
</el-button>
</el-tooltip>
@ -53,7 +53,7 @@ limitations under the License. -->
content="Remove selected columns"
placement="bottom-start"
>
<el-button class="toggle-btn mx-3" @click="hideColumn">
<el-button class="toggle-btn mx-3" @click="hideColumns">
<Icon iconSize="sm" iconName="cancel" />
</el-button>
</el-tooltip>
@ -341,10 +341,14 @@ function setVisbleColumn() {
});
console.log(cols, [...logStore.serviceLogColumn]);
}
function hideColumn() {
function hideColumns() {
logStore.hideColumns(selectedColumns.value)
selectedColumns.value = []
}
function showColumns() {
logStore.showColumns(selectedColumns.value)
selectedColumns.value = []
}
async function init() {
const resp = await logStore.getLogsByKeywords();