Skip to content

Commit

Permalink
iterating on visual overview differencing (#803)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelquigley committed Dec 6, 2024
1 parent 348e86e commit d020851
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 5 additions & 2 deletions ui100/src/ApiConsole.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {useEffect, useState} from "react";
import {Configuration, MetadataApi} from "./api";
import buildVisualizerGraph, {VisualOverview} from "./model/visualizer.ts";
import {buildVisualOverview, VisualOverview, visualOverviewsEqual} from "./model/visualizer.ts";
import {Box} from "@mui/material";
import NavBar from "./NavBar.tsx";
import {User} from "./model/user.ts";
Expand Down Expand Up @@ -36,7 +36,10 @@ const ApiConsole = ({ user, logout }: ApiConsoleProps) => {
let api = new MetadataApi(cfg);
api.overview()
.then(d => {
setOverview(buildVisualizerGraph(d));
let vo = buildVisualOverview(d);
if(!visualOverviewsEqual(vo, overview)) {
setOverview(vo);
}
})
.catch(e => {
console.log(e);
Expand Down
6 changes: 4 additions & 2 deletions ui100/src/model/visualizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export class VisualOverview {
edges: Edge[];
}

const buildVisualizerGraph = (overview: Overview): VisualOverview => {
export const buildVisualOverview = (overview: Overview): VisualOverview => {
let out = new VisualOverview();
out.nodes = [
{ id: "0", position: { x: 0, y: 0 }, data: { label: "[email protected]" }, type: "account" }
Expand Down Expand Up @@ -90,4 +90,6 @@ const buildVisualizerGraph = (overview: Overview): VisualOverview => {
return out;
}

export default buildVisualizerGraph;
export const visualOverviewsEqual = (a: VisualOverview, b: VisualOverview): boolean => {
return false;
}

0 comments on commit d020851

Please sign in to comment.