Commit e4ab5b58 authored by Alexander Philipp Nowosad's avatar Alexander Philipp Nowosad
Browse files

Add prettier

parent bf382629
{
"root": true,
"ignorePatterns": [
"projects/**/*"
],
"ignorePatterns": ["projects/**/*"],
"overrides": [
{
"files": [
"*.ts"
],
"files": ["*.ts"],
"parserOptions": {
"project": [
"tsconfig.json",
"e2e/tsconfig.json"
],
"project": ["tsconfig.json", "e2e/tsconfig.json"],
"createDefaultProgram": true
},
"extends": [
"plugin:@angular-eslint/recommended",
"plugin:@angular-eslint/template/process-inline-templates"
"plugin:@angular-eslint/template/process-inline-templates",
"prettier"
],
"rules": {
"@angular-eslint/component-selector": [
......@@ -39,12 +33,8 @@
}
},
{
"files": [
"*.html"
],
"extends": [
"plugin:@angular-eslint/template/recommended"
],
"files": ["*.html"],
"extends": ["plugin:@angular-eslint/template/recommended", "prettier"],
"rules": {
"@angular-eslint/template/eqeqeq": [
"error",
......
......@@ -10,7 +10,7 @@ stages:
# https://docs.gitlab.com/ee/ci/caching/#caching-nodejs-dependencies
cache:
key: "$CI_COMMIT_REF_SLUG"
key: '$CI_COMMIT_REF_SLUG'
paths:
- .npm/
policy: pull
......@@ -23,24 +23,24 @@ build:
stage: build
script: npm run build -- --prod
cache:
key: "$CI_COMMIT_REF_SLUG"
key: '$CI_COMMIT_REF_SLUG'
paths:
- .npm/
policy: push
artifacts:
name: "$CI_COMMIT_REF_SLUG-$CI_JOB_NAME"
name: '$CI_COMMIT_REF_SLUG-$CI_JOB_NAME'
paths:
- "dist/"
- 'dist/'
expire_in: 1 week
tslint:
stage: test
script: npm -s run lint -- --format=stylish > report
artifacts:
name: "$CI_COMMIT_REF_SLUG-$CI_JOB_NAME"
name: '$CI_COMMIT_REF_SLUG-$CI_JOB_NAME'
when: on_failure
paths:
- "report"
- 'report'
expire_in: 1 week
dependencies: []
allow_failure: true # TODO: remove after testing deployment
......@@ -49,14 +49,14 @@ unittest:
stage: test
script: npm -s run test -- --codeCoverage --progress=false --watch=false --browsers=ChromeHeadlessCI --reporters junit,dots
artifacts:
name: "$CI_COMMIT_REF_SLUG-$CI_JOB_NAME"
name: '$CI_COMMIT_REF_SLUG-$CI_JOB_NAME'
when: always
paths:
- "coverage/"
- "reports/TESTS-*.xml"
- 'coverage/'
- 'reports/TESTS-*.xml'
reports:
cobertura: "coverage/bmdl-modeler/cobertura-coverage.xml"
junit: "reports/TESTS-*.xml"
cobertura: 'coverage/bmdl-modeler/cobertura-coverage.xml'
junit: 'reports/TESTS-*.xml'
expire_in: 1 week
dependencies: []
......@@ -64,12 +64,12 @@ e2etest:
stage: test
script: npm -s run e2e -- --protractor-config=e2e/protractor-ci.conf.js
artifacts:
name: "$CI_COMMIT_REF_SLUG-$CI_JOB_NAME"
name: '$CI_COMMIT_REF_SLUG-$CI_JOB_NAME'
when: on_failure
paths:
- "reports/e2e-report.xml"
- 'reports/e2e-report.xml'
reports:
junit: "reports/e2e-report.xml"
junit: 'reports/e2e-report.xml'
expire_in: 1 week
dependencies: []
......@@ -91,7 +91,7 @@ pages:
buildcontainer:
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
entrypoint: ['']
stage: deploy
before_script: []
script:
......
# See http://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
/dist
/tmp
/out-tsc
# Only exists if Bazel was run
/bazel-out
# dependencies
/node_modules
# profiling files
chrome-profiler-events.json
speed-measure-plugin.json
# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*
# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings
# System Files
.DS_Store
Thumbs.db
# reports (custom)
/reports
/local
{
"singleQuote": true
}
......@@ -4,7 +4,6 @@ The Situational Business Model Developer is licensed under the MIT License
Copyright (c) 2021 Sebastian Gottschalk
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
......
......@@ -19,13 +19,13 @@ and [bpmn-js](https://bpmn.io/toolkit/bpmn-js/) to run directly in the webbrowse
## Screenshots
| Create Running Method | Kanban board to enact method |
| ------ | ------ |
| [![Create Running Method](images/create_running_method.png "Create Running Method")](images/create_running_method.png) | [![Kanban board to enact method](images/kanban_board.png "Kanban board to enact method")](images/kanban_board.png) |
| Create Running Method | Kanban board to enact method |
| ---------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| [![Create Running Method](images/create_running_method.png 'Create Running Method')](images/create_running_method.png) | [![Kanban board to enact method](images/kanban_board.png 'Kanban board to enact method')](images/kanban_board.png) |
| Execute Building Block |
| ------ |
| [![Execute Building Block](images/execute_method.png "Execute Building Block")](images/execute_method.png) |
| Execute Building Block |
| ---------------------------------------------------------------------------------------------------------- |
| [![Execute Building Block](images/execute_method.png 'Execute Building Block')](images/execute_method.png) |
## Installation
......
......@@ -18,10 +18,7 @@
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"assets": ["src/favicon.ico", "src/assets"],
"styles": [
"node_modules/bootstrap/dist/css/bootstrap.min.css",
"node_modules/bpmn-js/dist/assets/diagram-js.css",
......@@ -35,10 +32,7 @@
"sourceMap": true,
"optimization": false,
"namedChunks": true,
"allowedCommonJsDependencies": [
"ajv",
"immediate"
]
"allowedCommonJsDependencies": ["ajv", "immediate"]
},
"configurations": {
"production": {
......@@ -94,23 +88,15 @@
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css"
],
"assets": ["src/favicon.ico", "src/assets"],
"styles": ["src/styles.css"],
"scripts": []
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"src/**/*.ts",
"src/**/*.html"
]
"lintFilePatterns": ["src/**/*.ts", "src/**/*.html"]
}
},
"e2e": {
......
......@@ -6,8 +6,8 @@ config.chromeDriver = '/usr/bin/chromedriver';
config.capabilities = {
browserName: 'chrome',
chromeOptions: {
args: ['--headless', '--no-sandbox']
}
args: ['--headless', '--no-sandbox'],
},
};
exports.config = config;
......@@ -9,11 +9,9 @@ const { SpecReporter } = require('jasmine-spec-reporter');
*/
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./src/**/*.e2e-spec.ts'
],
specs: ['./src/**/*.e2e-spec.ts'],
capabilities: {
'browserName': 'chrome'
browserName: 'chrome',
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
......@@ -22,20 +20,24 @@ exports.config = {
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
print: function () {},
},
onPrepare() {
require('ts-node').register({
project: require('path').join(__dirname, './tsconfig.json')
project: require('path').join(__dirname, './tsconfig.json'),
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
jasmine
.getEnv()
.addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
// From https://www.protractortest.org/#/faq#how-do-i-produce-an-xml-report-of-my-test-results- adapted
const jasmineReporters = require('jasmine-reporters');
jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter({
consolidateAll: true,
savePath: 'reports',
filePrefix: 'e2e-report'
}));
}
jasmine.getEnv().addReporter(
new jasmineReporters.JUnitXmlReporter({
consolidateAll: true,
savePath: 'reports',
filePrefix: 'e2e-report',
})
);
},
};
......@@ -14,12 +14,13 @@ describe('workspace-project App', () => {
});
describe('when adding an expert model', () => {
beforeAll(async () => {
page = new AppPage();
await page.navigateTo();
await page.expertModelList.modelNameInput.sendKeys('Test Model');
await page.expertModelList.modelDescriptionInput.sendKeys('Test Description');
await page.expertModelList.modelDescriptionInput.sendKeys(
'Test Description'
);
await page.expertModelList.submitButton.click();
await browser.wait(page.expertModelList.expectedListItem('Test Model'));
});
......@@ -28,7 +29,11 @@ describe('workspace-project App', () => {
it('should be displayed', async () => {
expect(await page.expertModelList.listItems.count()).toBe(4);
expect(await page.expertModelList.findListItem('Test Model').description.getText()).toBe('Test Description');
expect(
await page.expertModelList
.findListItem('Test Model')
.description.getText()
).toBe('Test Description');
});
it('should be able to navigate to view page', async () => {
......@@ -42,33 +47,40 @@ describe('workspace-project App', () => {
});
describe('and deleting', async () => {
beforeAll(async () => {
await page.navigateTo();
await page.expertModelList.findListItem('Test Model').deleteButton.click();
await browser.wait(ExpectedConditions.not(page.expertModelList.expectedListItem('Test Model')));
await page.expertModelList
.findListItem('Test Model')
.deleteButton.click();
await browser.wait(
ExpectedConditions.not(
page.expertModelList.expectedListItem('Test Model')
)
);
});
it('should be gone', async () => {
expect(await page.expertModelList.listItems.count()).toBe(3);
});
});
afterAll(async () => {
await browser.executeScript('window.localStorage.clear();');
await browser.executeScript('window.sessionStorage.clear();');
await browser.executeScript('window.indexedDB.deleteDatabase("_pouch_bmdl-feature-modeler");');
await browser.executeScript(
'window.indexedDB.deleteDatabase("_pouch_bmdl-feature-modeler");'
);
await browser.driver.manage().deleteAllCookies();
});
});
afterEach(async () => {
// Assert that there are no errors emitted from the browser
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
expect(logs).not.toContain(jasmine.objectContaining({
level: logging.Level.SEVERE,
} as logging.Entry));
expect(logs).not.toContain(
jasmine.objectContaining({
level: logging.Level.SEVERE,
} as logging.Entry)
);
});
});
import { browser, by, element, ElementFinder, ExpectedConditions } from 'protractor';
import {
browser,
by,
element,
ElementFinder,
ExpectedConditions,
} from 'protractor';
export class AppPage {
expertModelList = this.modelList('.expert-model-list');
companyModelList = this.modelList('.company-model-list');
async navigateTo() {
await browser.get(browser.baseUrl);
await browser.wait(ExpectedConditions.or(
ExpectedConditions.presenceOf(this.expertModelList.listItems.first()),
ExpectedConditions.presenceOf(this.companyModelList.listItems.first())
));
await browser.wait(
ExpectedConditions.or(
ExpectedConditions.presenceOf(this.expertModelList.listItems.first()),
ExpectedConditions.presenceOf(this.companyModelList.listItems.first())
)
);
}
getNavbarBrand() {
......@@ -25,10 +32,22 @@ export class AppPage {
listItems,
expectedListItem: (name: string) =>
ExpectedConditions.presenceOf(
listItems.filter(async (item) => await item.element(by.css('strong')).getText() === name).first()
listItems
.filter(
async (item) =>
(await item.element(by.css('strong')).getText()) === name
)
.first()
),
findListItem: (name: string) =>
this.itemToObject(listItems.filter(async (item) => await item.element(by.css('strong')).getText() === name).first()),
this.itemToObject(
listItems
.filter(
async (item) =>
(await item.element(by.css('strong')).getText()) === name
)
.first()
),
getListItem: (index: number) => this.itemToObject(listItems.get(index)),
modelNameInput: list.element(by.id('name')),
modelDescriptionInput: list.element(by.id('description')),
......
......@@ -4,10 +4,6 @@
"outDir": "../out-tsc/e2e",
"module": "commonjs",
"target": "es2018",
"types": [
"jasmine",
"jasminewd2",
"node"
]
"types": ["jasmine", "jasminewd2", "node"]
}
}
......@@ -14,12 +14,12 @@ module.exports = function (config) {
require('karma-junit-reporter'),
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
clearContext: false, // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, './coverage/bmdl-modeler'),
reports: ['html', 'lcovonly', 'text-summary', 'cobertura'],
fixWebpackSourcePaths: true
fixWebpackSourcePaths: true,
},
reporters: ['progress', 'kjhtml'],
junitReporter: {
......@@ -35,9 +35,9 @@ module.exports = function (config) {
ChromeHeadlessCI: {
base: 'ChromeHeadless',
flags: ['--no-sandbox'],
}
},
},
singleRun: false,
restartOnFileChange: true
restartOnFileChange: true,
});
};
......@@ -5923,6 +5923,12 @@
}
}
},
"eslint-config-prettier": {
"version": "8.3.0",
"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.3.0.tgz",
"integrity": "sha512-BgZuLUSeKzvlL/VUjx/Yb787VQ26RU3gGjA3iiFvdsp/2bMfVIWUVP7tjxtjS0e+HP409cPlPvNkQloz8C91ew==",
"dev": true
},
"eslint-scope": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz",
......@@ -11725,6 +11731,12 @@
"resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz",
"integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw="
},
"prettier": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.3.2.tgz",
"integrity": "sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ==",
"dev": true
},
"pretty-bytes": {
"version": "5.6.0",
"resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.6.0.tgz",
......
......@@ -8,6 +8,7 @@
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"style": "npx prettier --check .",
"e2e": "ng e2e",
"postinstall": "node post-install.js"
},
......@@ -56,6 +57,7 @@
"@typescript-eslint/eslint-plugin": "4.28.2",
"@typescript-eslint/parser": "4.28.2",
"eslint": "^7.26.0",
"eslint-config-prettier": "^8.3.0",
"jasmine-core": "~3.6.0",
"jasmine-reporters": "^2.4.0",
"jasmine-spec-reporter": "~5.0.0",
......@@ -66,6 +68,7 @@
"karma-jasmine-html-reporter": "^1.5.0",
"karma-junit-reporter": "^2.0.1",
"ng-mocks": "^12.3.1",
"prettier": "2.3.2",
"protractor": "~7.0.0",
"ts-node": "~7.0.0",
"typescript": "~4.3.5"
......
......@@ -13,5 +13,11 @@ function removeSideEffects(moduleName) {
}
}
const modules = ['bpmn-js', 'bpmn-moddle', 'diagram-js', 'moddle', 'moddle-xml'];
const modules = [
'bpmn-js',
'bpmn-moddle',
'diagram-js',
'moddle',
'moddle-xml',
];
modules.forEach((moduleName) => removeSideEffects(moduleName));
......@@ -5,18 +5,20 @@ import { ToolExplanationComponent } from './tool-explanation/tool-explanation.co
import { LoginComponent } from './login/login.component';
import { AuthGuard } from './database/auth.guard';
// Routing for the Feature Modeler
const routes: Routes = [
{path: '', redirectTo: '/runningprocess', pathMatch: 'full'},
{path: 'login', component: LoginComponent},
{path: 'options', component: OptionsComponent, canActivate: [AuthGuard]},
{path: 'explanation', component: ToolExplanationComponent, canActivate: [AuthGuard]},
{ path: '', redirectTo: '/runningprocess', pathMatch: 'full' },
{ path: 'login', component: LoginComponent },
{ path: 'options', component: OptionsComponent, canActivate: [AuthGuard] },
{
path: 'explanation',
component: ToolExplanationComponent,
canActivate: [AuthGuard],
},
];
@NgModule({
imports: [RouterModule.forRoot(routes, {relativeLinkResolution: 'legacy'})],
exports: [RouterModule]
imports: [RouterModule.forRoot(routes, { relativeLinkResolution: 'legacy' })],
exports: [RouterModule],
})
export class AppRoutingModule {
}
export class AppRoutingModule {}
......@@ -7,11 +7,29 @@
<footer
*ngIf="showNavbar"
class="text-muted container text-center mb-3 d-flex align-items-baseline justify-content-center">
<button type="button" class="btn btn-link" (click)="logout()">Logout</button>
class="
text-muted
container
text-center
mb-3
d-flex
align-items-baseline
justify-content-center
"
>
<button type="button" class="btn btn-link" (click)="logout()">
Logout
</button>
<div>&ndash;</div>
<a class="btn btn-link" routerLinkActive="active" [routerLink]="['/', 'options']">Options</a>
<a
class="btn btn-link"
routerLinkActive="active"
[routerLink]="['/', 'options']"
>Options</a
>
<div>&ndash;</div>
<div class="btn btn-link" routerLinkActive="active" [routerLink]="['/']">SBMD v{{VERSION}}</div>
<div class="btn btn-link" routerLinkActive="active" [routerLink]="['/']">
SBMD v{{ VERSION }}