Skip to content

Commit

Permalink
fix: hide system operations in tree view
Browse files Browse the repository at this point in the history
  • Loading branch information
garethgeorge committed Aug 27, 2024
1 parent a9eb786 commit 8c1cf79
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions webui/src/components/OperationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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());
Expand Down
10 changes: 7 additions & 3 deletions webui/src/components/OperationTree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 0 additions & 1 deletion webui/src/views/PlanView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 }>) => {
Expand Down
4 changes: 1 addition & 3 deletions webui/src/views/RepoView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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()!;

Expand Down

0 comments on commit 8c1cf79

Please sign in to comment.