fix: hide system operations in tree view

This commit is contained in:
garethgeorge
2024-08-26 19:20:38 -07:00
parent 8ec32a8c67
commit 5b5230e457
4 changed files with 10 additions and 9 deletions
+2 -2
View File
@@ -6,6 +6,7 @@ import { GetOperationsRequest } from "../../gen/ts/v1/service_pb";
import { useAlertApi } from "./Alerts";
import { OperationRow } from "./OperationRow";
import { OplogState, syncStateFromRequest } from "../state/logstate";
import { shouldHideStatus } from "../state/oplog";
// OperationList displays a list of operations that are either fetched based on 'req' or passed in via 'useBackups'.
// If showPlan is provided the planId will be displayed next to each operation in the operation list.
@@ -25,9 +26,8 @@ export const OperationList = ({
let [operations, setOperations] = useState<Operation[]>([]);
if (req) {
// track backups for this operation tree view.
useEffect(() => {
const logState = new OplogState();
const logState = new OplogState((op) => !shouldHideStatus(op.status));
logState.subscribe((ids, flowIDs, event) => {
setOperations(logState.getAll());
+7 -3
View File
@@ -74,10 +74,14 @@ export const OperationTree = ({
event === OperationEventType.EVENT_UPDATED
) {
for (const flowID of flowIDs) {
backupInfoByFlowID.set(
flowID,
displayInfoForFlow(logState.getByFlowID(flowID) || [])
const displayInfo = displayInfoForFlow(
logState.getByFlowID(flowID) || []
);
if (!displayInfo.hidden) {
backupInfoByFlowID.set(flowID, displayInfo);
} else {
backupInfoByFlowID.delete(flowID);
}
}
} else if (event === OperationEventType.EVENT_DELETED) {
for (const flowID of flowIDs) {
-1
View File
@@ -13,7 +13,6 @@ import {
OpSelector,
} from "../../gen/ts/v1/service_pb";
import { SpinButton } from "../components/SpinButton";
import { shouldHideStatus } from "../state/oplog";
import { useShowModal } from "../components/ModalManager";
export const PlanView = ({ plan }: React.PropsWithChildren<{ plan: Plan }>) => {
+1 -3
View File
@@ -10,9 +10,7 @@ import {
GetOperationsRequest,
OpSelector,
} from "../../gen/ts/v1/service_pb";
import { shouldHideStatus } from "../state/oplog";
import { backrestService } from "../api";
import { StringValue } from "@bufbuild/protobuf";
import { SpinButton } from "../components/SpinButton";
import { useConfig } from "../components/ConfigProvider";
import { formatErrorAlert, useAlertApi } from "../components/Alerts";
@@ -21,7 +19,7 @@ import { useShowModal } from "../components/ModalManager";
const StatsPanel = React.lazy(() => import("../components/StatsPanel"));
export const RepoView = ({ repo }: React.PropsWithChildren<{ repo: Repo }>) => {
const [config, setConfig] = useConfig();
const [config, _] = useConfig();
const showModal = useShowModal();
const alertsApi = useAlertApi()!;