aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/frontend/src/graph
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2023-09-03 18:04:05 +0200
committerLibravatar Kristóf Marussy <kristof@marussy.com>2023-09-03 18:05:27 +0200
commit983fea3d1aa238fd1fb6df66187248e31379a31d (patch)
tree7a47b0ca33dcf7fe8aa88cb46947a9d7df8c37c9 /subprojects/frontend/src/graph
parentchore: prefer Prolog-style comments (diff)
downloadrefinery-983fea3d1aa238fd1fb6df66187248e31379a31d.tar.gz
refinery-983fea3d1aa238fd1fb6df66187248e31379a31d.tar.zst
refinery-983fea3d1aa238fd1fb6df66187248e31379a31d.zip
feat(frontend): hide object scopes by default
Diffstat (limited to 'subprojects/frontend/src/graph')
-rw-r--r--subprojects/frontend/src/graph/GraphStore.ts6
-rw-r--r--subprojects/frontend/src/graph/VisibilityDialog.tsx9
-rw-r--r--subprojects/frontend/src/graph/dotSource.ts3
3 files changed, 17 insertions, 1 deletions
diff --git a/subprojects/frontend/src/graph/GraphStore.ts b/subprojects/frontend/src/graph/GraphStore.ts
index 50cb8c19..ecb016b5 100644
--- a/subprojects/frontend/src/graph/GraphStore.ts
+++ b/subprojects/frontend/src/graph/GraphStore.ts
@@ -61,6 +61,8 @@ export default class GraphStore {
61 61
62 abbreviate = true; 62 abbreviate = true;
63 63
64 scopes = false;
65
64 selectedSymbol: RelationMetadata | undefined; 66 selectedSymbol: RelationMetadata | undefined;
65 67
66 constructor() { 68 constructor() {
@@ -145,6 +147,10 @@ export default class GraphStore {
145 this.abbreviate = !this.abbreviate; 147 this.abbreviate = !this.abbreviate;
146 } 148 }
147 149
150 toggleScopes(): void {
151 this.scopes = !this.scopes;
152 }
153
148 setSelectedSymbol(option: RelationMetadata | undefined): void { 154 setSelectedSymbol(option: RelationMetadata | undefined): void {
149 if (option === undefined) { 155 if (option === undefined) {
150 this.selectedSymbol = undefined; 156 this.selectedSymbol = undefined;
diff --git a/subprojects/frontend/src/graph/VisibilityDialog.tsx b/subprojects/frontend/src/graph/VisibilityDialog.tsx
index 5c459fd1..f1fef28b 100644
--- a/subprojects/frontend/src/graph/VisibilityDialog.tsx
+++ b/subprojects/frontend/src/graph/VisibilityDialog.tsx
@@ -55,6 +55,9 @@ const VisibilityDialogRoot = styled('div', {
55 marginLeft: 0, 55 marginLeft: 0,
56 paddingTop: theme.spacing(1), 56 paddingTop: theme.spacing(1),
57 paddingLeft: theme.spacing(1), 57 paddingLeft: theme.spacing(1),
58 '& + .MuiFormControlLabel-root': {
59 paddingTop: 0,
60 },
58 }, 61 },
59 '.VisibilityDialog-scroll': { 62 '.VisibilityDialog-scroll': {
60 display: 'flex', 63 display: 'flex',
@@ -247,6 +250,12 @@ function VisibilityDialog({
247 } 250 }
248 label="Fully qualified names" 251 label="Fully qualified names"
249 /> 252 />
253 <FormControlLabel
254 control={
255 <Switch checked={graph.scopes} onClick={() => graph.toggleScopes()} />
256 }
257 label="Object scopes"
258 />
250 <div className="VisibilityDialog-scroll"> 259 <div className="VisibilityDialog-scroll">
251 {hasRows ? ( 260 {hasRows ? (
252 <table cellSpacing={0}> 261 <table cellSpacing={0}>
diff --git a/subprojects/frontend/src/graph/dotSource.ts b/subprojects/frontend/src/graph/dotSource.ts
index b24bca2f..5f7707aa 100644
--- a/subprojects/frontend/src/graph/dotSource.ts
+++ b/subprojects/frontend/src/graph/dotSource.ts
@@ -123,6 +123,7 @@ function createNodes(graph: GraphStore, lines: string[]): void {
123 const nodeData = computeNodeData(graph); 123 const nodeData = computeNodeData(graph);
124 const { 124 const {
125 semantics: { nodes }, 125 semantics: { nodes },
126 scopes,
126 } = graph; 127 } = graph;
127 128
128 nodes.forEach((node, i) => { 129 nodes.forEach((node, i) => {
@@ -141,7 +142,7 @@ function createNodes(graph: GraphStore, lines: string[]): void {
141 const classes = classList.join(' '); 142 const classes = classList.join(' ');
142 const name = nodeName(graph, node); 143 const name = nodeName(graph, node);
143 const border = node.kind === 'INDIVIDUAL' ? 2 : 1; 144 const border = node.kind === 'INDIVIDUAL' ? 2 : 1;
144 const count = data.equalsSelf !== 'TRUE' ? ` ${data.count}` : ''; 145 const count = scopes && data.equalsSelf !== 'TRUE' ? ` ${data.count}` : '';
145 lines.push(`n${i} [id="${node.name}", class="${classes}", label=< 146 lines.push(`n${i} [id="${node.name}", class="${classes}", label=<
146 <table border="${border}" cellborder="0" cellspacing="0" style="rounded" bgcolor="white"> 147 <table border="${border}" cellborder="0" cellspacing="0" style="rounded" bgcolor="white">
147 <tr><td cellpadding="4.5" width="32" bgcolor="green">${name}${count}</td></tr>`); 148 <tr><td cellpadding="4.5" width="32" bgcolor="green">${name}${count}</td></tr>`);