fix(vipergc-574): Use selected shelve duration for fault management (#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
This commit is contained in:
Jesse Mazzella
2024-10-15 16:26:57 -07:00
committed by GitHub
parent 2b8673941a
commit ccf7ed91af
3 changed files with 10 additions and 23 deletions

View File

@ -35,7 +35,7 @@ export const DEFAULT_SHELVE_DURATIONS = [
value: 900000
},
{
name: 'Indefinite',
name: 'Unlimited',
value: null
}
];
@ -136,17 +136,21 @@ export default class FaultManagementAPI {
/**
* Retrieves the available shelve durations from the provider, or the default durations if the
* provider does not provide any.
* @returns {ShelveDuration[]}
* @returns {ShelveDuration[] | undefined}
*/
getShelveDurations() {
return this.provider?.getShelveDurations() ?? DEFAULT_SHELVE_DURATIONS;
if (!this.provider) {
return;
}
return this.provider.getShelveDurations?.() ?? DEFAULT_SHELVE_DURATIONS;
}
}
/**
* @typedef {Object} ShelveDuration
* @property {string} name - The name of the shelve duration
* @property {number|null} value - The value of the shelve duration in milliseconds, or null for indefinite
* @property {number|null} value - The value of the shelve duration in milliseconds, or null for unlimited
*/
/**