Skip to content

Commit ccf7ed9

Browse files
authored
fix(vipergc-574): Use selected shelve duration for fault management (nasa#7890)
* refactor: `Indefinite` -> `Unlimited` * refactor: remove unused const * fix: use the selected shelveDuration * fix: set and use default if none selected * fix: bad optional chaining * fix: handle the case of no provider * fix: don't assign defaults if no provider
1 parent 2b86739 commit ccf7ed9

File tree

3 files changed

+10
-23
lines changed

3 files changed

+10
-23
lines changed

src/api/faultmanagement/FaultManagementAPI.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export const DEFAULT_SHELVE_DURATIONS = [
3535
value: 900000
3636
},
3737
{
38-
name: 'Indefinite',
38+
name: 'Unlimited',
3939
value: null
4040
}
4141
];
@@ -136,17 +136,21 @@ export default class FaultManagementAPI {
136136
/**
137137
* Retrieves the available shelve durations from the provider, or the default durations if the
138138
* provider does not provide any.
139-
* @returns {ShelveDuration[]}
139+
* @returns {ShelveDuration[] | undefined}
140140
*/
141141
getShelveDurations() {
142-
return this.provider?.getShelveDurations() ?? DEFAULT_SHELVE_DURATIONS;
142+
if (!this.provider) {
143+
return;
144+
}
145+
146+
return this.provider.getShelveDurations?.() ?? DEFAULT_SHELVE_DURATIONS;
143147
}
144148
}
145149

146150
/**
147151
* @typedef {Object} ShelveDuration
148152
* @property {string} name - The name of the shelve duration
149-
* @property {number|null} value - The value of the shelve duration in milliseconds, or null for indefinite
153+
* @property {number|null} value - The value of the shelve duration in milliseconds, or null for unlimited
150154
*/
151155

152156
/**

src/plugins/faultManagement/FaultManagementView.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,8 @@ export default {
330330
}
331331
332332
shelveData.comment = data.comment || '';
333-
shelveData.shelveDuration = data.shelveDuration ?? this.shelveDurations[0].value;
333+
shelveData.shelveDuration =
334+
data.shelveDuration === undefined ? this.shelveDurations[0].value : data.shelveDuration;
334335
} else {
335336
shelveData = {
336337
shelved: false

src/plugins/faultManagement/constants.js

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -42,24 +42,6 @@ export const FAULT_MANAGEMENT_TYPE = 'faultManagement';
4242
export const FAULT_MANAGEMENT_INSPECTOR = 'faultManagementInspector';
4343
export const FAULT_MANAGEMENT_ALARMS = 'alarms';
4444
export const FAULT_MANAGEMENT_GLOBAL_ALARMS = 'global-alarm-status';
45-
export const FAULT_MANAGEMENT_SHELVE_DURATIONS_IN_MS = [
46-
{
47-
name: '5 Minutes',
48-
value: 300000
49-
},
50-
{
51-
name: '10 Minutes',
52-
value: 600000
53-
},
54-
{
55-
name: '15 Minutes',
56-
value: 900000
57-
},
58-
{
59-
name: 'Indefinite',
60-
value: 0
61-
}
62-
];
6345
export const FAULT_MANAGEMENT_VIEW = 'faultManagement.view';
6446
export const FAULT_MANAGEMENT_NAMESPACE = 'faults.taxonomy';
6547
export const FILTER_ITEMS = ['Standard View', 'Acknowledged', 'Unacknowledged', 'Shelved'];

0 commit comments

Comments
 (0)