iterating on visual overview differencing (#803)

This commit is contained in:
Michael Quigley 2024-12-06 15:00:34 -05:00
parent 348e86e71b
commit d020851515
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62
2 changed files with 9 additions and 4 deletions

View File

@ -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";
@ -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);

View File

@ -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: "michael@quigley.com" }, type: "account" }
@ -90,4 +90,6 @@ const buildVisualizerGraph = (overview: Overview): VisualOverview => {
return out;
}
export default buildVisualizerGraph;
export const visualOverviewsEqual = (a: VisualOverview, b: VisualOverview): boolean => {
return false;
}