diff --git a/.travis.yml b/.travis.yml index ccdd4814c3..9bd21020d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,7 @@ branches: only: - master - development + - /.*beta.*/ # TRAVIS_PULL_REQUEST == false means is running on dev branch and is not a PR stages: @@ -62,7 +63,7 @@ jobs: - stage: Unit test name: core script: - AFFECTED_LIBS="$(./scripts/affected-libs.sh -b $TRAVIS_BRANCH)"; + AFFECTED_LIBS="$(./scripts/affected-libs.sh -b -gnu $TRAVIS_BRANCH)"; if [[ $AFFECTED_LIBS =~ "core$" || $TRAVIS_PULL_REQUEST == "false" ]]; then ng test core --watch=false || exit 1; @@ -70,7 +71,7 @@ jobs: - stage: Unit test name: extensions script: - AFFECTED_LIBS="$(./scripts/affected-libs.sh -b $TRAVIS_BRANCH)"; + AFFECTED_LIBS="$(./scripts/affected-libs.sh -b -gnu $TRAVIS_BRANCH)"; if [[ $AFFECTED_LIBS =~ "extensions$" || $TRAVIS_PULL_REQUEST == "false" ]]; then ng test extensions --watch=false || exit 1; @@ -78,7 +79,7 @@ jobs: - stage: Unit test name: process-services script: - AFFECTED_LIBS="$(./scripts/affected-libs.sh -b $TRAVIS_BRANCH)"; + AFFECTED_LIBS="$(./scripts/affected-libs.sh -b -gnu $TRAVIS_BRANCH)"; if [[ $AFFECTED_LIBS =~ "process-services$" || $TRAVIS_PULL_REQUEST == "false" ]]; then ng test process-services --watch=false || exit 1; @@ -86,7 +87,7 @@ jobs: - stage: Unit test name: insights script: - AFFECTED_LIBS="$(./scripts/affected-libs.sh -b $TRAVIS_BRANCH)"; + AFFECTED_LIBS="$(./scripts/affected-libs.sh -b -gnu $TRAVIS_BRANCH)"; if [[ $AFFECTED_LIBS =~ "insights$" || $TRAVIS_PULL_REQUEST == "false" ]]; then ng test insights --watch=false || exit 1; @@ -94,7 +95,7 @@ jobs: - stage: Unit test name: content-services script: - AFFECTED_LIBS="$(./scripts/affected-libs.sh -b $TRAVIS_BRANCH)"; + AFFECTED_LIBS="$(./scripts/affected-libs.sh -b -gnu $TRAVIS_BRANCH)"; if [[ $AFFECTED_LIBS =~ "content-services$" || $TRAVIS_PULL_REQUEST == "false" ]]; then ng test content-services --watch=false || exit 1; @@ -102,7 +103,7 @@ jobs: - stage: Unit test name: process-services-cloud script: - AFFECTED_LIBS="$(./scripts/affected-libs.sh -b $TRAVIS_BRANCH)"; + AFFECTED_LIBS="$(./scripts/affected-libs.sh -b -gnu $TRAVIS_BRANCH)"; if [[ $AFFECTED_LIBS =~ "process-services-cloud$" || $TRAVIS_PULL_REQUEST == "false" ]]; then ng test process-services-cloud --watch=false || exit 1; @@ -133,7 +134,7 @@ jobs: name: core script: AFFECTED_E2E="$(./scripts/affected-folder.sh -b $TRAVIS_BRANCH -f "e2e")"; - AFFECTED_LIBS="$(./scripts/affected-libs.sh -b $TRAVIS_BRANCH)"; + AFFECTED_LIBS="$(./scripts/affected-libs.sh -gnu -b $TRAVIS_BRANCH)"; if [[ $AFFECTED_LIBS =~ "core$" || $AFFECTED_E2E = "e2e" || $TRAVIS_PULL_REQUEST == "false" ]]; then (./scripts/test-e2e-lib.sh -host localhost:4200 --host_sso "$E2E_HOST_SSO" --host_bpm "$E2E_HOST_BPM" --host_identity "$E2E_HOST_IDENTITY" -proxy "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" -e $E2E_EMAIL -b --folder core --skip-lint --use-dist || exit 1;); @@ -142,7 +143,7 @@ jobs: name: process-services script: AFFECTED_E2E="$(./scripts/affected-folder.sh -b $TRAVIS_BRANCH -f "e2e")"; - AFFECTED_LIBS="$(./scripts/affected-libs.sh -b $TRAVIS_BRANCH)"; + AFFECTED_LIBS="$(./scripts/affected-libs.sh -gnu -b $TRAVIS_BRANCH)"; if [[ $AFFECTED_LIBS =~ "process-services$" || $AFFECTED_E2E = "e2e" || $TRAVIS_PULL_REQUEST == "false" ]]; then (./scripts/test-e2e-lib.sh -host localhost:4200 -proxy "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" -e $E2E_EMAIL -b --folder process-services --skip-lint --use-dist || exit 1;); @@ -151,7 +152,7 @@ jobs: name: content-services script: AFFECTED_E2E="$(./scripts/affected-folder.sh -b $TRAVIS_BRANCH -f "e2e")"; - AFFECTED_LIBS="$(./scripts/affected-libs.sh -b $TRAVIS_BRANCH)"; + AFFECTED_LIBS="$(./scripts/affected-libs.sh -gnu -b $TRAVIS_BRANCH)"; if [[ $AFFECTED_LIBS =~ "content-services$" || $AFFECTED_E2E = "e2e" || $TRAVIS_PULL_REQUEST == "false" ]]; then (./scripts/test-e2e-lib.sh -host localhost:4200 -proxy "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" -e $E2E_EMAIL -b --folder content-services --skip-lint --use-dist || exit 1;); @@ -160,7 +161,7 @@ jobs: name: search script: AFFECTED_E2E="$(./scripts/affected-folder.sh -b $TRAVIS_BRANCH -f "e2e")"; - AFFECTED_LIBS="$(./scripts/affected-libs.sh -b $TRAVIS_BRANCH)"; + AFFECTED_LIBS="$(./scripts/affected-libs.sh -b -gnu $TRAVIS_BRANCH)"; if [[ $AFFECTED_LIBS =~ "content-services$" || $AFFECTED_E2E = "e2e" || $TRAVIS_PULL_REQUEST == "false" ]]; then (./scripts/test-e2e-lib.sh -host localhost:4200 -proxy "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" -e $E2E_EMAIL -b --folder search --skip-lint --use-dist || exit 1;); @@ -169,7 +170,7 @@ jobs: name: process-services-cloud script: AFFECTED_E2E="$(./scripts/affected-folder.sh -b $TRAVIS_BRANCH -f "e2e")"; - AFFECTED_LIBS="$(./scripts/affected-libs.sh -b $TRAVIS_BRANCH)"; + AFFECTED_LIBS="$(./scripts/affected-libs.sh -b -gnu $TRAVIS_BRANCH)"; if [[ $AFFECTED_LIBS =~ "process-services-cloud$" || $AFFECTED_E2E = "e2e" || $TRAVIS_PULL_REQUEST == "false" ]]; then (./scripts/test-e2e-lib.sh -host localhost:4200 --host_sso "$E2E_HOST_SSO" --host_bpm "$E2E_HOST_BPM" --host_identity "$E2E_HOST_IDENTITY" -proxy "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" -e $E2E_EMAIL -b --folder process-services-cloud --skip-lint --use-dist || exit 1;); @@ -178,7 +179,7 @@ jobs: name: insights script: AFFECTED_E2E="$(./scripts/affected-folder.sh -b $TRAVIS_BRANCH -f "e2e")"; - AFFECTED_LIBS="$(./scripts/affected-libs.sh -b $TRAVIS_BRANCH)"; + AFFECTED_LIBS="$(./scripts/affected-libs.sh -b -gnu $TRAVIS_BRANCH)"; if [[ $AFFECTED_LIBS =~ "process-services-cloud$" || $AFFECTED_E2E = "e2e" || $TRAVIS_PULL_REQUEST == "false" ]]; then (./scripts/test-e2e-lib.sh -host localhost:4200 -proxy "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" -e $E2E_EMAIL -b --folder insights --skip-lint --use-dist || exit 1;); diff --git a/angular.json b/angular.json index 3b79b6cd61..ccbbd5959d 100644 --- a/angular.json +++ b/angular.json @@ -540,7 +540,7 @@ "build": { "builder": "@angular-devkit/build-ng-packagr:build", "options": { - "tsConfig": "lib/core/tsconfig.json", + "tsConfig": "lib/core/tsconfig.lib.json", "project": "lib/core/ng-package.json" }, "configurations": { @@ -553,7 +553,7 @@ "builder": "@angular-devkit/build-angular:karma", "options": { "main": "lib/core/test.ts", - "tsConfig": "lib/core/tsconfig.json", + "tsConfig": "lib/core/tsconfig.spec.json", "karmaConfig": "lib/core/karma.conf.js", "codeCoverage": true, "sourceMap": true @@ -582,7 +582,7 @@ "build": { "builder": "@angular-devkit/build-ng-packagr:build", "options": { - "tsConfig": "lib/content-services/tsconfig.json", + "tsConfig": "lib/content-services/tsconfig.lib.json", "project": "lib/content-services/ng-package.json" }, "configurations": { @@ -595,7 +595,7 @@ "builder": "@angular-devkit/build-angular:karma", "options": { "main": "lib/content-services/test.ts", - "tsConfig": "lib/content-services/tsconfig.json", + "tsConfig": "lib/content-services/tsconfig.spec.json", "karmaConfig": "lib/content-services/karma.conf.js", "codeCoverage": true, "sourceMap": true @@ -624,7 +624,7 @@ "build": { "builder": "@angular-devkit/build-ng-packagr:build", "options": { - "tsConfig": "lib/process-services/tsconfig.json", + "tsConfig": "lib/process-services/tsconfig.lib.json", "project": "lib/process-services/ng-package.json" }, "configurations": { @@ -637,7 +637,7 @@ "builder": "@angular-devkit/build-angular:karma", "options": { "main": "lib/process-services/test.ts", - "tsConfig": "lib/process-services/tsconfig.json", + "tsConfig": "lib/process-services/tsconfig.spec.json", "karmaConfig": "lib/process-services/karma.conf.js", "codeCoverage": true, "sourceMap": true @@ -708,7 +708,7 @@ "build": { "builder": "@angular-devkit/build-ng-packagr:build", "options": { - "tsConfig": "lib/insights/tsconfig.json", + "tsConfig": "lib/extensions/tsconfig.lib.json", "project": "lib/insights/ng-package.json" }, "configurations": { @@ -721,7 +721,7 @@ "builder": "@angular-devkit/build-angular:karma", "options": { "main": "lib/insights/test.ts", - "tsConfig": "lib/insights/tsconfig.json", + "tsConfig": "lib/extensions/tsconfig.spec.json", "karmaConfig": "lib/insights/karma.conf.js", "codeCoverage": true, "sourceMap": true diff --git a/demo-shell/src/app/app-extension.module.ts b/demo-shell/src/app/app-extension.module.ts new file mode 100644 index 0000000000..63a3017383 --- /dev/null +++ b/demo-shell/src/app/app-extension.module.ts @@ -0,0 +1,27 @@ +/*! + * @license + * Copyright 2019 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { NgModule } from '@angular/core'; +import { AcaMonacoModule } from 'adf-monaco-extension'; + +@NgModule({ + imports: [ + AcaMonacoModule + ] +}) +export class AppExtensionsModule { +} diff --git a/demo-shell/src/app/app.module.ts b/demo-shell/src/app/app.module.ts index 16a29c4618..84914b8208 100644 --- a/demo-shell/src/app/app.module.ts +++ b/demo-shell/src/app/app.module.ts @@ -24,6 +24,7 @@ import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { AppConfigService, TRANSLATION_PROVIDER, DebugAppConfigService, CoreModule } from '@alfresco/adf-core'; +import { ExtensionsModule } from '@alfresco/adf-extensions'; import { AppComponent } from './app.component'; import { MaterialModule } from './material.module'; import { LoginComponent } from './components/login/login.component'; @@ -65,7 +66,6 @@ import { ProcessModule } from '@alfresco/adf-process-services'; import { AuthBearerInterceptor } from './services'; import { ProcessServicesCloudModule, GroupCloudModule } from '@alfresco/adf-process-services-cloud'; import { TreeViewSampleComponent } from './components/tree-view/tree-view-sample.component'; -import { AppExtensionsModule } from './extensions/extensions.module'; import { CloudLayoutComponent } from './components/app-layout/cloud/cloud-layout.component'; import { AppsCloudDemoComponent } from './components/app-layout/cloud/apps-cloud-demo.component'; import { ProcessesCloudDemoComponent } from './components/app-layout/cloud/processes-cloud-demo.component'; @@ -78,6 +78,7 @@ import { StartProcessCloudDemoComponent } from './components/app-layout/cloud/st import { TemplateDemoComponent } from './components/template-list/template-demo.component'; import { PeopleGroupCloudDemoComponent } from './components/app-layout/cloud/people-groups-cloud-demo.component'; import { CloudSettingsComponent } from './components/app-layout/cloud/cloud-settings.component'; +import { AppExtensionsModule } from './app-extension.module'; @NgModule({ imports: [ @@ -88,16 +89,18 @@ import { CloudSettingsComponent } from './components/app-layout/cloud/cloud-sett FormsModule, HttpClientModule, MaterialModule, + AppExtensionsModule, FlexLayoutModule, CoreModule.forRoot(), ContentModule.forRoot(), InsightsModule.forRoot(), ProcessModule.forRoot(), + ProcessServicesCloudModule, + ExtensionsModule.forRoot(), ThemePickerModule, ChartsModule, MonacoEditorModule.forRoot(), ProcessServicesCloudModule, - AppExtensionsModule.forRoot(), GroupCloudModule ], declarations: [ diff --git a/demo-shell/src/app/components/about/about.component.ts b/demo-shell/src/app/components/about/about.component.ts index 68b61f2d6b..9e450a476c 100644 --- a/demo-shell/src/app/components/about/about.component.ts +++ b/demo-shell/src/app/components/about/about.component.ts @@ -16,8 +16,7 @@ */ import { Component } from '@angular/core'; -import { ExtensionRef } from '@alfresco/adf-extensions'; -import { AppExtensionService } from '../../extensions/extension.service'; +import { AppExtensionService, ExtensionRef } from '@alfresco/adf-extensions'; import { Observable } from 'rxjs'; @Component({ diff --git a/demo-shell/src/app/components/app-layout/cloud/start-process-cloud-demo.component.ts b/demo-shell/src/app/components/app-layout/cloud/start-process-cloud-demo.component.ts index ed1e24bb0a..9fff604ef6 100644 --- a/demo-shell/src/app/components/app-layout/cloud/start-process-cloud-demo.component.ts +++ b/demo-shell/src/app/components/app-layout/cloud/start-process-cloud-demo.component.ts @@ -19,6 +19,7 @@ import { Component, OnInit } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { NotificationService, AppConfigService } from '@alfresco/adf-core'; import { CloudLayoutService } from './services/cloud-layout.service'; + @Component({ templateUrl: './start-process-cloud-demo.component.html', styleUrls: ['./start-process-cloud-demo.component.scss'] diff --git a/demo-shell/src/app/components/file-view/file-view.component.html b/demo-shell/src/app/components/file-view/file-view.component.html index 3488d76c8f..0fa9cb5a31 100644 --- a/demo-shell/src/app/components/file-view/file-view.component.html +++ b/demo-shell/src/app/components/file-view/file-view.component.html @@ -4,7 +4,7 @@ - + diff --git a/demo-shell/src/app/components/file-view/file-view.component.scss b/demo-shell/src/app/components/file-view/file-view.component.scss index a834b0602b..2be390eb61 100644 --- a/demo-shell/src/app/components/file-view/file-view.component.scss +++ b/demo-shell/src/app/components/file-view/file-view.component.scss @@ -1,3 +1,12 @@ .adf-viewer__sidebar { width: 380px !important; } + +/* stylelint-disable */ +.monaco-scrollable-element { + width: 600px; +} + +adf-preview-extension { + width: 600px; +} diff --git a/demo-shell/src/app/components/file-view/file-view.component.ts b/demo-shell/src/app/components/file-view/file-view.component.ts index 86ad27b4c2..2fcb5aa68c 100644 --- a/demo-shell/src/app/components/file-view/file-view.component.ts +++ b/demo-shell/src/app/components/file-view/file-view.component.ts @@ -17,7 +17,7 @@ import { Component, OnInit, ViewEncapsulation } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; -import { ContentService, PermissionsEnum, NodesApiService } from '@alfresco/adf-core'; +import { ContentService, AllowableOperationsEnum, PermissionsEnum, NodesApiService } from '@alfresco/adf-core'; import { MatSnackBar } from '@angular/material'; @Component({ @@ -52,7 +52,7 @@ export class FileViewComponent implements OnInit { showLeftSidebar = null; showRightSidebar = false; customToolbar = false; - isCommentDisabled = false; + isCommentEnabled = false; constructor(private router: Router, private route: ActivatedRoute, @@ -68,7 +68,8 @@ export class FileViewComponent implements OnInit { this.nodeApiService.getNode(id).subscribe( (node) => { if (node && node.isFile) { - this.isCommentDisabled = this.contentServices.hasPermissions(node, PermissionsEnum.CONSUMER); + this.isCommentEnabled = this.contentServices.hasPermissions(node, PermissionsEnum.NOT_CONSUMER) || + this.contentServices.hasAllowableOperations(node, AllowableOperationsEnum.UPDATE); this.nodeId = id; return; } diff --git a/demo-shell/src/app/components/form/form-list.component.ts b/demo-shell/src/app/components/form/form-list.component.ts index 494c3c5910..5bc660b9e8 100644 --- a/demo-shell/src/app/components/form/form-list.component.ts +++ b/demo-shell/src/app/components/form/form-list.component.ts @@ -16,8 +16,7 @@ */ import { Component, ViewChild } from '@angular/core'; -import { FormComponent, FormModel, FormService, LogService } from '@alfresco/adf-core'; -import { FormOutcomeEvent } from '../../../../../lib/core/form/components/widgets/core'; +import { FormComponent, FormModel, FormService, LogService, FormOutcomeEvent } from '@alfresco/adf-core'; @Component({ selector: 'app-form-list', diff --git a/demo-shell/src/app/components/process-service/task-attachments.component.ts b/demo-shell/src/app/components/process-service/task-attachments.component.ts index dc5abe30ab..f235452b58 100644 --- a/demo-shell/src/app/components/process-service/task-attachments.component.ts +++ b/demo-shell/src/app/components/process-service/task-attachments.component.ts @@ -22,10 +22,9 @@ import { TaskDetailsModel, TaskUploadService } from '@alfresco/adf-process-services'; -import { UploadService, AlfrescoApiService, AppConfigService } from '@alfresco/adf-core'; +import { UploadService, AlfrescoApiService, AppConfigService, FileUploadCompleteEvent } from '@alfresco/adf-core'; import { PreviewService } from '../../services/preview.service'; import { Subscription } from 'rxjs'; -import { FileUploadCompleteEvent } from '../../../../../lib/core/events/file.event'; export function taskUploadServiceFactory(api: AlfrescoApiService, config: AppConfigService) { return new TaskUploadService(api, config); diff --git a/demo-shell/src/app/extensions/extensions.module.ts b/demo-shell/src/app/extensions/extensions.module.ts deleted file mode 100644 index 24d68622c8..0000000000 --- a/demo-shell/src/app/extensions/extensions.module.ts +++ /dev/null @@ -1,51 +0,0 @@ -/*! - * @license - * Copyright 2019 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { NgModule, ModuleWithProviders, APP_INITIALIZER } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { CoreModule } from '@alfresco/adf-core'; -import { AppExtensionService } from './extension.service'; -import { ExtensionsModule } from '@alfresco/adf-extensions'; - -export function setupExtensions(service: AppExtensionService): Function { - return () => service.load(); -} - -@NgModule({ - imports: [CommonModule, CoreModule.forChild(), ExtensionsModule] -}) -export class AppExtensionsModule { - static forRoot(): ModuleWithProviders { - return { - ngModule: AppExtensionsModule, - providers: [ - { - provide: APP_INITIALIZER, - useFactory: setupExtensions, - deps: [AppExtensionService], - multi: true - } - ] - }; - } - - static forChild(): ModuleWithProviders { - return { - ngModule: AppExtensionsModule - }; - } -} diff --git a/demo-shell/src/assets/.gitkeep b/demo-shell/src/assets/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/demo-shell/src/assets/app.extensions.json b/demo-shell/src/assets/app.extensions.json index ecda91eb59..a7e0183e9d 100644 --- a/demo-shell/src/assets/app.extensions.json +++ b/demo-shell/src/assets/app.extensions.json @@ -1,15 +1,9 @@ { - "$schema": "./extension.schema.json", - "$id": "app.1.0.0", - "$name": "app", - "$version": "1.0.0", - "$vendor": "Alfresco", - "$license": "Apache-2.0", - "$runtime": "2.7.0", - "$description": "base application extensions", + "$schema": "../../lib/extensions/config/schema/app-extension.schema.json", "$references": [ "plugin1.json", - "plugin2.json" + "plugin2.json", + "monaco-extension.json" ], "$dependencies": [] } diff --git a/demo-shell/src/assets/plugins/monaco-extension.json b/demo-shell/src/assets/plugins/monaco-extension.json new file mode 100644 index 0000000000..1b5cc0d874 --- /dev/null +++ b/demo-shell/src/assets/plugins/monaco-extension.json @@ -0,0 +1,17 @@ +{ + "$schema": "../../../lib/extensions/config/schema/plugin-extension.schema.json", + "$version": "1.0.0", + "$name": "monaco extension", + "$description": "monaco plugin", + "features": { + "viewer": { + "content": [ + { + "id": "dev.tools.viewer", + "fileExtension": "js", + "component": "monaco-extension.main.component" + } + ] + } + } +} diff --git a/demo-shell/src/assets/plugins/plugin1.json b/demo-shell/src/assets/plugins/plugin1.json index 72d2095dac..63991be786 100644 --- a/demo-shell/src/assets/plugins/plugin1.json +++ b/demo-shell/src/assets/plugins/plugin1.json @@ -1,16 +1,11 @@ { - "$schema": "../extension.schema.json", - "$id": "plugin1.1.0.0", + "$schema": "../../../lib/extensions/config/schema/plugin-extension.schema.json", "$name": "plugin1", "$version": "1.0.0", "$vendor": "Alfresco", "$license": "Apache-2.0", "$runtime": "2.7.0", "$description": "example plugin", - "$dependencies": [ - "@some/library1" - ], - "features": { "custom": { "key": "value" diff --git a/demo-shell/src/assets/plugins/plugin2.json b/demo-shell/src/assets/plugins/plugin2.json index 7afe124bb5..508f7c82ec 100644 --- a/demo-shell/src/assets/plugins/plugin2.json +++ b/demo-shell/src/assets/plugins/plugin2.json @@ -1,16 +1,11 @@ { - "$schema": "../extension.schema.json", - "$id": "plugin2.1.1.0", + "$schema": "../../../lib/extensions/config/schema/plugin-extension.schema.json", "$name": "plugin2", "$version": "1.1.0", "$vendor": "Alfresco", "$license": "Apache-2.0", "$runtime": "2.7.0", "$description": "another example plugin", - "$dependencies": [ - "@some/library2" - ], - "features": { "extra": { "key": "value" diff --git a/demo-shell/src/tsconfig.app.json b/demo-shell/src/tsconfig.app.json index 66f72873a2..7166e04043 100644 --- a/demo-shell/src/tsconfig.app.json +++ b/demo-shell/src/tsconfig.app.json @@ -4,30 +4,7 @@ "outDir": "../out-tsc/app", "module": "es2015", "baseUrl": ".", - "types": [], - "paths": { - "@alfresco/adf-extensions": [ - "../../lib/extensions" - ], - "@alfresco/adf-core": [ - "../../lib/core" - ], - "@alfresco/adf-process-services-cloud": [ - "../../lib/process-services-cloud" - ], - "@alfresco/adf-testing": [ - "../../lib/testing" - ], - "@alfresco/adf-content-services": [ - "../../lib/content-services" - ], - "@alfresco/adf-process-services": [ - "../../lib/process-services" - ], - "@alfresco/adf-insights": [ - "../../lib/insights" - ] - } + "types": [] }, "exclude": [ "test.ts", diff --git a/e2e/core/card-view/aspect-oriented-config.e2e.ts b/e2e/core/card-view/aspect-oriented-config.e2e.ts index b4070736df..bf38664232 100644 --- a/e2e/core/card-view/aspect-oriented-config.e2e.ts +++ b/e2e/core/card-view/aspect-oriented-config.e2e.ts @@ -88,7 +88,7 @@ describe('Aspect oriented config', () => { it('[C261117] Should be possible restrict the display properties of one an aspect', () => { - configEditorPage.enterConfiguration('{ "presets": {' + + configEditorPage.enterBigConfigurationText('{ "presets": {' + ' "default": [{' + ' "title": "IMAGE",' + ' "items": [' + @@ -123,7 +123,7 @@ describe('Aspect oriented config', () => { it('[C260185] Should ignore not existing aspect when present in the configuration', () => { - configEditorPage.enterConfiguration(' {' + + configEditorPage.enterBigConfigurationText(' {' + ' "presets": {' + ' "default": {' + ' "exif:exif": "*",' + @@ -152,7 +152,7 @@ describe('Aspect oriented config', () => { it('[C260183] Should show all the aspect if the content-metadata configuration is NOT provided', () => { - configEditorPage.enterConfiguration('{ }'); + configEditorPage.enterBigConfigurationText('{ }'); configEditorPage.clickSaveButton(); @@ -176,7 +176,7 @@ describe('Aspect oriented config', () => { it('[C260182] Should show all the aspects if the default configuration contains the star symbol', () => { - configEditorPage.enterConfiguration('{' + + configEditorPage.enterBigConfigurationText('{' + ' "presets": {' + ' "default": "*"' + ' }' + @@ -205,7 +205,7 @@ describe('Aspect oriented config', () => { it('[C268899] Should be possible use a Translation key as Title of a metadata group', () => { - configEditorPage.enterConfiguration('{' + + configEditorPage.enterBigConfigurationText('{' + ' "presets": {' + ' "default": [' + ' {' + @@ -221,11 +221,8 @@ describe('Aspect oriented config', () => { ' "title": "GROUP-TITLE2-TRANSLATION-KEY",' + ' "items": [' + ' {' + - ' "aspect": "kitten:food",' + - ' "properties": [' + - ' "kitten:favourite-food",' + - ' "kitten:recommended-food"' + - ' ]' + + ' "aspect": "exif:exif"' + + ' "properties": "*"' + ' }' + ' ]' + ' }' + @@ -255,7 +252,7 @@ describe('Aspect oriented config', () => { it('[C279968] Should be possible use a custom preset', () => { - configEditorPage.enterConfiguration('{' + + configEditorPage.enterBigConfigurationText('{' + ' "presets": {' + ' "custom-preset": {' + ' "exif:exif": "*",' + diff --git a/lib/content-services/content-node-selector/content-node-selector.component.spec.ts b/lib/content-services/content-node-selector/content-node-selector.component.spec.ts index 628a35a1ef..75ede2ffe0 100644 --- a/lib/content-services/content-node-selector/content-node-selector.component.spec.ts +++ b/lib/content-services/content-node-selector/content-node-selector.component.spec.ts @@ -27,6 +27,7 @@ import { of } from 'rxjs'; import { ContentTestingModule } from '../testing/content.testing.module'; import { DocumentListService } from '../document-list/services/document-list.service'; import { DocumentListComponent } from '../document-list/components/document-list.component'; +import { ShareDataRow } from '../document-list'; describe('ContentNodeSelectorDialogComponent', () => { @@ -36,7 +37,10 @@ describe('ContentNodeSelectorDialogComponent', () => { title: 'Move along citizen...', actionName: 'move', select: new EventEmitter(), - rowFilter: () => { + rowFilter: (shareDataRow: ShareDataRow) => { + if (shareDataRow.node.entry.name === 'impossible-name') { + return true; + } }, imageResolver: () => 'piccolo', currentFolderId: 'cat-girl-nuku-nuku' @@ -88,14 +92,25 @@ describe('ContentNodeSelectorDialogComponent', () => { expect(documentList.componentInstance.currentFolderId).toBe('cat-girl-nuku-nuku'); }); - xit('should pass through the injected rowFilter to the documentList', (done) => { - fixture.whenStable().then(() => { - let documentList = fixture.debugElement.query(By.directive(DocumentListComponent)); - expect(documentList).not.toBeNull('Document list should be shown'); - expect(documentList.componentInstance.rowFilter).toBe(data.rowFilter); - done(); - }); - + it('should pass through the injected rowFilter to the documentList', () => { + let documentList = fixture.debugElement.query(By.directive(DocumentListComponent)); + expect(documentList).not.toBeNull('Document list should be shown'); + expect(documentList.componentInstance.rowFilter({ + node: { + entry: new Node({ + name: 'impossible-name', + id: 'name' + }) + } + })) + .toBe(data.rowFilter( { + node: { + entry: new Node({ + name: 'impossible-name', + id: 'name' + }) + } + })); }); it('should pass through the injected imageResolver to the documentList', () => { diff --git a/lib/content-services/content-node-share/content-node-share.dialog.spec.ts b/lib/content-services/content-node-share/content-node-share.dialog.spec.ts index eb82ba6f5f..73b16865c6 100644 --- a/lib/content-services/content-node-share/content-node-share.dialog.spec.ts +++ b/lib/content-services/content-node-share/content-node-share.dialog.spec.ts @@ -120,31 +120,6 @@ describe('ShareDialogComponent', () => { }); })); - xit(`should copy shared link and notify on button event`, (done) => { - node.entry.properties['qshare:sharedId'] = 'sharedId'; - spyOn(document, 'execCommand').and.callThrough(); - - component.data = { - node, - baseShareUrl: 'some-url/' - }; - - fixture.detectChanges(); - - fixture.whenStable().then(() => { - fixture.detectChanges(); - - fixture.nativeElement.querySelector('.adf-input-action') - .dispatchEvent(new MouseEvent('click')); - - fixture.detectChanges(); - - expect(document.execCommand).toHaveBeenCalledWith('copy'); - expect(notificationServiceMock.openSnackMessage).toHaveBeenCalledWith('SHARE.CLIPBOARD-MESSAGE'); - done(); - }); - }); - it('should open a confirmation dialog when unshare button is triggered', () => { spyOn(matDialog, 'open').and.returnValue({ beforeClose: () => of(false) }); spyOn(sharedLinksApiService, 'deleteSharedLink').and.callThrough(); diff --git a/lib/content-services/document-list/components/document-list.component.spec.ts b/lib/content-services/document-list/components/document-list.component.spec.ts index 194e350b7c..7c3471087c 100644 --- a/lib/content-services/document-list/components/document-list.component.spec.ts +++ b/lib/content-services/document-list/components/document-list.component.spec.ts @@ -1219,7 +1219,7 @@ describe('DocumentList', () => { documentList.loadFolderByNodeId('-recent-'); }); - xit('should emit error when fetch recent fails on search call', (done) => { + it('should emit error when fetch recent fails on search call', (done) => { spyOn(customResourcesService, 'loadFolderByNodeId').and.returnValue(throwError('error')); let disposableError = documentList.error.subscribe((val) => { diff --git a/lib/content-services/folder-directive/folder-create.directive.spec.ts b/lib/content-services/folder-directive/folder-create.directive.spec.ts index 1c7c1817a8..f7462d82a2 100644 --- a/lib/content-services/folder-directive/folder-create.directive.spec.ts +++ b/lib/content-services/folder-directive/folder-create.directive.spec.ts @@ -55,7 +55,6 @@ class TestComponent { describe('FolderCreateDirective', () => { let fixture: ComponentFixture; let element; - let node: any; let dialog: MatDialog; let contentService: ContentService; let dialogRefMock; @@ -85,8 +84,6 @@ describe('FolderCreateDirective', () => { }); beforeEach(() => { - node = { entry: { id: 'nodeId' } }; - dialogRefMock = { afterClosed: (val) => of(val), componentInstance: { @@ -106,22 +103,6 @@ describe('FolderCreateDirective', () => { spyOn(dialog, 'open').and.returnValue(dialogRefMock); }); - xit('should emit folderCreate event when input value is not undefined', (done) => { - spyOn(dialogRefMock, 'afterClosed').and.returnValue(of(node)); - spyOn(contentService.folderCreate, 'next'); - - contentService.folderCreate.subscribe((val) => { - expect(val).toBe(node); - done(); - }); - - fixture.detectChanges(); - - fixture.whenStable().then(() => { - element.nativeElement.click(); - }); - }); - it('should not emit folderCreate event when input value is undefined', () => { spyOn(dialogRefMock, 'afterClosed').and.returnValue(of(null)); spyOn(contentService.folderCreate, 'next'); diff --git a/lib/content-services/ng-package.json b/lib/content-services/ng-package.json index c5f43efa53..ae3b199144 100644 --- a/lib/content-services/ng-package.json +++ b/lib/content-services/ng-package.json @@ -9,7 +9,7 @@ "entryFile": "./public-api.ts", "flatModuleFile": "adf-content-services", "umdModuleIds": { - "@alfresco/js-api": "@alfresco/js-ap", + "@alfresco/js-api": "@alfresco/js-api", "minimatch": "minimatch", "@angular/platform-browser/animations": "@angular/platform-browser/animations", "@angular/material": "@angular/material", diff --git a/lib/content-services/tree-view/services/tree-view.service.spec.ts b/lib/content-services/tree-view/services/tree-view.service.spec.ts index a6e7a2f660..85e2dd7cd8 100644 --- a/lib/content-services/tree-view/services/tree-view.service.spec.ts +++ b/lib/content-services/tree-view/services/tree-view.service.spec.ts @@ -20,7 +20,7 @@ import { TreeViewService } from './tree-view.service'; import { TestBed } from '@angular/core/testing'; import { ContentTestingModule } from '../../testing/content.testing.module'; import { of } from 'rxjs'; -import { TreeBaseNode } from 'tree-view/models/tree-view.model'; +import { TreeBaseNode } from '../models/tree-view.model'; describe('TreeViewService', () => { diff --git a/lib/content-services/tsconfig.json b/lib/content-services/tsconfig.json deleted file mode 100644 index c62a7416e0..0000000000 --- a/lib/content-services/tsconfig.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "compilerOptions": { - "target": "es5", - "module": "commonjs", - "moduleResolution": "node", - "sourceMap": true, - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "skipLibCheck": false, - "noLib": false, - "allowUnreachableCode": false, - "allowUnusedLabels": false, - "noImplicitAny": false, - "noImplicitReturns": false, - "noImplicitUseStrict": false, - "noFallthroughCasesInSwitch": true, - "removeComments": true, - "declaration": true, - "outDir": "../dist/content-services/", - "baseUrl" : "./", - "paths": { - "@alfresco/adf-process-services": ["../process-services"], - "@alfresco/adf-core": ["../core"] - }, - "lib": [ - "es2016", - "dom" - ], - "suppressImplicitAnyIndexErrors": true, - "noUnusedLocals": true - }, - "exclude": [ - "demo", - "node_modules", - "dist" - ], - "angularCompilerOptions": { - "strictMetadataEmit": false, - "skipTemplateCodegen": true - } -} diff --git a/lib/content-services/tsconfig.lib.json b/lib/content-services/tsconfig.lib.json new file mode 100644 index 0000000000..7cffb50412 --- /dev/null +++ b/lib/content-services/tsconfig.lib.json @@ -0,0 +1,6 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "outDir": "../dist/content-services/" + } +} diff --git a/lib/content-services/tsconfig.spec.json b/lib/content-services/tsconfig.spec.json new file mode 100644 index 0000000000..ab9099eca3 --- /dev/null +++ b/lib/content-services/tsconfig.spec.json @@ -0,0 +1,6 @@ +{ + "extends": "../tsconfig.spec.json", + "files": [ + "test.ts" + ] +} diff --git a/lib/core/app-config/schema.json b/lib/core/app-config/schema.json index 8eaf04ee1a..c29f531bb1 100644 --- a/lib/core/app-config/schema.json +++ b/lib/core/app-config/schema.json @@ -1106,7 +1106,6 @@ }, "categories": { "type": "array", - "minItems": 1, "items": { "type": "object", "required": [ diff --git a/lib/core/core.module.ts b/lib/core/core.module.ts index 2f6d394d11..742a3f3eb9 100644 --- a/lib/core/core.module.ts +++ b/lib/core/core.module.ts @@ -52,10 +52,12 @@ import { startupServiceFactory } from './services/startup-service-factory'; import { SortingPickerModule } from './sorting-picker/sorting-picker.module'; import { IconModule } from './icon/icon.module'; import { TranslateLoaderService } from './services/translate-loader.service'; +import { ExtensionsModule } from '@alfresco/adf-extensions'; @NgModule({ imports: [ TranslateModule, + ExtensionsModule.forChild(), AboutModule, ViewerModule, SidenavLayoutModule, diff --git a/lib/core/form/components/form.component.spec.ts b/lib/core/form/components/form.component.spec.ts index 86a414f78f..56d1e44d22 100644 --- a/lib/core/form/components/form.component.spec.ts +++ b/lib/core/form/components/form.component.spec.ts @@ -627,14 +627,14 @@ describe('FormComponent', () => { it('should parse form from json', () => { let form = formComponent.parseForm({ - id: '', + id: 1, fields: [ { id: 'field1', type: FormFieldTypes.CONTAINER } ] }); expect(form).toBeDefined(); - expect(form.id).toBe(''); + expect(form.id).toBe(1); expect(form.fields.length).toBe(1); expect(form.fields[0].id).toBe('field1'); }); @@ -642,7 +642,7 @@ describe('FormComponent', () => { it('should provide outcomes for form definition', () => { spyOn(formComponent, 'getFormDefinitionOutcomes').and.callThrough(); - let form = formComponent.parseForm({ id: '' }); + let form = formComponent.parseForm({ id: 1 }); expect(formComponent.getFormDefinitionOutcomes).toHaveBeenCalledWith(form); }); diff --git a/lib/core/ng-package.json b/lib/core/ng-package.json index 4f21e42b7b..8337c7246a 100644 --- a/lib/core/ng-package.json +++ b/lib/core/ng-package.json @@ -9,7 +9,7 @@ "entryFile": "./public-api.ts", "flatModuleFile": "adf-core", "umdModuleIds": { - "@alfresco/js-api": "@alfresco/js-ap", + "@alfresco/js-api": "@alfresco/js-api", "minimatch": "minimatch-browser", "@angular/platform-browser/animations": "@angular/platform-browser/animations", "@angular/material": "@angular/material", @@ -23,7 +23,8 @@ "moment": "moment", "moment-es6": "moment-es6", "moment/src/moment": "moment/src/moment", - "@ngx-translate/core": "@ngx-translate/core" + "@ngx-translate/core": "@ngx-translate/core", + "rxjs": "rxjs" } } } diff --git a/lib/core/tsconfig.json b/lib/core/tsconfig.json deleted file mode 100644 index e45eb0a69b..0000000000 --- a/lib/core/tsconfig.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "compilerOptions": { - "target": "es5", - "module": "commonjs", - "moduleResolution": "node", - "sourceMap": true, - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "skipLibCheck": false, - "noLib": false, - "allowUnreachableCode": false, - "allowUnusedLabels": false, - "noImplicitAny": false, - "noImplicitReturns": false, - "noImplicitUseStrict": false, - "noFallthroughCasesInSwitch": true, - "removeComments": true, - "declaration": true, - "outDir": "../dist/core/", - "baseUrl": "./", - "allowSyntheticDefaultImports": true, - "paths": { - "@alfresco/adf-process-services": [ - "../process-services" - ], - "@alfresco/adf-content-services": [ - "../content-services" - ] - }, - "lib": [ - "es2016", - "dom" - ], - "suppressImplicitAnyIndexErrors": true, - "noUnusedLocals": true - }, - "exclude": [ - "demo", - "node_modules", - "dist" - ], - "angularCompilerOptions": { - "strictMetadataEmit": false, - "skipTemplateCodegen": true - } -} diff --git a/lib/core/tsconfig.lib.json b/lib/core/tsconfig.lib.json new file mode 100644 index 0000000000..049b4da4fc --- /dev/null +++ b/lib/core/tsconfig.lib.json @@ -0,0 +1,6 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "outDir": "../dist/core/" + } +} diff --git a/lib/core/tsconfig.spec.json b/lib/core/tsconfig.spec.json new file mode 100644 index 0000000000..ab9099eca3 --- /dev/null +++ b/lib/core/tsconfig.spec.json @@ -0,0 +1,6 @@ +{ + "extends": "../tsconfig.spec.json", + "files": [ + "test.ts" + ] +} diff --git a/lib/core/viewer/components/viewer.component.html b/lib/core/viewer/components/viewer.component.html index d919585579..c7c820da77 100644 --- a/lib/core/viewer/components/viewer.component.html +++ b/lib/core/viewer/components/viewer.component.html @@ -76,7 +76,7 @@ mat-icon-button title="{{ 'ADF_VIEWER.ACTIONS.DOWNLOAD' | translate }}" data-automation-id="adf-toolbar-download" - [adfNodeDownload]="node"> + [adfNodeDownload]="nodeEntry"> file_download @@ -169,6 +169,7 @@
+ @@ -195,8 +196,22 @@ + + + + + + - + diff --git a/lib/core/viewer/components/viewer.component.spec.ts b/lib/core/viewer/components/viewer.component.spec.ts index 08cef2a41a..a1d4cd31e4 100644 --- a/lib/core/viewer/components/viewer.component.spec.ts +++ b/lib/core/viewer/components/viewer.component.spec.ts @@ -600,10 +600,10 @@ describe('ViewerComponent', () => { }); it('should get and assign node for download', (done) => { - const node = { id: 'fake-node' }; component.nodeId = '12'; component.urlFile = ''; const displayName = 'the-name'; + const node = new NodeEntry({ entry: { name: displayName, id: '12', content: { mimeType: 'txt' } } }); const nodeDetails = { name: displayName, id: '12', content: { mimeType: 'txt' } }; const contentUrl = '/content/url/path'; const alfrescoApiInstanceMock = { @@ -618,7 +618,7 @@ describe('ViewerComponent', () => { component.ngOnChanges(null); fixture.whenStable().then(() => { fixture.detectChanges(); - expect(component.node).toBe(node); + expect(component.nodeEntry).toBe(node); done(); }); }); diff --git a/lib/core/viewer/components/viewer.component.ts b/lib/core/viewer/components/viewer.component.ts index 601b95b186..d92b84df61 100644 --- a/lib/core/viewer/components/viewer.component.ts +++ b/lib/core/viewer/components/viewer.component.ts @@ -31,6 +31,7 @@ import { ViewerSidebarComponent } from './viewer-sidebar.component'; import { ViewerToolbarComponent } from './viewer-toolbar.component'; import { Subscription } from 'rxjs'; import { ViewUtilService } from '../services/view-util.service'; +import { ExtensionService, ViewerExtensionRef } from '@alfresco/adf-extensions'; @Component({ selector: 'adf-viewer', @@ -201,7 +202,7 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy { viewerType = 'unknown'; isLoading = false; - node: NodeEntry; + nodeEntry: NodeEntry; extensionTemplates: { template: TemplateRef, isVisible: boolean }[] = []; externalExtensions: string[] = []; @@ -211,6 +212,7 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy { sidebarRightTemplateContext: { node: Node } = { node: null }; sidebarLeftTemplateContext: { node: Node } = { node: null }; fileTitle: string; + viewerExtensions: Array = []; private cacheBusterNumber; @@ -220,7 +222,7 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy { private extensions = { image: ['png', 'jpg', 'jpeg', 'gif', 'bpm', 'svg'], media: ['wav', 'mp4', 'mp3', 'webm', 'ogg'], - text: ['txt', 'xml', 'js', 'html', 'json', 'ts', 'css', 'md'], + text: ['txt', 'xml', 'html', 'json', 'ts', 'css', 'md'], pdf: ['pdf'] }; @@ -236,6 +238,7 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy { private viewUtils: ViewUtilService, private logService: LogService, private location: Location, + private extensionService: ExtensionService, private el: ElementRef) { } @@ -247,6 +250,15 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy { this.subscriptions.push( this.apiService.nodeUpdated.subscribe((node) => this.onNodeUpdated(node)) ); + + this.extensionLoad(); + } + + private extensionLoad() { + this.viewerExtensions = this.extensionService.getFeature('viewer.content'); + this.viewerExtensions.forEach((currentViewerExtension: ViewerExtensionRef) => { + this.externalExtensions.push(currentViewerExtension.fileExtension); + }); } ngOnDestroy() { @@ -280,7 +292,7 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy { } else if (this.nodeId) { this.apiService.nodesApi.getNode(this.nodeId, { include: ['allowableOperations'] }).then( (node: NodeEntry) => { - this.node = node; + this.nodeEntry = node; this.setUpNodeFile(node.entry).then(() => { this.isLoading = false; }); diff --git a/lib/core/viewer/viewer.module.ts b/lib/core/viewer/viewer.module.ts index 2717e49729..56d410f6d8 100644 --- a/lib/core/viewer/viewer.module.ts +++ b/lib/core/viewer/viewer.module.ts @@ -21,6 +21,8 @@ import { TranslateModule } from '@ngx-translate/core'; import { FlexLayoutModule } from '@angular/flex-layout'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; +import { ExtensionsModule } from '@alfresco/adf-extensions'; + import { MaterialModule } from '../material.module'; import { ToolbarModule } from '../toolbar/toolbar.module'; import { PipeModule } from '../pipes/pipe.module'; @@ -43,6 +45,7 @@ import { DirectiveModule } from '../directives/directive.module'; @NgModule({ imports: [ + ExtensionsModule, CommonModule, MaterialModule, TranslateModule.forChild(), diff --git a/lib/extensions/ng-package.json b/lib/extensions/ng-package.json index 5fcc2568b7..5eb0fcd86c 100644 --- a/lib/extensions/ng-package.json +++ b/lib/extensions/ng-package.json @@ -7,7 +7,23 @@ "entryFile": "src/public-api.ts", "flatModuleFile": "adf-extensions", "umdModuleIds": { - "@alfresco/js-api": "@alfresco/js-ap" + "@alfresco/js-api": "@alfresco/js-api", + "minimatch": "minimatch", + "@angular/platform-browser/animations": "@angular/platform-browser/animations", + "@angular/material": "@angular/material", + "@mat-datetimepicker": "@mat-datetimepicker", + "@angular/flex-layout": "@angular/flex-layout", + "@alfresco/adf-core": "@alfresco/adf-core", + "@alfresco/adf-content-services": "@alfresco/adf-content-services", + "@angular/material-moment-adapter": "@angular/material-moment-adapter", + "@angular/animations": "@angular/animations", + "@angular/cdk/platform": "@angular/cdk/platform", + "@angular/material/core": "@angular/material/core", + "moment": "moment", + "moment-es6": "moment-es6", + "moment/src/moment": "moment/src/moment", + "@ngx-translate/core": "@ngx-translate/core", + "rxjs": "rxjs" } } } diff --git a/lib/extensions/package.json b/lib/extensions/package.json index 42386f7d42..985e7e71c9 100644 --- a/lib/extensions/package.json +++ b/lib/extensions/package.json @@ -2,7 +2,6 @@ "name": "@alfresco/adf-extensions", "description": "Provides extensibility support for ADF applications.", "version": "3.0.0", - "license": "Apache-2.0", "author": "Alfresco Software, Ltd.", "main": "bundles/adf-extensions.js", "repository": { @@ -13,9 +12,17 @@ "url": "https://github.com/Alfresco/alfresco-ng2-components/issues" }, "peerDependencies": { - "@angular/common": "^6.0.0", - "@angular/core": "^6.0.0", - "@angular/http": "^6.1.4", + "@angular/common": ">=7.0.3", + "@angular/core": ">=7.0.3", + "@angular/http": ">=7.0.3", "@alfresco/js-api": "3.0.0" - } + }, + "keywords": [ + "extensions", + "alfresco-component", + "angular", + "activiti", + "components" + ], + "license": "Apache-2.0" } diff --git a/lib/extensions/src/lib/components/public-api.ts b/lib/extensions/src/lib/components/public-api.ts new file mode 100644 index 0000000000..519440acf6 --- /dev/null +++ b/lib/extensions/src/lib/components/public-api.ts @@ -0,0 +1,21 @@ +/*! + * @license + * Copyright 2019 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from './viewer/preview-extension.component'; +export * from './dynamic-column/dynamic-column.component'; +export * from './dynamic-component/dynamic.component'; +export * from './dynamic-tab/dynamic-tab.component'; diff --git a/lib/extensions/src/lib/components/viewer/preview-extension.component.ts b/lib/extensions/src/lib/components/viewer/preview-extension.component.ts new file mode 100644 index 0000000000..43eedff097 --- /dev/null +++ b/lib/extensions/src/lib/components/viewer/preview-extension.component.ts @@ -0,0 +1,99 @@ +/*! + * @license + * Copyright 2019 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { + Component, + Input, + ComponentRef, + OnInit, + ComponentFactoryResolver, + ViewChild, + ViewContainerRef, + OnDestroy, + OnChanges +} from '@angular/core'; +import { ExtensionService } from '../../services/extension.service'; +import { Node } from '@alfresco/js-api'; + +@Component({ + selector: 'adf-preview-extension', + template: ` +
+ ` +}) +export class PreviewExtensionComponent implements OnInit, OnChanges, OnDestroy { + @ViewChild('content', { read: ViewContainerRef }) + content: ViewContainerRef; + + @Input() + id: string; + + @Input() + url: string; + + @Input() + extension: string; + + @Input() + node: Node; + + private componentRef: ComponentRef; + + constructor( + private extensionService: ExtensionService, + private componentFactoryResolver: ComponentFactoryResolver + ) {} + + ngOnInit() { + if (!this.id) { + return; + } + + const componentType = this.extensionService.getComponentById(this.id); + if (componentType) { + const factory = this.componentFactoryResolver.resolveComponentFactory( + componentType + ); + if (factory) { + this.content.clear(); + this.componentRef = this.content.createComponent(factory, 0); + this.updateInstance(); + } + } + } + + ngOnChanges() { + this.updateInstance(); + } + + ngOnDestroy() { + if (this.componentRef) { + this.componentRef.destroy(); + this.componentRef = null; + } + } + + private updateInstance() { + if (this.componentRef && this.componentRef.instance) { + const instance = this.componentRef.instance; + + instance.node = this.node; + instance.url = this.url; + instance.extension = this.extension; + } + } +} diff --git a/lib/extensions/src/lib/config/extension-utils.ts b/lib/extensions/src/lib/config/extension-utils.ts index ae277837b3..ddf3f0146a 100644 --- a/lib/extensions/src/lib/config/extension-utils.ts +++ b/lib/extensions/src/lib/config/extension-utils.ts @@ -146,5 +146,5 @@ export function mergeArrays(left: any[], right: any[]): any[] { } }); - return Object.values(map).concat(result); + return Object.keys(map).map((key) => map[key]).concat(result); } diff --git a/lib/extensions/src/lib/config/schema/app-extension.schema.json b/lib/extensions/src/lib/config/schema/app-extension.schema.json new file mode 100644 index 0000000000..2d0d90b45e --- /dev/null +++ b/lib/extensions/src/lib/config/schema/app-extension.schema.json @@ -0,0 +1,18 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "id": "https://github.com/Alfresco/alfresco-ng2-components/tree/master/lib/extensions/config/schema/app-extension.schema.json", + "title": "ACA Extension Schema", + "description": "Provides a validation schema for extensions", + "type": "object", + "properties": { + "$references": { + "description": "References to external files", + "type": "array", + "items": { + "type": "string" + }, + "minItems": 0, + "uniqueItems": true + } + } +} diff --git a/demo-shell/src/assets/extension.schema.json b/lib/extensions/src/lib/config/schema/plugin-extension.schema.json similarity index 99% rename from demo-shell/src/assets/extension.schema.json rename to lib/extensions/src/lib/config/schema/plugin-extension.schema.json index d5e3a1b230..b8e576e901 100644 --- a/demo-shell/src/assets/extension.schema.json +++ b/lib/extensions/src/lib/config/schema/plugin-extension.schema.json @@ -1,9 +1,8 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://github.com/Alfresco/alfresco-content-app/blob/development/extension.schema.json", + "id": "https://github.com/Alfresco/alfresco-ng2-components/tree/master/lib/extensions/config/schema/extension.schema.json", "title": "ACA Extension Schema", - "description": "Provides a validation schema for ACA extensions", - + "description": "Provides a validation schema for extensions plugin JSON", "definitions": { "ruleRef": { "type": "object", diff --git a/lib/extensions/src/lib/extensions.module.ts b/lib/extensions/src/lib/extensions.module.ts index 29faf04f4f..ae39e3a8e1 100644 --- a/lib/extensions/src/lib/extensions.module.ts +++ b/lib/extensions/src/lib/extensions.module.ts @@ -15,21 +15,46 @@ * limitations under the License. */ -import { NgModule } from '@angular/core'; import { DynamicExtensionComponent } from './components/dynamic-component/dynamic.component'; import { DynamicTabComponent } from './components/dynamic-tab/dynamic-tab.component'; import { DynamicColumnComponent } from './components/dynamic-column/dynamic-column.component'; +import { PreviewExtensionComponent } from './components/viewer/preview-extension.component'; +import { NgModule, ModuleWithProviders, APP_INITIALIZER } from '@angular/core'; +import { AppExtensionService } from './services/app-extension.service'; +import { setupExtensions } from './services/startup-extension-factory'; @NgModule({ declarations: [ DynamicExtensionComponent, DynamicTabComponent, - DynamicColumnComponent + DynamicColumnComponent, + PreviewExtensionComponent ], exports: [ DynamicExtensionComponent, DynamicTabComponent, - DynamicColumnComponent + DynamicColumnComponent, + PreviewExtensionComponent ] }) -export class ExtensionsModule {} +export class ExtensionsModule { + static forRoot(): ModuleWithProviders { + return { + ngModule: ExtensionsModule, + providers: [ + { + provide: APP_INITIALIZER, + useFactory: setupExtensions, + deps: [AppExtensionService], + multi: true + } + ] + }; + } + + static forChild(): ModuleWithProviders { + return { + ngModule: ExtensionsModule + }; + } +} diff --git a/demo-shell/src/app/extensions/extension.service.ts b/lib/extensions/src/lib/services/app-extension.service.ts similarity index 77% rename from demo-shell/src/app/extensions/extension.service.ts rename to lib/extensions/src/lib/services/app-extension.service.ts index a11a1e0388..5599e975c5 100644 --- a/demo-shell/src/app/extensions/extension.service.ts +++ b/lib/extensions/src/lib/services/app-extension.service.ts @@ -16,11 +16,8 @@ */ import { Injectable } from '@angular/core'; -import { - ExtensionService, - ExtensionConfig, - ExtensionRef -} from '@alfresco/adf-extensions'; +import { ExtensionConfig, ExtensionRef } from '../config/extension.config'; +import { ExtensionService } from '../services/extension.service'; import { Observable, BehaviorSubject } from 'rxjs'; @Injectable({ @@ -31,22 +28,19 @@ export class AppExtensionService { references$: Observable; - constructor(private extensions: ExtensionService) { + constructor(protected extensionService: ExtensionService) { this.references$ = this._references.asObservable(); } async load() { - const config = await this.extensions.load(); + const config = await this.extensionService.load(); this.setup(config); } setup(config: ExtensionConfig) { if (!config) { - console.error('Extension configuration not found'); return; } - // tslint:disable-next-line:no-console - console.log('loaded extension config', config); const references = (config.$references || []) .filter((entry) => typeof entry === 'object') diff --git a/lib/extensions/src/lib/services/extension-loader.service.ts b/lib/extensions/src/lib/services/extension-loader.service.ts index efbd591365..0e918a9ebd 100644 --- a/lib/extensions/src/lib/services/extension-loader.service.ts +++ b/lib/extensions/src/lib/services/extension-loader.service.ts @@ -34,38 +34,40 @@ export class ExtensionLoaderService { load(configPath: string, pluginsPath: string): Promise { return new Promise((resolve) => { this.loadConfig(configPath, 0).then((result) => { - let config = result.config; + if (result) { + let config = result.config; - const override = sessionStorage.getItem('app.extension.config'); - if (override) { - config = JSON.parse(override); - } + const override = sessionStorage.getItem('app.extension.config'); + if (override) { + config = JSON.parse(override); + } - if (config.$references && config.$references.length > 0) { - const plugins = config.$references.map((name, idx) => - this.loadConfig(`${pluginsPath}/${name}`, idx) - ); + if (config.$references && config.$references.length > 0) { + const plugins = config.$references.map((name, idx) => + this.loadConfig(`${pluginsPath}/${name}`, idx) + ); - Promise.all(plugins).then((results) => { - const configs = results - .filter((entry) => entry) - .sort(sortByOrder) - .map((entry) => entry.config); + Promise.all(plugins).then((results) => { + const configs = results + .filter((entry) => entry) + .sort(sortByOrder) + .map((entry) => entry.config); - if (configs.length > 0) { - config = mergeObjects(config, ...configs); - } + if (configs.length > 0) { + config = mergeObjects(config, ...configs); + } - config = { - ...config, - ...this.getMetadata(result.config), - $references: configs.map((ext) => this.getMetadata(ext)) - }; + config = { + ...config, + ...this.getMetadata(result.config), + $references: configs.map((ext) => this.getMetadata(ext)) + }; + resolve(config); + }); + } else { resolve(config); - }); - } else { - resolve(config); + } } }); }); @@ -140,6 +142,13 @@ export class ExtensionLoaderService { return []; } + getFeatures(config: ExtensionConfig): any { + if (config) { + return config.features || []; + } + return []; + } + protected setActionDefaults(action: ContentActionRef): ContentActionRef { if (action) { action.type = action.type || ContentActionType.default; diff --git a/lib/extensions/src/lib/services/extension.service.ts b/lib/extensions/src/lib/services/extension.service.ts index cde2fbce36..f57c8ffe77 100644 --- a/lib/extensions/src/lib/services/extension.service.ts +++ b/lib/extensions/src/lib/services/extension.service.ts @@ -34,6 +34,7 @@ export class ExtensionService { rules: Array = []; routes: Array = []; actions: Array = []; + features: Array = []; authGuards: { [key: string]: Type<{}> } = {}; evaluators: { [key: string]: RuleEvaluator } = {}; @@ -41,7 +42,8 @@ export class ExtensionService { constructor( private loader: ExtensionLoaderService, private componentRegister: ComponentRegisterService - ) {} + ) { + } /** * Loads and registers an extension config file and plugins (specified by path properties). @@ -75,6 +77,12 @@ export class ExtensionService { this.rules = this.loader.getRules(config); this.actions = this.loader.getActions(config); this.routes = this.loader.getRoutes(config); + this.features = this.loader.getFeatures(config); + } + + getFeature(key: string): any[] { + let properties: string[] = Array.isArray(key) ? [key] : key.split('.'); + return properties.reduce((prev, curr) => prev && prev[curr], this.features) || []; } /** diff --git a/lib/extensions/src/lib/services/startup-extension-factory.ts b/lib/extensions/src/lib/services/startup-extension-factory.ts new file mode 100644 index 0000000000..e938f78d5f --- /dev/null +++ b/lib/extensions/src/lib/services/startup-extension-factory.ts @@ -0,0 +1,22 @@ +/*! + * @license + * Copyright 2019 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { AppExtensionService } from './app-extension.service'; + +export function setupExtensions(appExtensionService: AppExtensionService): Function { + return () => appExtensionService.load(); +} diff --git a/lib/extensions/src/public-api.ts b/lib/extensions/src/public-api.ts index a13cb00071..c7acbcf4fb 100644 --- a/lib/extensions/src/public-api.ts +++ b/lib/extensions/src/public-api.ts @@ -15,6 +15,8 @@ * limitations under the License. */ +export * from './lib/extensions.module'; + export * from './lib/config/action.extensions'; export * from './lib/config/extension-element'; export * from './lib/config/extension-utils'; @@ -29,10 +31,11 @@ export * from './lib/config/viewer.extensions'; export * from './lib/services/extension-loader.service'; export * from './lib/services/extension.service'; export * from './lib/services/component-register.service'; +export * from './lib/services/app-extension.service'; export * from './lib/store/states/navigation.state'; export * from './lib/store/states/profile.state'; export * from './lib/store/states/selection.state'; export * from './lib/store/states/repository.state'; -export * from './lib/extensions.module'; +export * from './lib/components/public-api'; diff --git a/lib/extensions/tsconfig.lib.json b/lib/extensions/tsconfig.lib.json index bd8c4dab32..a551dbfa82 100644 --- a/lib/extensions/tsconfig.lib.json +++ b/lib/extensions/tsconfig.lib.json @@ -1,34 +1,7 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", "compilerOptions": { - "outDir": "../../out-tsc/lib", - "target": "es2015", - "module": "es2015", - "moduleResolution": "node", - "declaration": true, - "sourceMap": true, - "inlineSources": true, - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "importHelpers": true, - "types": [], - "lib": [ - "dom", - "es2015" - ] - }, - "angularCompilerOptions": { - "annotateForClosureCompiler": true, - "skipTemplateCodegen": true, - "strictMetadataEmit": true, - "fullTemplateTypeCheck": true, - "strictInjectionParameters": true, - "flatModuleId": "AUTOGENERATED", - "flatModuleOutFile": "AUTOGENERATED", - "enableResourceInlining": true - }, - "exclude": [ - "src/test.ts", - "**/*.spec.ts" - ] + "outDir": "../dist/extensions/", + "baseUrl": "src" + } } diff --git a/lib/extensions/tsconfig.spec.json b/lib/extensions/tsconfig.spec.json index 16da33db07..ef8eb83f35 100644 --- a/lib/extensions/tsconfig.spec.json +++ b/lib/extensions/tsconfig.spec.json @@ -1,17 +1,6 @@ { - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "../../out-tsc/spec", - "types": [ - "jasmine", - "node" - ] - }, + "extends": "../tsconfig.spec.json", "files": [ "src/test.ts" - ], - "include": [ - "**/*.spec.ts", - "**/*.d.ts" ] } diff --git a/lib/extensions/tslint.json b/lib/extensions/tslint.json deleted file mode 100644 index 65bb2a595e..0000000000 --- a/lib/extensions/tslint.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../../tslint.json", - "rules": { - "directive-selector": [ - true, - "attribute", - "adf", - "camelCase" - ], - "component-selector": [ - true, - "element", - "adf", - "kebab-case" - ] - } -} diff --git a/lib/insights/ng-package.json b/lib/insights/ng-package.json index aa4bfefd2e..8a16e250e3 100644 --- a/lib/insights/ng-package.json +++ b/lib/insights/ng-package.json @@ -9,7 +9,7 @@ "entryFile": "./public-api.ts", "flatModuleFile": "adf-insights", "umdModuleIds": { - "@alfresco/js-api": "@alfresco/js-ap", + "@alfresco/js-api": "@alfresco/js-api", "minimatch": "minimatch", "@angular/platform-browser/animations": "@angular/platform-browser/animations", "@angular/material": "@angular/material", diff --git a/lib/insights/tsconfig.json b/lib/insights/tsconfig.json deleted file mode 100644 index ddee748298..0000000000 --- a/lib/insights/tsconfig.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "compilerOptions": { - "target": "es5", - "module": "commonjs", - "moduleResolution": "node", - "sourceMap": true, - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "skipLibCheck": false, - "noLib": false, - "allowUnreachableCode": false, - "allowUnusedLabels": false, - "noImplicitAny": false, - "noImplicitReturns": false, - "noImplicitUseStrict": false, - "noFallthroughCasesInSwitch": true, - "removeComments": true, - "declaration": true, - "outDir": "../dist/insights/", - "baseUrl" : "./", - "paths": { - "@alfresco/adf-process-services": ["../process-services"], - "@alfresco/adf-content-services": ["../content-services"], - "@alfresco/adf-core": ["../core"] - }, - "lib": [ - "es2016", - "dom" - ], - "suppressImplicitAnyIndexErrors": true, - "noUnusedLocals": true - }, - "exclude": [ - "demo", - "node_modules", - "dist" - ], - "angularCompilerOptions": { - "strictMetadataEmit": false, - "skipTemplateCodegen": true - } -} diff --git a/lib/insights/tsconfig.lib.json b/lib/insights/tsconfig.lib.json new file mode 100644 index 0000000000..6dd77ad2d1 --- /dev/null +++ b/lib/insights/tsconfig.lib.json @@ -0,0 +1,6 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "outDir": "../dist/insights/" + } +} diff --git a/lib/insights/tsconfig.spec.json b/lib/insights/tsconfig.spec.json new file mode 100644 index 0000000000..ab9099eca3 --- /dev/null +++ b/lib/insights/tsconfig.spec.json @@ -0,0 +1,6 @@ +{ + "extends": "../tsconfig.spec.json", + "files": [ + "test.ts" + ] +} diff --git a/lib/process-services-cloud/ng-package.json b/lib/process-services-cloud/ng-package.json index a60b5b9d38..77b6dc0b48 100644 --- a/lib/process-services-cloud/ng-package.json +++ b/lib/process-services-cloud/ng-package.json @@ -6,7 +6,23 @@ "entryFile": "src/public-api.ts", "flatModuleFile": "adf-process-services-cloud", "umdModuleIds": { - "@alfresco/js-api": "@alfresco/js-ap" + "@alfresco/js-api": "@alfresco/js-api", + "minimatch": "minimatch", + "@angular/platform-browser/animations": "@angular/platform-browser/animations", + "@angular/material": "@angular/material", + "@mat-datetimepicker": "@mat-datetimepicker", + "@angular/flex-layout": "@angular/flex-layout", + "@alfresco/adf-core": "@alfresco/adf-core", + "@alfresco/adf-content-services": "@alfresco/adf-content-services", + "@angular/material-moment-adapter": "@angular/material-moment-adapter", + "@angular/animations": "@angular/animations", + "@angular/cdk/platform": "@angular/cdk/platform", + "@angular/material/core": "@angular/material/core", + "moment": "moment", + "moment-es6": "moment-es6", + "moment/src/moment": "moment/src/moment", + "@ngx-translate/core": "@ngx-translate/core", + "rxjs": "rxjs" } } } diff --git a/lib/process-services-cloud/src/lib/app/app-list-cloud.module.ts b/lib/process-services-cloud/src/lib/app/app-list-cloud.module.ts index c9903c2876..7bf67346b2 100644 --- a/lib/process-services-cloud/src/lib/app/app-list-cloud.module.ts +++ b/lib/process-services-cloud/src/lib/app/app-list-cloud.module.ts @@ -30,7 +30,7 @@ import { TemplateModule, CoreModule } from '@alfresco/adf-core'; TemplateModule, MaterialModule, FlexLayoutModule, - CoreModule.forChild() + CoreModule ], declarations: [ AppListCloudComponent, diff --git a/lib/process-services-cloud/src/lib/group/group-cloud.module.ts b/lib/process-services-cloud/src/lib/group/group-cloud.module.ts index 3ecd481947..4c28ab8262 100644 --- a/lib/process-services-cloud/src/lib/group/group-cloud.module.ts +++ b/lib/process-services-cloud/src/lib/group/group-cloud.module.ts @@ -35,7 +35,7 @@ import { InitialGroupNamePipe } from './pipe/group-initial.pipe'; FormsModule, ReactiveFormsModule, FormModule, - CoreModule.forChild() + CoreModule ], declarations: [GroupCloudComponent, InitialGroupNamePipe], exports: [GroupCloudComponent, InitialGroupNamePipe] diff --git a/lib/process-services-cloud/src/lib/process-services-cloud.module.ts b/lib/process-services-cloud/src/lib/process-services-cloud.module.ts index 9a2d6363c7..2d06817264 100644 --- a/lib/process-services-cloud/src/lib/process-services-cloud.module.ts +++ b/lib/process-services-cloud/src/lib/process-services-cloud.module.ts @@ -24,7 +24,7 @@ import { GroupCloudModule } from './group/group-cloud.module'; @NgModule({ imports: [ - CoreModule.forChild(), + CoreModule, AppListCloudModule, ProcessCloudModule, TaskCloudModule, diff --git a/lib/process-services-cloud/src/lib/process/process-cloud.module.ts b/lib/process-services-cloud/src/lib/process/process-cloud.module.ts index 39a0f269ea..8a9bf46ac1 100644 --- a/lib/process-services-cloud/src/lib/process/process-cloud.module.ts +++ b/lib/process-services-cloud/src/lib/process/process-cloud.module.ts @@ -26,7 +26,7 @@ import { CoreModule } from '@alfresco/adf-core'; ProcessFiltersCloudModule, ProcessListCloudModule, StartProcessCloudModule, - CoreModule.forChild() + CoreModule ], exports: [ ProcessFiltersCloudModule, diff --git a/lib/process-services-cloud/src/lib/process/process-filters/process-filters-cloud.module.ts b/lib/process-services-cloud/src/lib/process/process-filters/process-filters-cloud.module.ts index 1cb86d990c..99efb0ba5f 100644 --- a/lib/process-services-cloud/src/lib/process/process-filters/process-filters-cloud.module.ts +++ b/lib/process-services-cloud/src/lib/process/process-filters/process-filters-cloud.module.ts @@ -36,7 +36,7 @@ import { AppListCloudModule } from './../../app/app-list-cloud.module'; FlexLayoutModule, MaterialModule, AppListCloudModule, - CoreModule.forChild() + CoreModule ], declarations: [ProcessFiltersCloudComponent, EditProcessFilterCloudComponent, ProcessFilterDialogCloudComponent], diff --git a/lib/process-services-cloud/src/lib/process/process-list/process-list-cloud.module.ts b/lib/process-services-cloud/src/lib/process/process-list/process-list-cloud.module.ts index ced1e7e2f8..244985b2fc 100644 --- a/lib/process-services-cloud/src/lib/process/process-list/process-list-cloud.module.ts +++ b/lib/process-services-cloud/src/lib/process/process-list/process-list-cloud.module.ts @@ -28,7 +28,7 @@ import { ProcessListCloudService } from './services/process-list-cloud.service'; MaterialModule, DataTableModule, TemplateModule, - CoreModule.forChild() + CoreModule ], declarations: [ProcessListCloudComponent], diff --git a/lib/process-services-cloud/src/lib/process/start-process/start-process-cloud.module.ts b/lib/process-services-cloud/src/lib/process/start-process/start-process-cloud.module.ts index fd6309204f..bfbc4885c5 100644 --- a/lib/process-services-cloud/src/lib/process/start-process/start-process-cloud.module.ts +++ b/lib/process-services-cloud/src/lib/process/start-process/start-process-cloud.module.ts @@ -30,7 +30,7 @@ import { CoreModule } from '@alfresco/adf-core'; MaterialModule, FlexLayoutModule, ReactiveFormsModule, - CoreModule.forChild() + CoreModule ], declarations: [ StartProcessCloudComponent diff --git a/lib/process-services-cloud/src/lib/task/start-task/start-task-cloud.module.ts b/lib/process-services-cloud/src/lib/task/start-task/start-task-cloud.module.ts index 416384963b..73138d8666 100644 --- a/lib/process-services-cloud/src/lib/task/start-task/start-task-cloud.module.ts +++ b/lib/process-services-cloud/src/lib/task/start-task/start-task-cloud.module.ts @@ -38,7 +38,7 @@ import { GroupCloudModule } from '../../group/group-cloud.module'; GroupCloudModule, FormModule, GroupCloudModule, - CoreModule.forChild() + CoreModule ], declarations: [StartTaskCloudComponent, PeopleCloudComponent], providers: [ diff --git a/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts b/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts index f21a88d20f..fabcd581c2 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts @@ -37,7 +37,7 @@ import { AppListCloudModule } from './../../app/app-list-cloud.module'; FlexLayoutModule, MaterialModule, AppListCloudModule, - CoreModule.forChild() + CoreModule ], declarations: [TaskFiltersCloudComponent, EditTaskFilterCloudComponent, TaskFilterDialogCloudComponent], exports: [TaskFiltersCloudComponent, EditTaskFilterCloudComponent], diff --git a/lib/process-services-cloud/src/lib/task/task-header/task-header-cloud.module.ts b/lib/process-services-cloud/src/lib/task/task-header/task-header-cloud.module.ts index 06df6f6232..6571c48891 100644 --- a/lib/process-services-cloud/src/lib/task/task-header/task-header-cloud.module.ts +++ b/lib/process-services-cloud/src/lib/task/task-header/task-header-cloud.module.ts @@ -29,7 +29,7 @@ import { TaskHeaderCloudService } from './services/task-header-cloud.service'; DataTableModule, TemplateModule, CardViewModule, - CoreModule.forChild() + CoreModule ], declarations: [ TaskHeaderCloudComponent diff --git a/lib/process-services-cloud/src/lib/task/task-list/task-list-cloud.module.ts b/lib/process-services-cloud/src/lib/task/task-list/task-list-cloud.module.ts index 3026b3894c..5daefde043 100644 --- a/lib/process-services-cloud/src/lib/task/task-list/task-list-cloud.module.ts +++ b/lib/process-services-cloud/src/lib/task/task-list/task-list-cloud.module.ts @@ -28,7 +28,7 @@ import { TaskListCloudService } from './services/task-list-cloud.service'; MaterialModule, DataTableModule, TemplateModule, - CoreModule.forChild() + CoreModule ], declarations: [TaskListCloudComponent], exports: [TaskListCloudComponent], diff --git a/lib/process-services-cloud/src/public-api.ts b/lib/process-services-cloud/src/public-api.ts index eb73264245..187f0cbcae 100644 --- a/lib/process-services-cloud/src/public-api.ts +++ b/lib/process-services-cloud/src/public-api.ts @@ -16,6 +16,7 @@ */ export * from './lib/process-services-cloud.module'; + export * from './lib/app/public-api'; export * from './lib/process/public-api'; export * from './lib/task/public-api'; diff --git a/lib/process-services-cloud/tsconfig.lib.json b/lib/process-services-cloud/tsconfig.lib.json index 89a9991c06..e65ed8e99a 100644 --- a/lib/process-services-cloud/tsconfig.lib.json +++ b/lib/process-services-cloud/tsconfig.lib.json @@ -1,32 +1,7 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", "compilerOptions": { - "outDir": "../../out-tsc/lib", - "target": "es2015", - "module": "es2015", - "moduleResolution": "node", - "declaration": true, - "sourceMap": true, - "inlineSources": true, - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "importHelpers": true, - "types": [], - "lib": [ - "dom", - "es2015" - ] - }, - "angularCompilerOptions": { - "annotateForClosureCompiler": true, - "skipTemplateCodegen": true, - "strictMetadataEmit": true, - "fullTemplateTypeCheck": true, - "strictInjectionParameters": true, - "enableResourceInlining": true - }, - "exclude": [ - "src/test.ts", - "**/*.spec.ts" - ] + "outDir": "../dist/process-services-cloud/", + "baseUrl": "src" + } } diff --git a/lib/process-services-cloud/tsconfig.spec.json b/lib/process-services-cloud/tsconfig.spec.json index 1e6bebd1a2..ef8eb83f35 100644 --- a/lib/process-services-cloud/tsconfig.spec.json +++ b/lib/process-services-cloud/tsconfig.spec.json @@ -1,17 +1,6 @@ { - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "../../out-tsc/spec", - "types": [ - "jasmine", - "node" - ] - }, + "extends": "../tsconfig.spec.json", "files": [ "src/test.ts" - ], - "include": [ - "**/*.spec.ts", - "**/*.d.ts" ] } diff --git a/lib/process-services-cloud/tslint.json b/lib/process-services-cloud/tslint.json index 3af9ab1abd..ba3c56d2fb 100644 --- a/lib/process-services-cloud/tslint.json +++ b/lib/process-services-cloud/tslint.json @@ -1,5 +1,5 @@ { - "extends": "../../tslint.json", + "extends": "../tslint.json", "rules": { "directive-selector": [ true, diff --git a/lib/process-services/ng-package.json b/lib/process-services/ng-package.json index f52550deaf..3adb1b4924 100644 --- a/lib/process-services/ng-package.json +++ b/lib/process-services/ng-package.json @@ -9,7 +9,7 @@ "entryFile": "./public-api.ts", "flatModuleFile": "adf-process-services", "umdModuleIds": { - "@alfresco/js-api": "@alfresco/js-ap", + "@alfresco/js-api": "@alfresco/js-api", "minimatch": "minimatch", "@angular/platform-browser/animations": "@angular/platform-browser/animations", "@angular/material": "@angular/material", diff --git a/lib/process-services/process-list/components/process-list.component.spec.ts b/lib/process-services/process-list/components/process-list.component.spec.ts index 62f63eb879..74bf129e59 100644 --- a/lib/process-services/process-list/components/process-list.component.spec.ts +++ b/lib/process-services/process-list/components/process-list.component.spec.ts @@ -29,7 +29,7 @@ import { fakeProcessInstance, fakeProcessInstancesWithNoName, fakeProcessInstanc import { ProcessService } from '../services/process.service'; import { ProcessTestingModule } from '../../testing/process.testing.module'; import { fakeProcessCustomSchema } from '../../mock'; -import { ProcessListModule } from 'process-list/process-list.module'; +import { ProcessListModule } from '../process-list.module'; describe('ProcessInstanceListComponent', () => { diff --git a/lib/process-services/task-list/components/task-list.component.spec.ts b/lib/process-services/task-list/components/task-list.component.spec.ts index 708172ffe8..c81c344491 100644 --- a/lib/process-services/task-list/components/task-list.component.spec.ts +++ b/lib/process-services/task-list/components/task-list.component.spec.ts @@ -26,7 +26,7 @@ import { ProcessTestingModule } from '../../testing/process.testing.module'; import { fakeGlobalTask, fakeCustomSchema, fakeEmptyTask } from '../../mock'; import { TranslateService } from '@ngx-translate/core'; import { of } from 'rxjs'; -import { TaskListModule } from 'task-list/task-list.module'; +import { TaskListModule } from '../task-list.module'; declare let jasmine: any; diff --git a/lib/process-services/tsconfig.json b/lib/process-services/tsconfig.json deleted file mode 100644 index 4832dfc68f..0000000000 --- a/lib/process-services/tsconfig.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "compilerOptions": { - "target": "es5", - "module": "commonjs", - "moduleResolution": "node", - "sourceMap": true, - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "skipLibCheck": false, - "noLib": false, - "allowUnreachableCode": false, - "allowUnusedLabels": false, - "noImplicitAny": false, - "noImplicitReturns": false, - "noImplicitUseStrict": false, - "noFallthroughCasesInSwitch": true, - "removeComments": true, - "declaration": true, - "outDir": "../dist/process-services/", - "baseUrl" : "./", - "paths": { - "@alfresco/adf-content-services": ["../content-services"], - "@alfresco/adf-insights": ["../analytics"], - "@alfresco/adf-core": ["../core"] - }, - "lib": [ - "es2016", - "dom" - ], - "suppressImplicitAnyIndexErrors": true, - "noUnusedLocals": true - }, - "exclude": [ - "demo", - "node_modules", - "dist" - ], - "angularCompilerOptions": { - "strictMetadataEmit": false, - "skipTemplateCodegen": true - } -} diff --git a/lib/process-services/tsconfig.lib.json b/lib/process-services/tsconfig.lib.json new file mode 100644 index 0000000000..acc2f6c692 --- /dev/null +++ b/lib/process-services/tsconfig.lib.json @@ -0,0 +1,6 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "outDir": "../dist/process-services/" + } +} diff --git a/lib/process-services/tsconfig.spec.json b/lib/process-services/tsconfig.spec.json new file mode 100644 index 0000000000..ab9099eca3 --- /dev/null +++ b/lib/process-services/tsconfig.spec.json @@ -0,0 +1,6 @@ +{ + "extends": "../tsconfig.spec.json", + "files": [ + "test.ts" + ] +} diff --git a/lib/testing/tsconfig.lib.json b/lib/testing/tsconfig.lib.json index 3fe337fcf5..fe8317959f 100644 --- a/lib/testing/tsconfig.lib.json +++ b/lib/testing/tsconfig.lib.json @@ -1,32 +1,6 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", "compilerOptions": { - "outDir": "../../out-tsc/lib", - "target": "es2015", - "module": "es2015", - "moduleResolution": "node", - "declaration": true, - "sourceMap": true, - "inlineSources": true, - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "importHelpers": true, - "types": [], - "lib": [ - "dom", - "es2018" - ] - }, - "angularCompilerOptions": { - "annotateForClosureCompiler": true, - "skipTemplateCodegen": true, - "strictMetadataEmit": true, - "fullTemplateTypeCheck": true, - "strictInjectionParameters": true, - "enableResourceInlining": true - }, - "exclude": [ - "src/test.ts", - "**/*.spec.ts" - ] + "outDir": "../dist/testing/" + } } diff --git a/lib/testing/tsconfig.spec.json b/lib/testing/tsconfig.spec.json index 16da33db07..ef8eb83f35 100644 --- a/lib/testing/tsconfig.spec.json +++ b/lib/testing/tsconfig.spec.json @@ -1,17 +1,6 @@ { - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "../../out-tsc/spec", - "types": [ - "jasmine", - "node" - ] - }, + "extends": "../tsconfig.spec.json", "files": [ "src/test.ts" - ], - "include": [ - "**/*.spec.ts", - "**/*.d.ts" ] } diff --git a/lib/tsconfig.spec.json b/lib/tsconfig.spec.json new file mode 100644 index 0000000000..3c0b6a01f9 --- /dev/null +++ b/lib/tsconfig.spec.json @@ -0,0 +1,15 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../out-tsc/spec", + "types": [ + "jasmine", + "node" + ] + }, + "include": [ + "**/*.spec.ts", + "**/*.d.ts", + "**/test.ts" + ] +} diff --git a/package-lock.json b/package-lock.json index ffc5f01010..42710dfe8a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,61 +1,61 @@ { "name": "alfresco-components", - "version": "2.7.0-beta5", + "version": "3.0.0", "lockfileVersion": 1, "requires": true, "dependencies": { "@alfresco/adf-content-services": { - "version": "3.0.0-1c25b50b1a15635da1689fdb9f38449a5714630b", - "resolved": "https://registry.npmjs.org/@alfresco/adf-content-services/-/adf-content-services-3.0.0-1c25b50b1a15635da1689fdb9f38449a5714630b.tgz", - "integrity": "sha512-TJzQ0fSUkuix7WDkgapQH4jSg60JKPrniNIaE3oPePXN68HA7fSeCPGaZEm3UcGgsvTu8xaVKAgiuLdRnvyOCg==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@alfresco/adf-content-services/-/adf-content-services-3.0.0.tgz", + "integrity": "sha512-fslg/adVczwvrDJV4i/9zWgsrYv+zvqhmiFXubS+vORDvl48fqf3575OIfDSoeRblPrINzyoupH61DHWzAKa/w==", "requires": { "tslib": "^1.9.0" } }, "@alfresco/adf-core": { - "version": "3.0.0-1c25b50b1a15635da1689fdb9f38449a5714630b", - "resolved": "https://registry.npmjs.org/@alfresco/adf-core/-/adf-core-3.0.0-1c25b50b1a15635da1689fdb9f38449a5714630b.tgz", - "integrity": "sha512-gbs0L/iLAQzFzznrX9xmDmnuaeURl393Dhjiz4tluKUN7PsmxJJ2HFvg/NnFszWccLo2OpqmhogNrm87tCGqtg==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@alfresco/adf-core/-/adf-core-3.0.0.tgz", + "integrity": "sha512-3WbOGNPDM1YIG0fSQC2NiEwoNVoBU555yiW6jcNIMI6tSMVw13zuDyA9+wOmo6KY4FZlABah3hGcD/DfqBfNLg==", "requires": { "tslib": "^1.9.0" } }, "@alfresco/adf-extensions": { - "version": "3.0.0-1c25b50b1a15635da1689fdb9f38449a5714630b", - "resolved": "https://registry.npmjs.org/@alfresco/adf-extensions/-/adf-extensions-3.0.0-1c25b50b1a15635da1689fdb9f38449a5714630b.tgz", - "integrity": "sha512-N9X8aGrR3V8x60jlLE4vYXm1LO+S2kbSxScElXjC/WJ7W0mu7zBLaNzSeY31oSIoXp+LT8GR/ZZyS8Os1Y6tNw==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@alfresco/adf-extensions/-/adf-extensions-3.0.0.tgz", + "integrity": "sha512-piQvPQbG6Zx6J+M8U4Qv6m42gUOOOy9W3Zwgq+DdVCjP60RfhXcS+HW8wUMUxFOTgjonFOIyNA26BddIOoUhEQ==", "requires": { "tslib": "^1.9.0" } }, "@alfresco/adf-insights": { - "version": "3.0.0-1c25b50b1a15635da1689fdb9f38449a5714630b", - "resolved": "https://registry.npmjs.org/@alfresco/adf-insights/-/adf-insights-3.0.0-1c25b50b1a15635da1689fdb9f38449a5714630b.tgz", - "integrity": "sha512-7m982iBcLvvPXYmBrmPPjy5Pkr0lVXm97T529EoYMea55h8EmW7C81adbcQiGUy6S9FQzb3iqIoBW2fL8vCPgg==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@alfresco/adf-insights/-/adf-insights-3.0.0.tgz", + "integrity": "sha512-rjdESqKT+BFeJXLGqN+LyWUEIujocKOmH+mWaRIY8oeWFnUPrb3vguc3YGoC0eCN6fhNJSGq6v4LUpKcT/M3Eg==", "requires": { "tslib": "^1.9.0" } }, "@alfresco/adf-process-services": { - "version": "3.0.0-1c25b50b1a15635da1689fdb9f38449a5714630b", - "resolved": "https://registry.npmjs.org/@alfresco/adf-process-services/-/adf-process-services-3.0.0-1c25b50b1a15635da1689fdb9f38449a5714630b.tgz", - "integrity": "sha512-pZyHyZU4Ye8IFVBgWKEu9BG679Vx8Q1yHznhMybKTentvZZQY+atpL+WK6ZyxGlLJyCd3kxKEmUChgDOttV/qQ==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@alfresco/adf-process-services/-/adf-process-services-3.0.0.tgz", + "integrity": "sha512-PqHXne7tERofGAVxzQyNmZKqepOwtNeC4V/ZTcEib3qL44E/LGQJoy+ega3XlrXCqJ3s7eeMtjg6BN7PiarW0A==", "requires": { "tslib": "^1.9.0" } }, "@alfresco/adf-process-services-cloud": { - "version": "3.0.0-1c25b50b1a15635da1689fdb9f38449a5714630b", - "resolved": "https://registry.npmjs.org/@alfresco/adf-process-services-cloud/-/adf-process-services-cloud-3.0.0-1c25b50b1a15635da1689fdb9f38449a5714630b.tgz", - "integrity": "sha512-bKjDSNV6RaIQtFYoPvzG9QrsrJGhUM/cNAVrcMOiYT4tuFoDWQatUHBx6SRpC/q/8FlQi9qkhwtSjyRxikF7gQ==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@alfresco/adf-process-services-cloud/-/adf-process-services-cloud-3.0.0.tgz", + "integrity": "sha512-gYPhtzWVpML4IAYdlRKo4DPR+yorRF8KQdyKq5beH9pakjgKsJbaF0KN3cbpuQ+fz8wE2d6bnSBK7QRNB1f4Mw==", "requires": { "tslib": "^1.9.0" } }, "@alfresco/js-api": { - "version": "3.0.0-d7850f421268e21861e2cd219441b7343efd27ba", - "resolved": "https://registry.npmjs.org/@alfresco/js-api/-/js-api-3.0.0-d7850f421268e21861e2cd219441b7343efd27ba.tgz", - "integrity": "sha512-glHDIbJX5xoOT1SBlmryJ1aDEH99a/826KnJK5M/ybLfv5yBg+LFL8aMRRMkz26wzKn9YxRwxh14a+6u2u9o1A==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@alfresco/js-api/-/js-api-3.0.0.tgz", + "integrity": "sha512-eiJQRJH+GHw9OszNoHWyGrc/llcI5qQBult5G3TfmRDK3c1YcCLHXbQmaN7hgoOuk0i88oPziXC6ZFS/rfi+fA==", "requires": { "event-emitter": "0.3.4", "superagent": "3.8.2" @@ -1922,6 +1922,14 @@ "dev": true, "optional": true }, + "adf-monaco-extension": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/adf-monaco-extension/-/adf-monaco-extension-0.0.8.tgz", + "integrity": "sha512-GvbrgvYhLgCLKN9tvgK1JpQW32F2LRSfukNtga9coPNkoDZeYcXEAOSy8ZPtyI7fXROAy8sYI0G4gD94g4SXPw==", + "requires": { + "tslib": "^1.9.0" + } + }, "adf-tslint-rules": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/adf-tslint-rules/-/adf-tslint-rules-0.0.6.tgz", @@ -5906,6 +5914,12 @@ "integrity": "sha512-0xy4A/twfrRCnkhfk8ErDi5DqdAsAqeGxht4xkCUrsvhhbQNs7E+4jV0CN7+NKIY0aHE72+XvqtBIXzD31ZbXQ==", "dev": true }, + "electron-to-chromium": { + "version": "1.3.113", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.113.tgz", + "integrity": "sha512-De+lPAxEcpxvqPTyZAXELNpRZXABRxf+uL/rSykstQhzj/B0l1150G/ExIIxKc16lI89Hgz81J0BHAcbTqK49g==", + "dev": true + }, "elliptic": { "version": "6.4.1", "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.1.tgz", @@ -8244,7 +8258,7 @@ }, "got": { "version": "6.7.1", - "resolved": "http://registry.npmjs.org/got/-/got-6.7.1.tgz", + "resolved": "https://registry.npmjs.org/got/-/got-6.7.1.tgz", "integrity": "sha1-JAzQV4WpoY5WHcG0S0HHY+8ejbA=", "dev": true, "requires": { @@ -10631,7 +10645,7 @@ "dependencies": { "promise": { "version": "7.0.4", - "resolved": "http://registry.npmjs.org/promise/-/promise-7.0.4.tgz", + "resolved": "https://registry.npmjs.org/promise/-/promise-7.0.4.tgz", "integrity": "sha1-Nj6EpMNsg1a4kP7WLJHOhdAu1Tk=", "dev": true, "requires": { @@ -12457,9 +12471,9 @@ "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=" }, "ng-packagr": { - "version": "4.4.5", - "resolved": "https://registry.npmjs.org/ng-packagr/-/ng-packagr-4.4.5.tgz", - "integrity": "sha512-O2s2j6c54HguKLX183zQtey/hcVY7+XVJ5ynpB/LEaiGmkhxFXAku7K/7lLdCO5GkE8YaYw55M/Cmt8O+AqPsQ==", + "version": "4.7.1", + "resolved": "https://registry.npmjs.org/ng-packagr/-/ng-packagr-4.7.1.tgz", + "integrity": "sha512-MIPKxyrnV22fS3wSfst2XjwWOonFKujVVEnIehYJhiu8GOg37bCdbbr9plsE1jRDmDAUz6M1MvdKibUrJyRp6Q==", "dev": true, "requires": { "@ngtools/json-schema": "^1.1.0", @@ -12476,7 +12490,7 @@ "less-plugin-npm-import": "^2.1.0", "node-sass": "^4.9.3", "node-sass-tilde-importer": "^1.0.0", - "opencollective": "^1.0.3", + "opencollective-postinstall": "^2.0.1", "postcss": "^7.0.0", "postcss-url": "^8.0.0", "read-pkg-up": "^4.0.0", @@ -12484,7 +12498,7 @@ "rollup": "^0.67.0", "rollup-plugin-commonjs": "^9.1.3", "rollup-plugin-json": "^3.1.0", - "rollup-plugin-node-resolve": "^3.0.0", + "rollup-plugin-node-resolve": "^4.0.0", "rollup-plugin-sourcemaps": "^0.4.2", "rxjs": "^6.0.0", "stylus": "^0.54.5", @@ -12505,23 +12519,36 @@ "dev": true }, "autoprefixer": { - "version": "9.4.2", - "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-9.4.2.tgz", - "integrity": "sha512-tYQYJvZvqlJCzF+BLC//uAcdT/Yy4ik9bwZRXr/EehUJ/bjjpTthsWTy8dpowdoIE1sLCDf1ch4Eb2cOSzZC9w==", + "version": "9.4.8", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-9.4.8.tgz", + "integrity": "sha512-DIhd0KMi9Nql3oJkJ2HCeOVihrXFPtWXc6ckwaUNwliDOt9OGr0fk8vV8jCLWXnZc1EXvQ2uLUzGpcPxFAQHEQ==", "dev": true, "requires": { - "browserslist": "^4.3.5", - "caniuse-lite": "^1.0.30000914", + "browserslist": "^4.4.1", + "caniuse-lite": "^1.0.30000938", "normalize-range": "^0.1.2", "num2fraction": "^1.2.2", - "postcss": "^7.0.6", + "postcss": "^7.0.14", "postcss-value-parser": "^3.3.1" + }, + "dependencies": { + "browserslist": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.4.1.tgz", + "integrity": "sha512-pEBxEXg7JwaakBXjATYw/D1YZh4QUSCX/Mnd/wnqSRPPSi1U39iDhDoKGoBUcraKdxDlrYqJxSI5nNvD+dWP2A==", + "dev": true, + "requires": { + "caniuse-lite": "^1.0.30000929", + "electron-to-chromium": "^1.3.103", + "node-releases": "^1.1.3" + } + } } }, "caniuse-lite": { - "version": "1.0.30000918", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000918.tgz", - "integrity": "sha512-CAZ9QXGViBvhHnmIHhsTPSWFBujDaelKnUj7wwImbyQRxmXynYqKGi3UaZTSz9MoVh+1EVxOS/DFIkrJYgR3aw==", + "version": "1.0.30000938", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000938.tgz", + "integrity": "sha512-ekW8NQ3/FvokviDxhdKLZZAx7PptXNwxKgXtnR5y+PR3hckwuP3yJ1Ir+4/c97dsHNqtAyfKUGdw8P4EYzBNgw==", "dev": true }, "cross-spawn": { @@ -12605,7 +12632,7 @@ "dependencies": { "chalk": { "version": "1.1.3", - "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { @@ -12619,9 +12646,9 @@ } }, "p-limit": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.0.0.tgz", - "integrity": "sha512-fl5s52lI5ahKCernzzIyAP0QAZbGIovtVHGwpcu1Jr/EpzLVDI2myISHwGqK7m8uQFugVWSrbxH7XnhGtvEc+A==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.1.0.tgz", + "integrity": "sha512-NhURkNcrVB+8hNfLuysU8enY5xn2KXphsHBaC2YmRNTZRc7RWusw6apSpdEj3jo4CMb6W9nrF6tTnsJsJeyu6g==", "dev": true, "requires": { "p-try": "^2.0.0" @@ -12675,7 +12702,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { @@ -12824,6 +12851,15 @@ } } }, + "node-releases": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.8.tgz", + "integrity": "sha512-gQm+K9mGCiT/NXHy+V/ZZS1N/LOaGGqRAAJJs3X9Ah1g+CIbRcBgNyoNYQ+SEtcyAtB9KqDruu+fF7nWjsqRaA==", + "dev": true, + "requires": { + "semver": "^5.3.0" + } + }, "node-sass": { "version": "4.9.2", "resolved": "https://registry.npmjs.org/node-sass/-/node-sass-4.9.2.tgz", @@ -13508,6 +13544,12 @@ } } }, + "opencollective-postinstall": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/opencollective-postinstall/-/opencollective-postinstall-2.0.2.tgz", + "integrity": "sha512-pVOEP16TrAO2/fjej1IdOyupJY8KDUM1CvsaScRbw6oddvpQoOfGk4ywha0HKKVAD6RkW4x6Q+tNBwhf3Bgpuw==", + "dev": true + }, "opener": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/opener/-/opener-1.5.1.tgz", @@ -14194,21 +14236,52 @@ "dev": true }, "postcss": { - "version": "7.0.6", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.6.tgz", - "integrity": "sha512-Nq/rNjnHFcKgCDDZYO0lNsl6YWe6U7tTy+ESN+PnLxebL8uBtYX59HZqvrj7YLK5UCyll2hqDsJOo3ndzEW8Ug==", + "version": "7.0.14", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.14.tgz", + "integrity": "sha512-NsbD6XUUMZvBxtQAJuWDJeeC4QFsmWsfozWxCJPWf3M55K9iu2iMDaKqyoOdTJ1R4usBXuxlVFAIo8rZPQD4Bg==", "dev": true, "requires": { - "chalk": "^2.4.1", + "chalk": "^2.4.2", "source-map": "^0.6.1", - "supports-color": "^5.5.0" + "supports-color": "^6.1.0" }, "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true + }, + "supports-color": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", + "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } } } }, @@ -15331,9 +15404,9 @@ "optional": true }, "reflect-metadata": { - "version": "0.1.10", - "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.10.tgz", - "integrity": "sha1-tPg3BEFqytiZiMmxVjXUfgO5NEo=" + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz", + "integrity": "sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==" }, "regenerate": { "version": "1.4.0", @@ -15791,12 +15864,12 @@ }, "dependencies": { "resolve": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.8.1.tgz", - "integrity": "sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA==", + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.10.0.tgz", + "integrity": "sha512-3sUr9aq5OfSg2S9pNtPA9hL1FVEAjvfOC4leW0SNf/mpnaakz2a9femSd6LqAww2RaFctwyf1lCqnTHuF1rxDg==", "dev": true, "requires": { - "path-parse": "^1.0.5" + "path-parse": "^1.0.6" } } } @@ -15811,21 +15884,30 @@ } }, "rollup-plugin-node-resolve": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-3.4.0.tgz", - "integrity": "sha512-PJcd85dxfSBWih84ozRtBkB731OjXk0KnzN0oGp7WOWcarAFkVa71cV5hTJg2qpVsV2U8EUwrzHP3tvy9vS3qg==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-4.0.0.tgz", + "integrity": "sha512-7Ni+/M5RPSUBfUaP9alwYQiIKnKeXCOHiqBpKUl9kwp3jX5ZJtgXAait1cne6pGEVUUztPD6skIKH9Kq9sNtfw==", "dev": true, "requires": { - "builtin-modules": "^2.0.0", + "builtin-modules": "^3.0.0", "is-module": "^1.0.0", - "resolve": "^1.1.6" + "resolve": "^1.8.1" }, "dependencies": { "builtin-modules": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-2.0.0.tgz", - "integrity": "sha512-3U5kUA5VPsRUA3nofm/BXX7GVHKfxz0hOBAPxXrIvHzlDRkQVqEn6yi8QJegxl4LzOHLdvb7XF5dVawa/VVYBg==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.0.0.tgz", + "integrity": "sha512-hMIeU4K2ilbXV6Uv93ZZ0Avg/M91RaKXucQ+4me2Do1txxBDyDZWCBa5bJSLqoNTRpXTLwEzIk1KmloenDDjhg==", "dev": true + }, + "resolve": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.10.0.tgz", + "integrity": "sha512-3sUr9aq5OfSg2S9pNtPA9hL1FVEAjvfOC4leW0SNf/mpnaakz2a9femSd6LqAww2RaFctwyf1lCqnTHuF1rxDg==", + "dev": true, + "requires": { + "path-parse": "^1.0.6" + } } } }, @@ -15840,103 +15922,20 @@ } }, "rollup-pluginutils": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.3.3.tgz", - "integrity": "sha512-2XZwja7b6P5q4RZ5FhyX1+f46xi1Z3qBKigLRZ6VTZjwbN0K1IFGMlwm06Uu0Emcre2Z63l77nq/pzn+KxIEoA==", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.4.1.tgz", + "integrity": "sha512-wesMQ9/172IJDIW/lYWm0vW0LiKe5Ekjws481R7z9WTRtmO59cqyM/2uUlxvf6yzm/fElFmHUobeQOYz46dZJw==", "dev": true, "requires": { - "estree-walker": "^0.5.2", - "micromatch": "^2.3.11" + "estree-walker": "^0.6.0", + "micromatch": "^3.1.10" }, "dependencies": { - "arr-diff": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", - "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", - "dev": true, - "requires": { - "arr-flatten": "^1.0.1" - } - }, - "array-unique": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", - "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", + "estree-walker": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.0.tgz", + "integrity": "sha512-peq1RfVAVzr3PU/jL31RaOjUKLoZJpObQWJJ+LgfcxDUifyLZ1RjPQZTl0pzj2uJ45b7A7XpyppXvxdEqzo4rw==", "dev": true - }, - "braces": { - "version": "1.8.5", - "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", - "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", - "dev": true, - "requires": { - "expand-range": "^1.8.1", - "preserve": "^0.2.0", - "repeat-element": "^1.1.2" - } - }, - "expand-brackets": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", - "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", - "dev": true, - "requires": { - "is-posix-bracket": "^0.1.0" - } - }, - "extglob": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", - "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", - "dev": true, - "requires": { - "is-extglob": "^1.0.0" - } - }, - "is-extglob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", - "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", - "dev": true - }, - "is-glob": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", - "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", - "dev": true, - "requires": { - "is-extglob": "^1.0.0" - } - }, - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - }, - "micromatch": { - "version": "2.3.11", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", - "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", - "dev": true, - "requires": { - "arr-diff": "^2.0.0", - "array-unique": "^0.2.1", - "braces": "^1.8.2", - "expand-brackets": "^0.1.4", - "extglob": "^0.3.1", - "filename-regex": "^2.0.0", - "is-extglob": "^1.0.0", - "is-glob": "^2.0.1", - "kind-of": "^3.0.2", - "normalize-path": "^2.0.1", - "object.omit": "^2.0.0", - "parse-glob": "^3.0.4", - "regex-cache": "^0.4.2" - } } } }, @@ -17037,6 +17036,12 @@ "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.1.tgz", "integrity": "sha512-TfOfPcYGBB5sDuPn3deByxPhmfegAhpDYKSOXZQN81Oyrrif8ZCodOLzK3AesELnCx03kikhyDwh0pfvvQvF8w==" }, + "spdx-license-list": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/spdx-license-list/-/spdx-license-list-5.0.0.tgz", + "integrity": "sha512-N5u9tEFRBUzQDjMKRRt8SHxC/UaqYApPmdF4MMFnICQg3z52onNbnneuro/sWw2rd+eGu9agQOzUbD671Xia7Q==", + "dev": true + }, "spdx-ranges": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/spdx-ranges/-/spdx-ranges-2.1.0.tgz", diff --git a/package.json b/package.json index 9c62bbf02e..e9e77ab604 100644 --- a/package.json +++ b/package.json @@ -80,6 +80,7 @@ "@ngx-translate/core": "^11.0.0", "@nrwl/nx": "7.1.1", "@nrwl/schematics": "7.1.1", + "adf-monaco-extension": "0.0.8", "adf-tslint-rules": "0.0.6", "alfresco-js-api-node": "2.7.0-beta5", "chart.js": "2.5.0", @@ -91,11 +92,11 @@ "moment": "2.22.2", "moment-es6": "^1.0.0", "ng2-charts": "1.6.0", - "ngx-monaco-editor": "6.0.0", + "ngx-monaco-editor": "^6.0.0", "pdfjs-dist": "^2.0.489", "protractor-retry": "^1.2.0", "raphael": "2.2.7", - "reflect-metadata": "0.1.10", + "reflect-metadata": "0.1.13", "rxjs": "^6.2.2", "systemjs": "0.19.27", "web-animations-js": "2.3.1", @@ -154,7 +155,7 @@ "merge-stream": "1.0.1", "nconf": "^0.10.0", "ncp": "^2.0.0", - "ng-packagr": "4.4.5", + "ng-packagr": "4.7.1", "node-sass": "4.9.2", "protractor": "^5.4.0", "protractor-html-reporter-2": "^1.0.4", diff --git a/scripts/affected-libs.sh b/scripts/affected-libs.sh index aac1fbb015..89dc7c0c73 100755 --- a/scripts/affected-libs.sh +++ b/scripts/affected-libs.sh @@ -4,11 +4,18 @@ eval BRANCH_NAME="" eval HEAD_SHA_BRANCH="" eval SHA_2="HEAD" eval DIRECTORY="tmp" +eval GNU=false show_help() { - echo "Usage: smart-build.sh" + echo "Usage: affected-libs.sh" echo "" echo "-b branch name" + echo "-gnu for gnu" +} + +gnu_mode() { + echo "====== GNU MODE =====" + GNU=true } branch_name(){ @@ -18,10 +25,18 @@ branch_name(){ while [[ $1 == -* ]]; do case "$1" in -b) branch_name $2; shift 2;; + -gnu) gnu_mode; shift;; -*) echo "invalid option: $1" 1>&2; show_help; exit 0;; esac done +if $GNU; then + sedi='-i' +else + sedi=('-i' '') +fi + + if [[ "$BRANCH_NAME" == "" ]] then echo "The branch name is mandatory" @@ -47,10 +62,10 @@ cat $DIRECTORY/deps.txt #echo "extensions" > deps.txt #clean file -sed -i '/^$/d' ./$DIRECTORY/deps.txt -sed -i '/alfresco-components/d' ./$DIRECTORY/deps.txt -sed -i '/nx affected:libs/d' ./$DIRECTORY/deps.txt -sed -i '/^$/d' ./$DIRECTORY/deps.txt +sed "${sedi[@]}" '/^$/d' ./$DIRECTORY/deps.txt +sed "${sedi[@]}" '/alfresco-components/d' ./$DIRECTORY/deps.txt +sed "${sedi[@]}" '/nx affected:libs/d' ./$DIRECTORY/deps.txt +sed "${sedi[@]}" '/^$/d' ./$DIRECTORY/deps.txt #read result from file while IFS= read -r var @@ -61,6 +76,14 @@ done < "./$DIRECTORY/deps.txt" #transform string to array libs=(`echo $fileLine | sed 's/^$/\n/g'`) +#extensions +for i in "${libs[@]}" +do + if [ "$i" == "extensions" ] ; then + AFFECTED_LIBS=$AFFECTED_LIBS" extensions$" + fi +done + #core for i in "${libs[@]}" do @@ -95,14 +118,6 @@ do fi done -#extensions -for i in "${libs[@]}" -do - if [ "$i" == "extensions" ] ; then - AFFECTED_LIBS=$AFFECTED_LIBS" extensions$" - fi -done - #process-services-cloud for i in "${libs[@]}" do @@ -111,4 +126,4 @@ do fi done -echo "${AFFECTED_LIBS}" +echo "AFFECTED LIBS => ${AFFECTED_LIBS}" diff --git a/scripts/build-extensions.sh b/scripts/build-extensions.sh index 431584b1bd..827d6fd34f 100755 --- a/scripts/build-extensions.sh +++ b/scripts/build-extensions.sh @@ -6,7 +6,7 @@ cd $DIR/.. echo "====== Extensions ======" echo "====== Build ======" -ng build extensions || exit 1 +npm run ng-packagr -- -p ./lib/extensions/ || exit 1 echo "====== Move to node_modules ======" rm -rf ./node_modules/@alfresco/adf-extensions/ && \ diff --git a/scripts/build-process-services-cloud.sh b/scripts/build-process-services-cloud.sh index 98397e97c7..67ccd05a29 100755 --- a/scripts/build-process-services-cloud.sh +++ b/scripts/build-process-services-cloud.sh @@ -6,7 +6,7 @@ cd $DIR/.. echo "====== Process Services Cloud ======" echo "====== Build ======" -ng build process-services-cloud || exit 1 +npm run ng-packagr -- -p ./lib/process-services-cloud/ || exit 1 echo "====== Build style ======" node ./lib/config/bundle-process-services-cloud-scss.js || exit 1 diff --git a/scripts/ng-packagr.sh b/scripts/ng-packagr.sh index 58d34cef0f..4900014123 100755 --- a/scripts/ng-packagr.sh +++ b/scripts/ng-packagr.sh @@ -3,24 +3,25 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd $DIR -echo "====== run lib =====" -echo "------ run core -----" -./build-core.sh +echo "====== Run lib =====" -echo "------ run content-services -----" -./build-content-services.sh - -echo "------ Build process-services -----" -./build-process-services.sh - -echo "------ run insights -----" -./build-insights.sh - -echo "------ run extensions -----" +echo "====== Run extensions =====" ./build-extensions.sh -echo "------ run process-services-cloud -----" +echo "====== run core =====" +./build-core.sh + +echo "====== Run content-services =====" +./build-content-services.sh + +echo "====== Run process-services =====" +./build-process-services.sh + +echo "====== Run insights =====" +./build-insights.sh + +echo "====== Run process-services-cloud =====" ./build-process-services-cloud.sh echo "====== Copy schema =====" diff --git a/scripts/pr-reminder.js b/scripts/pr-reminder.js new file mode 100644 index 0000000000..aa297ce29c --- /dev/null +++ b/scripts/pr-reminder.js @@ -0,0 +1,260 @@ +var program = require('commander'); +var request = require('request'); + +function asyncRequest(option) { + return new Promise(function (resolve, reject) { + request(option, function (error, res, body) { + if (!error && (res.statusCode == 200 || res.statusCode == 201)) { + resolve(body); + } else { + console.log("Error " + JSON.stringify(body)); + reject(error + JSON.stringify(body)); + throw "Error"; + } + }); + }); +} + +async function main() { + + program + .version('0.1.0') + .option('-n, --name [type]', 'Name to give at the service in rancher') + .option('-r, --remote [type]', 'Remote environment host adf.lab.com ') + .option('-e, --env [type]', 'Name to give at the service in rancher') + .option('-i, --image [type]', 'Docker image to load') + .option('-s, --server [type]', 'Server RANCHER_SERVER URL') + .option('-p, --password [type]', 'password RANCHER') + .option('-u, --username [type]', 'username RANCHER') + .parse(process.argv); + + auth = 'Basic ' + new Buffer(program.username + ':' + program.password).toString('base64'); + + var project = await asyncRequest({ + url: program.server + `/v1/project?name=${program.env}`, + method: 'GET', + json: true, + headers: { + "content-type": "application/json", + "accept": "application/json", + "Authorization": auth + }, + body: "" + }).catch((error) => { + console.log('Project name error'+ error); + }); + + var stacks = await asyncRequest({ + url: `${program.server}/v2-beta/projects/${project.data[0].id}/stacks?limit=-1&sort=name`, + method: 'GET', + json: true, + headers: { + "content-type": "application/json", + "accept": "application/json", + "Authorization": auth + }, + body: "" + }).catch((error) => { + console.log('Stacks error'+ error); + }); + + + var stackId = stacks.data[0].id; + var environmentId = project.data[0].id; + + console.log("StackId " + stackId); + console.log("ID environment " + environmentId); + console.log("image to Load " + program.image); + + var postData = { + "scale": 1, + "assignServiceIpAddress": false, + "startOnCreate": true, + "type": "service", + "stackId": stackId, + "launchConfig": { + "instanceTriggeredStop": "stop", + "kind": "container", + "networkMode": "managed", + "privileged": false, + "publishAllPorts": false, + "readOnly": false, + "runInit": false, + "startOnCreate": true, + "stdinOpen": true, + "tty": true, + "vcpu": 1, + "drainTimeoutMs": 0, + "type": "launchConfig", + "labels": {"io.rancher.container.pull_image": "always"}, + "restartPolicy": {"name": "always"}, + "secrets": [], + "dataVolumes": [], + "dataVolumesFrom": [], + "dns": [], + "dnsSearch": [], + "capAdd": [], + "capDrop": [], + "devices": [], + "logConfig": {"driver": "", "config": {}}, + "dataVolumesFromLaunchConfigs": [], + "imageUuid": program.image, + "ports": [], + "blkioWeight": null, + "cgroupParent": null, + "count": null, + "cpuCount": null, + "cpuPercent": null, + "cpuPeriod": null, + "cpuQuota": null, + "cpuRealtimePeriod": null, + "cpuRealtimeRuntime": null, + "cpuSet": null, + "cpuSetMems": null, + "cpuShares": null, + "createIndex": null, + "created": null, + "deploymentUnitUuid": null, + "description": null, + "diskQuota": null, + "domainName": null, + "externalId": null, + "firstRunning": null, + "healthInterval": null, + "healthRetries": null, + "healthState": null, + "healthTimeout": null, + "hostname": null, + "ioMaximumBandwidth": null, + "ioMaximumIOps": null, + "ip": null, + "ip6": null, + "ipcMode": null, + "isolation": null, + "kernelMemory": null, + "memory": null, + "memoryMb": null, + "memoryReservation": null, + "memorySwap": null, + "memorySwappiness": null, + "milliCpuReservation": null, + "oomScoreAdj": null, + "pidMode": null, + "pidsLimit": null, + "removed": null, + "requestedIpAddress": null, + "shmSize": null, + "startCount": null, + "stopSignal": null, + "stopTimeout": null, + "user": null, + "userdata": null, + "usernsMode": null, + "uts": null, + "uuid": null, + "volumeDriver": null, + "workingDir": null, + "networkLaunchConfig": null + }, + "secondaryLaunchConfigs": [], + "name": program.name, + "createIndex": null, + "created": null, + "description": null, + "externalId": null, + "healthState": null, + "kind": null, + "removed": null, + "selectorContainer": null, + "selectorLink": null, + "uuid": null, + "vip": null, + "fqdn": null + }; + + var createService = await asyncRequest({ + url: `${program.server}/v2-beta/projects/${environmentId}/service`, + method: 'POST', + json: true, + headers: { + "content-type": "application/json", + "accept": "application/json", + "Authorization": auth + }, + body: postData, + }).catch((error) => { + console.log('Error createService'+ error); + }); + + if (!createService) { + return; + } + + console.log("New environment ID " + createService.id); + + var loadBalancer = await asyncRequest({ + url: `${program.server}/v1/projects/${environmentId}/loadbalancerservices`, + method: 'GET', + json: true, + headers: { + "content-type": "application/json", + "accept": "application/json", + "Authorization": auth + }, + body: postData, + }).catch((error) => { + console.log('Error loadBalancer'+ error); + }); + + if (!loadBalancer) { + return; + } + + var loadBalancerId = loadBalancer.data[0].id; + console.log("Load balancer ID " + loadBalancerId); + + var loadBalancerGet = await asyncRequest({ + url: `${program.server}/v2-beta/projects/${environmentId}/loadbalancerservices/${loadBalancerId}`, + method: 'GET', + json: true, + headers: { + "content-type": "application/json", + "accept": "application/json", + "Authorization": auth + } + }).catch((error) => { + console.log('Error get load balancer'+ error); + }); + + //console.log("Load balancer ID " + JSON.stringify(loadBalancerGet.lbConfig.portRules)); + + var newRule = { + "type": "portRule", + "hostname": program.remote, + "path": `/${program.name}`, + "priority": 1, + "protocol": "http", + "serviceId": createService.id, + "sourcePort": 80, + "targetPort": 80 + }; + + loadBalancerGet.lbConfig.portRules.push(newRule); + + await asyncRequest({ + url: `${program.server}/v2-beta/projects/${environmentId}/loadbalancerservices/${loadBalancerId}`, + method: 'PUT', + json: true, + headers: { + "content-type": "application/json", + "accept": "application/json", + "Authorization": auth + }, + body: loadBalancerGet + }).catch((error) => { + console.log('Error Update load balancer'+ error); + }); + +} + +main(); diff --git a/scripts/smart-build.sh b/scripts/smart-build.sh index 65a42b6f4f..00cda50608 100755 --- a/scripts/smart-build.sh +++ b/scripts/smart-build.sh @@ -31,6 +31,14 @@ affected="$(./scripts/affected-libs.sh -b "$BRANCH_NAME")" echo $affected libs=(`echo $affected | sed 's/^$/\n/g'`) +#extensions +for i in "${libs[@]}" +do + if [ "$i" == "extensions$" ] ; then + ./scripts/build-extensions.sh || exit 1; + fi +done + #core for i in "${libs[@]}" do @@ -70,11 +78,3 @@ do ./scripts/build-insights.sh || exit 1; fi done - -#extensions -for i in "${libs[@]}" -do - if [ "$i" == "extensions$" ] ; then - ./scripts/build-extensions.sh || exit 1; - fi -done