@operato/process 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.storybook/main.js +3 -0
- package/.storybook/server.mjs +8 -0
- package/CHANGELOG.md +1824 -0
- package/LICENSE +21 -0
- package/README.md +95 -0
- package/demo/index-modeller.html +101 -0
- package/demo/index-viewer.html +101 -0
- package/demo/index.html +101 -0
- package/dist/src/data-storage/data-storage.d.ts +8 -0
- package/dist/src/data-storage/data-storage.js +28 -0
- package/dist/src/data-storage/data-storage.js.map +1 -0
- package/dist/src/graphql/data-subscription.d.ts +5 -0
- package/dist/src/graphql/data-subscription.js +24 -0
- package/dist/src/graphql/data-subscription.js.map +1 -0
- package/dist/src/graphql/favorite-process.d.ts +1 -0
- package/dist/src/graphql/favorite-process.js +23 -0
- package/dist/src/graphql/favorite-process.js.map +1 -0
- package/dist/src/graphql/index.d.ts +3 -0
- package/dist/src/graphql/index.js +4 -0
- package/dist/src/graphql/index.js.map +1 -0
- package/dist/src/graphql/process-group.d.ts +7 -0
- package/dist/src/graphql/process-group.js +125 -0
- package/dist/src/graphql/process-group.js.map +1 -0
- package/dist/src/graphql/process.d.ts +6 -0
- package/dist/src/graphql/process.js +130 -0
- package/dist/src/graphql/process.js.map +1 -0
- package/dist/src/graphql/scenario.d.ts +6 -0
- package/dist/src/graphql/scenario.js +69 -0
- package/dist/src/graphql/scenario.js.map +1 -0
- package/dist/src/index.d.ts +5 -0
- package/dist/src/index.js +6 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/modeller/component-toolbar/component-detail.d.ts +12 -0
- package/dist/src/modeller/component-toolbar/component-detail.js +58 -0
- package/dist/src/modeller/component-toolbar/component-detail.js.map +1 -0
- package/dist/src/modeller/component-toolbar/component-menu.d.ts +24 -0
- package/dist/src/modeller/component-toolbar/component-menu.js +190 -0
- package/dist/src/modeller/component-toolbar/component-menu.js.map +1 -0
- package/dist/src/modeller/component-toolbar/component-toolbar.d.ts +28 -0
- package/dist/src/modeller/component-toolbar/component-toolbar.js +168 -0
- package/dist/src/modeller/component-toolbar/component-toolbar.js.map +1 -0
- package/dist/src/modeller/component-toolbar/mode-icons.d.ts +2 -0
- package/dist/src/modeller/component-toolbar/mode-icons.js +86 -0
- package/dist/src/modeller/component-toolbar/mode-icons.js.map +1 -0
- package/dist/src/modeller/edit-toolbar-style.d.ts +4 -0
- package/dist/src/modeller/edit-toolbar-style.js +227 -0
- package/dist/src/modeller/edit-toolbar-style.js.map +1 -0
- package/dist/src/modeller/edit-toolbar.d.ts +61 -0
- package/dist/src/modeller/edit-toolbar.js +641 -0
- package/dist/src/modeller/edit-toolbar.js.map +1 -0
- package/dist/src/modeller/property-sidebar/abstract-property.d.ts +10 -0
- package/dist/src/modeller/property-sidebar/abstract-property.js +55 -0
- package/dist/src/modeller/property-sidebar/abstract-property.js.map +1 -0
- package/dist/src/modeller/property-sidebar/effects/effects-shared-style.d.ts +4 -0
- package/dist/src/modeller/property-sidebar/effects/effects-shared-style.js +61 -0
- package/dist/src/modeller/property-sidebar/effects/effects-shared-style.js.map +1 -0
- package/dist/src/modeller/property-sidebar/effects/effects.d.ts +20 -0
- package/dist/src/modeller/property-sidebar/effects/effects.js +42 -0
- package/dist/src/modeller/property-sidebar/effects/effects.js.map +1 -0
- package/dist/src/modeller/property-sidebar/effects/property-shadow.d.ts +23 -0
- package/dist/src/modeller/property-sidebar/effects/property-shadow.js +103 -0
- package/dist/src/modeller/property-sidebar/effects/property-shadow.js.map +1 -0
- package/dist/src/modeller/property-sidebar/effects/value-converter.d.ts +1 -0
- package/dist/src/modeller/property-sidebar/effects/value-converter.js +21 -0
- package/dist/src/modeller/property-sidebar/effects/value-converter.js.map +1 -0
- package/dist/src/modeller/property-sidebar/inspector/inspector.d.ts +29 -0
- package/dist/src/modeller/property-sidebar/inspector/inspector.js +318 -0
- package/dist/src/modeller/property-sidebar/inspector/inspector.js.map +1 -0
- package/dist/src/modeller/property-sidebar/property-shared-style.d.ts +4 -0
- package/dist/src/modeller/property-sidebar/property-shared-style.js +135 -0
- package/dist/src/modeller/property-sidebar/property-shared-style.js.map +1 -0
- package/dist/src/modeller/property-sidebar/property-sidebar.d.ts +43 -0
- package/dist/src/modeller/property-sidebar/property-sidebar.js +309 -0
- package/dist/src/modeller/property-sidebar/property-sidebar.js.map +1 -0
- package/dist/src/modeller/property-sidebar/shapes/box-padding-editor-styles.d.ts +1 -0
- package/dist/src/modeller/property-sidebar/shapes/box-padding-editor-styles.js +94 -0
- package/dist/src/modeller/property-sidebar/shapes/box-padding-editor-styles.js.map +1 -0
- package/dist/src/modeller/property-sidebar/shapes/shapes.d.ts +28 -0
- package/dist/src/modeller/property-sidebar/shapes/shapes.js +321 -0
- package/dist/src/modeller/property-sidebar/shapes/shapes.js.map +1 -0
- package/dist/src/modeller/property-sidebar/specifics/specific-properties-builder.d.ts +16 -0
- package/dist/src/modeller/property-sidebar/specifics/specific-properties-builder.js +132 -0
- package/dist/src/modeller/property-sidebar/specifics/specific-properties-builder.js.map +1 -0
- package/dist/src/modeller/property-sidebar/specifics/specifics.d.ts +25 -0
- package/dist/src/modeller/property-sidebar/specifics/specifics.js +81 -0
- package/dist/src/modeller/property-sidebar/specifics/specifics.js.map +1 -0
- package/dist/src/modeller/property-sidebar/styles/styles.d.ts +21 -0
- package/dist/src/modeller/property-sidebar/styles/styles.js +559 -0
- package/dist/src/modeller/property-sidebar/styles/styles.js.map +1 -0
- package/dist/src/modeller/scene-viewer/scene-handler.d.ts +11 -0
- package/dist/src/modeller/scene-viewer/scene-handler.js +32 -0
- package/dist/src/modeller/scene-viewer/scene-handler.js.map +1 -0
- package/dist/src/modeller/scene-viewer/scene-layer.d.ts +10 -0
- package/dist/src/modeller/scene-viewer/scene-layer.js +38 -0
- package/dist/src/modeller/scene-viewer/scene-layer.js.map +1 -0
- package/dist/src/modeller/scene-viewer/scene-property.d.ts +6 -0
- package/dist/src/modeller/scene-viewer/scene-property.js +15 -0
- package/dist/src/modeller/scene-viewer/scene-property.js.map +1 -0
- package/dist/src/modeller/scene-viewer/scene-viewer.d.ts +38 -0
- package/dist/src/modeller/scene-viewer/scene-viewer.js +243 -0
- package/dist/src/modeller/scene-viewer/scene-viewer.js.map +1 -0
- package/dist/src/ox-process-list.d.ts +2 -0
- package/dist/src/ox-process-list.js +427 -0
- package/dist/src/ox-process-list.js.map +1 -0
- package/dist/src/ox-process-modeller.d.ts +58 -0
- package/dist/src/ox-process-modeller.js +396 -0
- package/dist/src/ox-process-modeller.js.map +1 -0
- package/dist/src/ox-process-viewer.d.ts +51 -0
- package/dist/src/ox-process-viewer.js +512 -0
- package/dist/src/ox-process-viewer.js.map +1 -0
- package/dist/src/types.d.ts +37 -0
- package/dist/src/types.js +2 -0
- package/dist/src/types.js.map +1 -0
- package/dist/stories/index.stories.d.ts +33 -0
- package/dist/stories/index.stories.js +33 -0
- package/dist/stories/index.stories.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/icons/components/audio.png +0 -0
- package/icons/components/both-arrow.png +0 -0
- package/icons/components/color-image.png +0 -0
- package/icons/components/container.png +0 -0
- package/icons/components/dash.png +0 -0
- package/icons/components/donut.png +0 -0
- package/icons/components/ellipse.png +0 -0
- package/icons/components/forklift.png +0 -0
- package/icons/components/gif-image.png +0 -0
- package/icons/components/global-reference.png +0 -0
- package/icons/components/gray-image.png +0 -0
- package/icons/components/humidity-sensor.png +0 -0
- package/icons/components/info-window.png +0 -0
- package/icons/components/line.png +0 -0
- package/icons/components/local-reference.png +0 -0
- package/icons/components/no-image.png +0 -0
- package/icons/components/ortholine.png +0 -0
- package/icons/components/person.png +0 -0
- package/icons/components/polygon.png +0 -0
- package/icons/components/polyline.png +0 -0
- package/icons/components/popup.png +0 -0
- package/icons/components/rect.png +0 -0
- package/icons/components/single-arrow.png +0 -0
- package/icons/components/star.png +0 -0
- package/icons/components/streamline.png +0 -0
- package/icons/components/text.png +0 -0
- package/icons/components/triangle.png +0 -0
- package/icons/icon-collapse-active.png +0 -0
- package/icons/icon-collapse.png +0 -0
- package/icons/icon-fullscreen.png +0 -0
- package/icons/icon-htoolbar.png +0 -0
- package/icons/icon-properties-arrow-type.png +0 -0
- package/icons/icon-properties-gradient-direction.png +0 -0
- package/icons/icon-properties-label.png +0 -0
- package/icons/icon-properties-line-type.png +0 -0
- package/icons/icon-properties-padding.png +0 -0
- package/icons/icon-properties-ratio.png +0 -0
- package/icons/icon-properties-table.png +0 -0
- package/icons/icon-properties.png +0 -0
- package/icons/icon-shell-inspector.png +0 -0
- package/package.json +115 -0
- package/src/data-storage/data-storage.ts +47 -0
- package/src/graphql/data-subscription.ts +30 -0
- package/src/graphql/favorite-process.ts +25 -0
- package/src/graphql/index.ts +3 -0
- package/src/graphql/process-group.ts +138 -0
- package/src/graphql/process.ts +144 -0
- package/src/graphql/scenario.ts +79 -0
- package/src/index.ts +7 -0
- package/src/modeller/component-toolbar/component-detail.ts +58 -0
- package/src/modeller/component-toolbar/component-menu.ts +187 -0
- package/src/modeller/component-toolbar/component-toolbar.ts +173 -0
- package/src/modeller/component-toolbar/mode-icons.ts +86 -0
- package/src/modeller/edit-toolbar-style.ts +228 -0
- package/src/modeller/edit-toolbar.ts +641 -0
- package/src/modeller/property-sidebar/abstract-property.ts +69 -0
- package/src/modeller/property-sidebar/effects/effects-shared-style.ts +62 -0
- package/src/modeller/property-sidebar/effects/effects.ts +47 -0
- package/src/modeller/property-sidebar/effects/property-shadow.ts +114 -0
- package/src/modeller/property-sidebar/effects/value-converter.ts +23 -0
- package/src/modeller/property-sidebar/inspector/inspector.ts +361 -0
- package/src/modeller/property-sidebar/property-shared-style.ts +136 -0
- package/src/modeller/property-sidebar/property-sidebar.ts +308 -0
- package/src/modeller/property-sidebar/shapes/box-padding-editor-styles.ts +94 -0
- package/src/modeller/property-sidebar/shapes/shapes.ts +326 -0
- package/src/modeller/property-sidebar/specifics/specific-properties-builder.ts +144 -0
- package/src/modeller/property-sidebar/specifics/specifics.ts +77 -0
- package/src/modeller/property-sidebar/styles/styles.ts +577 -0
- package/src/modeller/scene-viewer/scene-handler.ts +39 -0
- package/src/modeller/scene-viewer/scene-layer.ts +41 -0
- package/src/modeller/scene-viewer/scene-property.ts +9 -0
- package/src/modeller/scene-viewer/scene-viewer.ts +249 -0
- package/src/ox-process-list.ts +459 -0
- package/src/ox-process-modeller.ts +396 -0
- package/src/ox-process-viewer.ts +555 -0
- package/src/types.ts +68 -0
- package/stories/index.stories.ts +52 -0
- package/tsconfig.json +23 -0
- package/web-dev-server.config.mjs +30 -0
- package/web-test-runner.config.mjs +29 -0
package/package.json
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@operato/process",
|
|
3
|
+
"version": "1.1.1",
|
|
4
|
+
"description": "Webcomponent for business process modeling following open-wc recommendations",
|
|
5
|
+
"author": "heartyoh",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"main": "dist/src/index.js",
|
|
8
|
+
"module": "dist/src/index.js",
|
|
9
|
+
"publishConfig": {
|
|
10
|
+
"access": "public",
|
|
11
|
+
"@ioperato:registry": "https://registry.npmjs.org"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/heartyoh/ioperato.git",
|
|
16
|
+
"directory": "packages/process"
|
|
17
|
+
},
|
|
18
|
+
"exports": {
|
|
19
|
+
".": "./dist/src/index.js",
|
|
20
|
+
"./ox-process-list.js": "./dist/src/ox-process-list.js",
|
|
21
|
+
"./ox-process-viewer.js": "./dist/src/ox-process-viewer.js",
|
|
22
|
+
"./ox-process-modeller.js": "./dist/src/ox-process-modeller.js",
|
|
23
|
+
"./register-default-groups.js": "./dist/src/component/register-default-groups.js"
|
|
24
|
+
},
|
|
25
|
+
"typesVersions": {
|
|
26
|
+
"*": {
|
|
27
|
+
"ox-process-list.js": [
|
|
28
|
+
"./dist/src/ox-process-list.d.ts"
|
|
29
|
+
],
|
|
30
|
+
"ox-process-viewer.js": [
|
|
31
|
+
"./dist/src/ox-process-viewer.d.ts"
|
|
32
|
+
],
|
|
33
|
+
"ox-process-modeller.js": [
|
|
34
|
+
"./dist/src/ox-process-modeller.d.ts"
|
|
35
|
+
],
|
|
36
|
+
"register-default-groups.js": [
|
|
37
|
+
"./dist/src/register-default-groups.d.ts"
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"analyze": "cem analyze --litelement",
|
|
43
|
+
"start": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds\"",
|
|
44
|
+
"build": "tsc && npm run analyze -- --exclude dist",
|
|
45
|
+
"prepublish": "tsc && npm run analyze -- --exclude dist",
|
|
46
|
+
"lint": "eslint --ext .ts,.html . --ignore-path .gitignore && prettier \"**/*.ts\" --check --ignore-path .gitignore",
|
|
47
|
+
"format": "eslint --ext .ts,.html . --fix --ignore-path .gitignore && prettier \"**/*.ts\" --write --ignore-path .gitignore",
|
|
48
|
+
"test": "tsc && wtr --coverage",
|
|
49
|
+
"test:watch": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wtr --watch\"",
|
|
50
|
+
"storybook": "tsc && npm run analyze -- --exclude dist && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds -c .storybook/server.mjs\"",
|
|
51
|
+
"storybook:build": "tsc && npm run analyze -- --exclude dist && build-storybook"
|
|
52
|
+
},
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"@open-wc/scoped-elements": "^2.1.3",
|
|
55
|
+
"@operato/app": "^1.1.1",
|
|
56
|
+
"@operato/data-grist": "^1.1.1",
|
|
57
|
+
"@operato/font": "^1.1.1",
|
|
58
|
+
"@operato/graphql": "^1.1.1",
|
|
59
|
+
"@operato/i18n": "^1.1.1",
|
|
60
|
+
"@operato/input": "^1.1.1",
|
|
61
|
+
"@operato/markdown": "^1.1.1",
|
|
62
|
+
"@operato/popup": "^1.1.1",
|
|
63
|
+
"@operato/property-editor": "^1.1.1",
|
|
64
|
+
"@operato/styles": "^1.1.1",
|
|
65
|
+
"@operato/utils": "^1.1.1",
|
|
66
|
+
"@polymer/paper-dropdown-menu": "^3.2.0",
|
|
67
|
+
"@types/file-saver": "^2.0.4",
|
|
68
|
+
"@types/sortablejs": "^1.10.7",
|
|
69
|
+
"dexie": "^3.2.2",
|
|
70
|
+
"file-saver": "^2.0.5",
|
|
71
|
+
"lit": "^2.4.0",
|
|
72
|
+
"lodash-es": "^4.17.21",
|
|
73
|
+
"sortablejs": "^1.14.0"
|
|
74
|
+
},
|
|
75
|
+
"devDependencies": {
|
|
76
|
+
"@custom-elements-manifest/analyzer": "^0.4.17",
|
|
77
|
+
"@hatiolab/prettier-config": "^1.0.0",
|
|
78
|
+
"@hatiolab/things-scene": "^3.0.22",
|
|
79
|
+
"@material/mwc-fab": "^0.27.0",
|
|
80
|
+
"@material/mwc-icon": "^0.27.0",
|
|
81
|
+
"@open-wc/eslint-config": "^4.3.0",
|
|
82
|
+
"@open-wc/testing": "^3.0.4",
|
|
83
|
+
"@rollup/plugin-image": "^2.1.1",
|
|
84
|
+
"@rollup/plugin-json": "^4.1.0",
|
|
85
|
+
"@types/lodash-es": "^4.17.6",
|
|
86
|
+
"@types/w3c-web-usb": "^1.0.5",
|
|
87
|
+
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
88
|
+
"@typescript-eslint/parser": "^4.33.0",
|
|
89
|
+
"@web/dev-server": "^0.1.29",
|
|
90
|
+
"@web/dev-server-storybook": "^0.5.0",
|
|
91
|
+
"@web/test-runner": "next",
|
|
92
|
+
"concurrently": "^5.3.0",
|
|
93
|
+
"eslint": "^7.32.0",
|
|
94
|
+
"eslint-config-prettier": "^8.3.0",
|
|
95
|
+
"husky": "^7.0.2",
|
|
96
|
+
"lint-staged": "^10.5.4",
|
|
97
|
+
"prettier": "^2.4.1",
|
|
98
|
+
"tslib": "^2.3.1",
|
|
99
|
+
"typescript": "^4.8.4"
|
|
100
|
+
},
|
|
101
|
+
"customElements": "custom-elements.json",
|
|
102
|
+
"prettier": "@hatiolab/prettier-config",
|
|
103
|
+
"husky": {
|
|
104
|
+
"hooks": {
|
|
105
|
+
"pre-commit": "lint-staged"
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"lint-staged": {
|
|
109
|
+
"*.ts": [
|
|
110
|
+
"eslint --fix",
|
|
111
|
+
"prettier --write"
|
|
112
|
+
]
|
|
113
|
+
},
|
|
114
|
+
"gitHead": "8acd5da56c7d09d5c2ad4e03e8009a6fbf1a4f56"
|
|
115
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import Dexie from 'dexie'
|
|
2
|
+
|
|
3
|
+
import { Component, PersistentDataStorage } from '@hatiolab/things-scene'
|
|
4
|
+
|
|
5
|
+
class ProcessDatabase extends Dexie {
|
|
6
|
+
process_data!: Dexie.Table<IProcessData, number> // number = type of the primkey
|
|
7
|
+
//...other tables goes here...
|
|
8
|
+
|
|
9
|
+
constructor() {
|
|
10
|
+
super('operato-process-database')
|
|
11
|
+
this.version(1).stores({
|
|
12
|
+
process_data: '[process+refid]'
|
|
13
|
+
//...other tables goes here...
|
|
14
|
+
})
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface IProcessData {
|
|
19
|
+
id?: number
|
|
20
|
+
process: string
|
|
21
|
+
refid: string | number
|
|
22
|
+
data: any
|
|
23
|
+
timestamp: number
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const db = new ProcessDatabase()
|
|
27
|
+
|
|
28
|
+
export class DataStorage implements PersistentDataStorage {
|
|
29
|
+
private id: string
|
|
30
|
+
|
|
31
|
+
constructor(id: string) {
|
|
32
|
+
this.id = id
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public async load(key: Component): Promise<any> {
|
|
36
|
+
const saved = await db.process_data.where({ process: this.id, refid: key.state.refid }).first()
|
|
37
|
+
return saved?.data
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
public async save(key: Component, value: any): Promise<void> {
|
|
41
|
+
await db.process_data.put({ process: this.id, refid: key.state.refid, data: value, timestamp: Date.now() })
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public async clear(key: Component): Promise<void> {
|
|
45
|
+
await db.process_data.where({ process: this.id, refid: key.state.refid }).delete()
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Component, DataSubscriptionProvider } from '@hatiolab/things-scene'
|
|
2
|
+
|
|
3
|
+
import gql from 'graphql-tag'
|
|
4
|
+
import { subscribe } from '@operato/graphql'
|
|
5
|
+
|
|
6
|
+
export class DataSubscriptionProviderImpl implements DataSubscriptionProvider {
|
|
7
|
+
async subscribe(tag: string, component: Component) {
|
|
8
|
+
return await subscribe(
|
|
9
|
+
{
|
|
10
|
+
query: gql`
|
|
11
|
+
subscription {
|
|
12
|
+
data(tag: "${tag}") {
|
|
13
|
+
tag
|
|
14
|
+
data
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
`
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
next: async ({ data }: { data: any }) => {
|
|
21
|
+
if (data) {
|
|
22
|
+
component.data = data.data.data
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
dispose() {}
|
|
30
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { buildArgs, client } from '@operato/graphql'
|
|
2
|
+
|
|
3
|
+
import gql from 'graphql-tag'
|
|
4
|
+
|
|
5
|
+
export async function fetchFavoriteProcessList(listParam = {}) {
|
|
6
|
+
const response = await client.query({
|
|
7
|
+
query: gql`
|
|
8
|
+
{
|
|
9
|
+
favoriteProcesses(${buildArgs(listParam)}) {
|
|
10
|
+
items {
|
|
11
|
+
id
|
|
12
|
+
name
|
|
13
|
+
description
|
|
14
|
+
thumbnail
|
|
15
|
+
createdAt
|
|
16
|
+
updatedAt
|
|
17
|
+
}
|
|
18
|
+
total
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
`
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
return response.data
|
|
25
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { ProcessGroup } from '../types'
|
|
2
|
+
import { client } from '@operato/graphql'
|
|
3
|
+
import gql from 'graphql-tag'
|
|
4
|
+
|
|
5
|
+
export async function fetchProcessGroup(id: string) {
|
|
6
|
+
const response = await client.query({
|
|
7
|
+
query: gql`
|
|
8
|
+
query FetchProcessGroupById($id: String!) {
|
|
9
|
+
group(id: $id) {
|
|
10
|
+
id
|
|
11
|
+
name
|
|
12
|
+
description
|
|
13
|
+
createdAt
|
|
14
|
+
creator {
|
|
15
|
+
id
|
|
16
|
+
name
|
|
17
|
+
}
|
|
18
|
+
updatedAt
|
|
19
|
+
updater {
|
|
20
|
+
id
|
|
21
|
+
name
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
`,
|
|
26
|
+
variables: { id }
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
return response.data
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export async function updateProcessGroup(group: ProcessGroup) {
|
|
33
|
+
var { id, name, description } = group
|
|
34
|
+
|
|
35
|
+
const response = await client.mutate({
|
|
36
|
+
mutation: gql`
|
|
37
|
+
mutation UpdateProcessGroup($id: String!, $patch: ProcessGroupPatch!) {
|
|
38
|
+
updateProcessGroup(id: $id, patch: $patch) {
|
|
39
|
+
id
|
|
40
|
+
name
|
|
41
|
+
description
|
|
42
|
+
createdAt
|
|
43
|
+
updatedAt
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
`,
|
|
47
|
+
variables: {
|
|
48
|
+
id,
|
|
49
|
+
patch: { name, description }
|
|
50
|
+
}
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
return response.data
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export async function deleteProcessGroup(id: string) {
|
|
57
|
+
const response = await client.mutate({
|
|
58
|
+
mutation: gql`
|
|
59
|
+
mutation ($id: String!) {
|
|
60
|
+
deleteProcessGroup(id: $id)
|
|
61
|
+
}
|
|
62
|
+
`,
|
|
63
|
+
variables: {
|
|
64
|
+
id
|
|
65
|
+
}
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
return response.data
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export async function fetchProcessGroupList() {
|
|
72
|
+
const response = await client.query({
|
|
73
|
+
query: gql`
|
|
74
|
+
{
|
|
75
|
+
processGroups {
|
|
76
|
+
items {
|
|
77
|
+
id
|
|
78
|
+
name
|
|
79
|
+
description
|
|
80
|
+
createdAt
|
|
81
|
+
updatedAt
|
|
82
|
+
}
|
|
83
|
+
total
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
`
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
return response.data
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export async function createProcessGroup(group: ProcessGroup) {
|
|
93
|
+
const response = await client.mutate({
|
|
94
|
+
mutation: gql`
|
|
95
|
+
mutation CreateProcessGroup($group: NewProcessGroup!) {
|
|
96
|
+
createProcessGroup(group: $group) {
|
|
97
|
+
id
|
|
98
|
+
name
|
|
99
|
+
description
|
|
100
|
+
createdAt
|
|
101
|
+
updatedAt
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
`,
|
|
105
|
+
variables: { group }
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
return response.data
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export async function joinProcessGroup(processId: string, groupId: string) {
|
|
112
|
+
const response = await client.mutate({
|
|
113
|
+
mutation: gql`
|
|
114
|
+
mutation JoinProcessGroup($id: String!, $processIds: [String!]!) {
|
|
115
|
+
joinProcessGroup(id: $id, processIds: $processIds) {
|
|
116
|
+
id
|
|
117
|
+
name
|
|
118
|
+
description
|
|
119
|
+
processes {
|
|
120
|
+
id
|
|
121
|
+
name
|
|
122
|
+
description
|
|
123
|
+
createdAt
|
|
124
|
+
updatedAt
|
|
125
|
+
}
|
|
126
|
+
createdAt
|
|
127
|
+
updatedAt
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
`,
|
|
131
|
+
variables: {
|
|
132
|
+
id: groupId,
|
|
133
|
+
processIds: [processId]
|
|
134
|
+
}
|
|
135
|
+
})
|
|
136
|
+
|
|
137
|
+
return response.data
|
|
138
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { buildArgs, client } from '@operato/graphql'
|
|
2
|
+
|
|
3
|
+
import { Process } from '../types'
|
|
4
|
+
import gql from 'graphql-tag'
|
|
5
|
+
|
|
6
|
+
export async function fetchProcessList(listParam = {}) {
|
|
7
|
+
const response = await client.query({
|
|
8
|
+
query: gql`
|
|
9
|
+
{
|
|
10
|
+
processes(${buildArgs(listParam)}) {
|
|
11
|
+
items {
|
|
12
|
+
id
|
|
13
|
+
name
|
|
14
|
+
description
|
|
15
|
+
thumbnail
|
|
16
|
+
createdAt
|
|
17
|
+
updatedAt
|
|
18
|
+
}
|
|
19
|
+
total
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
`
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
return response.data
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export async function fetchProcess(id: string) {
|
|
29
|
+
const response = await client.query({
|
|
30
|
+
query: gql`
|
|
31
|
+
query FetchProcessById($id: String!) {
|
|
32
|
+
process(id: $id) {
|
|
33
|
+
id
|
|
34
|
+
name
|
|
35
|
+
description
|
|
36
|
+
group {
|
|
37
|
+
id
|
|
38
|
+
name
|
|
39
|
+
}
|
|
40
|
+
thumbnail
|
|
41
|
+
model
|
|
42
|
+
createdAt
|
|
43
|
+
creator {
|
|
44
|
+
id
|
|
45
|
+
name
|
|
46
|
+
}
|
|
47
|
+
updatedAt
|
|
48
|
+
updater {
|
|
49
|
+
id
|
|
50
|
+
name
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
`,
|
|
55
|
+
variables: { id }
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
return response.data
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export async function createProcess(process: Process) {
|
|
62
|
+
/*
|
|
63
|
+
input NewProcess {
|
|
64
|
+
name : String!
|
|
65
|
+
description : String
|
|
66
|
+
model : String!
|
|
67
|
+
groupId : String!
|
|
68
|
+
}
|
|
69
|
+
*/
|
|
70
|
+
|
|
71
|
+
process.model = JSON.stringify(process.model)
|
|
72
|
+
|
|
73
|
+
const response = await client.mutate({
|
|
74
|
+
mutation: gql`
|
|
75
|
+
mutation CreateProcess($process: NewProcess!) {
|
|
76
|
+
createProcess(process: $process) {
|
|
77
|
+
id
|
|
78
|
+
name
|
|
79
|
+
description
|
|
80
|
+
model
|
|
81
|
+
createdAt
|
|
82
|
+
updatedAt
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
`,
|
|
86
|
+
variables: {
|
|
87
|
+
process
|
|
88
|
+
}
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
return response.data
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export async function updateProcess(process: Process) {
|
|
95
|
+
/*
|
|
96
|
+
input ProcessPatch {
|
|
97
|
+
name : String
|
|
98
|
+
description : String
|
|
99
|
+
model : String
|
|
100
|
+
}
|
|
101
|
+
*/
|
|
102
|
+
var { id, name, description, model, groupId } = process
|
|
103
|
+
model = JSON.stringify(model)
|
|
104
|
+
|
|
105
|
+
const response = await client.mutate({
|
|
106
|
+
mutation: gql`
|
|
107
|
+
mutation UpdateProcess($id: String!, $patch: ProcessPatch!) {
|
|
108
|
+
updateProcess(id: $id, patch: $patch) {
|
|
109
|
+
id
|
|
110
|
+
name
|
|
111
|
+
description
|
|
112
|
+
model
|
|
113
|
+
group {
|
|
114
|
+
id
|
|
115
|
+
name
|
|
116
|
+
}
|
|
117
|
+
createdAt
|
|
118
|
+
updatedAt
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
`,
|
|
122
|
+
variables: {
|
|
123
|
+
id,
|
|
124
|
+
patch: { name, description, model, groupId }
|
|
125
|
+
}
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
return response.data
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export async function deleteProcess(id: string) {
|
|
132
|
+
const response = await client.mutate({
|
|
133
|
+
mutation: gql`
|
|
134
|
+
mutation ($id: String!) {
|
|
135
|
+
deleteProcess(id: $id)
|
|
136
|
+
}
|
|
137
|
+
`,
|
|
138
|
+
variables: {
|
|
139
|
+
id
|
|
140
|
+
}
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
return response.data
|
|
144
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import gql from 'graphql-tag'
|
|
2
|
+
|
|
3
|
+
import { client } from '@operato/graphql'
|
|
4
|
+
|
|
5
|
+
export const scenarios = async (): Promise<{ name: string; description: string }[]> => {
|
|
6
|
+
var response = await client.query({
|
|
7
|
+
query: gql`
|
|
8
|
+
query {
|
|
9
|
+
scenarios {
|
|
10
|
+
items {
|
|
11
|
+
name
|
|
12
|
+
description
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
`
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
if (response.errors) {
|
|
20
|
+
return []
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return response.data.scenarios.items
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const startScenario = async (
|
|
27
|
+
scenarioName: string,
|
|
28
|
+
instanceName: string,
|
|
29
|
+
variables: string | number | object
|
|
30
|
+
) => {
|
|
31
|
+
if (!scenarioName) {
|
|
32
|
+
return
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (client) {
|
|
36
|
+
var response = await client.query({
|
|
37
|
+
query: gql`
|
|
38
|
+
mutation ($instanceName: String, $scenarioName: String!, $variables: Object) {
|
|
39
|
+
startScenario(instanceName: $instanceName, scenarioName: $scenarioName, variables: $variables) {
|
|
40
|
+
state
|
|
41
|
+
message
|
|
42
|
+
data
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
`,
|
|
46
|
+
variables: {
|
|
47
|
+
instanceName: instanceName,
|
|
48
|
+
scenarioName: scenarioName,
|
|
49
|
+
variables
|
|
50
|
+
}
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
return response?.data?.startScenario?.data
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export const runScenario = async (scenarioName: string, variables: string | number | object) => {
|
|
58
|
+
if (!scenarioName) return
|
|
59
|
+
|
|
60
|
+
if (client) {
|
|
61
|
+
var response = await client.query({
|
|
62
|
+
query: gql`
|
|
63
|
+
mutation ($scenarioName: String!, $variables: Object) {
|
|
64
|
+
runScenario(scenarioName: $scenarioName, variables: $variables) {
|
|
65
|
+
state
|
|
66
|
+
message
|
|
67
|
+
data
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
`,
|
|
71
|
+
variables: {
|
|
72
|
+
scenarioName: scenarioName,
|
|
73
|
+
variables
|
|
74
|
+
}
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
return response?.data?.runScenario?.data
|
|
78
|
+
}
|
|
79
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import '@operato/markdown'
|
|
6
|
+
|
|
7
|
+
import { css, html, LitElement } from 'lit'
|
|
8
|
+
import { property } from 'lit/decorators.js'
|
|
9
|
+
|
|
10
|
+
import { ScrollbarStyles } from '@operato/styles'
|
|
11
|
+
|
|
12
|
+
export class ComponentDetail extends LitElement {
|
|
13
|
+
static styles = [
|
|
14
|
+
ScrollbarStyles,
|
|
15
|
+
css`
|
|
16
|
+
:host {
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
align-content: stretch;
|
|
20
|
+
|
|
21
|
+
background-color: var(--component-detail-background-color, white);
|
|
22
|
+
margin: 0px;
|
|
23
|
+
padding: 0px;
|
|
24
|
+
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
|
|
27
|
+
border: 2px solid var(--component-detail-border-color, gray);
|
|
28
|
+
box-sizing: border-box;
|
|
29
|
+
|
|
30
|
+
top: 0px;
|
|
31
|
+
|
|
32
|
+
z-index: 1;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
ox-markdown,
|
|
36
|
+
iframe {
|
|
37
|
+
flex: 1;
|
|
38
|
+
padding: 10px;
|
|
39
|
+
overflow: auto;
|
|
40
|
+
}
|
|
41
|
+
`
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
@property({ type: Object }) template: { about: string } | null = null
|
|
45
|
+
|
|
46
|
+
render() {
|
|
47
|
+
const { about } = this.template || {}
|
|
48
|
+
|
|
49
|
+
if (about) {
|
|
50
|
+
var aboutURL = new URL(about, location.origin)
|
|
51
|
+
if (aboutURL.origin !== location.origin) {
|
|
52
|
+
return html`<iframe src=${about}></iframe>`
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return html` <ox-markdown .src=${about}></ox-markdown> `
|
|
57
|
+
}
|
|
58
|
+
}
|