diff --git a/.browserslistrc b/.browserslistrc new file mode 100644 index 0000000..37371cb --- /dev/null +++ b/.browserslistrc @@ -0,0 +1,11 @@ +# This file is currently used by autoprefixer to adjust CSS to support the below specified browsers +# For additional information regarding the format and rule options, please see: +# https://github.com/browserslist/browserslist#queries +# +# For IE 9-11 support, please remove 'not' from the last line of the file and adjust as needed + +> 0.5% +last 2 versions +Firefox ESR +not dead +not IE 9-11 \ No newline at end of file diff --git a/LICENSE b/LICENSE deleted file mode 100644 index c2f8a48..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2017 Stefanos Gatsios - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/README.md b/README.md index 07f98ff..e322528 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,24 @@ -# AdminPortal +# Connect Admin -This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.3.0. +This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 7.3.10 and has been updated to 11.2.14. + +## Install packages + +Run npm install (maybe needs sudo), a script that will delete unused files from library will be run. ## Development server -Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. +Run `npm start` for a dev server. Navigate to `http://localhost:5000`. The app will automatically reload if you change any of the source files. -## Code scaffolding +## Build - CSR -Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. +Use the `npm run build-dev` for a development build.
+Use the `npm run build-beta` for a beta build.
+Use the `npm run build-prod` for a production build. -## Build +## Webpack Analyzer -Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build. +In order to analyze bundle size you can run `npm run webpack-bundle-analyzer` ## Running unit tests @@ -21,8 +27,3 @@ Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github. ## Running end-to-end tests Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). -Before running the tests make sure you are serving the app via `ng serve`. - -## Further help - -To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). diff --git a/README.txt b/README.txt deleted file mode 100644 index 724b5d7..0000000 --- a/README.txt +++ /dev/null @@ -1,14 +0,0 @@ -*******Useful project infrmation*********** -Project has 2 external folders. Check them using - svn propget svn:externals ./ - -Above command should show the following: - ./src/app/openaireLibrary https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app - ./src/assets/common-assets https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/assets - -After initial checkout, you may have to exlude ./src/app/openaireLibrary/app.* files in order the project to run properly. -Exclude the files from your local copy, but keep them in the repository. - -Use the following command, to exclude the files: - cd ./src/app/openaireLibrary - svn update --set-depth exclude ./app.* diff --git a/angular.json b/angular.json index cd63dce..aa3721f 100644 --- a/angular.json +++ b/angular.json @@ -1,71 +1,134 @@ { - "$schema": "./node_modules/@angular-devkit/core/src/workspace/workspace-schema.json", + "$schema": "./node_modules/@angular/cli/lib/config/schema.json", "version": 1, "newProjectRoot": "projects", "projects": { - "admin-portal": { + "connect-admin": { "root": "", "sourceRoot": "src", "projectType": "application", + "prefix": "app", + "schematics": { + "@schematics/angular:class": { + "skipTests": true + }, + "@schematics/angular:component": { + "skipTests": true + }, + "@schematics/angular:directive": { + "skipTests": true + }, + "@schematics/angular:guard": { + "skipTests": true + }, + "@schematics/angular:module": { + "skipTests": true + }, + "@schematics/angular:pipe": { + "skipTests": true + }, + "@schematics/angular:service": { + "skipTests": true + } + }, "architect": { "build": { "builder": "@angular-devkit/build-angular:browser", "options": { - "outputPath": "dist", + "aot": true, + "outputPath": "dist/connect-admin", "index": "src/index.html", "main": "src/main.ts", - "tsConfig": "src/tsconfig.app.json", "polyfills": "src/polyfills.ts", + "tsConfig": "src/tsconfig.app.json", "assets": [ "src/assets", "src/robots.txt" ], "styles": [ "src/material.scss", - "node_modules/datatables.net-dt/css/jquery.dataTables.css", - "node_modules/interactiveminingv3/assets/css/interactive-mining.css", - "node_modules/interactiveminingv3/assets/css/animations.css", + "src/mining.scss", "src/styles.css" ], "scripts": [ "node_modules/jquery/dist/jquery.js", - "node_modules/datatables.net/js/jquery.dataTables.js", "node_modules/interactiveminingv3/assets/js/ResizeSensor.js", "node_modules/interactiveminingv3/assets/js/jquery.sticky-sidebar.js" ] }, "configurations": { - "production": { + "development": { "optimization": true, "outputHashing": "all", "sourceMap": false, - "extractCss": true, "namedChunks": false, "aot": true, "extractLicenses": true, "vendorChunk": false, "buildOptimizer": true, - "fileReplacements": [ + "budgets": [ { - "replace": "src/environments/environment.ts", - "with": "src/environments/environment.prod.ts" + "type": "initial", + "maximumWarning": "2mb", + "maximumError": "5mb" + }, + { + "type": "anyComponentStyle", + "maximumWarning": "6kb" } ] }, "beta": { + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.beta.ts" + } + ], "optimization": true, "outputHashing": "all", "sourceMap": false, - "extractCss": true, "namedChunks": false, "aot": true, "extractLicenses": true, "vendorChunk": false, "buildOptimizer": true, + "budgets": [ + { + "type": "initial", + "maximumWarning": "2mb", + "maximumError": "5mb" + }, + { + "type": "anyComponentStyle", + "maximumWarning": "6kb" + } + ] + }, + "production": { "fileReplacements": [ { "replace": "src/environments/environment.ts", - "with": "src/environments/environment.beta.ts" + "with": "src/environments/environment.prod.ts" + } + ], + "optimization": true, + "outputHashing": "all", + "sourceMap": false, + "namedChunks": false, + "aot": true, + "extractLicenses": true, + "vendorChunk": false, + "buildOptimizer": true, + "budgets": [ + { + "type": "initial", + "maximumWarning": "2mb", + "maximumError": "5mb" + }, + { + "type": "anyComponentStyle", + "maximumWarning": "6kb" } ] } @@ -74,45 +137,33 @@ "serve": { "builder": "@angular-devkit/build-angular:dev-server", "options": { - "browserTarget": "admin-portal:build" + "browserTarget": "connect-admin:build" }, "configurations": { "production": { - "browserTarget": "admin-portal:build:production" - }, - "beta": { - "browserTarget": "admin-portal:build:beta" + "browserTarget": "connect-admin:build:production" } } }, "extract-i18n": { "builder": "@angular-devkit/build-angular:extract-i18n", "options": { - "browserTarget": "admin-portal:build" + "browserTarget": "connect-admin:build" } }, "test": { "builder": "@angular-devkit/build-angular:karma", "options": { "main": "src/test.ts", - "karmaConfig": "./karma.conf.js", "polyfills": "src/polyfills.ts", "tsConfig": "src/tsconfig.spec.json", - "scripts": [ - "node_modules/jquery/dist/jquery.js", - "node_modules/datatables.net/js/jquery.dataTables.js", - "node_modules/interactiveminingv3/assets/js/ResizeSensor.js", - "node_modules/interactiveminingv3/assets/js/jquery.sticky-sidebar.js" - ], + "karmaConfig": "src/karma.conf.js", "styles": [ - "src/styles.css", - "node_modules/datatables.net-dt/css/jquery.dataTables.css", - "node_modules/interactiveminingv3/assets/css/interactive-mining.css", - "node_modules/interactiveminingv3/assets/css/animations.css" + "src/styles.css" ], + "scripts": [], "assets": [ - "src/assets", - "src/robots.txt" + "src/assets" ] } }, @@ -130,24 +181,27 @@ } } }, - "admin-portal-e2e": { - "root": "e2e", - "sourceRoot": "e2e", + "connect-admin-e2e": { + "root": "e2e/", "projectType": "application", + "prefix": "", "architect": { "e2e": { "builder": "@angular-devkit/build-angular:protractor", "options": { - "protractorConfig": "./protractor.conf.js", - "devServerTarget": "admin-portal:serve" + "protractorConfig": "e2e/protractor.conf.js", + "devServerTarget": "connect-admin:serve" + }, + "configurations": { + "production": { + "devServerTarget": "connect-admin:serve:production" + } } }, "lint": { "builder": "@angular-devkit/build-angular:tslint", "options": { - "tsConfig": [ - "e2e/tsconfig.e2e.json" - ], + "tsConfig": "e2e/tsconfig.e2e.json", "exclude": [ "**/node_modules/**" ] @@ -156,14 +210,5 @@ } } }, - "defaultProject": "admin-portal", - "schematics": { - "@schematics/angular:component": { - "prefix": "app", - "styleext": "css" - }, - "@schematics/angular:directive": { - "prefix": "app" - } - } + "defaultProject": "connect-admin" } diff --git a/clean-library.sh b/clean-library.sh new file mode 100644 index 0000000..716cb96 --- /dev/null +++ b/clean-library.sh @@ -0,0 +1,3 @@ +cd src/app/openaireLibrary +cd ../../../ +echo "Done" diff --git a/e2e/app.e2e-spec.ts b/e2e/app.e2e-spec.ts deleted file mode 100644 index c2949ad..0000000 --- a/e2e/app.e2e-spec.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { AppPage } from './app.po'; - -describe('admin-portal App', () => { - let page: AppPage; - - beforeEach(() => { - page = new AppPage(); - }); - - it('should display welcome message', () => { - page.navigateTo(); - expect(page.getParagraphText()).toEqual('Welcome to app!'); - }); -}); diff --git a/e2e/app.po.ts b/e2e/app.po.ts deleted file mode 100644 index 82ea75b..0000000 --- a/e2e/app.po.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { browser, by, element } from 'protractor'; - -export class AppPage { - navigateTo() { - return browser.get('/'); - } - - getParagraphText() { - return element(by.css('app-root h1')).getText(); - } -} diff --git a/protractor.conf.js b/e2e/protractor.conf.js similarity index 86% rename from protractor.conf.js rename to e2e/protractor.conf.js index 7ee3b5e..86776a3 100644 --- a/protractor.conf.js +++ b/e2e/protractor.conf.js @@ -6,7 +6,7 @@ const { SpecReporter } = require('jasmine-spec-reporter'); exports.config = { allScriptsTimeout: 11000, specs: [ - './e2e/**/*.e2e-spec.ts' + './src/**/*.e2e-spec.ts' ], capabilities: { 'browserName': 'chrome' @@ -21,8 +21,8 @@ exports.config = { }, onPrepare() { require('ts-node').register({ - project: 'e2e/tsconfig.e2e.json' + project: require('path').join(__dirname, './tsconfig.e2e.json') }); jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); } -}; +}; \ No newline at end of file diff --git a/e2e/src/app.e2e-spec.ts b/e2e/src/app.e2e-spec.ts new file mode 100644 index 0000000..736556e --- /dev/null +++ b/e2e/src/app.e2e-spec.ts @@ -0,0 +1,23 @@ +import { AppPage } from './app.po'; +import { browser, logging } from 'protractor'; + +describe('workspace-project App', () => { + let page: AppPage; + + beforeEach(() => { + page = new AppPage(); + }); + + it('should display welcome message', () => { + page.navigateTo(); + expect(page.getTitleText()).toEqual('Welcome to connect-admin!'); + }); + + afterEach(async () => { + // Assert that there are no errors emitted from the browser + const logs = await browser.manage().logs().get(logging.Type.BROWSER); + expect(logs).not.toContain(jasmine.objectContaining({ + level: logging.Level.SEVERE, + } as logging.Entry)); + }); +}); diff --git a/e2e/src/app.po.ts b/e2e/src/app.po.ts new file mode 100644 index 0000000..5776aa9 --- /dev/null +++ b/e2e/src/app.po.ts @@ -0,0 +1,11 @@ +import { browser, by, element } from 'protractor'; + +export class AppPage { + navigateTo() { + return browser.get(browser.baseUrl) as Promise; + } + + getTitleText() { + return element(by.css('app-root h1')).getText() as Promise; + } +} diff --git a/e2e/tsconfig.e2e.json b/e2e/tsconfig.e2e.json index 1d9e5ed..a6dd622 100644 --- a/e2e/tsconfig.e2e.json +++ b/e2e/tsconfig.e2e.json @@ -1,8 +1,7 @@ { "extends": "../tsconfig.json", "compilerOptions": { - "outDir": "../out-tsc/e2e", - "baseUrl": "./", + "outDir": "../out-tsc/app", "module": "commonjs", "target": "es5", "types": [ @@ -11,4 +10,4 @@ "node" ] } -} +} \ No newline at end of file diff --git a/interactivemining-install.sh b/interactivemining-install.sh index f98b99a..841c5e4 100755 --- a/interactivemining-install.sh +++ b/interactivemining-install.sh @@ -1,7 +1,7 @@ rm -f interactiveminingv3.tgz git clone https://github.com/tasosgig/interactive-mining.git cd interactive-mining/ -git checkout angular7 +git checkout angular11 cd interactive-mining-angular-frontend/ npm install npm run packagr diff --git a/interactiveminingv3.tgz b/interactiveminingv3.tgz deleted file mode 100644 index 98cb087..0000000 Binary files a/interactiveminingv3.tgz and /dev/null differ diff --git a/package.json b/package.json index 4b2e319..f2884bf 100644 --- a/package.json +++ b/package.json @@ -1,76 +1,65 @@ { - "name": "admin-portal", - "version": "0.0.0", - "license": "MIT", + "name": "connect-admin", + "version": "1.0.0", "scripts": { "ng": "ng", - "clean-install": "rm -rf node_modules; npm install; npm run mining", - "mining": "./interactivemining-install.sh", "start": "ng serve --host 0.0.0.0 --disable-host-check --port=5000", - "build": "ng build --prod; npm run after-build-clean", - "build-beta": "ng build --configuration=beta; npm run after-build-clean", + "build": "ng build", + "build-dev": "ng build --configuration=development", + "build-beta": "ng build --configuration=beta", + "build-prod": "ng build --prod", + "webpack-bundle-analyzer": "ng build --stats-json && webpack-bundle-analyzer dist/monitor-dashboard/browser/stats.json --host 0.0.0.0", "test": "ng test", - "lint": "ng lint", "e2e": "ng e2e", - "after-build-clean": "rm -rf dist/assets/common-assets/.svn/ dist/assets/connect-assets/.svn/ dist/assets/dashboard-theme/.svn/" + "mining": "chmod +x interactivemining-install.sh && ./interactivemining-install.sh", + "postinstall": "chmod +x clean-library.sh && ./clean-library.sh && npm run mining", + "after-build-clean": "rm -rf dist/connect-admin/assets/common-assets/.svn/ dist/connect-admin/assets/dashboard-theme/.svn/" }, "private": true, "dependencies": { - "@angular/animations": "7.2.14", - "@angular/cdk": "^7.3.7", - "@angular/common": "7.2.14", - "@angular/compiler": "7.2.14", - "@angular/core": "7.2.14", - "@angular/forms": "7.2.14", - "@angular/http": "7.2.14", - "@angular/material": "^7.3.7", - "@angular/platform-browser": "7.2.14", - "@angular/platform-browser-dynamic": "7.2.14", - "@angular/router": "7.2.14", - "@nguniversal/express-engine": "^6.0.0", - "@types/express": "^4.16.1", - "angular-datatables": "^4.4.1", - "citation-js": "^0.3.4", - "ng2-ckeditor": "1.1.9", + "@angular/animations": "~11.2.14", + "@angular/cdk": "^11.2.13", + "@angular/common": "~11.2.14", + "@angular/compiler": "~11.2.14", + "@angular/core": "~11.2.14", + "@angular/forms": "~11.2.14", + "@angular/localize": "^11.2.14", + "@angular/material": "^11.2.13", + "@angular/platform-browser": "~11.2.14", + "@angular/platform-browser-dynamic": "~11.2.14", + "@angular/router": "~11.2.14", "clipboard": "^1.5.16", - "core-js": "2.6.8", - "datatables.net": "^1.10.19", - "datatables.net-dt": "^1.10.19", - "interactiveminingv3": "file:interactiveminingv3.tgz", + "core-js": "^2.5.4", + "express": "^4.15.2", "jquery": "^3.4.1", - "ng-recaptcha": "^3.0.5", - "ngx-bootstrap": "^1.6.6", + "ng-recaptcha": "^7.0.1", + "ng2-ckeditor": "1.3.1", "ngx-color-picker": "^8.1.0", - "ngx-json-ld": "0.1.6", + "rxjs": "^6.5.1", "ts-md5": "^1.2.0", - "tslib": "^1.9.0", - "zone.js": "0.8.29" + "tslib": "^2.0.0", + "zone.js": "~0.10.2", + "sass-loader": "7.3.1" }, "devDependencies": { - "@angular-devkit/build-angular": "~0.13.0", - "@angular/cli": "7.3.9", - "@angular/compiler-cli": "7.2.14", - "@angular/language-service": "7.2.14", - "@types/datatables.net": "^1.10.17", - "@types/jasmine": "~2.8.8", + "@angular-devkit/build-angular": "~0.1102.14", + "@angular/cli": "~11.2.14", + "@angular/compiler-cli": "~11.2.14", + "@angular/language-service": "~11.2.14", + "@types/express": "^4.17.0", + "@types/node": "^12.11.1", + "@types/jasmine": "~3.6.0", "@types/jasminewd2": "~2.0.3", - "@types/jquery": "^3.3.29", - "@types/node": "^8.0.30", - "codelyzer": "~4.5.0", - "jasmine-core": "~2.99.1", - "jasmine-spec-reporter": "~4.2.1", - "karma": "~3.0.0", - "karma-chrome-launcher": "~2.1.1", - "karma-cli": "~1.0.1", - "karma-coverage-istanbul-reporter": "~2.0.1", - "karma-jasmine": "~1.1.2", - "karma-jasmine-html-reporter": "^0.2.2", - "protractor": "~5.4.0", + "codelyzer": "^6.0.0", + "jasmine-core": "~3.8.0", + "jasmine-spec-reporter": "~5.0.0", + "karma": "~6.3.4", + "karma-chrome-launcher": "~3.1.0", + "karma-coverage-istanbul-reporter": "~3.0.2", + "karma-jasmine": "~4.0.0", + "karma-jasmine-html-reporter": "^1.6.0", + "protractor": "~7.0.0", "ts-node": "~7.0.0", - "tslint": "^5.7.0", - "typescript": "3.2.4", - "rxjs": "6.5.1", - "rxjs-compat": "^6.5.1", - "rxjs-tslint": "^0.1.7" + "typescript": "~4.0.7" } } diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 29354be..ab09232 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,6 +1,6 @@ import {ChangeDetectorRef, Component, HostListener, OnInit} from '@angular/core'; import {MenuItem, RootMenuItem} from './openaireLibrary/sharedComponents/menu'; -import {ActivatedRoute, NavigationEnd, Params, Router} from '@angular/router'; +import {ActivatedRoute, Data, NavigationEnd, Params, Router} from '@angular/router'; import {EnvProperties} from './openaireLibrary/utils/properties/env-properties'; import {Session, User} from './openaireLibrary/login/utils/helper.class'; import {UserManagementService} from './openaireLibrary/services/user-management.service'; @@ -12,6 +12,8 @@ import {CommunityInfo} from "./openaireLibrary/connect/community/communityInfo"; import {CommunityService} from "./openaireLibrary/connect/community/community.service"; import {arrow_left} from "./openaireLibrary/utils/icons/icons"; import {SmoothScroll} from "./openaireLibrary/utils/smooth-scroll"; +import {ConnectHelper} from './openaireLibrary/connect/connectHelper'; +import {ConfigurationService} from './openaireLibrary/utils/configuration/configuration.service'; @Component({ selector: 'app-root', @@ -22,6 +24,7 @@ export class AppComponent implements OnInit { properties: EnvProperties = properties; user: User; params: BehaviorSubject = new BehaviorSubject(null); + data: BehaviorSubject = new BehaviorSubject(null); hasSidebar: boolean = false; hasHeader: boolean = false; hasAdminMenu: boolean = false; @@ -55,17 +58,17 @@ export class AppComponent implements OnInit { private cdr: ChangeDetectorRef, private smoothScroll: SmoothScroll, private layoutService: LayoutService, - private userManagementService: UserManagementService) { + private userManagementService: UserManagementService, + private configurationService: ConfigurationService) { this.subscriptions.push(this.router.events.subscribe(event => { if (event instanceof NavigationEnd) { let r = this.route; - let params = r.snapshot.params; - while (r.firstChild && !params['community']) { + while (r.firstChild) { r = r.firstChild; - params = r.snapshot.params } this.paramsResolved = true; - this.params.next(params); + this.params.next(r.snapshot.params); + this.data.next(r.snapshot.data); } })); } @@ -104,6 +107,7 @@ export class AppComponent implements OnInit { this.subscriptions.push(this.communityService.getCommunity(params['community']).subscribe(community => { if (community) { this.community = community; + this.setProperties(community.communityId); this.buildMenu(); this.loading = false; } else { @@ -125,6 +129,12 @@ export class AppComponent implements OnInit { } } })); + this.subscriptions.push(this.data.subscribe(data => { + if(data && data.portal) { + this.setProperties(data.portal); + this.configurationService.initCommunityInformation(this.properties, this.properties.adminToolsCommunity); + } + })); this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => { this.user = user; if (this.user) { @@ -158,6 +168,16 @@ export class AppComponent implements OnInit { this.smoothScroll.clearSubscriptions(); } + setProperties(id, type = null){ + this.properties.adminToolsCommunity = id; + if(type) { + this.properties.adminToolsPortalType = type; + } else { + ConnectHelper.setPortalTypeFromPid(id); + } + this.configurationService.initCommunityInformation(this.properties, this.properties.adminToolsCommunity); + } + public get open() { return this.layoutService.open; } diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 88965e1..3800ab0 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -11,7 +11,6 @@ import {IsCommunity} from './openaireLibrary/connect/communityGuard/isCommunity. import {AdminErrorPageComponent} from './pages/error/errorPage.component'; import {ErrorModule} from './openaireLibrary/error/error.module'; import {TitleCasePipe} from '@angular/common'; -import {InteractiveMiningModule} from 'interactiveminingv3'; import {CommunityService} from './openaireLibrary/connect/community/community.service'; import {SubscribeService} from './openaireLibrary/utils/subscribe/subscribe.service'; import {ConnectRIGuard} from './openaireLibrary/connect/communityGuard/connectRIGuard.guard'; @@ -23,6 +22,7 @@ import {ErrorInterceptorService} from "./openaireLibrary/error-interceptor.servi import {DEFAULT_TIMEOUT, TimeoutInterceptor} from "./openaireLibrary/timeout-interceptor.service"; import {AdminLoginGuard} from "./openaireLibrary/login/adminLoginGuard.guard"; import {LoginGuard} from "./openaireLibrary/login/loginGuard.guard"; +import {InteractiveMiningModule} from 'interactiveminingv3'; @NgModule({ imports: [ diff --git a/src/app/app.routing.ts b/src/app/app.routing.ts index 4dd6d4f..e76240a 100644 --- a/src/app/app.routing.ts +++ b/src/app/app.routing.ts @@ -9,17 +9,17 @@ import {LoginGuard} from "./openaireLibrary/login/loginGuard.guard"; const routes: Routes = [ { path: '', - loadChildren: './pages/manage-communities/manage-communities.module#ManageCommunitiesModule', + loadChildren: () => import('./pages/manage-communities/manage-communities.module').then(m => m.ManageCommunitiesModule), canActivateChild: [LoginGuard] }, { path: 'reload', - loadChildren: './reload/libReload.module#LibReloadModule', + loadChildren: () => import('./reload/libReload.module').then(m => m.LibReloadModule), data: {hasSidebar: false, hasHeader: false} }, { path: 'user-info', - loadChildren: './login/libUser.module#LibUserModule', + loadChildren: () => import('./login/libUser.module').then(m => m.LibUserModule), data: {hasSidebar: false} }, { path: 'error', @@ -29,19 +29,19 @@ const routes: Routes = [ }, { path: 'connect/admin-tools', - loadChildren: './pages/admin-tools/admin-tools-routing.module#AdminToolsRoutingModule', + loadChildren: () => import('./pages/admin-tools/admin-tools-routing.module').then(m => m.AdminToolsRoutingModule), canActivateChild: [AdminLoginGuard], data: {portal: 'connect'} }, { path: 'openaire/admin-tools', - loadChildren: './pages/admin-tools/admin-tools-routing.module#AdminToolsRoutingModule', + loadChildren: () => import('./pages/admin-tools/admin-tools-routing.module').then(m => m.AdminToolsRoutingModule), canActivateChild: [AdminLoginGuard], data: {portal: 'openaire'} }, { path: 'admin-tools', - loadChildren: './pages/admin-tools/portal-admin-tools-routing.module#PortalAdminToolsRoutingModule', + loadChildren: () => import('./pages/admin-tools/portal-admin-tools-routing.module').then(m => m.PortalAdminToolsRoutingModule), canActivateChild: [AdminLoginGuard] }, { @@ -49,7 +49,7 @@ const routes: Routes = [ }, { path: ':community', - loadChildren: './pages/community-routing.module#CommunityRoutingModule', + loadChildren: () => import('./pages/community-routing.module').then(m => m.CommunityRoutingModule), canActivateChild: [IsCommunity, ConnectAdminLoginGuard] }, { path: '**', @@ -62,8 +62,7 @@ const routes: Routes = [ @NgModule({ imports: [RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules, - onSameUrlNavigation: "reload", - relativeLinkResolution: 'corrected' + onSameUrlNavigation: "reload" })], exports: [ RouterModule ] }) diff --git a/src/app/main.ts b/src/app/main.ts deleted file mode 100644 index 23407fe..0000000 --- a/src/app/main.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Created by stefania on 10/3/16. - */ -import './polyfills.ts'; -//import './vendors.ts'; - -import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; -import { AppModule } from './app.module'; -import {enableProdMode} from "@angular/core"; - -const platform = platformBrowserDynamic(); -if(process.env.PRODUCTION) {enableProdMode();} -platform.bootstrapModule(AppModule); \ No newline at end of file diff --git a/src/app/pages/admin-tools/admin-tools-routing.module.ts b/src/app/pages/admin-tools/admin-tools-routing.module.ts index 504f219..a6b69e8 100644 --- a/src/app/pages/admin-tools/admin-tools-routing.module.ts +++ b/src/app/pages/admin-tools/admin-tools-routing.module.ts @@ -6,32 +6,32 @@ import {RouterModule} from '@angular/router'; RouterModule.forChild([ { path: 'entities', - loadChildren: '../../openaireLibrary/dashboard/entity/entities.module#EntitiesModule', + loadChildren: () => import('../../openaireLibrary/dashboard/entity/entities.module').then(m => m.EntitiesModule), pathMatch: 'full' }, { path: 'classContents', - loadChildren: '../../openaireLibrary/dashboard/divhelpcontent/class-help-contents.module#ClassHelpContentsModule', + loadChildren: () => import('../../openaireLibrary/dashboard/divhelpcontent/class-help-contents.module').then(m => m.ClassHelpContentsModule), pathMatch: 'full' }, { path: 'classContents/edit', - loadChildren: '../../openaireLibrary/dashboard/divhelpcontent/class-help-content-form.module#ClassHelpContentFormModule', + loadChildren: () => import('../../openaireLibrary/dashboard/divhelpcontent/class-help-content-form.module').then(m => m.ClassHelpContentFormModule), pathMatch: 'full' }, { path: 'helptexts', - loadChildren: '../../openaireLibrary/dashboard/helpTexts/page-help-contents.module#PageHelpContentsModule', + loadChildren: () => import('../../openaireLibrary/dashboard/helpTexts/page-help-contents.module').then(m => m.PageHelpContentsModule), pathMatch: 'full' }, { path: 'helptexts/edit', - loadChildren: '../../openaireLibrary/dashboard/helpTexts/page-help-content-form.module#PageHelpContentFormModule', + loadChildren: () => import('../../openaireLibrary/dashboard/helpTexts/page-help-content-form.module').then(m => m.PageHelpContentFormModule), pathMatch: 'full' }, { path: 'pages', - loadChildren: '../../openaireLibrary/dashboard/page/pages.module#PagesModule', + loadChildren: () => import('../../openaireLibrary/dashboard/page/pages.module').then(m => m.PagesModule), pathMatch: 'full' } ]) diff --git a/src/app/pages/admin-tools/portal-admin-tools-routing.module.ts b/src/app/pages/admin-tools/portal-admin-tools-routing.module.ts index 6be1de5..b92f457 100644 --- a/src/app/pages/admin-tools/portal-admin-tools-routing.module.ts +++ b/src/app/pages/admin-tools/portal-admin-tools-routing.module.ts @@ -3,9 +3,9 @@ import {RouterModule} from "@angular/router"; @NgModule({ imports: [RouterModule.forChild([ - {path: '', loadChildren: './admin-tools-routing.module#AdminToolsRoutingModule'}, - {path: 'portals', loadChildren: '../../openaireLibrary/dashboard/portal/portals.module#PortalsModule'}, - {path: 'classes', loadChildren: '../../openaireLibrary/dashboard/divId/divIds.module#DivIdsModule'} + {path: '', loadChildren: () => import('./admin-tools-routing.module').then(m => m.AdminToolsRoutingModule)}, + {path: 'portals', loadChildren: () => import('../../openaireLibrary/dashboard/portal/portals.module').then(m => m.PortalsModule)}, + {path: 'classes', loadChildren: () => import('../../openaireLibrary/dashboard/divId/divIds.module').then(m => m.DivIdsModule)} ])] }) export class PortalAdminToolsRoutingModule { diff --git a/src/app/pages/community-info/community-info-routing.module.ts b/src/app/pages/community-info/community-info-routing.module.ts index 337aaca..a5ffc9f 100644 --- a/src/app/pages/community-info/community-info-routing.module.ts +++ b/src/app/pages/community-info/community-info-routing.module.ts @@ -6,13 +6,13 @@ import {ConnectCommunityGuard} from "../../openaireLibrary/connect/communityGuar imports: [ RouterModule.forChild([ {path: '', redirectTo: 'profile', pathMatch: 'full'}, - {path: 'profile', loadChildren: './profile/profile.module#ProfileModule'}, - {path: 'organizations', loadChildren: '../affiliations/affiliations.module#AffiliationsModule'}, - {path: 'projects', loadChildren: '../projects/communityProjects.module#CommunityProjectsModule'}, - {path: 'content-providers', loadChildren: '../content-providers/communityContentProviders.module#CommunityContentProvidersModule'}, - {path: 'content-providers/:provider', loadChildren: '../content-providers/criteria/criteria.module#CriteriaModule'}, - {path: 'zenodo-communities', loadChildren: '../zenodo-communities/zenodo-communities.module#ZenodoCommunitiesModule'}, - {path: 'subjects', canActivateChild: [ConnectCommunityGuard], loadChildren: '../subjects/subjects-edit-form/subjects-edit-form.module#SubjectsEditFormModule'}, + {path: 'profile', loadChildren: () => import('./profile/profile.module').then(m => m.ProfileModule)}, + {path: 'organizations', loadChildren: () => import('../affiliations/affiliations.module').then(m => m.AffiliationsModule)}, + {path: 'projects', loadChildren: () => import('../projects/communityProjects.module').then(m => m.CommunityProjectsModule)}, + {path: 'content-providers', loadChildren: () => import('../content-providers/communityContentProviders.module').then(m => m.CommunityContentProvidersModule)}, + {path: 'content-providers/:provider', loadChildren: () => import('../content-providers/criteria/criteria.module').then(m => m.CriteriaModule)}, + {path: 'zenodo-communities', loadChildren: () => import('../zenodo-communities/zenodo-communities.module').then(m => m.ZenodoCommunitiesModule)}, + {path: 'subjects', canActivateChild: [ConnectCommunityGuard], loadChildren: () => import('../subjects/subjects-edit-form/subjects-edit-form.module').then(m => m.SubjectsEditFormModule)}, ]) ], providers: [ConnectCommunityGuard] diff --git a/src/app/pages/community-info/profile/profile.component.ts b/src/app/pages/community-info/profile/profile.component.ts index 8de833b..db371c5 100644 --- a/src/app/pages/community-info/profile/profile.component.ts +++ b/src/app/pages/community-info/profile/profile.component.ts @@ -56,7 +56,7 @@ export class ProfileComponent implements OnInit, OnDestroy { public properties: EnvProperties = properties; public loading: boolean = false; private subscriptions: any[] = []; - @ViewChild('editCommunityComponent') editCommunityComponent: EditCommunityComponent; + @ViewChild('editCommunityComponent', { static: true }) editCommunityComponent: EditCommunityComponent; constructor(private communityService: CommunityService, private title: Title) { diff --git a/src/app/pages/community-routing.module.ts b/src/app/pages/community-routing.module.ts index ae0007f..23867e9 100644 --- a/src/app/pages/community-routing.module.ts +++ b/src/app/pages/community-routing.module.ts @@ -6,31 +6,31 @@ import {ConnectRIGuard} from "../openaireLibrary/connect/communityGuard/connectR imports: [RouterModule.forChild([ { path: 'info', - loadChildren: './community-info/community-info-routing.module#CommunityInfoRoutingModule', + loadChildren: () => import('./community-info/community-info-routing.module').then(m => m.CommunityInfoRoutingModule), }, { path: 'users', - loadChildren: './users/users-routing.module#UsersRoutingModule' + loadChildren: () => import('./users/users-routing.module').then(m => m.UsersRoutingModule) }, { path: 'mining', - loadChildren: './mining/mining.module#MiningModule', + loadChildren: () => import('./mining/mining.module').then(m => m.MiningModule), canActivateChild: [ConnectRIGuard] }, { path: 'admin-tools', - loadChildren: './admin-tools/admin-tools-routing.module#AdminToolsRoutingModule', + loadChildren: () => import('./admin-tools/admin-tools-routing.module').then(m => m.AdminToolsRoutingModule), data: { param: 'community' } }, { path: 'stats', - loadChildren: './stats/stats.module#StatsModule' + loadChildren: () => import('./stats/stats.module').then(m => m.StatsModule) }, { path: 'customize-layout', - loadChildren: './customization/customization.module#CustomizationModule', + loadChildren: () => import('./customization/customization.module').then(m => m.CustomizationModule), } ])] }) diff --git a/src/app/pages/content-providers/manage-content-providers.component.ts b/src/app/pages/content-providers/manage-content-providers.component.ts index 2e74dd9..d96550d 100644 --- a/src/app/pages/content-providers/manage-content-providers.component.ts +++ b/src/app/pages/content-providers/manage-content-providers.component.ts @@ -44,7 +44,7 @@ import {Subscriber} from "rxjs"; export class ManageContentProvidersComponent implements OnInit { @Input() communityContentProviders = []; @ViewChild(RemoveContentProvidersComponent) removeContentProvidersComponent: RemoveContentProvidersComponent; - @ViewChild('fsModal') fullscreen: FullScreenModalComponent; + @ViewChild('fsModal', { static: true }) fullscreen: FullScreenModalComponent; public toggle: boolean = false; diff --git a/src/app/pages/customization/Border.component.ts b/src/app/pages/customization/Border.component.ts index 6e1d0b0..2d808bf 100644 --- a/src/app/pages/customization/Border.component.ts +++ b/src/app/pages/customization/Border.component.ts @@ -4,19 +4,19 @@ import {Component, EventEmitter, Input, OnInit, Output,} from '@angular/core'; @Component({ selector: 'border', template: ` -
+
Border radius (px)
- +
- +
Border width (px)
- +
@@ -24,42 +24,41 @@ import {Component, EventEmitter, Input, OnInit, Output,} from '@angular/core';
- - solid - dotted - dashed + solid + dotted + dashed
- - ` }) export class BorderComponent implements OnInit { - @Input() radius:number =0; - @Input() width:number =0; + @Input() radius: number = 0; + @Input() width: number = 0; @Input() style = 'solid'; // @Input() addMargin: boolean = false; @Output() borderChange = new EventEmitter(); - - + + constructor() { } - - + + ngOnInit() { } - + borderChanged() { - this.borderChange.emit({radius:this.radius, width:this.width, style:this.style}); + console.log(this.radius); + this.borderChange.emit({radius: this.radius, width: this.width, style: this.style}); } - - + + } diff --git a/src/app/pages/customization/Color.component.ts b/src/app/pages/customization/Color.component.ts index 9ec7fe9..596e92c 100644 --- a/src/app/pages/customization/Color.component.ts +++ b/src/app/pages/customization/Color.component.ts @@ -8,7 +8,7 @@ import {CustomizationOptions} from '../../openaireLibrary/connect/community/Cust
-
{{label}}
diff --git a/src/app/pages/customization/customization.module.ts b/src/app/pages/customization/customization.module.ts index d194e90..e260bec 100644 --- a/src/app/pages/customization/customization.module.ts +++ b/src/app/pages/customization/customization.module.ts @@ -16,7 +16,9 @@ import {PageContentModule} from '../../openaireLibrary/dashboard/sharedComponent import {QuickLookComponent} from './quickLook.component'; import {QuickLookBackgroundsComponent} from './quickLook-backgrounds.component'; import {QuickLookButtonsComponent} from './quickLook-buttons.component'; -import {MatFormFieldModule, MatSelectModule, MatSlideToggleModule} from '@angular/material'; +import { MatFormFieldModule } from '@angular/material/form-field'; +import { MatSelectModule } from '@angular/material/select'; +import { MatSlideToggleModule } from '@angular/material/slide-toggle'; import {CustomizeButtonsComponent} from './customize-buttons.component'; import {IconsModule} from '../../openaireLibrary/utils/icons/icons.module'; import {IconsService} from '../../openaireLibrary/utils/icons/icons.service'; diff --git a/src/app/pages/mining/mining.component.ts b/src/app/pages/mining/mining.component.ts index 0e64cca..de410ea 100644 --- a/src/app/pages/mining/mining.component.ts +++ b/src/app/pages/mining/mining.component.ts @@ -8,7 +8,9 @@ import {Subscription} from "rxjs"; template: `
- +
+ +
` diff --git a/src/app/pages/mining/mining.module.ts b/src/app/pages/mining/mining.module.ts index 81cde1d..2c50576 100644 --- a/src/app/pages/mining/mining.module.ts +++ b/src/app/pages/mining/mining.module.ts @@ -10,7 +10,7 @@ import {PageContentModule} from "../../openaireLibrary/dashboard/sharedComponent RouterModule.forChild([ { path: '', component: MiningComponent, children: [ - {path: '', loadChildren: './mining-routing.module#MiningRoutingModule'} + {path: '', loadChildren: () => import('./mining-routing.module').then(m => m.MiningRoutingModule)} ] } ]), diff --git a/src/app/pages/projects/manage-projects.component.ts b/src/app/pages/projects/manage-projects.component.ts index fe368fe..69d0a23 100644 --- a/src/app/pages/projects/manage-projects.component.ts +++ b/src/app/pages/projects/manage-projects.component.ts @@ -43,7 +43,7 @@ import {Subscriber} from "rxjs"; export class ManageProjectsComponent implements OnInit { @Input() communityProjects = []; @ViewChild(RemoveProjectsComponent) removeProjectsComponent: RemoveProjectsComponent; - @ViewChild('fsModal') fullscreen: FullScreenModalComponent; + @ViewChild('fsModal', { static: true }) fullscreen: FullScreenModalComponent; public toggle: boolean = false; @@ -69,11 +69,10 @@ export class ManageProjectsComponent implements OnInit { this.body = "[Please write your message here]"; this.body = StringUtils.URIEncode(this.body); } + this.fullscreen.title = "Search and Add Projects"; + this.fullscreen.okButtonText = "Done"; + this.fullscreen.okButton = true; })); - - this.fullscreen.title = "Search and Add Projects"; - this.fullscreen.okButtonText = "Done"; - this.fullscreen.okButton = true; } public ngOnDestroy() { diff --git a/src/app/pages/stats/stats.module.ts b/src/app/pages/stats/stats.module.ts index 8cc4c7b..3a0cd6c 100644 --- a/src/app/pages/stats/stats.module.ts +++ b/src/app/pages/stats/stats.module.ts @@ -3,7 +3,7 @@ import {RouterModule} from '@angular/router'; import {CommonModule} from '@angular/common'; import {StatsComponent} from './stats.component'; import {StatsRoutingModule} from './stats-routing.module'; -import {MatSlideToggleModule} from '@angular/material'; +import { MatSlideToggleModule } from '@angular/material/slide-toggle'; @NgModule({ imports: [ diff --git a/src/app/pages/subjects/subjects-edit-form/subjects-edit-form.component.ts b/src/app/pages/subjects/subjects-edit-form/subjects-edit-form.component.ts index 452ed08..7765fe2 100644 --- a/src/app/pages/subjects/subjects-edit-form/subjects-edit-form.component.ts +++ b/src/app/pages/subjects/subjects-edit-form/subjects-edit-form.component.ts @@ -6,14 +6,13 @@ import {SubjectsService} from '../subjects.service'; import {EnvProperties} from '../../../openaireLibrary/utils/properties/env-properties'; import {Session} from '../../../openaireLibrary/login/utils/helper.class'; import {LoginErrorCodes} from '../../../openaireLibrary/login/utils/guardHelper.class'; - -import {concat} from 'rxjs/observable/concat'; import {Title} from '@angular/platform-browser'; import {properties} from '../../../../environments/environment'; import {AlertModal} from '../../../openaireLibrary/utils/modal/alert'; import {SearchInputComponent} from '../../../openaireLibrary/sharedComponents/search-input/search-input.component'; -import {Subscription} from 'rxjs'; +import {Subscription, zip} from 'rxjs'; import {CommunityInfo} from '../../../openaireLibrary/connect/community/communityInfo'; +import {concat} from 'rxjs/operators'; declare var UIkit; @@ -156,17 +155,13 @@ export class SubjectsEditFormComponent implements OnInit { const subjectsToDelete = this.getNonEmptyItems(subjectsToDeleteAr); const subjectsToAdd = this.getNonEmptyItems(subjectsToAddAr); if (subjectsToAdd.length > 0 && subjectsToDelete.length > 0) { - const obs = concat(this._subjectsService.addSubjects( - this.properties.communityAPI + this.communityId + '/subjects', subjectsToAdd), - this._subjectsService.removeSubjects( - this.properties.communityAPI + this.communityId + '/subjects', subjectsToDelete)); - this.subscriptions.push(obs.subscribe(res => { - if (res['method'] === 'delete') { - this.afterUpdateActions(res, "updated"); - } - }, - error => this.handleUpdateError('System error updating subjects', error) - )); + this.subscriptions.push(this._subjectsService.removeSubjects( + this.properties.communityAPI + this.communityId + '/subjects', subjectsToDelete).subscribe(res =>{ + this.subscriptions.push(this._subjectsService.addSubjects( + this.properties.communityAPI + this.communityId + '/subjects', subjectsToAdd).subscribe(res => { + this.afterUpdateActions(res, "added"); + })); + })); } else if (subjectsToAdd.length > 0) { this.subscriptions.push(this._subjectsService.addSubjects( this.properties.communityAPI + this.communityId + '/subjects', subjectsToAdd).subscribe(res => { diff --git a/src/app/pages/usernotifications/manage-user-notifications.module.ts b/src/app/pages/usernotifications/manage-user-notifications.module.ts index a0f9ece..ab0d7b8 100644 --- a/src/app/pages/usernotifications/manage-user-notifications.module.ts +++ b/src/app/pages/usernotifications/manage-user-notifications.module.ts @@ -9,7 +9,8 @@ import {MailPrefsModule} from '../../openaireLibrary/connect/userEmailPreference import {ManageUserNotificationsRoutingModule} from './manage-user-notifications-routing.module'; import {UsersTabsModule} from '../users/users-tabs.module'; import {PageContentModule} from '../../openaireLibrary/dashboard/sharedComponents/page-content/page-content.module'; -import {MatSelectModule, MatSlideToggleModule} from '@angular/material'; +import { MatSelectModule } from '@angular/material/select'; +import { MatSlideToggleModule } from '@angular/material/slide-toggle'; import {LoadingModule} from '../../openaireLibrary/utils/loading/loading.module'; import {SharedModule} from '../../openaireLibrary/shared/shared.module'; diff --git a/src/app/pages/users/users-routing.module.ts b/src/app/pages/users/users-routing.module.ts index 5039e4f..39a58ec 100644 --- a/src/app/pages/users/users-routing.module.ts +++ b/src/app/pages/users/users-routing.module.ts @@ -5,14 +5,14 @@ import {RouterModule} from '@angular/router'; imports: [ RouterModule.forChild([ {path: '', redirectTo: 'managers', pathMatch: 'full'}, - {path: 'managers', loadChildren: './users-managers/users-managers.module#UsersManagersModule'}, - {path: 'subscribers', loadChildren: './users-subscribers/users-subscribers.module#UsersSubscribersModule'}, + {path: 'managers', loadChildren: () => import('./users-managers/users-managers.module').then(m => m.UsersManagersModule)}, + {path: 'subscribers', loadChildren: () => import('./users-subscribers/users-subscribers.module').then(m => m.UsersSubscribersModule)}, { path: 'notifications', - loadChildren: '../usernotifications/manage-user-notifications.module#ManageUserNotificationsModule' + loadChildren: () => import('../usernotifications/manage-user-notifications.module').then(m => m.ManageUserNotificationsModule) }, - {path: 'claims', loadChildren: '../claims/claims.module#ClaimsModule'}, - {path: 'personal', loadChildren: './personal-info/personal-info.module#PersonalInfoModule'} + {path: 'claims', loadChildren: () => import('../claims/claims.module').then(m => m.ClaimsModule)}, + {path: 'personal', loadChildren: () => import('./personal-info/personal-info.module').then(m => m.PersonalInfoModule)} ]) ] }) diff --git a/src/app/pages/zenodo-communities/zenodo-communities.component.ts b/src/app/pages/zenodo-communities/zenodo-communities.component.ts index cae9f16..6336ed9 100644 --- a/src/app/pages/zenodo-communities/zenodo-communities.component.ts +++ b/src/app/pages/zenodo-communities/zenodo-communities.component.ts @@ -58,7 +58,7 @@ export class ZenodoCommunitiesComponent implements OnInit, OnDestroy { zenodoSearchUtils: SearchUtilsClass = new SearchUtilsClass(); public errorCodes: ErrorCodes = new ErrorCodes(); subscriptions = []; - @ViewChild('fsModal') fullscreen: FullScreenModalComponent; + @ViewChild('fsModal', { static: true }) fullscreen: FullScreenModalComponent; @ViewChild('manage') manage: ManageZenodoCommunitiesComponent; constructor(private element: ElementRef, private route: ActivatedRoute, private _router: Router, @@ -122,8 +122,6 @@ export class ZenodoCommunitiesComponent implements OnInit, OnDestroy { this.fullscreen.title = "Search and Add Zenodo Communities"; this.fullscreen.okButtonText = "Done"; this.fullscreen.okButton = true; - - } ngOnDestroy() { diff --git a/src/app/polyfills.ts b/src/app/polyfills.ts deleted file mode 100644 index 9dcf73e..0000000 --- a/src/app/polyfills.ts +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Created by stefanos on 25/4/2017. - */ -// Polyfills - -// import 'ie-shim'; // Internet Explorer 9 support -import 'reflect-metadata'; -// import 'core-js/es6'; -// Added parts of es6 which are necessary for your project or your browser support requirements. -import 'core-js/es6/symbol'; -import 'core-js/es6/object'; -import 'core-js/es6/function'; -import 'core-js/es6/parse-int'; -import 'core-js/es6/parse-float'; -import 'core-js/es6/number'; -import 'core-js/es6/math'; -import 'core-js/es6/string'; -import 'core-js/es6/date'; -import 'core-js/es6/array'; -import 'core-js/es6/regexp'; -import 'core-js/es6/map'; -import 'core-js/es6/set'; -import 'core-js/es6/weak-map'; -import 'core-js/es6/weak-set'; -import 'core-js/es6/typed'; -import 'core-js/es6/reflect'; -// see issue https://github.com/AngularClass/angular2-webpack-starter/issues/709 -// import 'core-js/es6/promise'; - -import 'intl'; -import 'intl/locale-data/jsonp/en'; - -import 'core-js/es7/reflect'; -import 'zone.js/dist/zone'; - -// import 'ng2-ckeditor/lib'; - -// if ('production' === ENV) { -// // Production -// -// } else { -// -// // Development -// Error.stackTraceLimit = Infinity; -// -// /* tslint:disable no-var-requires */ -// require('zone.js/dist/long-stack-trace-zone'); -// -// } diff --git a/src/app/services/help-content.service.ts b/src/app/services/help-content.service.ts index e413e6d..0d118e0 100644 --- a/src/app/services/help-content.service.ts +++ b/src/app/services/help-content.service.ts @@ -1,20 +1,19 @@ /** * Created by stefania on 7/13/17. */ -import { Injectable } from '@angular/core'; -import {HttpClient, HttpErrorResponse, HttpHeaders} from "@angular/common/http"; -import {Observable, Subscription} from 'rxjs'; -import { Page } from "../domain/page"; -import { PageHelpContent } from "../domain/page-help-content"; -import { Portal } from "../domain/portal"; -import { Entity } from "../domain/entity"; -import { DivId } from "../domain/divId"; -import { DivHelpContent } from "../domain/div-help-content"; +import {Injectable} from '@angular/core'; +import {HttpClient, HttpErrorResponse} from '@angular/common/http'; +import {Observable, throwError} from 'rxjs'; +import {Page} from '../domain/page'; +import {PageHelpContent} from '../domain/page-help-content'; +import {Portal} from '../domain/portal'; +import {Entity} from '../domain/entity'; +import {DivId} from '../domain/divId'; +import {DivHelpContent} from '../domain/div-help-content'; import {StatisticsDisplay, StatisticsSummary} from '../openaireLibrary/connect/statistics/statisticsEntities'; -import { CustomOptions } from '../openaireLibrary/services/servicesUtils/customOptions.class'; -import {catchError, map} from "rxjs/operators"; -import {COOKIE} from "../openaireLibrary/login/utils/helper.class"; -import {properties} from "../../environments/environment"; +import {CustomOptions} from '../openaireLibrary/services/servicesUtils/customOptions.class'; +import {catchError, map} from 'rxjs/operators'; +import {properties} from '../../environments/environment'; @Injectable() @@ -426,7 +425,7 @@ export class HelpContentService { // in a real world app, we may send the error to some remote logging infrastructure // instead of just logging it to the console console.error(error); - return Observable.throw(error.error || 'Server error'); + return throwError(error.error || 'Server error'); } // getDataProviders() { diff --git a/src/app/services/manageContentProviders.service.ts b/src/app/services/manageContentProviders.service.ts index d1f9aec..7be4c2f 100644 --- a/src/app/services/manageContentProviders.service.ts +++ b/src/app/services/manageContentProviders.service.ts @@ -2,7 +2,7 @@ import {Injectable} from '@angular/core'; import {HttpClient, HttpHeaders} from '@angular/common/http'; import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties'; import {ContentProvider} from '../openaireLibrary/utils/entities/contentProvider'; -import {Observable} from 'rxjs/Observable'; +import {Observable} from 'rxjs'; @Injectable() export class ManageCommunityContentProvidersService { diff --git a/karma.conf.js b/src/karma.conf.js similarity index 81% rename from karma.conf.js rename to src/karma.conf.js index 0840f6c..86c7c56 100644 --- a/karma.conf.js +++ b/src/karma.conf.js @@ -12,20 +12,21 @@ module.exports = function (config) { require('karma-coverage-istanbul-reporter'), require('@angular-devkit/build-angular/plugins/karma') ], - client:{ + client: { clearContext: false // leave Jasmine Spec Runner output visible in browser }, coverageIstanbulReporter: { - dir: require('path').join(__dirname, 'coverage'), reports: [ 'html', 'lcovonly' ], + dir: require('path').join(__dirname, '../coverage/connect-admin'), + reports: ['html', 'lcovonly', 'text-summary'], fixWebpackSourcePaths: true }, - reporters: ['progress', 'kjhtml'], port: 9876, colors: true, logLevel: config.LOG_INFO, autoWatch: true, browsers: ['Chrome'], - singleRun: false + singleRun: false, + restartOnFileChange: true }); }; diff --git a/src/main.ts b/src/main.ts index 9be6714..c203640 100644 --- a/src/main.ts +++ b/src/main.ts @@ -8,4 +8,5 @@ if (properties.environment !== "development") { enableProdMode(); } -platformBrowserDynamic().bootstrapModule(AppModule); +platformBrowserDynamic().bootstrapModule(AppModule) + .catch(err => console.error(err)); diff --git a/src/mining.scss b/src/mining.scss new file mode 100644 index 0000000..75b9615 --- /dev/null +++ b/src/mining.scss @@ -0,0 +1,8 @@ +@use "sass:meta"; +@import "~interactiveminingv3/assets/css/variables.css"; + +.mining { + + @include meta.load-css("node_modules/interactiveminingv3/assets/css/interactive-mining.css"); + @include meta.load-css("node_modules/interactiveminingv3/assets/css/animations.css"); +} diff --git a/src/polyfills.ts b/src/polyfills.ts index 4e77c07..7c9e495 100644 --- a/src/polyfills.ts +++ b/src/polyfills.ts @@ -1,3 +1,7 @@ +/*************************************************************************************************** + * Load `$localize` onto the global scope - used if i18n tags appear in Angular templates. + */ +import '@angular/localize/init'; /** * This file includes polyfills needed by Angular and is loaded before the app. * You can add your own extra polyfills to this file. @@ -11,61 +15,53 @@ * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. * - * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html + * Learn more in https://angular.io/guide/browser-support */ /*************************************************************************************************** * BROWSER POLYFILLS */ -/** IE9, IE10 and IE11 requires all of the following polyfills. **/ -import 'core-js/es6/symbol'; -import 'core-js/es6/object'; -import 'core-js/es6/function'; -import 'core-js/es6/parse-int'; -import 'core-js/es6/parse-float'; -import 'core-js/es6/number'; -import 'core-js/es6/math'; -import 'core-js/es6/string'; -import 'core-js/es6/date'; -import 'core-js/es6/array'; -import 'core-js/es6/regexp'; -import 'core-js/es6/map'; -import 'core-js/es6/weak-map'; -import 'core-js/es6/set'; - /** IE10 and IE11 requires the following for NgClass support on SVG elements */ // import 'classlist.js'; // Run `npm install --save classlist.js`. -/** Evergreen browsers require these. **/ -import 'core-js/es6/reflect'; - - /** - * Required to support Web Animations `@angular/animation`. - * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation - **/ + * Web Animations `@angular/platform-browser/animations` + * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. + * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). + */ // import 'web-animations-js'; // Run `npm install --save web-animations-js`. - +/** + * By default, zone.js will patch all possible macroTask and DomEvents + * user can disable parts of macroTask/DomEvents patch by setting following flags + * because those flags need to be set before `zone.js` being loaded, and webpack + * will put import in the top of bundle, so user need to create a separate file + * in this directory (for example: zone-flags.ts), and put the following flags + * into that file, and then add the following code before importing zone.js. + * import './zone-flags.ts'; + * + * The flags allowed in zone-flags.ts are listed here. + * + * The following flags will work for all browsers. + * + * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame + * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick + * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames + * + * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js + * with the following flag, it will bypass `zone.js` patch for IE/Edge + * + * (window as any).__Zone_enable_cross_context_check = true; + * + */ /*************************************************************************************************** - * Zone JS is required by Angular itself. + * Zone JS is required by default for Angular itself. */ import 'zone.js/dist/zone'; // Included with Angular CLI. - /*************************************************************************************************** * APPLICATION IMPORTS */ - -/** - * Date, currency, decimal and percent pipes. - * Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10 - */ -// import 'intl'; // Run `npm install --save intl`. -/** - * Need to import at least one locale-data with intl. - */ -// import 'intl/locale-data/jsonp/en'; diff --git a/src/styles.css b/src/styles.css index 200aa08..b435524 100644 --- a/src/styles.css +++ b/src/styles.css @@ -4,4 +4,3 @@ @import "assets/common-assets/library.css"; @import "assets/dashboard-theme/main.css"; @import "assets/css/connect-custom.css"; - diff --git a/src/test.ts b/src/test.ts index cd612ee..1631789 100644 --- a/src/test.ts +++ b/src/test.ts @@ -1,24 +1,14 @@ // This file is required by karma.conf.js and loads recursively all the .spec and framework files -import 'zone.js/dist/long-stack-trace-zone'; -import 'zone.js/dist/proxy.js'; -import 'zone.js/dist/sync-test'; -import 'zone.js/dist/jasmine-patch'; -import 'zone.js/dist/async-test'; -import 'zone.js/dist/fake-async-test'; +import 'zone.js/dist/zone-testing'; import { getTestBed } from '@angular/core/testing'; import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing'; -// Unfortunately there's no typing for the `__karma__` variable. Just declare it as any. -declare const __karma__: any; declare const require: any; -// Prevent Karma from running prematurely. -__karma__.loaded = function () {}; - // First, initialize the Angular testing environment. getTestBed().initTestEnvironment( BrowserDynamicTestingModule, @@ -28,5 +18,3 @@ getTestBed().initTestEnvironment( const context = require.context('./', true, /\.spec\.ts$/); // And load the modules. context.keys().map(context); -// Finally, start Karma to run the tests. -__karma__.start(); diff --git a/src/tsconfig.app.json b/src/tsconfig.app.json index c300528..f3a1b80 100644 --- a/src/tsconfig.app.json +++ b/src/tsconfig.app.json @@ -1,23 +1,14 @@ { "extends": "../tsconfig.json", "compilerOptions": { - "paths": { - "*": [ - "types/*" - ] - }, - "paths": { - "*": [ - "types/*" - ] - }, "outDir": "../out-tsc/app", - "baseUrl": "./", - "module": "es2015", - "types": ["node"] + "types": [] }, - "exclude": [ - "test.ts", - "**/*.spec.ts" + "files": [ + "main.ts", + "polyfills.ts" + ], + "include": [ + "src/**/*.d.ts" ] } diff --git a/src/tsconfig.spec.json b/src/tsconfig.spec.json index 18bad40..de77336 100644 --- a/src/tsconfig.spec.json +++ b/src/tsconfig.spec.json @@ -2,9 +2,6 @@ "extends": "../tsconfig.json", "compilerOptions": { "outDir": "../out-tsc/spec", - "baseUrl": "./", - "module": "commonjs", - "target": "es5", "types": [ "jasmine", "node" diff --git a/src/typings.d.ts b/src/typings.d.ts deleted file mode 100644 index ef5c7bd..0000000 --- a/src/typings.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -/* SystemJS module definition */ -declare var module: NodeModule; -interface NodeModule { - id: string; -} diff --git a/tsconfig.json b/tsconfig.json index 8cd9a30..8c693a2 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,22 +1,23 @@ { "compileOnSave": false, "compilerOptions": { - "importHelpers": true, + "baseUrl": "./", + "downlevelIteration": true, "outDir": "./dist/out-tsc", "sourceMap": true, "declaration": false, + "module": "es2020", "moduleResolution": "node", "emitDecoratorMetadata": true, "experimentalDecorators": true, - "target": "es5", + "importHelpers": true, + "target": "es2015", "typeRoots": [ "node_modules/@types" ], "lib": [ - "es2017", + "es2018", "dom" - ], - "module": "es2015", - "baseUrl": "./" + ] } -} \ No newline at end of file +} diff --git a/tslint.json b/tslint.json deleted file mode 100644 index 7223e1a..0000000 --- a/tslint.json +++ /dev/null @@ -1,141 +0,0 @@ -{ - "rulesDirectory": [ - "node_modules/codelyzer" - ], - "rules": { - "arrow-return-shorthand": true, - "callable-types": true, - "class-name": true, - "comment-format": [ - true, - "check-space" - ], - "curly": true, - "eofline": true, - "forin": true, - "import-blacklist": [ - true - ], - "import-spacing": true, - "indent": [ - true, - "spaces" - ], - "interface-over-type-literal": true, - "label-position": true, - "max-line-length": [ - true, - 140 - ], - "member-access": false, - "member-ordering": [ - true, - { - "order": [ - "static-field", - "instance-field", - "static-method", - "instance-method" - ] - } - ], - "no-arg": true, - "no-bitwise": true, - "no-console": [ - true, - "debug", - "info", - "time", - "timeEnd", - "trace" - ], - "no-construct": true, - "no-debugger": true, - "no-duplicate-super": true, - "no-empty": false, - "no-empty-interface": true, - "no-eval": true, - "no-inferrable-types": [ - true, - "ignore-params" - ], - "no-misused-new": true, - "no-non-null-assertion": true, - "no-shadowed-variable": true, - "no-string-literal": false, - "no-string-throw": true, - "no-switch-case-fall-through": true, - "no-trailing-whitespace": true, - "no-unnecessary-initializer": true, - "no-unused-expression": true, - "no-use-before-declare": true, - "no-var-keyword": true, - "object-literal-sort-keys": false, - "one-line": [ - true, - "check-open-brace", - "check-catch", - "check-else", - "check-whitespace" - ], - "prefer-const": true, - "quotemark": [ - true, - "single" - ], - "radix": true, - "semicolon": [ - true, - "always" - ], - "triple-equals": [ - true, - "allow-null-check" - ], - "typedef-whitespace": [ - true, - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - } - ], - "typeof-compare": true, - "unified-signatures": true, - "variable-name": false, - "whitespace": [ - true, - "check-branch", - "check-decl", - "check-operator", - "check-separator", - "check-type" - ], - "directive-selector": [ - true, - "attribute", - "app", - "camelCase" - ], - "component-selector": [ - true, - "element", - "app", - "kebab-case" - ], - "use-input-property-decorator": true, - "use-output-property-decorator": true, - "use-host-property-decorator": true, - "no-input-rename": true, - "no-output-rename": true, - "use-life-cycle-interface": true, - "use-pipe-transform-interface": true, - "component-class-suffix": true, - "directive-class-suffix": true, - "no-access-missing-member": true, - "templates-use-public": true, - "invoke-injectable": true - } -}