Skip to content

Commit

Permalink
added graph rewind, then disabled it because its terrible. Fixed impo…
Browse files Browse the repository at this point in the history
…rt bug
  • Loading branch information
TonyGermaneri committed Jan 8, 2024
1 parent 821a607 commit c83923a
Show file tree
Hide file tree
Showing 12 changed files with 335 additions and 22 deletions.
11 changes: 9 additions & 2 deletions packages/Graph/GraphCanvas.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
x-graph-canvas
:style="graphCanvasStyle"
v-if="graphSnapshot"
:key="graphUpdateVersion"
@drop="drop($event)"
@dragover="dragOver($event)"
>
Expand All @@ -13,14 +14,14 @@
></div>
<node-edge-connector
v-for="c in connectors"
:key="c.connector.id + graphSnapshot.version"
:key="c.connector.id + graphUpdateVersion"
:connector="c.connector"
:edge="c.edge"
:node="c.node"
/>
<node
v-for="node in graphSnapshot.nodes"
:key="node.id"
:key="node.id + graphUpdateVersion"
:node="node"
:graph="graphSnapshot"
:presentation="presentation"
Expand All @@ -44,11 +45,16 @@ export default {
innerWidth: 0,
positionLocationSaveTimeout: 750,
positionTimeout: 0,
graphUpdateVersion: 0,
}
},
watch: {
graphSnapshot: {
handler() {
// force updates in rewind mode
if (this.inRewindMode) {
this.graphUpdateVersion += 1;
}
this.updateBoundingRect();
},
deep: true,
Expand Down Expand Up @@ -111,6 +117,7 @@ export default {
'el',
'boundingRect',
'presentation',
'inRewindMode',
]),
connectors: function () {
let connectors = [];
Expand Down
1 change: 1 addition & 0 deletions packages/Graph/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export default () => {
preferencesStore: usePreferencesStore(),
graphSnapshotStore: useGraphSnapshotStore(),
graphSnapshot: null as any,
rewindVersion: 0,
keys: {} as Record<string, string>,
artifacts: {} as Record<string, any>,
nodeMimeType: "application/json+plastic-io",
Expand Down
13 changes: 7 additions & 6 deletions packages/ImportPanel/ImportPanelList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
{{subItem.icon || iconType(subItem.type)}}
</v-icon>
{{subItem.title || subItem.name || "Untitled"}} - v{{subItem.version}}

</v-list-item-title>
</v-list-item>
</v-list>
Expand Down Expand Up @@ -65,11 +64,13 @@ export default {
groupByPrefix(toc) {
const {id, ...arts } = toc;
const group = {};
Object.values(arts).forEach((item) => {
const [prefix, suffix] = item.id.split('.');
group[prefix] = group[prefix] || [];
group[prefix].push(item);
});
Object.values(arts)
.filter(item => /published/.test(item.type))
.forEach((item) => {
const [prefix, suffix] = item.id.split('.');
group[prefix] = group[prefix] || [];
group[prefix].push(item);
});
Object.keys(group).forEach((prefix) => {
group[prefix].sort((a, b) => {
return new Date(a) - new Date(b);
Expand Down
2 changes: 1 addition & 1 deletion packages/Input/mouse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default class MouseAction {
this.graphStore.updateGraphFromSnapshot(description);
}
mouse(mouse: any) {
if (this.orchestratorStore.inRewindMode) {
if (this.graphStore.inRewindMode) {
console.warn("No mouse based mutations during rewind mode");
return;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/Input/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const useStore = defineStore('input', {
e.preventDefault();
},
mousemove(e: MouseEvent) {
if (this.orchistratorStore.showHelp || this.orchistratorStore.inRewindMode) {
if (this.orchistratorStore.showHelp || this.graphStore.inRewindMode) {
return;
}
// do not track control panel inputs
Expand Down Expand Up @@ -89,7 +89,7 @@ export const useStore = defineStore('input', {
},
mousedown(e: MouseEvent) {
let isMap = false;
if (!this.graphStore.graph || this.orchistratorStore.showHelp || this.orchistratorStore.inRewindMode) {
if (!this.graphStore.graph || this.orchistratorStore.showHelp || this.graphStore.inRewindMode) {
return;
}
// do not track control panel inputs
Expand Down
2 changes: 1 addition & 1 deletion packages/NodeEdgeConnector/NodeEdgeConnector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ export default {
...mapState(usePreferencesStore, ['preferences',]),
...mapState(useInputStore, ['mouse']),
...mapState(useOrchestratorStore, [
'inRewindMode',
'historyPosition',
]),
...mapState(useGraphStore, [
Expand All @@ -75,6 +74,7 @@ export default {
'graphSnapshot',
'view',
'translating',
'inRewindMode',
'ltrPct',
'selectedConnectors',
'hoveredConnector',
Expand Down
4 changes: 3 additions & 1 deletion packages/Orchestrator/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ export const useStore = defineStore('orchestrator', {
},
fortunes: [],
inRewindMode: false,
rewindVisible: false,
testOutputVersion: 0,
testOutput: [],
ownEvents: [],
Expand Down Expand Up @@ -167,6 +166,9 @@ export const useStore = defineStore('orchestrator', {
}),
actions: {
hyphenateProperty,
getEvents(url: string) {
return this.dataProviders!.artifact!.getEvents(url);
},
async init(graphUrl: string) {
return await this.graphStore.open(graphUrl);
},
Expand Down
Loading

0 comments on commit c83923a

Please sign in to comment.