Files
windmill/frontend/src/lib/common.ts
Ádám Kovács 9bf0f6e70d feat(frontend): Flow graph (#827)
* chore(frontend): Install d3@7.6.1

* feat(frontend): Add basic graph components

* feat: Add graph node component

* feat: Add graph edges

* fix: Rename graph flow module

* feat: Add flow graph to editor

* feat: Add loops

* feat: Add hub scripts to graph

* fix: Display hub scripts

* fix: Nested loops

* feat: Graph displaying packages

* fix: Remove unused parts

* feat: Update graph layout

* fix: Clean up imports

* feat: Add icons to graph nodes

* feat: Add graph viewer to flow details page

* fix: Action row component on scroll behaviour

* fix: Update supported languages type

* fix: Add bash language icons

* fix: Support empty scripts and branches

* fix: Ellipsizing virtual node text

* feat: Display script id in node

* fix: Remove graph from flow editor

* fix: Update node id display

* chore: Remove unused packages

* flow viewer

Co-authored-by: Ruben Fiszel <ruben@rubenfiszel.com>
2022-11-12 20:14:29 +01:00

49 lines
1.1 KiB
TypeScript

export type OwnerKind = 'group' | 'user'
export type ActionKind = 'Create' | 'Update' | 'Delete' | 'Execute'
export type SupportedLanguage = 'deno' | 'python3' | 'go' | 'bash'
export interface SchemaProperty {
type: string | undefined
description: string
pattern?: string
default?: any
enum?: string[]
contentEncoding?: 'base64' | 'binary'
format?: string
items?: { type?: 'string' | 'number' | 'bytes'; contentEncoding?: 'base64' }
properties?: { [name: string]: SchemaProperty }
}
export type Schema = {
$schema: string
type: string
properties: { [name: string]: SchemaProperty }
required: string[]
}
export type Meta = { ownerKind: OwnerKind; owner: string; name: string }
export function pathToMeta(path: string): Meta {
const splitted = path.split('/')
let ownerKind: OwnerKind
if (splitted[0] == 'g') {
ownerKind = 'group'
} else if (splitted[0] == 'u') {
ownerKind = 'user'
} else {
console.error('Not recognized owner:' + splitted[0])
return {
ownerKind: 'user',
owner: '',
name: ''
}
}
return {
ownerKind,
owner: splitted[1],
name: splitted.slice(2).join('/')
}
}