Prepared for Vite Migration
This commit is contained in:
parent
468437b5d0
commit
d46be86f68
14 changed files with 392 additions and 236 deletions
|
@ -23,16 +23,16 @@ const catalogMock = new Array(10).fill(0).map((v, i) => ({
|
|||
type: i % 3 ? "api" : "ui",
|
||||
}));
|
||||
|
||||
const failingMock = new Array(10).fill(0).map((v, i) => ({
|
||||
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:${2 + i}:33.810Z`,
|
||||
timestamp: `2022-05-10T16:0${i < 10 ? i : i - 10}:33.810Z`,
|
||||
method: `SomeMethod`,
|
||||
silencedUntil: i % 4 ? null : `2022-05-10T16:${2 + i}:33.810Z`,
|
||||
silencedUntil: i % 4 ? null : `2022-05-10T16:0${i}:33.810Z`,
|
||||
frequency: "1hour",
|
||||
type: i % 3 ? "api" : "ui",
|
||||
dailyFails: i + 1,
|
||||
screenshot: "https://example.com",
|
||||
screenshot: "https://picsum.photos/1920/1080",
|
||||
recentResults: [1, 0, 0, 1, 0],
|
||||
isCompound: i % 5 ? false : true,
|
||||
failedMessage: `Some Test FailureMessage ${i}`,
|
||||
|
@ -57,6 +57,7 @@ const failingMock = new Array(10).fill(0).map((v, i) => ({
|
|||
}));
|
||||
|
||||
const initialState = {
|
||||
pages: ["failing", "alerting", "jobs", "catalog", "settings", "about"],
|
||||
intervals: [],
|
||||
catalog: catalogMock,
|
||||
failing: failingMock,
|
||||
|
@ -85,14 +86,28 @@ export const StoreProvider = ({ children }) => {
|
|||
const [state, dispatch] = useReducer(reducer, initialState);
|
||||
|
||||
function silenceRequest(silenceInfo) {
|
||||
const req = {name: silenceInfo.name ?? "*", class: silenceInfo.class ?? "*", method: silenceInfo.method ?? "*", silencedUntil: silenceInfo.silencedUntil };
|
||||
const req = {
|
||||
name: silenceInfo.name ?? "*",
|
||||
class: silenceInfo.class ?? "*",
|
||||
method: silenceInfo.method ?? "*",
|
||||
silencedUntil: silenceInfo.silencedUntil,
|
||||
};
|
||||
console.log("Would upsert silence", req);
|
||||
}
|
||||
|
||||
function removeFailure(failure) {
|
||||
const req = {
|
||||
name: failure.name,
|
||||
class: failure.class,
|
||||
};
|
||||
console.log("Would remove failure", req);
|
||||
}
|
||||
|
||||
const context = {
|
||||
state,
|
||||
dispatch,
|
||||
silenceRequest,
|
||||
removeFailure,
|
||||
updateStore: (store) => dispatch({ type: ACTIONS.UPDATE, store }),
|
||||
};
|
||||
const contextValue = useMemo(() => context, [state, dispatch]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue