From 4eec588169226ed8e5190262c8ca7a68df1bd982 Mon Sep 17 00:00:00 2001 From: Peter Heinemann Date: Thu, 9 May 2024 11:09:35 +0200 Subject: [PATCH] fix(modeler/jsonforms): fix bugs (#589) * fix(modeler): flatten element templates if given in an array and change default location to .camunda/element-templates * feat(modeler): ask for execution platform if a new diagram is created * fix(modeler/jsonforms): commands --- apps/miranum-extension-pack/CHANGELOG.md | 15 +- .../src/App.vue | 66 +- apps/miranum-jsonforms/CHANGELOG.md | 9 +- apps/miranum-jsonforms/package.json | 24 +- .../src/adapter/helper/vscode/editor.ts | 2 +- .../src/adapter/in/commands.ts | 8 +- .../src/adapter/in/editor.ts | 243 +- .../src/adapter/out/editor.ts | 117 +- .../src/adapter/out/window.ts | 5 - .../src/adapter/out/workspace.ts | 3 - .../src/application/ports/in.ts | 2 +- .../src/application/ports/out.ts | 7 +- .../src/application/useCases/editor.ts | 130 +- .../src/application/useCases/queries.ts | 12 +- .../src/application/useCases/workspace.ts | 46 +- apps/miranum-jsonforms/src/main.config.ts | 88 +- apps/miranum-jsonforms/src/main.ts | 4 +- .../src/app/modeler.ts | 10 +- apps/miranum-modeler-bpmn-webview/src/main.ts | 7 +- apps/miranum-modeler/CHANGELOG.md | 14 +- apps/miranum-modeler/package.json | 2 +- .../miranum-modeler/src/adapter/out/editor.ts | 25 +- .../src/adapter/out/quickPick.ts | 8 +- .../miranum-modeler/src/adapter/out/window.ts | 4 - .../src/adapter/out/workspace.ts | 4 - .../src/application/ports/out.ts | 7 +- .../src/application/useCases/displayEditor.ts | 56 +- .../src/application/useCases/miranumConfig.ts | 2 +- apps/miranum-modeler/src/main.config.ts | 123 +- .../src/lib/miranum-modeler.ts | 2 +- libs/vscode/miranum-vscode/src/lib/window.ts | 1 + package-lock.json | 2920 ++++++----------- package.json | 10 +- .../element-templates/c7-example.json | 0 .../element-templates/c7-mail-task-1.json | 0 .../element-templates/c7-mail-task-2.json | 0 .../element-templates/c8-example.json | 0 .../element-templates/c8-test.json | 0 resources/example-process/README.md | 7 - resources/example-process/camunda8-test.bpmn | 29 +- resources/example-process/forms/fTest.form | 20 - .../example-process/forms/ksof.form.json | 33 + .../forms/start-form-usertask.form | 68 - .../example-process/forms/user-task.form | 132 - resources/example-process/miranum.json | 25 - resources/example-process/test.dmn | 20 - 46 files changed, 1725 insertions(+), 2585 deletions(-) rename resources/example-process/{ => .camunda}/element-templates/c7-example.json (100%) rename resources/example-process/{ => .camunda}/element-templates/c7-mail-task-1.json (100%) rename resources/example-process/{ => .camunda}/element-templates/c7-mail-task-2.json (100%) rename resources/example-process/{ => .camunda}/element-templates/c8-example.json (100%) rename resources/example-process/{ => .camunda}/element-templates/c8-test.json (100%) delete mode 100644 resources/example-process/README.md delete mode 100644 resources/example-process/forms/fTest.form create mode 100644 resources/example-process/forms/ksof.form.json delete mode 100644 resources/example-process/forms/start-form-usertask.form delete mode 100644 resources/example-process/forms/user-task.form delete mode 100644 resources/example-process/miranum.json delete mode 100644 resources/example-process/test.dmn diff --git a/apps/miranum-extension-pack/CHANGELOG.md b/apps/miranum-extension-pack/CHANGELOG.md index 6ad48ec9..65dae8fa 100644 --- a/apps/miranum-extension-pack/CHANGELOG.md +++ b/apps/miranum-extension-pack/CHANGELOG.md @@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.5.11] - 2024-05-09 + +### Added + +* **\[Miranum Modeler\]** Ask for the execution platform when a new diagram is created (#589) + +### Fixed + +* **\[Miranum Modeler\]** Flatten the element templates if given in an array (#589) +* **\[Miranum Modeler\]** Minor bug fixes (#589) +* **\[Miranum Jsonforms\]** Minor bug fixes (#589) + ## [0.5.10] - 2024-04-30 ### Fixed @@ -101,7 +113,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * **\[Miranum Console\]** Use a single webview when the user triggers the available commands (#125) -[unreleased]: https://github.com/Miragon/miranum-ide/compare/release/v0.5.10-vscode...HEAD +[unreleased]: https://github.com/Miragon/miranum-ide/compare/release/v0.5.11-vscode...HEAD +[0.5.11]: https://github.com/Miragon/miranum-ide/compare/release/v0.5.10...release/v0.5.11-vscode [0.5.10]: https://github.com/Miragon/miranum-ide/compare/release/v0.5.9...release/v0.5.10-vscode [0.5.9]: https://github.com/Miragon/miranum-ide/compare/release/v0.5.8...release/v0.5.9-vscode [0.5.8]: https://github.com/Miragon/miranum-ide/compare/release/v0.5.7...release/v0.5.8-vscode diff --git a/apps/miranum-jsonforms-preview-webview/src/App.vue b/apps/miranum-jsonforms-preview-webview/src/App.vue index 196e2835..443b0ea3 100644 --- a/apps/miranum-jsonforms-preview-webview/src/App.vue +++ b/apps/miranum-jsonforms-preview-webview/src/App.vue @@ -18,6 +18,7 @@ import { Command, createResolver, GetJsonFormCommand, + GetSettingCommand, JsonFormQuery, LogErrorCommand, Query, @@ -29,7 +30,7 @@ import { minimalSchema, minimalUiSchema, personSchema, personUiSchema } from "./ let defaultSchema: JsonSchema = minimalSchema; let defaultUiSchema: UISchemaElement = minimalUiSchema; -let defaultRenderer: JsonFormsRendererRegistryEntry[] = []; +let defaultRenderer: JsonFormsRendererRegistryEntry[] = [...vuetifyRenderers]; if (import.meta.env.MODE === "development") { defaultSchema = personSchema; @@ -40,11 +41,13 @@ if (import.meta.env.MODE === "development") { const vscode = getVsCodeApi(); const jsonFormResolver = createResolver(); +const settingResolver = createResolver(); -const previewSetting = ref(); +const key = ref(0); const previewSchema = ref(defaultSchema); const previewUiSchema = ref(defaultUiSchema); const renderers = ref(defaultRenderer); +const rendererStyle = ref(""); const previewData = ref({}); @@ -62,9 +65,14 @@ onBeforeMount(async () => { } vscode.postMessage(new GetJsonFormCommand()); + vscode.postMessage(new GetSettingCommand()); + const jsonFormQuery = await jsonFormResolver.wait(); + const settingQuery = await settingResolver.wait(); loading = false; - updateRenderer(jsonFormQuery?.schema, jsonFormQuery?.uischema); + + updateSchema(jsonFormQuery?.schema, jsonFormQuery?.uischema); + updateRenderer(settingQuery?.renderer); }); onUnmounted(() => { @@ -89,8 +97,12 @@ async function onReceiveMessage(message: MessageEvent) { case queryOrCommand.type === "SettingQuery": { const settingQuery = queryOrCommand as SettingQuery; try { - previewSetting.value = settingQuery.renderer; - renderers.value = getRenderers(settingQuery.renderer); + if (loading) { + settingResolver.done(settingQuery); + return; + } + + updateRenderer(settingQuery.renderer); } catch (error) { vscode.postMessage(new LogErrorCommand((error as Error).message)); } @@ -99,26 +111,32 @@ async function onReceiveMessage(message: MessageEvent) { } } -function getRenderers(id?: RendererOption): JsonFormsRendererRegistryEntry[] { - switch (id) { - case "vuetify": - return [...vuetifyRenderers]; - case "vanilla": - return [...vanillaRenderers, ...boplusVueVanillaRenderers]; - default: - throw new Error("Unknown renderer id: " + id); - } -} +const debouncedUpdate = debounce(updateSchema, 100); -const debouncedUpdate = debounce(updateRenderer, 100); - -function updateRenderer(schema?: JsonSchema, uischema?: UISchemaElement): void { +function updateSchema(schema?: JsonSchema, uischema?: UISchemaElement): void { if (schema) { previewSchema.value = schema; } if (uischema) { previewUiSchema.value = uischema; } + key.value++; +} + +function updateRenderer(id?: RendererOption) { + switch (id) { + case "vuetify": + renderers.value = [...vuetifyRenderers]; + rendererStyle.value = ""; + break; + case "vanilla": + renderers.value = [...vanillaRenderers, ...boplusVueVanillaRenderers]; + rendererStyle.value = "styleA"; + break; + default: + throw new Error("Unknown renderer id: " + id); + } + key.value++; } function onUpdate(jsonForm: any) { @@ -130,17 +148,9 @@ function onUpdate(jsonForm: any) {