mirror of
https://github.com/datahub-project/datahub.git
synced 2025-08-23 00:28:03 +00:00
29 lines
827 B
TypeScript
29 lines
827 B
TypeScript
![]() |
import Component from '@glimmer/component';
|
||
|
import { IGraphViewerState } from '@datahub/shared/types/graph/graph-viewer-state';
|
||
|
import { rootNode } from '../constants/lineage';
|
||
|
import { simpleGraph } from '../constants/schema';
|
||
|
import { setProperties, action } from '@ember/object';
|
||
|
import { tracked } from '@glimmer/tracking';
|
||
|
export default class Graph extends Component<{
|
||
|
lineageMode: boolean;
|
||
|
}> {
|
||
|
@tracked
|
||
|
state: IGraphViewerState = {
|
||
|
graph: this.args.lineageMode ? rootNode : simpleGraph,
|
||
|
showAttributes: false,
|
||
|
lineageMode: this.args.lineageMode
|
||
|
};
|
||
|
@tracked
|
||
|
lastState: IGraphViewerState | undefined;
|
||
|
|
||
|
@action
|
||
|
onStateChanged(newState: IGraphViewerState): void {
|
||
|
const lastState = this.state;
|
||
|
const state = newState;
|
||
|
setProperties(this, {
|
||
|
state,
|
||
|
lastState
|
||
|
});
|
||
|
}
|
||
|
}
|