From 94211600ee8dc324b27c7f0f74dfe060fd6cd1ba Mon Sep 17 00:00:00 2001 From: Milan Mladoniczky <6153201+tuplle@users.noreply.github.com> Date: Tue, 16 Jan 2024 11:20:39 +0100 Subject: [PATCH] update github workflows - add version of app to env --- .github/ISSUE_TEMPLATE/bug_report.yaml | 81 +++++++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.yaml | 38 +++++++++ .github/config.yaml | 1 + .github/workflows/master-build.yaml | 20 ++--- .github/workflows/pr-build.yaml | 29 ++++--- .github/workflows/release-build.yaml | 27 +++++-- CHANGELOG.md | 62 ++------------ CODE_OF_CONDUCT.md | 6 +- README.md | 11 ++- docs/changelod.tex | 4 +- nae.json | 2 +- package.json | 2 +- src/app/app-builder-configuration.service.ts | 17 +++- src/app/app.component.html | 10 +-- src/app/app.component.ts | 29 ++++--- .../control-panel/modes/bpmn-import-tool.ts | 23 +++--- src/environments/environment.prod.ts | 7 +- src/environments/environment.ts | 7 +- 18 files changed, 250 insertions(+), 126 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yaml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yaml diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml new file mode 100644 index 0000000..b24becf --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -0,0 +1,81 @@ +name: "🐛 Bug Report" +description: Create a report to help us improve +title: "[BUG] " +labels: + - bug + - unverified +body: + - id: description + type: textarea + attributes: + label: Current behaviour + description: A clear and concise description of what the bug is. + validations: + required: false + - id: steps + type: textarea + attributes: + label: Steps to reproduce + description: Steps to reproduce the behavior. + placeholder: | + 1. Go to '...' + 2. Click on '....' + 3. Scroll down to '....' + 4. See error + validations: + required: true + - id: expected + type: textarea + attributes: + label: Expected behaviour + description: A clear and concise description of what you expected to happen. + validations: + required: false + - id: os + type: dropdown + attributes: + label: OS + description: OS of device + options: + - Windows + - Linux + - MacOS + - Android + - iOS + - other + validations: + required: false + - id: browser + type: dropdown + attributes: + label: Browser + description: Used web browser + options: + - Chrome + - Firefox + - Safari + - Edge + - Opera + - Other Chrome/Chromium based + - Other + validations: + required: false + - id: version + type: dropdown + attributes: + label: App version + options: + - 1.0.0 + default: 0 + validations: + required: true + - id: additional + type: textarea + attributes: + label: Anything else? + description: | + Links? References? Screenshots? Anything that will give us more context about the issue you are encountering! + + Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in. + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yaml new file mode 100644 index 0000000..f253e9c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yaml @@ -0,0 +1,38 @@ +name: "⬆️ Feature request" +description: Suggest an idea for this project +title: "[FEATURE] " +labels: + - improvement + - new +body: + - id: problem + type: textarea + attributes: + label: Is your feature request related to a problem? + description: A clear and concise description of what the problem is. Ex. I'm always frustrated when... + validations: + required: false + - id: solution + type: textarea + attributes: + label: Describe the solution you'd like + description: A clear and concise description of what you want to happen. + validations: + required: false + - id: alternative + type: textarea + attributes: + label: Describe alternatives you've considered + description: A clear and concise description of any alternative solutions or features you've considered. + validations: + required: false + - id: additional + type: textarea + attributes: + label: Anything else? + description: | + Links? References? Screenshots? Anything that will give us more context about the request. + + Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in. + validations: + required: false diff --git a/.github/config.yaml b/.github/config.yaml index 31d1f32..657e9d8 100644 --- a/.github/config.yaml +++ b/.github/config.yaml @@ -2,3 +2,4 @@ PR_TITLE_REGEX: /(?:\[[A-Z]+-[0-9]+\] .+)|(CI - Update documentation)|(?:Release COMMIT_MESSAGE_REGEX: /((^| )(\[[A-Z]+-[0-9]+\] .+(?:\n\r? - .*)*)|(Merge branch .*. into*.*)|((Release .*)+(:?\n\r? .*)*)|(CI - Update documentation)|(Revert ".*.)|(Merge remote-tracking *.*))/gim INVALID_COMMIT_MESSAGE: Commit messages are invalid. Valid format is -> [JIRA-ISSUE-KEY] Main change in the commit \n - other change in the commit INVALID_PULL_REQUEST_MESSAGE: Pull request title is invalid -> [JIRA-ISSUE-KEY] Jira issue summary / title +blank_issues_enabled: false diff --git a/.github/workflows/master-build.yaml b/.github/workflows/master-build.yaml index 7ef98be..399fc50 100644 --- a/.github/workflows/master-build.yaml +++ b/.github/workflows/master-build.yaml @@ -18,14 +18,14 @@ jobs: - run: npm i --legacy-peer-deps - name: Test - run: npm run full-test + run: npm run lint && npm run build - - name: Edit Path - run: | - sed -i 's/SF:.*.src/SF:src/g' coverage/lcov.info - sed -i 's/SF:.*.src/SF:src/g' coverage/lcov.info - - name: SonarCloud scan - uses: SonarSource/sonarcloud-github-action@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} +# - name: Edit Path +# run: | +# sed -i 's/SF:.*.src/SF:src/g' coverage/lcov.info +# sed -i 's/SF:.*.src/SF:src/g' coverage/lcov.info +# - name: SonarCloud scan +# uses: SonarSource/sonarcloud-github-action@master +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.github/workflows/pr-build.yaml b/.github/workflows/pr-build.yaml index 0d42082..352b5b8 100644 --- a/.github/workflows/pr-build.yaml +++ b/.github/workflows/pr-build.yaml @@ -20,18 +20,21 @@ jobs: - name: Lint run: npm run lint - - name: Check spelling - run: npm run spell +# - name: Check spelling +# run: npm run spell +# +# - name: Test +# run: npm run test - - name: Test - run: npm run test + - name: Build + run: npm run build - - name: Edit Path - run: | - sed -i 's/SF:.*.src/SF:src/g' coverage/lcov.info - sed -i 's/SF:.*.src/SF:src/g' coverage/lcov.info - - name: SonarCloud scan - uses: SonarSource/sonarcloud-github-action@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} +# - name: Edit Path +# run: | +# sed -i 's/SF:.*.src/SF:src/g' coverage/lcov.info +# sed -i 's/SF:.*.src/SF:src/g' coverage/lcov.info +# - name: SonarCloud scan +# uses: SonarSource/sonarcloud-github-action@master +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.github/workflows/release-build.yaml b/.github/workflows/release-build.yaml index 9eaf59b..4d5d8c2 100644 --- a/.github/workflows/release-build.yaml +++ b/.github/workflows/release-build.yaml @@ -14,11 +14,6 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Setup Node.js - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Log in to Docker Hub uses: docker/login-action@v1 with: @@ -42,6 +37,13 @@ jobs: push: true tags: netgrif/application-builder:latest + - name: Push Next + if: ${{ contains(steps.getVersion.outputs.version, '-') }} + uses: docker/build-push-action@v5 + with: + push: true + tags: netgrif/application-builder:next + publish-assets: name: Upload Release Assets runs-on: ubuntu-latest @@ -69,7 +71,7 @@ jobs: - name: Build project run: | - zip -r netgrif-application-builder-${{ steps.getVersion.outputs.version }}.zip target/application-builder + zip -r netgrif-application-builder-${{ steps.getVersion.outputs.version }}.zip dist/application-builder - name: Upload binaries to release uses: svenstaro/upload-release-action@v2 @@ -79,3 +81,16 @@ jobs: asset_name: netgrif-application-builder-${{ steps.getVersion.outputs.version }}.zip tag: ${{ github.ref }} overwrite: true + + deploy: + name: Deploy on K3S cluster + runs-on: ubuntu-latest + needs: publish-docker + steps: + - name: Apply new release + uses: actions-hub/kubectl@master + env: + KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }} + KUBE_CONTEXT: default-github-builder + with: + args: rollout restart deployment/netgrif-application-builder-${{ contains(steps.getVersion.outputs.version, '-') && 'uat' || 'prod' }}-dpl --namespace builder diff --git a/CHANGELOG.md b/CHANGELOG.md index 9297b26..fef5f56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,10 +7,16 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). Full Changelog: [https://github.com/netgrif/application-builder/commits/v1.0.0](https://github.com/netgrif/application-builder/commits/v1.0.0) +## [v1.0.0](https://github.com/netgrif/application-builder/releases/tag/v1.0.0) (2023-12-11) + +### Added + +- Initial open-source release of Netgrif Application Builder + [//]: # (TODO CHANGELOG) - ------ -## OLD - - -## 0.4.0 - Silver Dysprosium (10.09.2020) -### Bug Fixes - * [NAB-11](https://netgrif.atlassian.net/browse/NAB-11) - Data variable editor text overflow - * [NAB-95](https://netgrif.atlassian.net/browse/NAB-95) - Arc data reference bug - * [NAB-97](https://netgrif.atlassian.net/browse/NAB-97) - Forms inconsistent in modeler - * [NAB-107](https://netgrif.atlassian.net/browse/NAB-107) - Nezobrazuju sa novo pridane procesy v project overview - * [NAB-117](https://netgrif.atlassian.net/browse/NAB-117) - Data field ids generated as [object Object] - * [NAB-118](https://netgrif.atlassian.net/browse/NAB-118) - Form builder always displays calendar value selection - -### Improvements - * [NAB-62](https://netgrif.atlassian.net/browse/NAB-62) - Form builder refactor - * [NAB-124](https://netgrif.atlassian.net/browse/NAB-124) - Select tool preselected by default on modeler screen - * [NAB-125](https://netgrif.atlassian.net/browse/NAB-125) - Add action button to transition context menu - -### Features - * [NAB-123](https://netgrif.atlassian.net/browse/NAB-123) - File list data field - - -## 0.3.0 - Aqua Neon (24.07.2020) -### Bug Fixes - * [NAB-31](https://netgrif.atlassian.net/browse/NAB-31) - Form builder - inconsistent number of cols - * [NAB-28](https://netgrif.atlassian.net/browse/NAB-28) - Dashboard tiles refresh - * [NAB-25](https://netgrif.atlassian.net/browse/NAB-25) - Actions has the same id - * [NAB-24](https://netgrif.atlassian.net/browse/NAB-24) - Transition actions have trigger PRE/POST - * [NAB-17](https://netgrif.atlassian.net/browse/NAB-17) - Custom field inconsistencies - * [NAB-16](https://netgrif.atlassian.net/browse/NAB-16) - Builder does not load on Firefox - * [NAB-14](https://netgrif.atlassian.net/browse/NAB-14) - XML special chars are not escaped - -### Improvements - * [NAB-100](https://netgrif.atlassian.net/browse/NAB-100) - Form builder default values - * [NAB-96](https://netgrif.atlassian.net/browse/NAB-96) - Jenkins Pipeline - * [NAB-51](https://netgrif.atlassian.net/browse/NAB-51) - Custom datafield export - -### Features - * [NAB-93](https://netgrif.atlassian.net/browse/NAB-93) - I18n view - * [NAB-91](https://netgrif.atlassian.net/browse/NAB-91) - Modeler Tour - * [NAB-77](https://netgrif.atlassian.net/browse/NAB-77) - Automation policies - * Task icon is displayed in modeler in the middle of the transition rectangle - -### Tasks - * [NAB-8](https://netgrif.atlassian.net/browse/NAB-8) - Datetime field refactor - - -## 0.2.0 - Navy Hafnium -### Features - * Resizable action editor - * Tables can be sorted by clicking on its headers - * Side editors can be resized - * Data fields options can be edited in the Data variable editor diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 54cabf4..adfdcfd 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -106,7 +106,7 @@ Violating these terms may lead to a permanent ban. ### 4. Permanent Ban **Community Impact**: Demonstrating a pattern of violation of community -standards, including sustained inappropriate behavior, harassment of an +standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. **Consequence**: A permanent ban from any sort of public interaction within @@ -126,7 +126,11 @@ For answers to common questions about this code of conduct, see the FAQ at at [https://www.contributor-covenant.org/translations][translations]. [homepage]: https://www.contributor-covenant.org + [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html + [Mozilla CoC]: https://github.com/mozilla/diversity + [FAQ]: https://www.contributor-covenant.org/faq + [translations]: https://www.contributor-covenant.org/translations diff --git a/README.md b/README.md index 6272d41..873e394 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,12 @@ # Netgrif Application Builder [![License](https://img.shields.io/badge/license-NETGRIF%20Community%20License-green)](https://netgrif.com/license) -[![Angular dependency](https://img.shields.io/github/package-json/dependency-version/netgrif/application-builder/@angular/core?color=red)](https://www.angular.io/)) +[![Angular dependency](https://img.shields.io/github/package-json/dependency-version/netgrif/application-builder/@angular/core?color=red)](https://www.angular.io/) [![Petriflow 1.0.1](https://img.shields.io/badge/Petriflow-1.0.1-0aa8ff)](https://petriflow.com) [![Docker Pulls](https://img.shields.io/docker/pulls/netgrif/application-builder)](https://hub.docker.com/r/netgrif/application-builder) [![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/netgrif/application-builder?display_name=tag&sort=semver)](https://github.com/netgrif/application-builder/releases) -[![build](https://github.com/netgrif/application-builder/actions/workflows/master-build.yml/badge.svg)](https://github.com/netgrif/application-builder/actions/workflows/master-build.yml) +[![Master Build](https://github.com/netgrif/application-builder/actions/workflows/master-build.yaml/badge.svg)](https://github.com/netgrif/application-builder/actions/workflows/master-build.yaml) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=netgrif_application-builder&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=netgrif_application-builder) -[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=netgrif_application-builder&metric=coverage)](https://sonarcloud.io/dashboard?id=netgrif_application-builder) [![Known Vulnerabilities](https://snyk.io/test/github/netgrif/application-builder/badge.svg)](https://snyk.io/test/github/netgrif/application-builder) Netgrif Application Builder is an angular web application for implementing process-driven application in low-code language Petriflow. @@ -25,7 +24,7 @@ Builder can be deployed as is directly from the release artifact or as a docker ## Usage -Builder is single-page application (SPA) implemented in Angular. You can deploy it as normal web page on any website hosting. You can use a [release artifact](https://github.com/netgrif/application-builder/releases/tag/v6.3.2) +Builder is single-page application (SPA) implemented in Angular. You can deploy it as normal web page on any website hosting. You can use a [release artifact](https://github.com/netgrif/application-builder/releases/tag/v6.3.2) to deploy the zip archive. The application is also published to [DockerHub](https://hub.docker.com/r/netgrif/application-builder) for container deployment. For running the application no further configuration is needed. @@ -48,8 +47,8 @@ Application Engine can run as a standalone java application, as a docker image, ### Components -[Netgrif Components](https://github.com/netgrif/components) is an Angular library for creating SPA (Single-page application) compatible with Netgrif Application Engine. -The library provides all necessary tools for creating refined frontend application into NAE environment, +[Netgrif Components](https://github.com/netgrif/components) is an Angular library for creating SPA (Single-page application) compatible with Netgrif Application Engine. +The library provides all necessary tools for creating refined frontend application into NAE environment, and to create own library of Angular web components to incorporate your own personal design to the platform. ## Reporting issues diff --git a/docs/changelod.tex b/docs/changelod.tex index 3f4960a..fc44af4 100644 --- a/docs/changelod.tex +++ b/docs/changelod.tex @@ -4,7 +4,7 @@ \subsection*{0.4.0 - Silver Dysprosium (10.09.2020)} \item NAB-11 - Data variable editor text overflow \item NAB-95 - Arc data reference bug \item NAB-97 - Forms inconsistent in modeler - \item NAB-107 - Nezobrazuju sa novo pridane procesy v project overview + \item NAB-107 - New added processes are not displayed in project overview \item NAB-117 - Data field ids generated as object Object \item NAB-118 - Form builder always displays calendar value selection \end{itemize} @@ -37,7 +37,7 @@ \subsection*{0.3.0 - Aqua Neon (24.07.2020)} \begin{itemize} \item NAB-100 - Form builder default values \item NAB-96 - Jenkins Pipeline - \item NAB-51 - Custom datafield export + \item NAB-51 - Custom data field export \end{itemize} \subsubsection*{Features} diff --git a/nae.json b/nae.json index febab78..8df959b 100644 --- a/nae.json +++ b/nae.json @@ -104,7 +104,7 @@ }, "urls": { "netgrif": "https://netgrif.com", - "bpmn2pn": "https://bpmn2pn.netgrif.cloud", + "bpmn2pn": "https://bpmn2pn.netgrif.cloud/bpmn2pn/", "engine": "https://demo.netgrif.com/", "youtube": "https://www.youtube.com/channel/UCNfqgnjskMMpy7QvOOKhKgw", "github": "https://github.com/netgrif", diff --git a/package.json b/package.json index 8ec6fa7..533b962 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "build": "ng build --configuration production --aot=false --build-optimizer=false", "test": "ng test", "lint": "ng lint", - "spell": "cspell \"{**/*.md,src/**/*.ts}\"", + "spell": "cspell \"{docs/**/*,**/*.md,src/**/*.ts}\"", "e2e": "ng e2e", "full-test": "npm run lint && npm run spell && npm run test", "builder:clean-dist": "rm -rf dist", diff --git a/src/app/app-builder-configuration.service.ts b/src/app/app-builder-configuration.service.ts index d2b7e8e..d283178 100644 --- a/src/app/app-builder-configuration.service.ts +++ b/src/app/app-builder-configuration.service.ts @@ -4,10 +4,25 @@ import {NetgrifApplicationEngine} from '@netgrif/components-core/'; import {default as naeConfig} from '../../nae.json'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class AppBuilderConfigurationService extends ConfigurationService { constructor() { super(naeConfig as unknown as NetgrifApplicationEngine); + this.resolveConfigFromEnv(); + } + + private resolveConfigFromEnv() { + if (!window['env']) return; + Object.keys(window['env']).forEach(key => { + const parts = key.split('-'); + let obj = this.configuration; + for (let i = 0; i < parts.length - 1; i++) { + obj = obj[parts[i]]; + } + if (!!window['env'][key] && window['env'][key] !== '') { + obj[parts[parts.length - 1]] = window['env'][key]; + } + }); } } diff --git a/src/app/app.component.html b/src/app/app.component.html index 99a6778..2f39a48 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -2,28 +2,28 @@ - play_arrow device_hub @@ -38,7 +38,7 @@ bug_report diff --git a/src/app/app.component.ts b/src/app/app.component.ts index cfd9a04..7e317b9 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,25 +1,28 @@ import {AfterViewInit, Component, HostListener} from '@angular/core'; -import {LanguageService} from '@netgrif/components-core'; import {MatDialog} from '@angular/material/dialog'; -import {DialogConfirmComponent} from './dialogs/dialog-confirm/dialog-confirm.component'; -import {JoyrideService} from 'ngx-joyride'; -import {TutorialService} from './tutorial/tutorial-service'; -import {MortgageService} from './modeler/mortgage.service'; import {Router} from '@angular/router'; -import {ModelService} from './modeler/services/model/model.service'; -import {ModelerConfig} from './modeler/modeler-config'; +import {LanguageService} from '@netgrif/components-core'; +import {NetgrifApplicationEngine} from '@netgrif/components-core/'; +import {JoyrideService} from 'ngx-joyride'; +import {AppBuilderConfigurationService} from './app-builder-configuration.service'; +import {DialogConfirmComponent} from './dialogs/dialog-confirm/dialog-confirm.component'; import { - DialogLocalStorageModelComponent + DialogLocalStorageModelComponent, } from './dialogs/dialog-local-storage-model/dialog-local-storage-model.component'; import {ModelImportService} from './modeler/model-import-service'; +import {ModelerConfig} from './modeler/modeler-config'; +import {MortgageService} from './modeler/mortgage.service'; +import {ModelService} from './modeler/services/model/model.service'; +import {TutorialService} from './tutorial/tutorial-service'; @Component({ selector: 'nab-root', templateUrl: './app.component.html', - styleUrls: ['./app.component.scss'] + styleUrls: ['./app.component.scss'], }) export class AppComponent implements AfterViewInit { title = 'Netgrif Application Builder'; + config: NetgrifApplicationEngine; @HostListener('window:beforeunload', ['$event']) WindowBeforeUnload($event: any) { @@ -27,6 +30,7 @@ export class AppComponent implements AfterViewInit { } constructor( + config: AppBuilderConfigurationService, private router: Router, private _languageService: LanguageService, private matDialog: MatDialog, @@ -34,8 +38,9 @@ export class AppComponent implements AfterViewInit { private _mortgageService: MortgageService, private tutorialService: TutorialService, private modelService: ModelService, - private importService: ModelImportService + private importService: ModelImportService, ) { + this.config = config.get(); } ngAfterViewInit(): void { @@ -49,7 +54,7 @@ export class AppComponent implements AfterViewInit { id: localStorage.getItem(ModelerConfig.LOCALSTORAGE.DRAFT_MODEL.ID), timestamp: localStorage.getItem(ModelerConfig.LOCALSTORAGE.DRAFT_MODEL.TIMESTAMP), title: localStorage.getItem(ModelerConfig.LOCALSTORAGE.DRAFT_MODEL.TITLE), - } + }, }); dialogRef.afterClosed().subscribe(result => { if (result === true) { @@ -74,7 +79,7 @@ export class AppComponent implements AfterViewInit { help() { this.joyrideService.startTour({ steps: this.tutorialService.steps, - themeColor: '#0f4c81dd' + themeColor: '#0f4c81dd', }); } diff --git a/src/app/modeler/control-panel/modes/bpmn-import-tool.ts b/src/app/modeler/control-panel/modes/bpmn-import-tool.ts index 5406b95..761456b 100644 --- a/src/app/modeler/control-panel/modes/bpmn-import-tool.ts +++ b/src/app/modeler/control-panel/modes/bpmn-import-tool.ts @@ -1,21 +1,25 @@ +import {HttpClient, HttpErrorResponse} from '@angular/common/http'; import {Injectable} from '@angular/core'; -import {FileTool} from '../tools/file-tool'; +import {MatSnackBar} from '@angular/material/snack-bar'; +import {AppBuilderConfigurationService} from '../../../app-builder-configuration.service'; +import {ModelImportService} from '../../model-import-service'; import {ControlPanelButton} from '../control-panel-button'; import {ControlPanelIcon} from '../control-panel-icon'; +import {FileTool} from '../tools/file-tool'; import {ImportToolButtonComponent} from './import-tool-button/import-tool-button.component'; -import {HttpClient, HttpErrorResponse} from '@angular/common/http'; -import {MatSnackBar} from '@angular/material/snack-bar'; -import {ModelImportService} from '../../model-import-service'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class BpmnImportTool extends FileTool { + private bpmn2pnUrl: string; + constructor( + config: AppBuilderConfigurationService, private importService: ModelImportService, private http: HttpClient, - private snackBar: MatSnackBar + private snackBar: MatSnackBar, ) { super( 'bpmn_import', @@ -23,16 +27,17 @@ export class BpmnImportTool extends FileTool { new ControlPanelIcon('upload_file', false, true), 'Choose a BPMN file to open', ), - ImportToolButtonComponent + ImportToolButtonComponent, ); + this.bpmn2pnUrl = config.get().services?.urls?.bpmn2pn; } handleFileContent(content: string) { - this.http.post('https://bpmn2pn.netgrif.cloud/bpmn2pn/', content, { + this.http.post(this.bpmn2pnUrl, content, { headers: { 'Content-Type': 'text/xml;charset=US-ASCII', }, - responseType: 'text' + responseType: 'text', }).pipe().subscribe((xmlContent: string) => { this.importService.importFromXml(xmlContent); }, (error: HttpErrorResponse) => { diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index d99c40f..bd29d20 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -1,4 +1,7 @@ +import packageJson from '../../package.json'; + export const environment = { - production: true, - deployUrl: '/' + production: true, + deployUrl: '/', + version: packageJson.version, }; diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 039b746..5c8498d 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -2,9 +2,12 @@ // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. // The list of file replacements can be found in `angular.json`. +import packageJson from '../../package.json'; + export const environment = { - production: false, - deployUrl: '/' + production: false, + deployUrl: '/', + version: packageJson.version, }; /*