diff --git a/Jenkinsfile b/Jenkinsfile index 557a72035..7d60a49d7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -74,13 +74,74 @@ pipeline { } } } - post{ - always{ - recordIssues tools: [esLint(pattern: '**/eslint_report.xml')] + post { + always { + recordIssues qualityGates: [[threshold: 1, type: 'TOTAL', unstable: true]], tools: [esLint(pattern: '**/eslint_report.xml')] + } + } + } + + stage('Distribution Build') { + steps { + nvm('') { + catchError(buildResult: 'UNSTABLE', stageResult: 'UNSTABLE') { + sh 'npm run dist' + } } } } + // Deploy develop branch even if tests fail if the code builds, as it'll be an unstable snapshot but we should still deploy + stage('Deploy develop to Artifactory') { + when { + branch 'develop' + } + steps { + rtUpload( + serverId: 'cs-artifactory', + spec: '''{ + "files": [ + { + "pattern": "dist/mdm-ui-*.tgz", + "target": "artifacts-snapshots/mauroDataMapper/mdm-ui/" + } + ] + }''', + ) + rtPublishBuildInfo( + serverId: 'cs-artifactory', + ) + } + } + + stage('Deploy main to Artifactory') { + when { + allOf { + branch 'main' + expression { + currentBuild.currentResult == 'SUCCESS' + } + } + + } + steps { + rtUpload( + serverId: 'cs-artifactory', + spec: '''{ + "files": [ + { + "pattern": "dist/mdm-ui-*.tgz", + "target": "artifacts/mauroDataMapper/mdm-ui/" + } + ] + }''', + ) + rtPublishBuildInfo( + serverId: 'cs-artifactory', + ) + } + } + stage('Sonarqube') { when { branch 'develop' @@ -95,6 +156,28 @@ pipeline { } } } + + stage('Continuous Deployment') { + when { + allOf { + branch 'develop' + expression { + currentBuild.currentResult == 'SUCCESS' + } + } + } + steps { + script { + try { + println("Triggering the [continuous-deployment] job") + build quietPeriod: 300, wait: false, job: 'continuous-deployment' + } catch (hudson.AbortException ignored) { + println("Cannot trigger the [continuous-deployment] job as it doesn't exist") + } + } + } + } + } post { always { @@ -108,7 +191,6 @@ pipeline { reportTitles : 'Test' ]) outputTestResults() - slackNotification() zulipNotification(topic: 'mdm-ui') } } diff --git a/package-lock.json b/package-lock.json index 489df93cc..2d3c40c6d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { "name": "mdm-ui", - "version": "6.5.0", + "version": "6.6.0", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "6.5.0", + "version": "6.6.0", "hasInstallScript": true, "dependencies": { "@angular-eslint/template-parser": "0.5.0-beta.3", @@ -24,7 +24,7 @@ "@bpmn-io/dmn-migrate": "^0.4.3", "@ctrl/ngx-codemirror": "4.0.1", "@fortawesome/fontawesome-free": "5.15.1", - "@maurodatamapper/mdm-resources": "git+https://github.com/MauroDataMapper/mdm-resources.git#4.9.0", + "@maurodatamapper/mdm-resources": "git+https://github.com/MauroDataMapper/mdm-resources.git#4.10.0", "@uirouter/angular": "7.0.0", "@uirouter/core": "6.0.6", "@uirouter/rx": "0.6.5", @@ -2984,7 +2984,7 @@ }, "node_modules/@maurodatamapper/mdm-resources": { "version": "4.10.0", - "resolved": "git+ssh://git@github.com/MauroDataMapper/mdm-resources.git#6ede9f470c25957af9160c6ffc05f7dd75198cf4", + "resolved": "git+ssh://git@github.com/MauroDataMapper/mdm-resources.git#57006ec4e3c65d3ff3cc6e57aaf209a66bc1f4d5", "license": "Apache-2.0" }, "node_modules/@ngtools/webpack": { @@ -25376,8 +25376,8 @@ } }, "@maurodatamapper/mdm-resources": { - "version": "git+ssh://git@github.com/MauroDataMapper/mdm-resources.git#6ede9f470c25957af9160c6ffc05f7dd75198cf4", - "from": "@maurodatamapper/mdm-resources@git+https://github.com/MauroDataMapper/mdm-resources.git#4.9.0" + "version": "git+ssh://git@github.com/MauroDataMapper/mdm-resources.git#57006ec4e3c65d3ff3cc6e57aaf209a66bc1f4d5", + "from": "@maurodatamapper/mdm-resources@git+https://github.com/MauroDataMapper/mdm-resources.git#4.10.0" }, "@ngtools/webpack": { "version": "9.1.12", diff --git a/package.json b/package.json index 83124c36c..81218a908 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mdm-ui", - "version": "6.5.0", + "version": "6.6.0", "scripts": { "ng": "ng", "start": "ng serve", @@ -12,8 +12,8 @@ "test-watch": "jest --watch", "test-clearCache": "jest --clearCache", "lint": "ng lint", - "eslint": "tsc --noEmit && eslint . --ext ts --quiet --fix", - "eslint-nofix": "tsc --noEmit && eslint . --ext ts --quiet", + "eslint": "tsc --noEmit && eslint . --ext ts --fix", + "eslint-nofix": "tsc --noEmit && eslint . --ext ts", "eslint-report": "eslint . --ext ts --format checkstyle -o eslint_report.xml", "e2e": "ng e2e", "postinstall": "ngcc", @@ -38,7 +38,7 @@ "@bpmn-io/dmn-migrate": "^0.4.3", "@ctrl/ngx-codemirror": "4.0.1", "@fortawesome/fontawesome-free": "5.15.1", - "@maurodatamapper/mdm-resources": "git+https://github.com/MauroDataMapper/mdm-resources.git#4.9.0", + "@maurodatamapper/mdm-resources": "git+https://github.com/MauroDataMapper/mdm-resources.git#4.10.0", "@uirouter/angular": "7.0.0", "@uirouter/core": "6.0.6", "@uirouter/rx": "0.6.5", diff --git a/src/app/admin/api-property/api-property.component.ts b/src/app/admin/api-property/api-property.component.ts index b6c7e24dc..86d05f203 100644 --- a/src/app/admin/api-property/api-property.component.ts +++ b/src/app/admin/api-property/api-property.component.ts @@ -87,76 +87,6 @@ export class ApiPropertyComponent implements OnInit { } } - private createFormGroup() { - this.formGroup = new FormGroup({ - key: new FormControl(this.property.metadata.key, [Validators.required]), // eslint-disable-line @typescript-eslint/unbound-method - category: new FormControl(this.property.metadata.category, [Validators.required]), // eslint-disable-line @typescript-eslint/unbound-method - publiclyVisible: new FormControl({ value: this.property.metadata.publiclyVisible, disabled: this.property.metadata.isSystem }), - value: new FormControl(this.property.original?.value, [Validators.required]) // eslint-disable-line @typescript-eslint/unbound-method - }); - } - - private getBlankMetadata() { - return { - key: '', - category: '', - publiclyVisible: false, - editType: ApiPropertyEditType.Value, - isSystem: false - }; - } - - private loadExistingProperty() { - this.resources.apiProperties - .get(this.id) - .pipe( - map((response: ApiPropertyResponse): ApiPropertyEditableState => { - const original = response.body; - const metadata = propertyMetadata.find(p => p.key === original.key) ?? { - key: original.key, - category: original.category, - isSystem: false, - publiclyVisible: original.publiclyVisible, - editType: ApiPropertyEditType.Value - }; - - return { - metadata, - original - }; - }), - catchError(errors => { - this.messageHandler.showError('There was a problem getting the property.', errors); - return []; - }) - ) - .subscribe((data: ApiPropertyEditableState) => { - this.property = data; - this.createFormGroup(); - }); - } - - private loadAvailableSystemProperties() { - this.resources.apiProperties - .list() - .pipe( - map((response: ApiPropertyIndexResponse) => { - return response.body.items; - }), - catchError(errors => { - this.messageHandler.showError('There was a problem getting the properties.', errors); - return []; - }) - ) - .subscribe((data: ApiProperty[]) => { - this.systemProperties = propertyMetadata.filter(m => data.every(p => p.key !== m.key)); - this.property = { - metadata: this.getBlankMetadata() - }; - this.createFormGroup(); - }); - } - systemPropertyChanged(change: MatSelectChange) { if (change.value) { this.property.metadata = propertyMetadata.find(m => m.key === change.value); @@ -243,6 +173,76 @@ export class ApiPropertyComponent implements OnInit { } } + private createFormGroup() { + this.formGroup = new FormGroup({ + key: new FormControl(this.property.metadata.key, [Validators.required]), // eslint-disable-line @typescript-eslint/unbound-method + category: new FormControl(this.property.metadata.category, [Validators.required]), // eslint-disable-line @typescript-eslint/unbound-method + publiclyVisible: new FormControl({ value: this.property.metadata.publiclyVisible, disabled: this.property.metadata.isSystem }), + value: new FormControl(this.property.original?.value, [Validators.required]) // eslint-disable-line @typescript-eslint/unbound-method + }); + } + + private getBlankMetadata() { + return { + key: '', + category: '', + publiclyVisible: false, + editType: ApiPropertyEditType.Value, + isSystem: false + }; + } + + private loadExistingProperty() { + this.resources.apiProperties + .get(this.id) + .pipe( + map((response: ApiPropertyResponse): ApiPropertyEditableState => { + const original = response.body; + const metadata = propertyMetadata.find(p => p.key === original.key) ?? { + key: original.key, + category: original.category, + isSystem: false, + publiclyVisible: original.publiclyVisible, + editType: ApiPropertyEditType.Value + }; + + return { + metadata, + original + }; + }), + catchError(errors => { + this.messageHandler.showError('There was a problem getting the property.', errors); + return []; + }) + ) + .subscribe((data: ApiPropertyEditableState) => { + this.property = data; + this.createFormGroup(); + }); + } + + private loadAvailableSystemProperties() { + this.resources.apiProperties + .list() + .pipe( + map((response: ApiPropertyIndexResponse) => { + return response.body.items; + }), + catchError(errors => { + this.messageHandler.showError('There was a problem getting the properties.', errors); + return []; + }) + ) + .subscribe((data: ApiProperty[]) => { + this.systemProperties = propertyMetadata.filter(m => data.every(p => p.key !== m.key)); + this.property = { + metadata: this.getBlankMetadata() + }; + this.createFormGroup(); + }); + } + private navigateToParent() { this.editing.stop(); this.stateHandler.Go( diff --git a/src/app/admin/openid-connect-provider-table/openid-connect-provider-table.component.ts b/src/app/admin/openid-connect-provider-table/openid-connect-provider-table.component.ts index c8b12a15c..10afb56ee 100644 --- a/src/app/admin/openid-connect-provider-table/openid-connect-provider-table.component.ts +++ b/src/app/admin/openid-connect-provider-table/openid-connect-provider-table.component.ts @@ -22,7 +22,7 @@ import { MatSort, SortDirection } from '@angular/material/sort'; import { MatTableDataSource } from '@angular/material/table'; import { Title } from '@angular/platform-browser'; import { ModulesResponse, OpenIdConnectProvider, OpenIdConnectProvidersIndexResponse } from '@maurodatamapper/mdm-resources'; -import { OpenIdConnectModuleName } from '@mdm/model/openid-connect.model'; +import { openIdConnectModuleName } from '@mdm/model/openid-connect.model'; import { MdmResourcesService } from '@mdm/modules/resources'; import { GridService, MessageHandlerService, SharedService, StateHandlerService } from '@mdm/services'; import { MdmPaginatorComponent } from '@mdm/shared/mdm-paginator/mdm-paginator'; @@ -78,7 +78,7 @@ export class OpenidConnectProviderTableComponent implements OnInit, AfterViewIni finalize(() => this.loading = false) ) .subscribe((response: ModulesResponse) => { - this.moduleLoaded = response.body.findIndex(module => module.name === OpenIdConnectModuleName) !== -1; + this.moduleLoaded = response.body.findIndex(module => module.name === openIdConnectModuleName) !== -1; if (this.moduleLoaded) { this.initialise(); } diff --git a/src/app/admin/subscribed-catalogue/subscribed-catalogue.component.ts b/src/app/admin/subscribed-catalogue/subscribed-catalogue.component.ts index ddcdf6237..bd17b2f25 100644 --- a/src/app/admin/subscribed-catalogue/subscribed-catalogue.component.ts +++ b/src/app/admin/subscribed-catalogue/subscribed-catalogue.component.ts @@ -118,11 +118,6 @@ export class SubscribedCatalogueComponent implements OnInit { }); } - private navigateToParent() { - this.editingService.stop(); - this.stateHandler.Go('appContainer.adminArea.subscribedCatalogues'); - } - validate() { let isValid = true; this.errors = {}; @@ -144,4 +139,9 @@ export class SubscribedCatalogueComponent implements OnInit { return isValid; } + + private navigateToParent() { + this.editingService.stop(); + this.stateHandler.Go('appContainer.adminArea.subscribedCatalogues'); + } } diff --git a/src/app/admin/user/user.component.ts b/src/app/admin/user/user.component.ts index b3275e813..32693012f 100644 --- a/src/app/admin/user/user.component.ts +++ b/src/app/admin/user/user.component.ts @@ -204,11 +204,6 @@ export class UserComponent implements OnInit { }); }; - private navigateToParent() { - this.editingService.stop(); - this.stateHandler.Go('admin.users'); - } - onGroupSelect = (groups) => { this.user.groups = []; for (const val of this.allGroups) { @@ -220,4 +215,9 @@ export class UserComponent implements OnInit { } } }; + + private navigateToParent() { + this.editingService.stop(); + this.stateHandler.Go('admin.users'); + } } diff --git a/src/app/data-type/data-type-detail/data-type-detail.component.html b/src/app/data-type/data-type-detail/data-type-detail.component.html index 7770fbc15..a2b8ea48a 100644 --- a/src/app/data-type/data-type-detail/data-type-detail.component.html +++ b/src/app/data-type/data-type-detail/data-type-detail.component.html @@ -56,7 +56,7 @@