Skip to content

Commit

Permalink
Merge branch 'main' into feat/modeler_theming
Browse files Browse the repository at this point in the history
# Conflicts:
#	apps/miranum-bpmn-modeler-webview/src/main.ts
  • Loading branch information
peterhnm committed Aug 1, 2023
2 parents 25f6f25 + e8724e8 commit fe714b4
Show file tree
Hide file tree
Showing 106 changed files with 2,430 additions and 847 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:
run: npm run lint
- name: Test
run: npm run test
- name: Build
run: npm run build
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
Expand All @@ -25,5 +27,3 @@ jobs:
flags: unittests
name: miranum-ide
verbose: true
- name: Build
run: npm run build
152 changes: 92 additions & 60 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,23 @@ on:
description: 'Release Tag'
required: true
default: 'release/XXX'
miranum-extension-pack:
description: 'Release miranum-extension-pack app?'
miranum-cli:
description: 'Release miranum-cli app?'
type: boolean
required: true
default: true
miranum-cli:
description: 'Release miranum-cli app?'
miranum-core:
description: 'Release miranum-core?'
type: boolean
required: true
default: true
miranum-create-append-c7-element-templates:
description: 'Release miranum-create-append-c7-element-templates'
type: boolean
required: true
default: true
miranum-extension-pack:
description: 'Release miranum-extension-pack app?'
type: boolean
required: true
default: true
Expand All @@ -32,11 +42,6 @@ on:
type: boolean
required: true
default: true
miranum-core:
description: 'Release miranum-core?'
type: boolean
required: true
default: true
spring-boot-apps:
description: 'Release spring boot services?'
type: boolean
Expand Down Expand Up @@ -66,6 +71,16 @@ jobs:
with:
name: miranum-cli
path: dist/apps/miranum-cli
# miranum-core
- uses: actions/upload-artifact@v3
with:
name: miranum-core
path: dist/libs/miranum-core
# miranum-create-append-element-templates
- uses: actions/upload-artifact@v3
with:
name: miranum-create-append-element-templates
path: dist/libs/miranum-create-append-element-templates
# miranum-extension-pack
- uses: actions/upload-artifact@v3
with:
Expand All @@ -86,11 +101,7 @@ jobs:
with:
name: miranum-modeler
path: dist/apps/miranum-modeler
# miranum-core
- uses: actions/upload-artifact@v3
with:
name: miranum-core
path: dist/libs/miranum-core
# spring boot apps
- uses: actions/upload-artifact@v3
with:
name: spring-boot-apps
Expand Down Expand Up @@ -124,6 +135,69 @@ jobs:
draft: false
prerelease: false

# miranum-cli
publish-miranum-cli:
if: github.event.inputs.miranum-cli == 'true'
runs-on: ubuntu-latest
needs:
- build
- create-release
steps:
- name: Setup NodeJS 16
uses: actions/setup-node@v3
with:
node-version: '16'
registry-url: 'https://registry.npmjs.org'
- uses: actions/download-artifact@v3
with:
name: miranum-cli
- name: Publish
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_SECRET }}

# miranum-core
publish-miranum-core:
if: github.event.inputs.miranum-core == 'true'
runs-on: ubuntu-latest
needs:
- build
- create-release
steps:
- name: Setup NodeJS 16
uses: actions/setup-node@v3
with:
node-version: '16'
registry-url: 'https://registry.npmjs.org'
- uses: actions/download-artifact@v3
with:
name: miranum-core
- name: Publish
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_SECRET }}

# miranum-core
publish-miranum-create-append-element-templates:
if: github.event.inputs.miranum-create-append-element-templates == 'true'
runs-on: ubuntu-latest
needs:
- build
- create-release
steps:
- name: Setup NodeJS 16
uses: actions/setup-node@v3
with:
node-version: '16'
registry-url: 'https://registry.npmjs.org'
- uses: actions/download-artifact@v3
with:
name: miranum-create-append-element-templates
- name: Publish
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_SECRET }}

# miranum-extension-pack
publish-miranum-extension-pack:
if: github.event.inputs.miranum-extension-pack == 'true'
Expand Down Expand Up @@ -222,48 +296,6 @@ jobs:
env:
VSCE_PAT: ${{ secrets.VSCE_PUBLISH }}

# miranum-cli
publish-miranum-cli:
if: github.event.inputs.miranum-cli == 'true'
runs-on: ubuntu-latest
needs:
- build
- create-release
steps:
- name: Setup NodeJS 16
uses: actions/setup-node@v3
with:
node-version: '16'
registry-url: 'https://registry.npmjs.org'
- uses: actions/download-artifact@v3
with:
name: miranum-cli
- name: Publish
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_SECRET }}

# miranum-core
publish-miranum-core:
if: github.event.inputs.miranum-core == 'true'
runs-on: ubuntu-latest
needs:
- build
- create-release
steps:
- name: Setup NodeJS 16
uses: actions/setup-node@v3
with:
node-version: '16'
registry-url: 'https://registry.npmjs.org'
- uses: actions/download-artifact@v3
with:
name: miranum-core
- name: Publish
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_SECRET }}

publish-spring-boot-apps:
if: github.event.inputs.spring-boot-apps == 'true'
runs-on: ubuntu-latest
Expand All @@ -282,7 +314,7 @@ jobs:
- name: Release maven package
uses: samuelmeuli/action-maven-publish@v1
with:
directory: miranum-deployment-proxy
directory: miranum-deployment
gpg_private_key: ${{ secrets.PGP_PRIVATE_KEY }}
gpg_passphrase: ${{ secrets.PGP_PRIVATE_KEY_SECRET }}
nexus_username: ${{ secrets.NEXUS_USERNAME }}
Expand All @@ -300,10 +332,10 @@ jobs:
- name: Set Release version env variable
run: |
echo "RELEASE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- name: Build and push miranum-deployment-proxy
- name: Build and push miranum-deployment-service
uses: docker/build-push-action@v4
with:
context: ./miranum-deployment-proxy
context: ./miranum-deployment
push: true
tags: miragon/miranum-deployment-proxy:${{ env.RELEASE_VERSION }},miragon/miranum-deployment-proxy:latest
tags: miragon/miranum-deployment-service:${{ env.RELEASE_VERSION }},miragon/miranum-deployment-service:latest
platforms: linux/amd64, linux/arm64/v8
56 changes: 13 additions & 43 deletions apps/miranum-bpmn-modeler-webview/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
import { reverse, uniqBy } from "lodash";
import { asyncDebounce, FolderContent, MessageType, StateController } from "@miranum-ide/vscode/miranum-vscode-webview";
import { ExecutionPlatformVersion, ModelerData } from "@miranum-ide/vscode/shared/miranum-modeler";
import { ContentController, instanceOfModelerData, setFormKeys, TemplateElementFactory } from "./app"; // bpmn.js
import { ExtendElementTemplates } from "@miranum-ide/miranum-create-append-c7-element-templates";
import { ContentController, instanceOfModelerData, setFormKeys } from "./app";
// bpmn.js
import Modeler from "camunda-bpmn-js/lib/base/Modeler";
import BpmnModeler7 from "camunda-bpmn-js/lib/camunda-platform/Modeler";
import BpmnModeler8 from "camunda-bpmn-js/lib/camunda-cloud/Modeler";
import { ImportXMLResult } from "bpmn-js/lib/BaseViewer";
import { CreateAppendElementTemplatesModule } from "bpmn-js-create-append-anything";
import TokenSimulationModule from "bpmn-js-token-simulation";
import ElementTemplateChooserModule from "@bpmn-io/element-template-chooser";
import miragonProviderModule from "./app/PropertieProvider/provider"; // css
import "./styles/styles.css"; // import "./styles/theme.css";
import miragonProviderModule from "./app/PropertieProvider/provider";
// css
import "./styles.css";
import "camunda-bpmn-js/dist/assets/camunda-platform-modeler.css";
import "camunda-bpmn-js/dist/assets/camunda-cloud-modeler.css";
import "bpmn-js-token-simulation/assets/css/bpmn-js-token-simulation.css";
import "@bpmn-io/element-template-chooser/dist/element-template-chooser.css"; //
import "@bpmn-io/element-template-chooser/dist/element-template-chooser.css";

//
// Global objects
Expand Down Expand Up @@ -174,7 +177,7 @@ function setFiles(folders: FolderContent[] | undefined): void {
for (const folder of folders) {
switch (folder.type) {
case "element-template": {
modeler.get("elementTemplatesLoader").setTemplates(folder.files);
modeler.get<any>("elementTemplatesLoader").setTemplates(folder.files);
stateController.updateState({
data: {
additionalFiles: [{ type: folder.type, files: folder.files }],
Expand Down Expand Up @@ -228,7 +231,7 @@ function setupBpmnModelerListener() {
);
});

modeler.get("eventBus").on("commandStack.changed", sendChanges);
modeler.get<any>("eventBus").on("commandStack.changed", sendChanges);
}

/**
Expand Down Expand Up @@ -320,11 +323,11 @@ function createBpmnModeler(executionPlatformVersion: ExecutionPlatformVersion):
bpmnRenderer: defaultColor,
additionalModules: [
...commonModules,
ExtendElementTemplates,
CreateAppendElementTemplatesModule,
miragonProviderModule,
],
});
extendElementTemplates(bpmnModeler);
break;
}
case ExecutionPlatformVersion.Camunda8: {
Expand All @@ -342,24 +345,12 @@ function createBpmnModeler(executionPlatformVersion: ExecutionPlatformVersion):
}
}

addMiranumLogo();
return bpmnModeler;
}

function extendElementTemplates(bpmnModeler: BpmnModeler7) {
const elementTemplates: any = bpmnModeler.get("elementTemplates");

elementTemplates.__proto__.createElement = (template: any) => {
if (!template) {
throw new Error("template is missing");
}

const templateElementFactory = new TemplateElementFactory(bpmnModeler);

return templateElementFactory.create(template);
};
}

/**
* Retrieve the CSS variables from the DOM.
*/
function getTheme(): { defaultFillColor: string; defaultStrokeColor: string } {
const html = document.documentElement;
const css = getComputedStyle(html);
Expand All @@ -369,27 +360,6 @@ function getTheme(): { defaultFillColor: string; defaultStrokeColor: string } {
};
}

function addMiranumLogo(): void {
const logo: HTMLAnchorElement | null =
document.body.querySelector(".bjs-powered-by");

if (logo) {
logo.href = "https://www.miranum.io/";

let child = logo.lastElementChild;
while (child) {
logo.removeChild(child);
child = logo.lastElementChild;
}
const img = document.createElement("img");
img.src = "https://www.miranum.io/img/logo_blau.png";
img.alt = "Miranum Logo";
img.width = 120;

logo.appendChild(img);
}
}

/**
* A promise that will resolve if initialized() is called.
*/
Expand Down
7 changes: 7 additions & 0 deletions apps/miranum-bpmn-modeler-webview/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ export default defineConfig({
"../../libs/vscode/shared/miranum-modeler/src",
),
},
{
find: "@miranum-ide/miranum-create-append-c7-element-templates",
replacement: path.resolve(
__dirname,
"../../libs/miranum-create-append-c7-element-templates/src",
),
},
],
},

Expand Down
Loading

0 comments on commit fe714b4

Please sign in to comment.