feat: Conformance Save Log Done.

This commit is contained in:
chiayin
2023-11-29 16:47:25 +08:00
parent f1666a0bd1
commit 1f0a6aa900
14 changed files with 628 additions and 71 deletions

View File

@@ -16,6 +16,20 @@ export default defineStore('filesStore', {
ownerName: '',
}
],
allConformanceLog: [
{
log: {},
fileType: '',
ownerName: '',
}
],
allConformanceFilter: [
{
filter: {},
fileType: '',
ownerName: '',
}
],
allEventLog: [
{
parentLog: '',
@@ -39,7 +53,9 @@ export default defineStore('filesStore', {
allFiles: state => {
let result = [
...state.allEventLog,
...state.allFilter
...state.allFilter,
...state.allConformanceLog,
...state.allConformanceFilter
];
let data = state.switchFilesTagData;
let filesTag = state.filesTag;
@@ -101,6 +117,56 @@ export default defineStore('filesStore', {
apiError(error, 'Failed to load the filters.');
};
},
/**
* Fetch Conformance Log api
*/
async fetchConformanceLog() {
const api = '/api/log-checks';
try {
const response = await axios.get(api);
this.allConformanceLog = response.data;
this.allConformanceLog.map(o => {
o.icon = 'local_police';
o.parentLog = o.log.name;
o.fileType = "Rule";
o.ownerName = o.owner.name;
o.updated_base = o.updated_at;
o.accessed_base = o.accessed_at;
o.updated_at = moment(o.updated_at).utcOffset('+08:00').format('YYYY-MM-DD HH:mm');
o.accessed_at = o.accessed_at ? moment(o.accessed_at).utcOffset('+08:00').format('YYYY-MM-DD HH:mm') : null;
});
if(this.httpStatus < 300) loading.isLoading = false;
} catch(error) {
apiError(error, 'Failed to load the filters.');
};
},
/**
* Fetch Conformance Filter api
*/
async fetchConformanceFilter() {
const api = '/api/filter-checks';
try {
const response = await axios.get(api);
this.allConformancefilter = response.data;
this.allConformancefilter.map(o => {
o.icon = 'local_police';
o.parentLog = o.filter.name;
o.fileType = "Rule";
o.ownerName = o.owner.name;
o.updated_base = o.updated_at;
o.accessed_base = o.accessed_at;
o.updated_at = moment(o.updated_at).utcOffset('+08:00').format('YYYY-MM-DD HH:mm');
o.accessed_at = o.accessed_at ? moment(o.accessed_at).utcOffset('+08:00').format('YYYY-MM-DD HH:mm') : null;
});
if(this.httpStatus < 300) loading.isLoading = false;
} catch(error) {
apiError(error, 'Failed to load the filters.');
};
},
// fetchRule(){o.icon = local_police}
// fetchDesign(){o.icon = shape_line}
},