More styling and mocking

This commit is contained in:
Dunemask 2022-08-06 21:21:41 +00:00
parent ea06cf2ebf
commit 360ff368e1
20 changed files with 354 additions and 109 deletions

View file

@ -1,66 +1,10 @@
import React, { useReducer, createContext, useMemo } from "react";
const StoreContext = createContext();
const ACTIONS = {
UPDATE: "u",
};
const pipelineMappingsMock = [
["primary", "secondary1", "tertiary1"],
["primary", "secondary1", "tertiary2"],
["primary", "secondary2", "tertiary3"],
];
const silencedMock = new Array(10).fill(0).map((v, i) => ({
name: `Test${i + 1}`,
class: `SomeTestClass${i % 2 ? i - 1 : i / 2}`,
method: "someMethod",
id: Date.now(),
silencedUntil: `2022-05-10T16:${2 + i}:33.810Z`,
}));
const catalogMock = new Array(10).fill(0).map((v, i) => ({
name: `Test${i + 1}`,
class: `SomeTestClass${i % 2 ? i - 1 : i / 2}`,
repo: "Repo",
isCompound: i % 5 ? false : true,
type: i % 3 ? "api" : "ui",
}));
const failingMock = new Array(12).fill(0).map((v, i) => ({
class: `SomeTestClass${i % 2 ? i - 1 : i / 2}`,
name: `TestThatDoesOneThing${i + 1}`,
timestamp: `2022-05-10T16:0${i < 10 ? i : i - 10}:33.810Z`,
method: `SomeMethod`,
silencedUntil: i % 4 ? null : `2022-05-10T16:0${i}:33.810Z`,
frequency: "1hour",
type: i % 3 ? "api" : "ui",
dailyFails: i + 1,
screenshot: "https://picsum.photos/1920/1080",
recentResults: [1, 0, 0, 1, 0],
isCompound: i % 5 ? false : true,
failedMessage: `Some Test FailureMessage ${i}`,
jobStatus: (() => {
switch (i) {
case 1:
return "o";
case 3:
return "e";
case 4:
return "p";
case 5:
return "a";
case 6:
return "c";
case 8:
return "q";
default:
return null;
}
})(),
}));
const localStorage = { setItem: () => {}, getItem: () => {} };
const localSettings = localStorage.getItem("settings");
@ -78,10 +22,6 @@ const settingsKeys = Object.keys(defaultSettings);
const initialState = {
pages: ["failing", "alerting", "jobs", "catalog", "settings", "about"],
intervals: [],
catalog: catalogMock,
failing: failingMock,
silenced: silencedMock,
pipelineMappings: pipelineMappingsMock,
regions: [],
catalogSearch: "",
...settings,