diff --git a/main.go b/main.go index 75dde3fb..8115c21f 100644 --- a/main.go +++ b/main.go @@ -120,6 +120,7 @@ func main() { // Setup the plugin systems resourceController := resource.NewController(log, settingsProvider) resourceClient := resource.NewClient(resourceController) + graphService := resource.NewGraphService(resourceController.Graph()) settingsController := settings.NewController(log, settingsProvider) settingsClient := settings.NewClient(settingsController) @@ -340,6 +341,7 @@ func main() { pluginLogManager, devServerManager, resourceClient, + graphService, settingsClient, execClient, networkerClient, diff --git a/packages/omniviewdev-runtime/src/wailsjs/go/models.ts b/packages/omniviewdev-runtime/src/wailsjs/go/models.ts index a3189c5c..d1521fab 100755 --- a/packages/omniviewdev-runtime/src/wailsjs/go/models.ts +++ b/packages/omniviewdev-runtime/src/wailsjs/go/models.ts @@ -464,6 +464,132 @@ export namespace exec { } +export namespace graph { + + export class GraphNode { + pluginId: string; + connectionId: string; + resourceKey: string; + id: string; + namespace?: string; + + static createFrom(source: any = {}) { + return new GraphNode(source); + } + + constructor(source: any = {}) { + if ('string' === typeof source) source = JSON.parse(source); + this.pluginId = source["pluginId"]; + this.connectionId = source["connectionId"]; + this.resourceKey = source["resourceKey"]; + this.id = source["id"]; + this.namespace = source["namespace"]; + } + } + export class GraphEdge { + source: GraphNode; + target: GraphNode; + type: string; + label: string; + + static createFrom(source: any = {}) { + return new GraphEdge(source); + } + + constructor(source: any = {}) { + if ('string' === typeof source) source = JSON.parse(source); + this.source = this.convertValues(source["source"], GraphNode); + this.target = this.convertValues(source["target"], GraphNode); + this.type = source["type"]; + this.label = source["label"]; + } + + convertValues(a: any, classs: any, asMap: boolean = false): any { + if (!a) { + return a; + } + if (a.slice && a.map) { + return (a as any[]).map(elem => this.convertValues(elem, classs)); + } else if ("object" === typeof a) { + if (asMap) { + for (const key of Object.keys(a)) { + a[key] = new classs(a[key]); + } + return a; + } + return new classs(a); + } + return a; + } + } + export class DependencyNode { + edge: GraphEdge; + children: DependencyNode[]; + + static createFrom(source: any = {}) { + return new DependencyNode(source); + } + + constructor(source: any = {}) { + if ('string' === typeof source) source = JSON.parse(source); + this.edge = this.convertValues(source["edge"], GraphEdge); + this.children = this.convertValues(source["children"], DependencyNode); + } + + convertValues(a: any, classs: any, asMap: boolean = false): any { + if (!a) { + return a; + } + if (a.slice && a.map) { + return (a as any[]).map(elem => this.convertValues(elem, classs)); + } else if ("object" === typeof a) { + if (asMap) { + for (const key of Object.keys(a)) { + a[key] = new classs(a[key]); + } + return a; + } + return new classs(a); + } + return a; + } + } + export class DependencyTree { + root: GraphNode; + children: DependencyNode[]; + + static createFrom(source: any = {}) { + return new DependencyTree(source); + } + + constructor(source: any = {}) { + if ('string' === typeof source) source = JSON.parse(source); + this.root = this.convertValues(source["root"], GraphNode); + this.children = this.convertValues(source["children"], DependencyNode); + } + + convertValues(a: any, classs: any, asMap: boolean = false): any { + if (!a) { + return a; + } + if (a.slice && a.map) { + return (a as any[]).map(elem => this.convertValues(elem, classs)); + } else if ("object" === typeof a) { + if (asMap) { + for (const key of Object.keys(a)) { + a[key] = new classs(a[key]); + } + return a; + } + return new classs(a); + } + return a; + } + } + + +} + export namespace logs { export class ActionTargetBuilder { @@ -1510,6 +1636,11 @@ export namespace registry { export namespace resource { + export enum SyncPolicy { + ON_CONNECT = 0, + ON_FIRST_QUERY = 1, + NEVER = 2, + } export enum WatchState { IDLE = 0, SYNCING = 1, @@ -1520,11 +1651,6 @@ export namespace resource { FORBIDDEN = 6, SKIPPED = 7, } - export enum SyncPolicy { - ON_CONNECT = 0, - ON_FIRST_QUERY = 1, - NEVER = 2, - } export class SchemaProperty { type: string; description?: string; diff --git a/packages/omniviewdev-runtime/src/wailsjs/go/resource/GraphService.d.ts b/packages/omniviewdev-runtime/src/wailsjs/go/resource/GraphService.d.ts new file mode 100755 index 00000000..eda17c98 --- /dev/null +++ b/packages/omniviewdev-runtime/src/wailsjs/go/resource/GraphService.d.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT +import {graph} from '../models'; + +export function GetDependencyTree(arg1:string,arg2:string,arg3:string,arg4:string,arg5:string,arg6:number):Promise; + +export function GetRelated(arg1:string,arg2:string,arg3:string,arg4:string,arg5:string,arg6:string,arg7:any):Promise>; + +export function GetRelationshipChain(arg1:string,arg2:string,arg3:string,arg4:string,arg5:string,arg6:string,arg7:number):Promise>; diff --git a/packages/omniviewdev-runtime/src/wailsjs/go/resource/GraphService.js b/packages/omniviewdev-runtime/src/wailsjs/go/resource/GraphService.js new file mode 100755 index 00000000..f0e88a31 --- /dev/null +++ b/packages/omniviewdev-runtime/src/wailsjs/go/resource/GraphService.js @@ -0,0 +1,15 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +export function GetDependencyTree(arg1, arg2, arg3, arg4, arg5, arg6) { + return window['go']['resource']['GraphService']['GetDependencyTree'](arg1, arg2, arg3, arg4, arg5, arg6); +} + +export function GetRelated(arg1, arg2, arg3, arg4, arg5, arg6, arg7) { + return window['go']['resource']['GraphService']['GetRelated'](arg1, arg2, arg3, arg4, arg5, arg6, arg7); +} + +export function GetRelationshipChain(arg1, arg2, arg3, arg4, arg5, arg6, arg7) { + return window['go']['resource']['GraphService']['GetRelationshipChain'](arg1, arg2, arg3, arg4, arg5, arg6, arg7); +}