Project

General

Profile

« Previous | Next » 

Revision 59507

[Trunk | Graph]: Initial commit for OpenAIRE Research Graph portal.

View differences:

modules/uoa-graph-portal/trunk/src/typings.d.ts
1
/* SystemJS module definition */
2
declare var module: NodeModule;
3
interface NodeModule {
4
  id: string;
5
}
modules/uoa-graph-portal/trunk/src/environments/environment.prod.ts
1
import {EnvProperties} from '../app/openaireLibrary/utils/properties/env-properties';
2

  
3
export let properties: EnvProperties = {
4
  environment: "production",
5
  searchAPIURLLAst: "http://services.openaire.eu/search/v2/api/",
6
  helpdesk: "https://www.openaire.eu/support/helpdesk",
7
  helpdeskEmail: "helpdesk@openaire.eu",
8
  cookieDomain: ".openaire.eu",
9
  reCaptchaSiteKey: "6LezhVIUAAAAAOb4nHDd87sckLhMXFDcHuKyS76P",
10
};
modules/uoa-graph-portal/trunk/src/app/contact/contact.component.ts
1
import {Component, OnInit, ViewChild} from '@angular/core';
2
import {Router} from '@angular/router';
3
import {EmailService} from '../openaireLibrary/utils/email/email.service';
4
import {Email} from '../openaireLibrary/utils/email/email';
5
import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
6
import {Composer} from '../openaireLibrary/utils/email/composer';
7
import {Title} from '@angular/platform-browser';
8
import {HelperFunctions} from '../openaireLibrary/utils/HelperFunctions.class';
9
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
10
import {properties} from '../../environments/environment';
11

  
12
@Component({
13
  selector: 'contact',
14
  templateUrl: './contact.component.html',
15
  styleUrls: ['contact.component.css']
16
})
17

  
18
export class ContactComponent implements OnInit {
19
  public showLoading = true;
20
  public errorMessage = '';
21
  public email: Email;
22
  public properties: EnvProperties = properties;
23
  
24
  public contactForm: FormGroup;
25
  @ViewChild('AlertModal') modal;
26
  @ViewChild('recaptcha') recaptcha;
27
  
28
  constructor(private router: Router,
29
              private emailService: EmailService,
30
              private title: Title,
31
              private fb: FormBuilder) {
32
  }
33
  
34
  ngOnInit() {
35
    this.title.setTitle('OpenAIRE - UsageCounts | Contact Us');
36
    this.email = {body: '', subject: '', recipients: []};
37
    this.reset();
38
    this.showLoading = false;
39
  }
40
  
41
  public send(event) {
42
    HelperFunctions.scroll();
43
    if (event.valid === true) {
44
      this.sendMail(this.properties.admins);
45
    } else {
46
      this.errorMessage = 'Please fill in all the required fields!';
47
    }
48
  }
49
  
50
  public reset() {
51
    this.contactForm = this.fb.group({
52
      name: this.fb.control('', Validators.required),
53
      email: this.fb.control('', [Validators.required, Validators.email]),
54
      affiliation: this.fb.control('', Validators.required),
55
      organization: this.fb.control('', Validators.required),
56
      description: this.fb.control('', Validators.required),
57
      recaptcha: this.fb.control('', Validators.required),
58
    });
59
    this.errorMessage = '';
60
  }
61
  
62
  private sendMail(admins: any) {
63
    this.showLoading = true;
64
    this.emailService.contact(this.properties,
65
      Composer.composeEmailForUsageCounts(this.contactForm.value, admins),
66
      this.contactForm.value.recaptcha).subscribe(
67
      res => {
68
        this.showLoading = false;
69
        if (res) {
70
          this.reset();
71
          this.modalOpen();
72
        } else {
73
          this.errorMessage = 'Email sent failed! Please try again.';
74
          this.contactForm.get('recaptcha').setValue('');
75
        }
76
      },
77
      error => {
78
        this.handleError('Email sent failed! Please try again.', error);
79
        this.showLoading = false;
80
        this.contactForm.get('recaptcha').setValue('');
81
      }
82
    );
83
  }
84
  
85
  public modalOpen() {
86
    this.modal.okButton = true;
87
    this.modal.alertTitle = 'Your request has been successfully submitted';
88
    this.modal.alertMessage = false;
89
    this.modal.cancelButton = false;
90
    this.modal.okButtonLeft = false;
91
    this.modal.okButtonText = 'OK';
92
    this.modal.open();
93
  }
94
  
95
  handleError(message: string, error) {
96
    this.errorMessage = message;
97
    console.log('Server responded: ' + error);
98
    this.showLoading = false;
99
  }
100
  
101
  public goToHome() {
102
    this.router.navigate(['/']);
103
  }
104
}
modules/uoa-graph-portal/trunk/src/index.html
1
<!doctype html>
2
<html lang="en">
3
<head>
4
  <meta charset="utf-8">
5
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
  <meta name="viewport" content="width=device-width, initial-scale=1">
7
  <base href="/">
8
  <title>OpenAIRE - Graph</title>
9
  <meta charset="UTF-8">
10
  <link rel="apple-touch-icon" sizes="57x57" href="assets/common-assets/logo/apple-icon-57x57.png">
11
  <link rel="apple-touch-icon" sizes="60x60" href="assets/common-assets/logo/apple-icon-60x60.png">
12
  <link rel="apple-touch-icon" sizes="72x72" href="assets/common-assets/logo/apple-icon-72x72.png">
13
  <link rel="apple-touch-icon" sizes="76x76" href="assets/common-assets/logo/apple-icon-76x76.png">
14
  <link rel="apple-touch-icon" sizes="114x114" href="assets/common-assets/logo/apple-icon-114x114.png">
15
  <link rel="apple-touch-icon" sizes="120x120" href="assets/common-assets/logo/apple-icon-120x120.png">
16
  <link rel="apple-touch-icon" sizes="144x144" href="assets/common-assets/logo/apple-icon-144x144.png">
17
  <link rel="apple-touch-icon" sizes="152x152" href="assets/common-assets/logo/apple-icon-152x152.png">
18
  <link rel="apple-touch-icon" sizes="180x180" href="assets/common-assets/logo/apple-icon-180x180.png">
19
  <link rel="icon" type="image/png" sizes="192x192" href="assets/common-assets/logo/android-icon-192x192.png">
20
  <link rel="icon" type="image/png" sizes="32x32" href="assets/common-assets/logo/favicon-32x32.png">
21
  <link rel="icon" type="image/png" sizes="96x96" href="assets/common-assets/logo/favicon-96x96.png">
22
  <link rel="icon" type="image/png" sizes="16x16" href="assets/common-assets/logo/favicon-16x16.png">
23
  <link href="assets/common-assets/logo/favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon"/>
24
  <meta name="robots" content="noindex">
25
  <script src="https://cdn.ckeditor.com/4.5.11/full-all/ckeditor.js"></script>
26
</head>
27
<body>
28
<app></app>
29
</body>
30
</html>
modules/uoa-graph-portal/trunk/src/app/contact/contact.module.ts
1
import {NgModule} from '@angular/core';
2
import {CommonModule} from '@angular/common';
3
import {RouterModule} from '@angular/router';
4

  
5
import {ContactComponent} from './contact.component';
6
import {EmailService} from '../openaireLibrary/utils/email/email.service';
7
import {RecaptchaModule} from 'ng-recaptcha';
8
import {AlertModalModule} from '../openaireLibrary/utils/modal/alertModal.module';
9
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
10
import {HelperModule} from '../openaireLibrary/utils/helper/helper.module';
11
import {IsRouteEnabled} from '../openaireLibrary/error/isRouteEnabled.guard';
12
import {Schema2jsonldModule} from '../openaireLibrary/sharedComponents/schema2jsonld/schema2jsonld.module';
13
import {SEOServiceModule} from '../openaireLibrary/sharedComponents/SEO/SEOService.module';
14
import {ContactUsModule} from '../openaireLibrary/contact-us/contact-us.module';
15
import {BreadcrumbsModule} from '../openaireLibrary/utils/breadcrumbs/breadcrumbs.module';
16

  
17

  
18
@NgModule({
19
  imports: [
20
    RouterModule.forChild([{
21
      path: '', component: ContactComponent
22
    }]), CommonModule, RouterModule,
23
    AlertModalModule, RecaptchaModule.forRoot(), HelperModule,
24
    Schema2jsonldModule, SEOServiceModule, ContactUsModule, BreadcrumbsModule
25
  ],
26
  declarations: [
27
    ContactComponent
28
  ],
29
  providers: [
30
    EmailService, PiwikService, IsRouteEnabled
31
  ],
32
  exports: [
33
    ContactComponent
34
  ]
35
})
36

  
37
export class ContactModule { }
modules/uoa-graph-portal/trunk/src/polyfills.ts
1
/**
2
 * This file includes polyfills needed by Angular and is loaded before the app.
3
 * You can add your own extra polyfills to this file.
4
 *
5
 * This file is divided into 2 sections:
6
 *   1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
7
 *   2. Application imports. Files imported after ZoneJS that should be loaded before your main
8
 *      file.
9
 *
10
 * The current setup is for so-called "evergreen" browsers; the last versions of browsers that
11
 * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
12
 * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
13
 *
14
 * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
15
 */
16

  
17
/***************************************************************************************************
18
 * BROWSER POLYFILLS
19
 */
20

  
21
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
22
import 'core-js/es6/symbol';
23
import 'core-js/es6/object';
24
import 'core-js/es6/function';
25
import 'core-js/es6/parse-int';
26
import 'core-js/es6/parse-float';
27
import 'core-js/es6/number';
28
import 'core-js/es6/math';
29
import 'core-js/es6/string';
30
import 'core-js/es6/date';
31
import 'core-js/es6/array';
32
import 'core-js/es6/regexp';
33
import 'core-js/es6/map';
34
import 'core-js/es6/weak-map';
35
import 'core-js/es6/set';
36

  
37
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
38
// import 'classlist.js';  // Run `npm install --save classlist.js`.
39

  
40
/** Evergreen browsers require these. **/
41
import 'core-js/es6/reflect';
42

  
43

  
44
/**
45
 * Required to support Web Animations `@angular/animation`.
46
 * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation
47
 **/
48
// import 'web-animations-js';  // Run `npm install --save web-animations-js`.
49

  
50

  
51

  
52
/***************************************************************************************************
53
 * Zone JS is required by Angular itself.
54
 */
55
import 'zone.js/dist/zone';  // Included with Angular CLI.
56

  
57

  
58

  
59
/***************************************************************************************************
60
 * APPLICATION IMPORTS
61
 */
62

  
63
/**
64
 * Date, currency, decimal and percent pipes.
65
 * Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10
66
 */
67
// import 'intl';  // Run `npm install --save intl`.
68
/**
69
 * Need to import at least one locale-data with intl.
70
 */
71
// import 'intl/locale-data/jsonp/en';
modules/uoa-graph-portal/trunk/src/test.ts
1
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
2

  
3
import 'zone.js/dist/long-stack-trace-zone';
4
import 'zone.js/dist/proxy.js';
5
import 'zone.js/dist/sync-test';
6
import 'zone.js/dist/jasmine-patch';
7
import 'zone.js/dist/async-test';
8
import 'zone.js/dist/fake-async-test';
9
import { getTestBed } from '@angular/core/testing';
10
import {
11
  BrowserDynamicTestingModule,
12
  platformBrowserDynamicTesting
13
} from '@angular/platform-browser-dynamic/testing';
14

  
15
// Unfortunately there's no typing for the `__karma__` variable. Just declare it as any.
16
declare const __karma__: any;
17
declare const require: any;
18

  
19
// Prevent Karma from running prematurely.
20
__karma__.loaded = function () {};
21

  
22
// First, initialize the Angular testing environment.
23
getTestBed().initTestEnvironment(
24
  BrowserDynamicTestingModule,
25
  platformBrowserDynamicTesting()
26
);
27
// Then we find all the tests.
28
const context = require.context('./', true, /\.spec\.ts$/);
29
// And load the modules.
30
context.keys().map(context);
31
// Finally, start Karma to run the tests.
32
__karma__.start();
modules/uoa-graph-portal/trunk/src/environments/environment.ts
1
// The file contents for the current environment will overwrite these during build.
2
// The build system defaults to the dev environment which uses `environment.ts`, but if you do
3
// `ng build --env=prod` then `environment.prod.ts` will be used instead.
4
// The list of which env maps to which file can be found in `.angular-cli.json`.
5

  
6
import {EnvProperties} from "../app/openaireLibrary/utils/properties/env-properties";
7

  
8
export let properties: EnvProperties = {
9
  environment: "development",
10
  searchAPIURLLAst: "http://beta.services.openaire.eu/search/v2/api/",
11
  helpdesk: "https://www.openaire.eu/support/helpdesk",
12
  helpdeskEmail: "helpdesk@openaire.eu",
13
  cookieDomain: ".di.uoa.gr",
14
  reCaptchaSiteKey: "6LcVtFIUAAAAAB2ac6xYivHxYXKoUvYRPi-6_rLu",
15
};
modules/uoa-graph-portal/trunk/src/main.ts
1
import { enableProdMode } from '@angular/core';
2
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
3

  
4
import { AppModule } from './app/app.module';
5
import { properties } from './environments/environment';
6

  
7
if (properties.environment !== "development") {
8
  enableProdMode();
9
}
10

  
11
platformBrowserDynamic().bootstrapModule(AppModule);
modules/uoa-graph-portal/trunk/src/tsconfig.spec.json
1
{
2
  "extends": "../tsconfig.json",
3
  "compilerOptions": {
4
    "outDir": "../out-tsc/spec",
5
    "baseUrl": "./",
6
    "module": "commonjs",
7
    "target": "es5",
8
    "types": [
9
      "jasmine",
10
      "node"
11
    ]
12
  },
13
  "files": [
14
    "test.ts",
15
    "polyfills.ts"
16
  ],
17
  "include": [
18
    "**/*.spec.ts",
19
    "**/*.d.ts"
20
  ]
21
}
modules/uoa-graph-portal/trunk/e2e/app.po.ts
1
import { browser, by, element } from 'protractor';
2

  
3
export class AppPage {
4
  navigateTo() {
5
    return browser.get('/');
6
  }
7

  
8
  getParagraphText() {
9
    return element(by.css('app-root h1')).getText();
10
  }
11
}
modules/uoa-graph-portal/trunk/README.txt
1
*******Useful project infrmation***********
2
Project has 2 external folders. Check them using  
3
	svn propget svn:externals ./
4

  
5
Above command should show the following:
6
	./src/app/openaireLibrary https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app
7
	./src/assets/common-assets https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/assets
8

  
9
After initial checkout, you may have to exlude ./src/app/openaireLibrary/app.* files in order the project to run properly.
10
Exclude the files from your local copy, but keep them in the repository.
11

  
12
Use the following command, to exclude the files:
13
	cd ./src/app/openaireLibrary
14
	svn update --set-depth exclude ./app.*
15
	svn update --set-depth exclude ./dashboard
modules/uoa-graph-portal/trunk/angular.json
1
{
2
  "$schema": "./node_modules/@angular-devkit/core/src/workspace/workspace-schema.json",
3
  "version": 1,
4
  "newProjectRoot": "projects",
5
  "projects": {
6
    "graph-portal": {
7
      "root": "",
8
      "sourceRoot": "src",
9
      "projectType": "application",
10
      "architect": {
11
        "build": {
12
          "builder": "@angular-devkit/build-angular:browser",
13
          "options": {
14
            "outputPath": "dist",
15
            "index": "src/index.html",
16
            "main": "src/main.ts",
17
            "tsConfig": "src/tsconfig.app.json",
18
            "polyfills": "src/polyfills.ts",
19
            "assets": [
20
              "src/assets"
21
            ],
22
            "styles": [
23
              "src/styles.css",
24
              "src/material.scss"
25
            ],
26
            "scripts": [
27
              "src/assets/common-assets/common/jquery.js",
28
              "src/assets/common-assets/common/uikit.min.js",
29
              "src/assets/common-assets/common/uikit-icons.min.js",
30
              "node_modules/jquery/dist/jquery.js"
31
            ]
32
          },
33
          "configurations": {
34
            "production": {
35
              "optimization": true,
36
              "outputHashing": "all",
37
              "sourceMap": false,
38
              "extractCss": true,
39
              "namedChunks": false,
40
              "aot": true,
41
              "extractLicenses": true,
42
              "vendorChunk": false,
43
              "buildOptimizer": true,
44
              "fileReplacements": [
45
                {
46
                  "replace": "src/environments/environment.ts",
47
                  "with": "src/environments/environment.prod.ts"
48
                }
49
              ]
50
            },
51
            "beta": {
52
              "optimization": true,
53
              "outputHashing": "all",
54
              "sourceMap": false,
55
              "extractCss": true,
56
              "namedChunks": false,
57
              "aot": true,
58
              "extractLicenses": true,
59
              "vendorChunk": false,
60
              "buildOptimizer": true,
61
              "fileReplacements": [
62
                {
63
                  "replace": "src/environments/environment.ts",
64
                  "with": "src/environments/environment.beta.ts"
65
                }
66
              ]
67
            }
68
          }
69
        },
70
        "serve": {
71
          "builder": "@angular-devkit/build-angular:dev-server",
72
          "options": {
73
            "browserTarget": "graph-portal:build"
74
          },
75
          "configurations": {
76
            "production": {
77
              "browserTarget": "graph-portal:build:production"
78
            },
79
            "beta": {
80
              "browserTarget": "graph-portal:build:beta"
81
            }
82
          }
83
        },
84
        "extract-i18n": {
85
          "builder": "@angular-devkit/build-angular:extract-i18n",
86
          "options": {
87
            "browserTarget": "graph-portal:build"
88
          }
89
        },
90
        "test": {
91
          "builder": "@angular-devkit/build-angular:karma",
92
          "options": {
93
            "main": "src/test.ts",
94
            "karmaConfig": "./karma.conf.js",
95
            "polyfills": "src/polyfills.ts",
96
            "tsConfig": "src/tsconfig.spec.json",
97
            "scripts": [
98
              "node_modules/jquery/dist/jquery.js",
99
              "node_modules/datatables.net/js/jquery.dataTables.js",
100
              "node_modules/interactiveminingv3/assets/js/ResizeSensor.js",
101
              "node_modules/interactiveminingv3/assets/js/jquery.sticky-sidebar.js"
102
            ],
103
            "styles": [
104
              "src/styles.css",
105
              "node_modules/datatables.net-dt/css/jquery.dataTables.css",
106
              "node_modules/interactiveminingv3/assets/css/interactive-mining.css",
107
              "node_modules/interactiveminingv3/assets/css/animations.css"
108
            ],
109
            "assets": [
110
              "src/assets",
111
              "src/robots.txt"
112
            ]
113
          }
114
        },
115
        "lint": {
116
          "builder": "@angular-devkit/build-angular:tslint",
117
          "options": {
118
            "tsConfig": [
119
              "src/tsconfig.app.json",
120
              "src/tsconfig.spec.json"
121
            ],
122
            "exclude": [
123
              "**/node_modules/**"
124
            ]
125
          }
126
        }
127
      }
128
    },
129
    "graph-portal-e2e": {
130
      "root": "e2e",
131
      "sourceRoot": "e2e",
132
      "projectType": "application",
133
      "architect": {
134
        "e2e": {
135
          "builder": "@angular-devkit/build-angular:protractor",
136
          "options": {
137
            "protractorConfig": "./protractor.conf.js",
138
            "devServerTarget": "graph-portal:serve"
139
          }
140
        },
141
        "lint": {
142
          "builder": "@angular-devkit/build-angular:tslint",
143
          "options": {
144
            "tsConfig": [
145
              "e2e/tsconfig.e2e.json"
146
            ],
147
            "exclude": [
148
              "**/node_modules/**"
149
            ]
150
          }
151
        }
152
      }
153
    }
154
  },
155
  "defaultProject": "graph-portal",
156
  "schematics": {
157
    "@schematics/angular:component": {
158
      "prefix": "app",
159
      "styleext": "css"
160
    },
161
    "@schematics/angular:directive": {
162
      "prefix": "app"
163
    }
164
  }
165
}
modules/uoa-graph-portal/trunk/package.json
1
{
2
  "name": "graph-portal",
3
  "version": "0.0.1",
4
  "license": "MIT",
5
  "scripts": {
6
    "ng": "ng",
7
    "start": "ng serve  --host 0.0.0.0 --disable-host-check --port=4900",
8
    "build": "ng build --prod",
9
    "build-beta": "ng build --configuration=beta",
10
    "test": "ng test",
11
    "lint": "ng lint",
12
    "e2e": "ng e2e"
13
  },
14
  "private": true,
15
  "dependencies": {
16
    "@angular/animations": "7.2.14",
17
    "@angular/cdk": "^7.3.7",
18
    "@angular/common": "7.2.14",
19
    "@angular/compiler": "7.2.14",
20
    "@angular/core": "7.2.14",
21
    "@angular/forms": "7.2.14",
22
    "@angular/http": "7.2.14",
23
    "@angular/material": "^7.3.7",
24
    "@angular/platform-browser": "7.2.14",
25
    "@angular/platform-browser-dynamic": "7.2.14",
26
    "@angular/router": "7.2.14",
27
    "@nguniversal/express-engine": "^6.0.0",
28
    "@types/express": "^4.16.1",
29
    "angular-datatables": "^4.4.1",
30
    "citation-js": "^0.3.4",
31
    "clipboard": "^1.5.16",
32
    "core-js": "2.6.8",
33
    "datatables.net": "^1.10.19",
34
    "datatables.net-dt": "^1.10.19",
35
    "jquery": "^3.4.1",
36
    "ng2-ckeditor": "1.1.9",
37
    "ngx-bootstrap": "^1.6.6",
38
    "ngx-color-picker": "^8.1.0",
39
    "ngx-json-ld": "0.1.6",
40
    "ng-recaptcha": "^3.0.5",
41
    "ts-md5": "^1.2.0",
42
    "tslib": "^1.9.0",
43
    "zone.js": "0.8.29"
44
  },
45
  "devDependencies": {
46
    "@angular-devkit/build-angular": "~0.13.0",
47
    "@angular/cli": "7.3.9",
48
    "@angular/compiler-cli": "7.2.14",
49
    "@angular/language-service": "7.2.14",
50
    "@types/datatables.net": "^1.10.17",
51
    "@types/jasmine": "~2.8.8",
52
    "@types/jasminewd2": "~2.0.3",
53
    "@types/jquery": "^3.3.29",
54
    "@types/node": "^14.0.13",
55
    "codelyzer": "~4.5.0",
56
    "jasmine-core": "~2.99.1",
57
    "jasmine-spec-reporter": "~4.2.1",
58
    "karma": "~3.0.0",
59
    "karma-chrome-launcher": "~2.1.1",
60
    "karma-cli": "~1.0.1",
61
    "karma-coverage-istanbul-reporter": "~2.0.1",
62
    "karma-jasmine": "~1.1.2",
63
    "karma-jasmine-html-reporter": "^0.2.2",
64
    "protractor": "~5.4.0",
65
    "rxjs": "6.5.1",
66
    "rxjs-compat": "^6.5.1",
67
    "rxjs-tslint": "^0.1.7",
68
    "ts-node": "~7.0.0",
69
    "tslint": "^5.7.0",
70
    "typescript": "3.2.4"
71
  }
72
}
modules/uoa-graph-portal/trunk/tsconfig.json
1
{
2
  "compileOnSave": false,
3
  "compilerOptions": {
4
    "importHelpers": true,
5
    "outDir": "./dist/out-tsc",
6
    "sourceMap": true,
7
    "declaration": false,
8
    "moduleResolution": "node",
9
    "emitDecoratorMetadata": true,
10
    "experimentalDecorators": true,
11
    "target": "es5",
12
    "typeRoots": [
13
      "node_modules/@types"
14
    ],
15
    "lib": [
16
      "es2017",
17
      "dom"
18
    ],
19
    "module": "es2015",
20
    "baseUrl": "./"
21
  }
22
}
modules/uoa-graph-portal/trunk/tslint.json
1
{
2
  "rulesDirectory": [
3
    "node_modules/codelyzer"
4
  ],
5
  "rules": {
6
    "arrow-return-shorthand": true,
7
    "callable-types": true,
8
    "class-name": true,
9
    "comment-format": [
10
      true,
11
      "check-space"
12
    ],
13
    "curly": true,
14
    "eofline": true,
15
    "forin": true,
16
    "import-blacklist": [
17
      true
18
    ],
19
    "import-spacing": true,
20
    "indent": [
21
      true,
22
      "spaces"
23
    ],
24
    "interface-over-type-literal": true,
25
    "label-position": true,
26
    "max-line-length": [
27
      true,
28
      140
29
    ],
30
    "member-access": false,
31
    "member-ordering": [
32
      true,
33
      {
34
        "order": [
35
          "static-field",
36
          "instance-field",
37
          "static-method",
38
          "instance-method"
39
        ]
40
      }
41
    ],
42
    "no-arg": true,
43
    "no-bitwise": true,
44
    "no-console": [
45
      true,
46
      "debug",
47
      "info",
48
      "time",
49
      "timeEnd",
50
      "trace"
51
    ],
52
    "no-construct": true,
53
    "no-debugger": true,
54
    "no-duplicate-super": true,
55
    "no-empty": false,
56
    "no-empty-interface": true,
57
    "no-eval": true,
58
    "no-inferrable-types": [
59
      true,
60
      "ignore-params"
61
    ],
62
    "no-misused-new": true,
63
    "no-non-null-assertion": true,
64
    "no-shadowed-variable": true,
65
    "no-string-literal": false,
66
    "no-string-throw": true,
67
    "no-switch-case-fall-through": true,
68
    "no-trailing-whitespace": true,
69
    "no-unnecessary-initializer": true,
70
    "no-unused-expression": true,
71
    "no-use-before-declare": true,
72
    "no-var-keyword": true,
73
    "object-literal-sort-keys": false,
74
    "one-line": [
75
      true,
76
      "check-open-brace",
77
      "check-catch",
78
      "check-else",
79
      "check-whitespace"
80
    ],
81
    "prefer-const": true,
82
    "quotemark": [
83
      true,
84
      "single"
85
    ],
86
    "radix": true,
87
    "semicolon": [
88
      true,
89
      "always"
90
    ],
91
    "triple-equals": [
92
      true,
93
      "allow-null-check"
94
    ],
95
    "typedef-whitespace": [
96
      true,
97
      {
98
        "call-signature": "nospace",
99
        "index-signature": "nospace",
100
        "parameter": "nospace",
101
        "property-declaration": "nospace",
102
        "variable-declaration": "nospace"
103
      }
104
    ],
105
    "typeof-compare": true,
106
    "unified-signatures": true,
107
    "variable-name": false,
108
    "whitespace": [
109
      true,
110
      "check-branch",
111
      "check-decl",
112
      "check-operator",
113
      "check-separator",
114
      "check-type"
115
    ],
116
    "directive-selector": [
117
      true,
118
      "attribute",
119
      "app",
120
      "camelCase"
121
    ],
122
    "component-selector": [
123
      true,
124
      "element",
125
      "app",
126
      "kebab-case"
127
    ],
128
    "use-input-property-decorator": true,
129
    "use-output-property-decorator": true,
130
    "use-host-property-decorator": true,
131
    "no-input-rename": true,
132
    "no-output-rename": true,
133
    "use-life-cycle-interface": true,
134
    "use-pipe-transform-interface": true,
135
    "component-class-suffix": true,
136
    "directive-class-suffix": true,
137
    "no-access-missing-member": true,
138
    "templates-use-public": true,
139
    "invoke-injectable": true
140
  }
141
}
modules/uoa-graph-portal/trunk/src/app/app.component.spec.ts
1
import { TestBed, async } from '@angular/core/testing';
2

  
3
import { AppComponent } from './app.component';
4

  
5
describe('AppComponent', () => {
6
  beforeEach(async(() => {
7
    TestBed.configureTestingModule({
8
      declarations: [
9
        AppComponent
10
      ],
11
    }).compileComponents();
12
  }));
13

  
14
  it('should create the app', async(() => {
15
    const fixture = TestBed.createComponent(AppComponent);
16
    const app = fixture.debugElement.componentInstance;
17
    expect(app).toBeTruthy();
18
  }));
19

  
20
  it(`should have as title 'app'`, async(() => {
21
    const fixture = TestBed.createComponent(AppComponent);
22
    const app = fixture.debugElement.componentInstance;
23
    expect(app.title).toEqual('app');
24
  }));
25

  
26
  it('should render title in a h1 tag', async(() => {
27
    const fixture = TestBed.createComponent(AppComponent);
28
    fixture.detectChanges();
29
    const compiled = fixture.debugElement.nativeElement;
30
    expect(compiled.querySelector('h1').textContent).toContain('Welcome to app!');
31
  }));
32
});
modules/uoa-graph-portal/trunk/src/app/polyfills.ts
1
/**
2
 * Created by stefanos on 25/4/2017.
3
 */
4
// Polyfills
5

  
6
// import 'ie-shim'; // Internet Explorer 9 support
7
import 'reflect-metadata';
8
// import 'core-js/es6';
9
// Added parts of es6 which are necessary for your project or your browser support requirements.
10
import 'core-js/es6/symbol';
11
import 'core-js/es6/object';
12
import 'core-js/es6/function';
13
import 'core-js/es6/parse-int';
14
import 'core-js/es6/parse-float';
15
import 'core-js/es6/number';
16
import 'core-js/es6/math';
17
import 'core-js/es6/string';
18
import 'core-js/es6/date';
19
import 'core-js/es6/array';
20
import 'core-js/es6/regexp';
21
import 'core-js/es6/map';
22
import 'core-js/es6/set';
23
import 'core-js/es6/weak-map';
24
import 'core-js/es6/weak-set';
25
import 'core-js/es6/typed';
26
import 'core-js/es6/reflect';
27
// see issue https://github.com/AngularClass/angular2-webpack-starter/issues/709
28
// import 'core-js/es6/promise';
29

  
30
import 'intl';
31
import 'intl/locale-data/jsonp/en';
32

  
33
import 'core-js/es7/reflect';
34
import 'zone.js/dist/zone';
35

  
36
// import 'ng2-ckeditor/lib';
37

  
38
// if ('production' === ENV) {
39
//     // Production
40
//
41
// } else {
42
//
43
//     // Development
44
//     Error.stackTraceLimit = Infinity;
45
//
46
//     /* tslint:disable no-var-requires */
47
//     require('zone.js/dist/long-stack-trace-zone');
48
//
49
// }
modules/uoa-graph-portal/trunk/src/app/services/layout.service.ts
1
import {Injectable} from '@angular/core';
2
import {ActivationStart, Router} from '@angular/router';
3
import {BehaviorSubject, Observable} from 'rxjs';
4

  
5
@Injectable({
6
  providedIn: 'root'
7
})
8
export class LayoutService {
9
  
10
  private isHomeSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
11
  
12
  constructor(private router: Router) {
13
    this.router.events.subscribe(event => {
14
      if (event instanceof ActivationStart) {
15
        let data = event.snapshot.data;
16
        if (data['isHome'] == undefined ||
17
          data['isHome'] === false) {
18
          this.setIsHome(false);
19
        } else {
20
          this.setIsHome(true);
21
        }
22
      }
23
    });
24
  }
25
  
26
  public setIsHome(isHome: boolean) {
27
    this.isHomeSubject.next(isHome);
28
  }
29
  
30
  public get isHome(): Observable<boolean> {
31
    return this.isHomeSubject.asObservable();
32
  }
33
}
modules/uoa-graph-portal/trunk/src/app/app.component.html
1
<navbar *ngIf= "showMenu" portal="usage-counts" [onlyTop]="false" [userMenu]="false" [showLogo]="!isHome"
2
        [user]="user" [userMenuItems]=userMenuItems [menuItems]=menuItems [properties]=properties></navbar>
3
<div class="custom-main-content">
4
    <main [class.full-height]="isHome">
5
        <router-outlet></router-outlet>
6
    </main>
7
</div>
8
<bottom class="footer uk-visible@m"
9
        [showSocialButtons]="true" [showMenuItems]="true" [showOpenaire]="true"
10
        [darkBackground]="false" [centered]="true"></bottom>
11
<bottom class="footer uk-hidden@m"
12
        [showSocialButtons]="true" [showMenuItems]="true" [showOpenaire]="true"
13
        [darkBackground]="false" [centered]="true"></bottom>
14
<cookie-law position="bottom">
15
    OpenAIRE uses cookies in order to function properly.<br>
16
    Cookies are small pieces of data that websites store in your browser to allow us to give you the best browsing experience possible.
17
    By using the OpenAIRE portal you accept our use of cookies. <a href="//ec.europa.eu/ipg/basics/legal/cookies/index_en.htm" target="_blank"> Read more <span class="uk-icon">
18
    <svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="chevron-right" ratio="1"><polyline fill="none" stroke="#000" stroke-width="1.03" points="7 4 13 10 7 16"></polyline></svg>
19
    </span></a>
20
</cookie-law>
21

  
modules/uoa-graph-portal/trunk/src/app/app.component.ts
1
import {Component, OnInit} from '@angular/core';
2
import {MenuItem, RootMenuItem} from './openaireLibrary/sharedComponents/menu';
3
import {EnvProperties} from './openaireLibrary/utils/properties/env-properties';
4
import {User} from './openaireLibrary/login/utils/helper.class';
5
import {properties} from '../environments/environment';
6
import {LayoutService} from './services/layout.service';
7

  
8
@Component({
9
  selector: 'app',
10
  templateUrl: './app.component.html',
11
})
12

  
13
export class AppComponent implements OnInit {
14
  title = 'OpenAIRE Research Graph';
15
  userMenuItems: MenuItem[] = [];
16
  menuItems: RootMenuItem [] = [];
17
  logInUrl = null;
18
  logOutUrl = null;
19
  properties: EnvProperties = properties;
20
  showMenu: boolean = false;
21
  user: User;
22
  isHome: boolean;
23
  
24
  constructor(private layoutService: LayoutService) {}
25
  
26
  ngOnInit() {
27
    this.logInUrl = this.properties.loginUrl;
28
    this.logOutUrl = this.properties.logoutUrl;
29
    this.showMenu = true;
30
    this.layoutService.isHome.subscribe(isHome => {
31
      this.isHome = isHome;
32
      this.buildMenu(isHome);
33
    });
34
  }
35
  
36
  buildMenu(isHome) {
37
    this.menuItems = [
38
      {
39
        rootItem: new MenuItem("about", "About", "", "/about", false, [], null, {}),
40
        items: [
41
          // new MenuItem("architecture", "Architecture", "", "/about", false, [], null, {}, null, 'architecture'),
42
          /*
43
                    new MenuItem("faqs", "FAQs", "", "/about", false, [], null, {}, null, 'faqs')
44
          */
45
        ]
46
      },
47
      {
48
        rootItem: new MenuItem("resources", "Resources", "", "/resources", false, [], null, {}),
49
        items: [
50
          // new MenuItem("provide", "OpenAIRE Provide", "", "/resources", false, [], null, {}),
51
          // new MenuItem("apis", "APIs and Reports", "", "/resources", false, [], null, {}, null, 'apis')
52
        ]
53
      },
54
      {
55
        rootItem: new MenuItem("contact", "Support", "", "/support", false, [], null, {}),
56
        items: []
57
      }
58
    ];
59
    if(!isHome) {
60
      this.menuItems = [{
61
        rootItem: new MenuItem("home", "Home", "", "/", false, [], null, {}),
62
        items: []
63
      }].concat(this.menuItems);
64
    }
65
  }
66
}
modules/uoa-graph-portal/trunk/src/app/home/home.component.css
1
.portal-color.emphasis {
2
    color: #37C7E9;
3
    font-size: 40px;
4
    font-weight: bold;
5
}
6

  
7
/*.numbers-background {*/
8
/*    background: transparent url('explore-assets/numbers_background_pattern.svg') 0% 0% repeat-x padding-box;*/
9
/*    background-position: center bottom;*/
10
/*}*/
11

  
12
.numbers-background .emphasis {
13
    font-size: 40px;
14
    font-weight: bold;
15
}
modules/uoa-graph-portal/trunk/src/app/home/home.module.ts
1
// import {NgModule} from '@angular/core';
2
// import {HomeComponent} from './home.component';
3
// import {CommonModule} from '@angular/common';
4
// import {RouterModule} from '@angular/router';
5
// import {FullPageSliderModule} from '../openaireLibrary/utils/full-page-slider/full-page-slider.module';
6
// import {BottomModule} from '../openaireLibrary/sharedComponents/bottom.module';
7
//
8
// @NgModule({
9
//   imports: [
10
//     CommonModule,
11
//     RouterModule.forChild([{
12
//       path: '', component: HomeComponent,
13
//     }]),
14
//     FullPageSliderModule,
15
//     BottomModule,
16
//   ],
17
//   declarations: [HomeComponent],
18
//   exports: [HomeComponent]
19
// })
20
// export class HomeModule{
21
// }
22

  
23

  
24
import { NgModule}            from '@angular/core';
25
import { CommonModule }        from '@angular/common';
26
import { FormsModule }         from '@angular/forms';
27
import { RouterModule } from '@angular/router';
28

  
29
//import {HomeRoutingModule} from './home-routing.module';
30
import {HomeComponent} from './home.component';
31

  
32
import { DataProvidersServiceModule} from '../openaireLibrary/services/dataProvidersService.module';
33
import { SearchResearchResultsServiceModule} from '../openaireLibrary/services/searchResearchResultsService.module';
34
import { ProjectsServiceModule} from '../openaireLibrary/services/projectsService.module';
35
import { OrganizationsServiceModule} from '../openaireLibrary/services/organizationsService.module';
36
import { SearchFormModule} from '../openaireLibrary/searchPages/searchUtils/searchForm.module';
37
import { PiwikServiceModule} from '../openaireLibrary/utils/piwik/piwikService.module';
38

  
39
import {HelperModule} from '../openaireLibrary/utils/helper/helper.module';
40

  
41
import {RefineFieldResultsServiceModule} from '../openaireLibrary/services/refineFieldResultsService.module';
42
import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard';
43
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
44
import { SEOServiceModule } from '../openaireLibrary/sharedComponents/SEO/SEOService.module';
45

  
46
import {ErrorMessagesModule} from '../openaireLibrary/utils/errorMessages.module';
47
import {OtherPortalsModule} from "../openaireLibrary/sharedComponents/other-portals/other-portals.module";
48
import {EntitiesSelectionModule} from "../openaireLibrary/searchPages/searchUtils/entitiesSelection.module";
49
import {QuickSelectionsModule} from "../openaireLibrary/searchPages/searchUtils/quick-selections.module";
50

  
51
@NgModule({
52
  imports: [
53
    CommonModule, FormsModule, RouterModule,
54
    RouterModule.forChild([{
55
      path: '', component: HomeComponent,
56
    }]),
57
    RefineFieldResultsServiceModule,
58
    DataProvidersServiceModule, SearchResearchResultsServiceModule,
59
    ProjectsServiceModule, OrganizationsServiceModule,
60
    SearchFormModule,
61
    PiwikServiceModule,
62
    // HomeRoutingModule,
63
    HelperModule,
64
    ErrorMessagesModule,
65
    SEOServiceModule, OtherPortalsModule, EntitiesSelectionModule, QuickSelectionsModule
66
  ],
67
  declarations: [
68
    HomeComponent
69
  ],
70
  providers:[
71
    FreeGuard, PreviousRouteRecorder
72
  ],
73
  exports: [
74
    HomeComponent
75
  ]
76
})
77
export class HomeModule { }
modules/uoa-graph-portal/trunk/src/app/home/home.component.html
1

  
2
<div class="uk-section-default uk-section  uk-padding-remove-bottom">
3
  <div class="uk-container uk-text-center  uk-margin-medium-bottom">
4
    <div class="uk-margin-medium uk-flex-center">
5
      <div class="uk-first-column">
6
        <div class="uk-panel">
7
          <h2 class="uk-margin uk-h2 uk-text-center">
8
            We believe in <span class="uk-text-bold">Numbers</span>
9
          </h2>
10
          <div class="uk-margin-medium-top">
11
            <div class="uk-grid uk-child-width-1-3@m">
12
              <p *ngIf="fundersSize">
13
                <span class="portal-color emphasis">
14
                  <span class="uk-text-bold"> {{fundersSize.number|number}}</span>{{fundersSize.size}}
15
                </span>
16
                <br>
17
                <span class="uk-text-uppercase uk-text-large">Funders</span>
18
              </p>
19
              <p *ngIf="datasourcesSize" class="">
20
                <span class="portal-color emphasis">
21
                  <span class="uk-text-bold"> {{datasourcesSize.number|number}}</span>
22
                  <span class="portal-color uk-h2">{{datasourcesSize.size}}</span>
23
                </span>
24
                <br>
25
                <span class="uk-text-uppercase uk-text-large">Content providers</span>
26
              </p>
27
              <p *ngIf="projectsSize">
28
                <span class="portal-color emphasis">
29
                  <span class="uk-text-bold"> {{projectsSize.number|number}}</span>
30
                  <span class="portal-color uk-h2">{{projectsSize.size}}</span>
31
                </span>
32
                <br>
33
                <span class="uk-text-uppercase uk-text-large">Projects</span>
34
              </p>
35
            </div>
36
          </div>
37
        </div>
38
      </div>
39
    </div>
40
  </div>
41
</div>
42
<div class="uk-section-default uk-section numbers-background  uk-padding-remove-top">
43
  <div class="uk-container uk-margin-medium-top">
44
    <div class="uk-grid uk-flex uk-flex-center">
45
      <div class="uk-margin-large-right">
46
        <div *ngIf="publicationsSize" class="uk-margin-medium-bottom">
47
          <p>
48
            <span class="emphasis">{{publicationsSize.count|number}} </span><br>
49
            <span class="uk-icon uk-text-uppercase uk-float-left">
50
              <svg height="20" ratio="1" viewBox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg"><rect style="stroke: var(--portal-main-color);" fill="none" height="16" stroke="#000" width="12" x="3.5" y="2.5"></rect><polyline style="stroke: var(--portal-main-color);" fill="none" points="5 0.5 17.5 0.5 17.5 17" stroke="#000"></polyline></svg>
51
              publications
52
            </span>
53
          </p>
54
        </div>
55
        <div *ngIf="softwareSize" class="uk-margin-medium-bottom">
56
          <p>
57
            <span class="emphasis">{{softwareSize.count|number}} </span><br>
58
            <span class="uk-icon uk-text-uppercase uk-float-left">
59
              <svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" data-svg="cog"><circle style="stroke: var(--portal-main-color);" fill="none" stroke="#000" cx="9.997" cy="10" r="3.31"></circle><path style="stroke: var(--portal-main-color);" fill="none" stroke="#000" d="M18.488,12.285 L16.205,16.237 C15.322,15.496 14.185,15.281 13.303,15.791 C12.428,16.289 12.047,17.373 12.246,18.5 L7.735,18.5 C7.938,17.374 7.553,16.299 6.684,15.791 C5.801,15.27 4.655,15.492 3.773,16.237 L1.5,12.285 C2.573,11.871 3.317,10.999 3.317,9.991 C3.305,8.98 2.573,8.121 1.5,7.716 L3.765,3.784 C4.645,4.516 5.794,4.738 6.687,4.232 C7.555,3.722 7.939,2.637 7.735,1.5 L12.263,1.5 C12.072,2.637 12.441,3.71 13.314,4.22 C14.206,4.73 15.343,4.516 16.225,3.794 L18.487,7.714 C17.404,8.117 16.661,8.988 16.67,10.009 C16.672,11.018 17.415,11.88 18.488,12.285 L18.488,12.285 Z"></path></svg>
60
              software
61
            </span>
62
          </p>
63
        </div>
64
      </div>
65
      <div class="">
66
        <div *ngIf="datasetsSize" class="uk-margin-medium-bottom">
67
          <p>
68
            <span class="emphasis">{{datasetsSize.count|number}} </span><br>
69
            <span class="uk-icon uk-text-uppercase uk-float-left">
70
              <svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" data-svg="database"><ellipse style="stroke: var(--portal-main-color);" fill="none" stroke="#000" cx="10" cy="4.64" rx="7.5" ry="3.14"></ellipse><path style="stroke: var(--portal-main-color);" fill="none" stroke="#000" d="M17.5,8.11 C17.5,9.85 14.14,11.25 10,11.25 C5.86,11.25 2.5,9.84 2.5,8.11"></path><path style="stroke: var(--portal-main-color);"fill="none" stroke="#000" d="M17.5,11.25 C17.5,12.99 14.14,14.39 10,14.39 C5.86,14.39 2.5,12.98 2.5,11.25"></path><path style="stroke: var(--portal-main-color);" fill="none" stroke="#000" d="M17.49,4.64 L17.5,14.36 C17.5,16.1 14.14,17.5 10,17.5 C5.86,17.5 2.5,16.09 2.5,14.36 L2.5,4.64"></path></svg>
71
              research data
72
            </span>
73
          </p>
74
        </div>
75
        <div *ngIf="otherSize" class="uk-margin-medium-bottom">
76
          <p>
77
            <span class="emphasis">{{otherSize.count|number}} </span><br>
78
            <span class="uk-icon uk-text-uppercase uk-float-left">
79
              <svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" data-svg="world"><path style="stroke: var(--portal-main-color);" fill="none" stroke="#000" d="M1,10.5 L19,10.5"></path><path style="stroke: var(--portal-main-color);" fill="none" stroke="#000" d="M2.35,15.5 L17.65,15.5"></path><path style="stroke: var(--portal-main-color);" fill="none" stroke="#000" d="M2.35,5.5 L17.523,5.5"></path><path style="stroke: var(--portal-main-color);" fill="none" stroke="#000" d="M10,19.46 L9.98,19.46 C7.31,17.33 5.61,14.141 5.61,10.58 C5.61,7.02 7.33,3.83 10,1.7 C10.01,1.7 9.99,1.7 10,1.7 L10,1.7 C12.67,3.83 14.4,7.02 14.4,10.58 C14.4,14.141 12.67,17.33 10,19.46 L10,19.46 L10,19.46 L10,19.46 Z"></path><circle style="stroke: var(--portal-main-color);" fill="none" stroke="#000" cx="10" cy="10.5" r="9"></circle></svg>
80
              other research products
81
            </span>
82
          </p>
83
        </div>
84
      </div>
85
    </div>
86
  </div>
87
</div>
modules/uoa-graph-portal/trunk/src/app/home/home.component.ts
1
import {Component} from '@angular/core';
2
import {Subscription} from 'rxjs';
3
import {ActivatedRoute, Router} from '@angular/router';
4
import {Location} from '@angular/common';
5
import "rxjs/add/observable/zip";
6
import {Title, Meta}                  from '@angular/platform-browser';
7
import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service';
8
import {  SearchDataprovidersService} from '../openaireLibrary/services/searchDataproviders.service';
9
import {  SearchProjectsService} from '../openaireLibrary/services/searchProjects.service';
10
import {  SearchOrganizationsService} from '../openaireLibrary/services/searchOrganizations.service';
11
import {  RefineFieldResultsService} from '../openaireLibrary/services/refineFieldResults.service';
12
import {  NumberUtils} from '../openaireLibrary/utils/number-utils.class';
13

  
14
import {  RouterHelper} from '../openaireLibrary/utils/routerHelper.class';
15
import { EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
16
import { ErrorCodes} from '../openaireLibrary/utils/properties/errorCodes';
17
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
18
import { SEOService } from '../openaireLibrary/sharedComponents/SEO/SEO.service';
19
import {SearchResearchResultsService} from "../openaireLibrary/services/searchResearchResults.service";
20
import {properties} from "../../environments/environment";
21

  
22
@Component({
23
  selector: 'home',
24
  templateUrl: 'home.component.html',
25
  styleUrls: ['home.component.css']
26
})
27
export class HomeComponent {
28
  public pageTitle = "OpenAIRE Research Graph";
29

  
30
  public errorCodes:ErrorCodes = new ErrorCodes();
31
  public routerHelper:RouterHelper = new RouterHelper();
32

  
33
  public publicationsSize:any = null;
34
  public datasetsSize:any = null;
35
  public datasetsLinkedSize:any = null;
36
  public softwareLinkedSize:any = null;
37
  public softwareSize: any = null;
38
  public otherSize: any = null;
39
  public fundersSize:any = null;
40
  public projectsSize:any = null;
41
  public datasourcesSize:any = null;
42

  
43
  properties: EnvProperties = properties;
44

  
45
  subs: Subscription[] = [];
46

  
47
  constructor (
48
    private route: ActivatedRoute,
49
    private _router: Router,
50
    private _searchResearchResultsService: SearchResearchResultsService,
51
    private _searchDataprovidersService: SearchDataprovidersService,
52
    private _searchProjectsService: SearchProjectsService,
53
    private _searchOrganizationsService: SearchOrganizationsService,
54
    private _refineFieldResultsService:RefineFieldResultsService,
55
    private location: Location, private _piwikService:PiwikService,
56
    private config: ConfigurationService, private _meta: Meta, private _title: Title, private seoService: SEOService
57
  ) {
58

  
59
    let description = "OpenAIRE Research Graph: Over 100M of research deduplicated, 170K research software, 11M research data. One of the largest open scholarly records collection worldwide.";
60
    let title = "OpenAIRE | Find and Share research";
61

  
62
    this._title.setTitle(title);
63
    this._meta.updateTag({content:description},"name='description'");
64
    this._meta.updateTag({content:description},"property='og:description'");
65
    this._meta.updateTag({content:title},"property='og:title'");
66
  }
67

  
68
  public ngOnInit() {
69
        this.seoService.createLinkForCanonicalURL(this.properties.domain + this.properties.baseLink+this._router.url, false);
70

  
71
        if(this.properties){
72
          var url = this.properties.domain + this.properties.baseLink+this._router.url;
73
          this._meta.updateTag({content:url},"property='og:url'");
74
          if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
75
            this.subs.push(this._piwikService.trackView(this.properties, "OpenAIRE").subscribe());
76
          }
77

  
78

  
79
          this.getNumbers();
80
        }
81
  }
82
  public ngOnDestroy() {
83
    for (let sub of this.subs) {
84
      sub.unsubscribe();
85
    }
86
  }
87

  
88
  private getNumbers() {
89
    this.subs.push(this._searchResearchResultsService.numOfSearchResults("publication", "", this.properties).subscribe(
90
      data => {
91
        if(data && data > 0 ){
92
          this.publicationsSize = NumberUtils.roundNumber(data);
93

  
94
        }
95
      },
96
      err => {
97
        this.handleError("Error getting number of publications", err);
98
      }
99
    ));
100
    this.subs.push(this._searchResearchResultsService.numOfSearchResults("dataset", "", this.properties).subscribe(
101
      data => {
102
        if(data && data > 0 ){
103
          this.datasetsSize = NumberUtils.roundNumber(data);
104
        }
105
      },
106
      err => {
107
        //console.log(err);
108
        this.handleError("Error getting number of research data", err);
109
      }
110
    ));
111
    this.subs.push(this._searchResearchResultsService.numOfSearchResultsLinkedToPub("dataset", this.properties).subscribe(
112
      data => {
113
        if(data && data > 0 ){
114
          this.datasetsLinkedSize = NumberUtils.roundNumber(data);
115
        }
116
      },
117
      err => {
118
        this.handleError("Error getting number of linkedresearch data", err);
119
      }
120
    ));
121
    this.subs.push(this._searchResearchResultsService.numOfSearchResults("software", "", this.properties).subscribe(
122
      data => {
123
        if (data && data > 0) {
124
          this.softwareSize = NumberUtils.roundNumber(data);
125
        }
126
      },
127
      err => {
128
        this.handleError("Error getting number of software data", err);
129
      }
130
    ));
131
    this.subs.push(this._searchResearchResultsService.numOfSearchResultsLinkedToPub("software", this.properties).subscribe(
132
      data => {
133
        if(data && data > 0 ){
134
          this.softwareLinkedSize = NumberUtils.roundNumber(data);
135
        }
136
      },
137
      err => {
138
        this.handleError("Error getting number of linked software", err);
139
      }
140
    ));
141
    this.subs.push(this._searchResearchResultsService.numOfSearchResults("other", "", this.properties).subscribe(
142
      data => {
143
        if (data && data > 0) {
144
          this.otherSize = NumberUtils.roundNumber(data);
145
        }
146
      },
147
      err => {
148
        this.handleError("Error getting number of software data", err);
149
      }
150
    ));
151
    this.subs.push(this._refineFieldResultsService.getRefineFieldsResultsByEntityName(["funder"],"project", this.properties).subscribe(
152
      data => {
153

  
154

  
155
        if(data[0] && data[0] > 0 ){
156
          this.projectsSize = NumberUtils.roundNumber(data[0]);
157
        }
158
        if(data[1].length > 0 && data[1][0].filterId == "funder" && data[1][0].values ){
159
          this.fundersSize = NumberUtils.roundNumber(data[1][0].values.length);
160
        }
161

  
162
      },
163
      err => {
164
        this.handleError("Error getting 'funder' field results of projects", err);
165
      })
166
    );
167

  
168
    this.subs.push(this._searchDataprovidersService.numOfSearchDataproviders("", this.properties).subscribe(
169
      data => {
170
        if(data && data > 0 ){
171
          this.datasourcesSize = NumberUtils.roundNumber(data);
172
        }
173

  
174
      },
175
      err => {
176
        this.handleError("Error getting number of content providers", err);
177
      }
178
    ));
179
  }
180

  
181
  private handleError(message: string, error) {
182
    console.error("Home Page: "+message, error);
183
  }
184
}
modules/uoa-graph-portal/trunk/src/app/main.ts
1
import './polyfills.ts';
2
//import './vendors.ts';
3

  
4
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
5
import {AppModule} from './app.module';
6
import {enableProdMode} from "@angular/core";
7
import {properties} from "../environments/environment";
8

  
9
const platform = platformBrowserDynamic();
10
if (properties.environment !== "development") {
11
  enableProdMode();
12
}
13
platform.bootstrapModule(AppModule);
modules/uoa-graph-portal/trunk/src/app/app.module.ts
1
import {AppRoutingModule} from "./app.routing";
2
import {BrowserModule} from "@angular/platform-browser";
3
import {HttpClientModule} from "@angular/common/http";
4
import {CookieLawModule} from "./openaireLibrary/sharedComponents/cookie-law/cookie-law.module";
5
import {NavigationBarModule} from "./openaireLibrary/sharedComponents/navigationBar.module";
6
import {BrowserAnimationsModule} from "@angular/platform-browser/animations";
7
import {SafeHtmlPipeModule} from "./openaireLibrary/utils/pipes/safeHTMLPipe.module";
8
import {AppComponent} from "./app.component";
9
import {NgModule} from "@angular/core";
10
import {EnvironmentSpecificService} from "./openaireLibrary/utils/properties/environment-specific.service";
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff