Skip to content

Commit

Permalink
Fix deconfig records defects (#246)
Browse files Browse the repository at this point in the history
Resolves:
- SW550750 by removing option to delete logs based on demo feedback
- SW551637 show severity of manual records

Demo notes/conclusions:
- Critical guard record cannot be deleted or resolved,
- manually guarded entries can be deleted
- warning entries can be deleted
- can only be deleted when powered off
- "clear all" is  used to "resolve" all the records at once
- deconfig records page is mostly if not all critical errors
- hardware deconfig page handles manual records & manual actions

The following will be addressed in another commit
- SW550334 show Location code to identify the Dimm or Core
- SW549785 display SRC field


Signed-off-by: Dixsie Wolmers <[email protected]>
  • Loading branch information
dixsie authored and rfrandse committed Jun 30, 2022
1 parent 921083f commit ce28409
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 114 deletions.
61 changes: 15 additions & 46 deletions src/store/modules/Logs/DeconfigurationRecordsStore.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import api, { getResponseCount } from '@/store/api';
import api from '@/store/api';
import i18n from '@/i18n';

const DeconfigurationRecordsStore = {
Expand Down Expand Up @@ -31,24 +31,31 @@ const DeconfigurationRecordsStore = {
EntryType,
} = log;
return {
id: Id,
type: EntryType,
srcDetails: EventId,
severity: Severity,
additionalDataUri: AdditionalDataURI,
date: new Date(Created),
description: Message,
name: Name,
filterByStatus: Resolved ? 'Resolved' : 'Unresolved',
id: Id,
name: Name,
srcDetails: EventId,
status: Resolved, //true or false
type: EntryType,
uri: log['@odata.id'],
additionalDataUri: AdditionalDataURI,
severity:
Severity === 'Warning' && AdditionalDataURI
? 'Predictive'
: Severity === 'Critical'
? 'Fatal'
: Severity === 'Warning' && !AdditionalDataURI
? 'Manual'
: '--',
};
});
commit('setDeconfigurationRecordInfo', deconfigRecords);
})
.catch((error) => console.log(error));
},
async deleteAllEntries({ dispatch }, data) {
async clearAllEntries({ dispatch }, data) {
return await api
.post(
'/redfish/v1/Systems/system/LogServices/HardwareIsolation/Actions/LogService.ClearLog'
Expand All @@ -64,44 +71,6 @@ const DeconfigurationRecordsStore = {
);
});
},
async deleteRecords({ dispatch }, uris = []) {
const promises = uris.map((uri) =>
api.delete(uri).catch((error) => {
console.log(error);
return error;
})
);
return await api
.all(promises)
.then((response) => {
dispatch('getDeconfigurationRecordInfo');
return response;
})
.then(
api.spread((...responses) => {
const { successCount, errorCount } = getResponseCount(responses);
const toastMessages = [];

if (successCount) {
const message = i18n.tc(
'pageDeconfigurationRecords.toast.successDelete',
successCount
);
toastMessages.push({ type: 'success', message });
}

if (errorCount) {
const message = i18n.tc(
'pageDeconfigurationRecords.toast.errorDelete',
errorCount
);
toastMessages.push({ type: 'error', message });
}

return toastMessages;
})
);
},
},
};

Expand Down
72 changes: 4 additions & 68 deletions src/views/Logs/DeconfigurationRecords/DeconfigurationRecords.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<b-button
variant="link"
:disabled="allEntries.length === 0"
@click="deleteAllEntries"
@click="clearAllEntries"
>
<icon-delete /> {{ $t('global.action.clearAll') }}
</b-button>
Expand All @@ -32,9 +32,7 @@
<table-toolbar
ref="toolbar"
:selected-items-count="selectedRows.length"
:actions="batchActions"
@clear-selected="clearSelectedRows($refs.table)"
@batch-action="onBatchAction"
>
<template #toolbar-buttons>
<table-toolbar-export
Expand Down Expand Up @@ -127,27 +125,6 @@
<span class="sr-only">{{ $t('global.table.selectItem') }}</span>
</b-form-checkbox>
</template>
<!-- Severity column -->
<template #cell(severity)="row">
<span v-if="row.item.severity === 'Critical'">
{{ $t('pageDeconfigurationRecords.fatal') }}
</span>
<span
v-if="
row.item.severity === 'Warning' && row.item.additionalDataUri
"
>
{{ $t('pageDeconfigurationRecords.predictive') }}
</span>
<span
v-if="
row.item.severity === 'Warning' &&
row.item.additionalDataUri === 'undefined'
"
>
{{ $t('pageDeconfigurationRecords.manual') }}
</span>
</template>
<!-- Date column -->
<template #cell(date)="{ value }">
<p class="mb-0">{{ value | formatDate }}</p>
Expand Down Expand Up @@ -278,7 +255,7 @@ export default {
{
key: 'severity',
label: this.$t('pageDeconfigurationRecords.table.severity'),
sortable: false,
sortable: true,
},
{
key: 'type',
Expand All @@ -304,12 +281,6 @@ export default {
},
],
activeFilters: [],
batchActions: [
{
value: 'delete',
label: this.$t('global.action.delete'),
},
],
selectedRows: selectedRows,
tableHeaderCheckboxModel: tableHeaderCheckboxModel,
tableHeaderCheckboxIndeterminate: tableHeaderCheckboxIndeterminate,
Expand Down Expand Up @@ -342,7 +313,7 @@ export default {
.finally(() => this.endLoader());
},
methods: {
deleteAllEntries() {
clearAllEntries() {
this.$bvModal
.msgBoxConfirm(
this.$t('pageDeconfigurationRecords.modal.deleteAllMessage'),
Expand All @@ -357,7 +328,7 @@ export default {
if (deleteConfirmed) {
this.$store
.dispatch(
'deconfigurationRecords/deleteAllEntries',
'deconfigurationRecords/clearAllEntries',
this.allEntries
)
.then((message) => this.successToast(message))
Expand Down Expand Up @@ -422,41 +393,6 @@ export default {
});
}
},
onBatchAction(action) {
if (action === 'delete') {
const uris = this.selectedRows.map((row) => row.uri);
this.$bvModal
.msgBoxConfirm(
this.$tc(
'pageDeconfigurationRecords.modal.deleteMessage',
this.selectedRows.length
),
{
title: this.$tc(
'pageDeconfigurationRecords.modal.deleteTitle',
this.selectedRows.length
),
okTitle: this.$t('global.action.delete'),
cancelTitle: this.$t('global.action.cancel'),
}
)
.then((deleteConfirmed) => {
if (deleteConfirmed) {
if (this.selectedRows.length === this.allEntries.length) {
this.$store
.dispatch(
'deconfigurationRecords/deleteAllEntries',
this.selectedRows.length
)
.then((message) => this.successToast(message))
.catch(({ message }) => this.errorToast(message));
} else {
this.deleteRecords(uris);
}
}
});
}
},
},
};
</script>

0 comments on commit ce28409

Please sign in to comment.