mirror of
https://github.com/nasa/openmct.git
synced 2025-06-14 05:08:15 +00:00
feat(Fault Management): allow fault providers to define shelve durations (#7849)
* refactor: clean up FaultManagementView code * feat: providers can now provide "Shelve Duration" options * fix(exampleFaultSource): support `getShelveDurations` * a11y: aria label for fault management list item * a11y(FaultManagement): more labels * refactor: eliminate some faultUtils and refactor locator() out of tests * docs: add some more docs to fault management api * refactor: make for loop more readable * test: use static faults when testing * fix: set a timestamp for static faults and subtract so we get faults in order * refactor: autoformat * chore: add missing copyright header * fix: use as default parameter to get value as method is called * refactor: make magic number a const * fix(codecov): use codecov github action to upload * fix: generate the report * build: update circleci yml to use codecov orb * build: remove codecov scripts and package * build: don't use the orb because things can't be easy - nasa org disallows "third party" orbs * build: only use `sudo` if we ain't da root user --------- Co-authored-by: Andrew Henry <akhenry@gmail.com>
This commit is contained in:
@ -1,4 +1,27 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
const SEVERITIES = ['WATCH', 'WARNING', 'CRITICAL'];
|
||||
const MOONWALK_TIMESTAMP = 14159040000;
|
||||
const NAMESPACE = '/Example/fault-';
|
||||
const getRandom = {
|
||||
severity: () => SEVERITIES[Math.floor(Math.random() * 3)],
|
||||
@ -13,7 +36,8 @@ const getRandom = {
|
||||
|
||||
val = num;
|
||||
severity = SEVERITIES[severityIndex - 1];
|
||||
time = num;
|
||||
// Subtract `num` from the timestamp so that the faults are in order
|
||||
time = MOONWALK_TIMESTAMP - num; // Mon, 21 Jul 1969 02:56:00 GMT 🌔👨🚀👨🚀👨🚀
|
||||
}
|
||||
|
||||
return {
|
||||
@ -43,14 +67,7 @@ const getRandom = {
|
||||
}
|
||||
};
|
||||
|
||||
export function shelveFault(
|
||||
fault,
|
||||
opts = {
|
||||
shelved: true,
|
||||
comment: '',
|
||||
shelveDuration: 90000
|
||||
}
|
||||
) {
|
||||
export function shelveFault(fault, opts = { shelved: true, comment: '', shelveDuration: 90000 }) {
|
||||
fault.shelved = true;
|
||||
|
||||
setTimeout(() => {
|
||||
@ -65,8 +82,8 @@ export function acknowledgeFault(fault) {
|
||||
export function randomFaults(staticFaults, count = 5) {
|
||||
let faults = [];
|
||||
|
||||
for (let x = 1, y = count + 1; x < y; x++) {
|
||||
faults.push(getRandom.fault(x, staticFaults));
|
||||
for (let i = 1; i <= count; i++) {
|
||||
faults.push(getRandom.fault(i, staticFaults));
|
||||
}
|
||||
|
||||
return faults;
|
||||
|
Reference in New Issue
Block a user