Project

General

Profile

« Previous | Next » 

Revision 54927

Tagging release 1.0 of uoa-repository-manager dashboard project

View differences:

modules/uoa-repository-dashboard-gui/tags/release-1.0/angular.json
1
{
2
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3
  "version": 1,
4
  "newProjectRoot": "projects",
5
  "projects": {
6
    "uoa-repository-manager-ui": {
7
      "root": "",
8
      "sourceRoot": "src",
9
      "projectType": "application",
10
      "prefix": "app",
11
      "schematics": {},
12
      "architect": {
13
        "build": {
14
          "builder": "@angular-devkit/build-angular:browser",
15
          "options": {
16
            "outputPath": "dist/uoa-repository-manager-ui",
17
            "index": "src/index.html",
18
            "main": "src/main.ts",
19
            "polyfills": "src/polyfills.ts",
20
            "tsConfig": "src/tsconfig.app.json",
21
            "assets": [
22
              "src/favicon.ico",
23
              "src/assets"
24
            ],
25
            "styles": [
26
              "src/styles.scss"
27
            ],
28
            "scripts": [
29
              "node_modules/jquery/dist/jquery.min.js",
30
              "node_modules/uikit/dist/js/uikit.min.js",
31
              "node_modules/uikit/dist/js/uikit-icons.min.js"
32
            ]
33
          },
34
          "configurations": {
35
            "production": {
36
              "fileReplacements": [
37
                {
38
                  "replace": "src/environments/environment.ts",
39
                  "with": "src/environments/environment.prod.ts"
40
                }
41
              ],
42
              "optimization": true,
43
              "outputHashing": "all",
44
              "sourceMap": false,
45
              "extractCss": true,
46
              "namedChunks": false,
47
              "aot": true,
48
              "extractLicenses": true,
49
              "vendorChunk": false,
50
              "buildOptimizer": true
51
            }
52
          }
53
        },
54
        "serve": {
55
          "builder": "@angular-devkit/build-angular:dev-server",
56
          "options": {
57
            "browserTarget": "uoa-repository-manager-ui:build",
58
            "port": 4200,
59
            "host": "localhost"
60
          },
61
          "configurations": {
62
            "production": {
63
              "browserTarget": "uoa-repository-manager-ui:build:production"
64
            }
65
          }
66
        },
67
        "extract-i18n": {
68
          "builder": "@angular-devkit/build-angular:extract-i18n",
69
          "options": {
70
            "browserTarget": "uoa-repository-manager-ui:build"
71
          }
72
        },
73
        "test": {
74
          "builder": "@angular-devkit/build-angular:karma",
75
          "options": {
76
            "main": "src/test.ts",
77
            "polyfills": "src/polyfills.ts",
78
            "tsConfig": "src/tsconfig.spec.json",
79
            "karmaConfig": "src/karma.conf.js",
80
            "styles": [
81
              "src/styles.scss"
82
            ],
83
            "scripts": [],
84
            "assets": [
85
              "src/favicon.ico",
86
              "src/assets"
87
            ]
88
          }
89
        },
90
        "lint": {
91
          "builder": "@angular-devkit/build-angular:tslint",
92
          "options": {
93
            "tsConfig": [
94
              "src/tsconfig.app.json",
95
              "src/tsconfig.spec.json"
96
            ],
97
            "exclude": [
98
              "**/node_modules/**"
99
            ]
100
          }
101
        }
102
      }
103
    },
104
    "uoa-repository-manager-ui-e2e": {
105
      "root": "e2e/",
106
      "projectType": "application",
107
      "architect": {
108
        "e2e": {
109
          "builder": "@angular-devkit/build-angular:protractor",
110
          "options": {
111
            "protractorConfig": "e2e/protractor.conf.js",
112
            "devServerTarget": "uoa-repository-manager-ui:serve"
113
          },
114
          "configurations": {
115
            "production": {
116
              "devServerTarget": "uoa-repository-manager-ui:serve:production"
117
            }
118
          }
119
        },
120
        "lint": {
121
          "builder": "@angular-devkit/build-angular:tslint",
122
          "options": {
123
            "tsConfig": "e2e/tsconfig.e2e.json",
124
            "exclude": [
125
              "**/node_modules/**"
126
            ]
127
          }
128
        }
129
      }
130
    }
131
  },
132
  "defaultProject": "uoa-repository-manager-ui"
133
}
0 134

  
modules/uoa-repository-dashboard-gui/tags/release-1.0/package.json
1
{
2
  "name": "uoa-repository-manager-ui",
3
  "version": "0.0.0",
4
  "scripts": {
5
    "ng": "ng",
6
    "start": "ng serve",
7
    "start:proxy": "ng serve --proxy-config proxy.conf.json",
8
    "build": "rm -rf dist; ng build --prod",
9
    "test": "ng test",
10
    "lint": "ng lint",
11
    "e2e": "ng e2e"
12
  },
13
  "private": true,
14
  "dependencies": {
15
    "@angular/animations": "^6.0.3",
16
    "@angular/common": "^6.0.3",
17
    "@angular/compiler": "^6.0.3",
18
    "@angular/core": "^6.0.3",
19
    "@angular/forms": "^6.0.3",
20
    "@angular/http": "^6.0.3",
21
    "@angular/platform-browser": "^6.0.3",
22
    "@angular/platform-browser-dynamic": "^6.0.3",
23
    "@angular/router": "^6.0.3",
24
    "angular2-cookie-law": "^6.0.4",
25
    "bootstrap": "^4.1.3",
26
    "core-js": "^2.5.4",
27
    "jquery": "^3.3.1",
28
    "ngx-bootstrap": "^3.0.1",
29
    "ngx-matomo": "^0.1.2",
30
    "rxjs": "6.3.3",
31
    "uikit": "^3.0.0-rc.19",
32
    "zone.js": "^0.8.26"
33
  },
34
  "devDependencies": {
35
    "@angular-devkit/build-angular": "~0.6.8",
36
    "@angular/cli": "~6.0.8",
37
    "@angular/compiler-cli": "^6.0.3",
38
    "@angular/language-service": "^6.0.3",
39
    "@types/jasmine": "~2.8.6",
40
    "@types/jasminewd2": "~2.0.3",
41
    "@types/node": "~8.9.4",
42
    "codelyzer": "~4.2.1",
43
    "jasmine-core": "~2.99.1",
44
    "jasmine-spec-reporter": "~4.2.1",
45
    "karma": "~3.1.3",
46
    "karma-chrome-launcher": "~2.2.0",
47
    "karma-coverage-istanbul-reporter": "~2.0.0",
48
    "karma-jasmine": "~1.1.1",
49
    "karma-jasmine-html-reporter": "^0.2.2",
50
    "protractor": "^5.4.1",
51
    "ts-node": "~5.0.1",
52
    "tslint": "~5.9.1",
53
    "typescript": "~2.7.2"
54
  }
55
}
0 56

  
modules/uoa-repository-dashboard-gui/tags/release-1.0/tsconfig.json
1
{
2
  "compileOnSave": false,
3
  "compilerOptions": {
4
    "baseUrl": "./",
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
  }
20
}
0 21

  
modules/uoa-repository-dashboard-gui/tags/release-1.0/.gitignore
1
# Logs
2
logs
3
*.log
4

  
5
# Runtime data
6
pids
7
*.pid
8
*.seed
9

  
10
# Directory for instrumented libs generated by jscoverage/JSCover
11
lib-cov
12

  
13
# Coverage directory used by tools like istanbul
14
coverage
15

  
16
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
17
.grunt
18

  
19
# Compiled binary addons (http://nodejs.org/api/addons.html)
20
build/Release
21

  
22
# Users Environment Variables
23
.lock-wscript
24

  
25
# OS generated files #
26
.DS_Store
27
ehthumbs.db
28
Icon?
29
Thumbs.db
30

  
31
# Node Files #
32
/node_modules
33
/bower_components
34

  
35
# Coverage #
36
/coverage/
37

  
38
# Typing #
39
/src/typings/tsd/
40
/typings/
41
/tsd_typings/
42

  
43
# Dist #
44
/dist
45
/public/__build__/
46
/src/*/__build__/
47
__build__/**
48
.webpack.json
49

  
50
# Doc #
51
/doc/
52

  
53
# IDE #
54
.idea/
55
*.swp
modules/uoa-repository-dashboard-gui/tags/release-1.0/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
    "deprecation": {
15
      "severity": "warn"
16
    },
17
    "eofline": true,
18
    "forin": true,
19
    "import-blacklist": [
20
      true,
21
      "rxjs/Rx"
22
    ],
23
    "import-spacing": true,
24
    "indent": [
25
      true,
26
      "spaces"
27
    ],
28
    "interface-over-type-literal": true,
29
    "label-position": true,
30
    "max-line-length": [
31
      true,
32
      140
33
    ],
34
    "member-access": false,
35
    "member-ordering": [
36
      true,
37
      {
38
        "order": [
39
          "static-field",
40
          "instance-field",
41
          "static-method",
42
          "instance-method"
43
        ]
44
      }
45
    ],
46
    "no-arg": true,
47
    "no-bitwise": true,
48
    "no-console": [
49
      true,
50
      "debug",
51
      "info",
52
      "time",
53
      "timeEnd",
54
      "trace"
55
    ],
56
    "no-construct": true,
57
    "no-debugger": true,
58
    "no-duplicate-super": true,
59
    "no-empty": false,
60
    "no-empty-interface": true,
61
    "no-eval": true,
62
    "no-inferrable-types": [
63
      true,
64
      "ignore-params"
65
    ],
66
    "no-misused-new": true,
67
    "no-non-null-assertion": true,
68
    "no-shadowed-variable": true,
69
    "no-string-literal": false,
70
    "no-string-throw": true,
71
    "no-switch-case-fall-through": true,
72
    "no-trailing-whitespace": true,
73
    "no-unnecessary-initializer": true,
74
    "no-unused-expression": true,
75
    "no-use-before-declare": true,
76
    "no-var-keyword": true,
77
    "object-literal-sort-keys": false,
78
    "one-line": [
79
      true,
80
      "check-open-brace",
81
      "check-catch",
82
      "check-else",
83
      "check-whitespace"
84
    ],
85
    "prefer-const": true,
86
    "quotemark": [
87
      true,
88
      "single"
89
    ],
90
    "radix": true,
91
    "semicolon": [
92
      true,
93
      "always"
94
    ],
95
    "triple-equals": [
96
      true,
97
      "allow-null-check"
98
    ],
99
    "typedef-whitespace": [
100
      true,
101
      {
102
        "call-signature": "nospace",
103
        "index-signature": "nospace",
104
        "parameter": "nospace",
105
        "property-declaration": "nospace",
106
        "variable-declaration": "nospace"
107
      }
108
    ],
109
    "unified-signatures": true,
110
    "variable-name": false,
111
    "whitespace": [
112
      true,
113
      "check-branch",
114
      "check-decl",
115
      "check-operator",
116
      "check-separator",
117
      "check-type"
118
    ],
119
    "no-output-on-prefix": true,
120
    "use-input-property-decorator": true,
121
    "use-output-property-decorator": true,
122
    "use-host-property-decorator": true,
123
    "no-input-rename": true,
124
    "no-output-rename": true,
125
    "use-life-cycle-interface": true,
126
    "use-pipe-transform-interface": true,
127
    "component-class-suffix": true,
128
    "directive-class-suffix": true
129
  }
130
}
0 131

  
modules/uoa-repository-dashboard-gui/tags/release-1.0/Dockerfile
1
FROM nginx:alpine
2

  
3
COPY nginx.conf /etc/nginx/nginx.conf
4
#COPY index.html /usr/share/nginx/html/
5
COPY dist/uoa-repository-manager-ui/      /usr/share/nginx/html
6
#COPY assets/    /usr/share/nginx/html/assets
7

  
8
EXPOSE 80
0 9

  
modules/uoa-repository-dashboard-gui/tags/release-1.0/nginx.conf
1
worker_processes  1;
2

  
3
events {
4
    worker_connections  1024;
5
}
6

  
7
http {
8
    include       mime.types;
9
    default_type  application/octet-stream;
10
    sendfile        on;
11
    keepalive_timeout  65;
12

  
13
    server {
14
        listen       80;
15
        #server_name  mysite.com www.mysite.com;
16
        root /usr/share/nginx/html;
17

  
18
        location / {
19
            try_files $uri$args $uri$args/ /index.html;
20
	    }
21

  
22
	    location /api {
23
	        # try_files $uri$args $uri$args/ /api
24
	        return 404 /api;
25

  
26
	    }
27

  
28
        location  /warp/vendor/uikit/fonts/ {
29

  
30
          #Include vanilla types
31
          include mime.types;
32

  
33
          #Missing mime types
34
          types  {font/truetype ttf;}
35
          types  {application/font-woff woff;}
36
          types  {application/font-woff2 woff2;}
37
        }
38

  
39
        location  /font-awesome-4.6.3/fonts/ {
40

  
41
              #Include vanilla types
42
              include mime.types;
43

  
44
              #Missing mime types
45
              types  {font/truetype ttf;}
46
              types  {application/font-woff woff;}
47
              types  {application/font-woff2 woff2;}
48
            }
49
        }
50
}
0 51

  
modules/uoa-repository-dashboard-gui/tags/release-1.0/src/app/app.component.spec.ts
1
import { TestBed, async } from '@angular/core/testing';
2
import { AppComponent } from './app.component';
3
describe('AppComponent', () => {
4
  beforeEach(async(() => {
5
    TestBed.configureTestingModule({
6
      declarations: [
7
        AppComponent
8
      ],
9
    }).compileComponents();
10
  }));
11
  it('should create the app', async(() => {
12
    const fixture = TestBed.createComponent(AppComponent);
13
    const app = fixture.debugElement.componentInstance;
14
    expect(app).toBeTruthy();
15
  }));
16
  it(`should have as title 'app'`, async(() => {
17
    const fixture = TestBed.createComponent(AppComponent);
18
    const app = fixture.debugElement.componentInstance;
19
    expect(app.title).toEqual('app');
20
  }));
21
  it('should render title in a h1 tag', async(() => {
22
    const fixture = TestBed.createComponent(AppComponent);
23
    fixture.detectChanges();
24
    const compiled = fixture.debugElement.nativeElement;
25
    expect(compiled.querySelector('h1').textContent).toContain('Welcome to uoa-repository-manager-ui!');
26
  }));
27
});
0 28

  
modules/uoa-repository-dashboard-gui/tags/release-1.0/src/app/pages/adminPg/adminPg.component.ts
1
/*
2
*  updated by myrto on 19/12/2018
3
*/
4

  
5
import { Component, OnInit } from '@angular/core';
6

  
7
@Component ({
8
  selector: 'app-admin',
9
  templateUrl: '../pageContainer.html'
10
})
11

  
12
export class AdminPgComponent implements OnInit {
13

  
14
  constructor() {}
15

  
16
  ngOnInit() {}
17
}
0 18

  
modules/uoa-repository-dashboard-gui/tags/release-1.0/src/app/pages/adminPg/adminPg-metrics.component.html
1
<div class="uk-grid-margin uk-grid uk-grid-stack" uk-grid="">
2
  <div class="uk-width-1-1@m uk-first-column">
3

  
4
    <h1 class="uk-h2">Metrics Admin</h1>
5

  
6
    <!-- TOP HELP CONTENT -->
7
    <help-content #topHelperContent [position]="'top'"
8
                  [ngClass]="topHelperContent.isPresent()?'uk-margin-medium-top uk-margin-medium-bottom':'clear-style'">
9
    </help-content>
10

  
11
    <div class="uk-container uk-container-large uk-margin-medium-top uk-margin-medium-bottom">
12
      <div class="uk-grid">
13

  
14
        <!-- LEFT HELP CONTENT -->
15
        <aside-help-content #leftHelperContent [position]="'left'"
16
                            [ngClass]="leftHelperContent.isPresent()?'tm-sidebar uk-width-1-4@m uk-first-column':'clear-style'">
17
        </aside-help-content>
18

  
19
        <!-- MIDDLE -->
20
        <div class="uk-width-expand@m">
21

  
22
          <div *ngIf="errorMessage" class="uk-alert uk-alert-danger">{{ errorMessage }}</div>
23
          <div *ngIf="successMessage" class="uk-alert uk-alert-success">{{ successMessage }}</div>
24
          <div *ngIf="loadingMessage" class="loading-big">
25
            <div class="loader-big" style="text-align: center; padding-top: 170px; color: rgb(47, 64, 80); font-weight: bold;">
26
              {{ loadingMessage }}
27
            </div>
28
            <div class="whiteFilm"></div>
29
          </div>
30
          <div *ngIf="piwiks && piwiks.length>0">
31
            <table class="uk-table uk-table-striped uk-table-middle" style="font-size: 12px;">
32
              <thead>
33
              <tr>
34
                <th class="uk-text-nowrap">Repository</th>
35
                <th class="uk-text-nowrap">Piwik site</th>
36
                <th class="uk-text-nowrap">Requested on</th>
37
                <th class="uk-text-nowrap">Requestor</th>
38
                <th class="uk-text-nowrap">Validated</th>
39
                <th class="uk-text-nowrap">Actions</th>
40
              </tr>
41
              </thead>
42
              <tbody>
43
              <tr class="el-item" *ngFor="let piwik of piwiks">
44
                <td class="uk-table-shrink uk-text-truncate" style="min-width: 400px;">
45
                  {{ piwik.repositoryName }}<br>(ID: {{ piwik.repositoryId }})
46
                </td>
47
                <td class="uk-table-shrink">ID: {{ piwik.siteId }}<br>Authentication Token: {{ piwik.authenticationToken }}</td>
48
                <td class="uk-text-nowrap uk-table-shrink">{{ piwik.creationDate | date : "yyyy-MM-dd" }}</td>
49
                <td class="uk-text-nowrap uk-table-shrink">{{ piwik.requestorName }}<br>{{ piwik.requestorEmail }}</td>
50
                <td class="uk-text-nowrap uk-table-shrink">
51
                  <span *ngIf="piwik.validated">YES<br>on {{ piwik.validationDate | date : "yyyy-MM-dd" }}</span>
52
                  <span *ngIf="!piwik.validated">NO</span>
53
                </td>
54
                <td class="uk-text-nowrap uk-table-shrink">
55
                  <button id="{{ piwik.repositoryId }}"
56
                          *ngIf="!piwik.validated"
57
                          class="uk-button uk-button-primary validate"
58
                          (click)="confirmApproval(piwik.repositoryId)">Validate</button>
59
                </td>
60
              </tr>
61
              </tbody>
62
            </table>
63
          </div>
64

  
65
        </div>
66

  
67
        <!-- RIGHT HELP CONTENT -->
68
        <aside-help-content #rightHelperContent [position]="'right'"
69
                            [ngClass]="rightHelperContent.isPresent()?'tm-sidebar uk-width-1-4@m uk-first-column':'clear-style'">
70
        </aside-help-content>
71

  
72
      </div>
73
    </div>
74

  
75

  
76
    <!-- BOTTOM HELP CONTENT -->
77
    <help-content #bottomHelperContent [position]="'bottom'"
78
                  [ngClass]="bottomHelperContent.isPresent()?'uk-margin-medium-top uk-margin-medium-bottom':'clear-style'">
79
    </help-content>
80

  
81

  
82
  </div>
83
</div>
84

  
85

  
86
<confirmation-dialog #confirmApprovalModal [title]="modalTitle" [isModalShown]="isModalShown"
87
                     [confirmActionButton]="modalButton" (emitObject)="confirmedApproval($event)">
88
  Are you sure you want to validate the selected piwik site(s)?
89
</confirmation-dialog>
0 90

  
modules/uoa-repository-dashboard-gui/tags/release-1.0/src/app/pages/adminPg/adminPg.module.ts
1
import { NgModule } from '@angular/core';
2
import { CommonModule } from '@angular/common';
3
import { TabsModule } from 'ngx-bootstrap';
4
import { FormsModule } from '@angular/forms';
5
import { AdminPgRouting } from './adminPg.routing';
6
import { ReusableComponentsModule } from '../../shared/reusablecomponents/reusable-components.module';
7
import { AdminPgComponent } from './adminPg.component';
8
import { AdminPgMetricsComponent } from './adminPg-metrics.component';
9

  
10
@NgModule ({
11
  imports: [
12
    CommonModule,
13
    TabsModule.forRoot(),
14
    FormsModule,
15
    AdminPgRouting,
16
    ReusableComponentsModule
17
  ],
18
  declarations: [
19
    AdminPgComponent,
20
    AdminPgMetricsComponent
21
  ]
22
})
23

  
24
export class AdminPgModule {}
0 25

  
modules/uoa-repository-dashboard-gui/tags/release-1.0/src/app/pages/adminPg/adminPg-metrics.component.ts
1
import { Component, OnInit, ViewChild } from '@angular/core';
2
import { PiwikService } from '../../services/piwik.service';
3
import { PiwikInfo } from '../../domain/typeScriptClasses';
4
import {
5
  enabledMetricsError,
6
  enablingMetrics,
7
  loadingReposMessage,
8
  reposRetrievalError,
9
  validatePiwikSiteSuccess
10
} from '../../domain/shared-messages';
11
import { ConfirmationDialogComponent } from '../../shared/reusablecomponents/confirmation-dialog.component';
12

  
13
@Component ({
14
  selector: 'app-admin-metrics',
15
  templateUrl: 'adminPg-metrics.component.html'
16
})
17

  
18
export class AdminPgMetricsComponent implements OnInit {
19
  piwiks: PiwikInfo[] = [];
20
  errorMessage: string;
21
  successMessage: string;
22
  loadingMessage: string;
23

  
24
  modalTitle = 'Approval Confirmation';
25
  modalButton = 'Yes, validate';
26
  isModalShown: boolean;
27

  
28
  @ViewChild('confirmApprovalModal')
29
  public confirmApprovalModal: ConfirmationDialogComponent;
30

  
31
  constructor(private piwikService: PiwikService) {}
32

  
33
  ngOnInit() {
34
    this.getPiwiks();
35
    this.isModalShown = false;
36
  }
37

  
38

  
39
  getPiwiks() {
40
    this.loadingMessage = loadingReposMessage;
41
    this.piwikService.getPiwikSitesForRepos()
42
      .subscribe (
43
        piwiks => this.piwiks = piwiks.sort( function(a, b) {
44
          if (a.repositoryName < b.repositoryName) {
45
            return -1;
46
          } else if (a.repositoryName > b.repositoryName) {
47
            return 1;
48
          } else {
49
            return 0;
50
          }
51
        } ),
52
        error => {
53
          console.log(error);
54
          this.loadingMessage = '';
55
          this.errorMessage = reposRetrievalError;
56
        },
57
        () => {
58
          this.loadingMessage = '';
59
          window.scroll(1, 1);
60
        }
61
      );
62
  }
63

  
64
  confirmApproval(repoId: string) {
65
    this.confirmApprovalModal.ids = [repoId];
66
    this.confirmApprovalModal.showModal();
67
  }
68

  
69
  confirmedApproval(ids: string[]) {
70
    const id = ids[0];
71
    console.log(`approving validation of piwik for repo with id: ${id}`);
72
    this.approvePiwik(id);
73
  }
74

  
75
  approvePiwik(id: string) {
76
    this.loadingMessage = enablingMetrics;
77
    this.errorMessage = '';
78
    this.successMessage = '';
79

  
80
    /*this.piwikService.approvePiwikSite(id).subscribe(*/
81
    this.piwikService.markPiwikSiteAsValidated(id).subscribe(
82
      response => console.log(`approvePiwikSite responded: ${JSON.stringify(response)}`),
83
      error => {
84
        console.log(error);
85
        this.loadingMessage = '';
86
        this.errorMessage = enabledMetricsError;
87
      },
88
      () => {
89
        this.loadingMessage = '';
90
        this.errorMessage = '';
91
        this.successMessage = validatePiwikSiteSuccess;
92
        this.getPiwiks();
93
      }
94
    );
95
  }
96

  
97
}
0 98

  
modules/uoa-repository-dashboard-gui/tags/release-1.0/src/app/pages/adminPg/adminPg.routing.ts
1
import { NgModule } from '@angular/core';
2
import { RouterModule, Routes } from '@angular/router';
3

  
4
import { AdminPgComponent } from './adminPg.component';
5
import { AdminPgMetricsComponent } from './adminPg-metrics.component';
6
import { AuthGuardService } from '../../services/auth-guard.service';
7

  
8
const adminRoutes: Routes = [
9
  {
10
    path: '',
11
    component: AdminPgComponent,
12
    canActivate: [AuthGuardService],
13
    canLoad: [AuthGuardService],
14
    children: [
15
      {
16
        path: 'metrics',
17
        component: AdminPgMetricsComponent
18
      }
19
    ]
20
  }
21
];
22

  
23
@NgModule ({
24
  imports: [RouterModule.forChild(adminRoutes)],
25
  exports: [RouterModule]
26
})
27

  
28
export class AdminPgRouting {}
0 29

  
modules/uoa-repository-dashboard-gui/tags/release-1.0/src/app/pages/pageContainer.html
1
<div class="uk-section-default uk-section uk-section-small uk-padding-remove-bottom" style="min-height: 325px">
2

  
3
  <!-- MARGIN-TOP  -->
4
  <div class="uk-sticky-placeholder" style="height: 84px; margin: 0px;" aria-hidden="true"></div>
5
  <div class="uk-container uk-container-large" style="min-height: 500px;">
6
    <router-outlet></router-outlet>
7
  </div>
8
</div>
0 9

  
modules/uoa-repository-dashboard-gui/tags/release-1.0/src/app/pages/sources/sources-register/sr-data.component.ts
1
/*
2
*  created by myrto on 12/12/2017
3
*/
4

  
5
import { Component, OnInit } from '@angular/core';
6
import { RegisterExistingDatasourceComponent } from './register-existing-datasource.component';
7

  
8
@Component ({
9
  selector: 'app-sr-data',
10
  templateUrl: './register-existing-datasource.component.html'
11
})
12

  
13
export class SrDataComponent extends RegisterExistingDatasourceComponent implements OnInit {
14

  
15
  ngOnInit() {
16
    this.datasourceType = 'data';
17
    this.currentMode = 're3data';
18
    super.ngOnInit();
19
  }
20

  
21
}
0 22

  
modules/uoa-repository-dashboard-gui/tags/release-1.0/src/app/pages/sources/sources-register/sr-journal.component.ts
1
import { Component, OnInit } from '@angular/core';
2
import { RegisterNewDatasourceComponent } from './register-new-datasource.component';
3

  
4
@Component ({
5
  selector: 'app-sr-journal',
6
  templateUrl: './register-new-datasource.component.html'
7
})
8

  
9
export class SrJournalComponent extends RegisterNewDatasourceComponent implements OnInit {
10

  
11
  ngOnInit() {
12
    this.datasourceType = 'journal';
13
    super.ngOnInit();
14
  }
15

  
16
}
0 17

  
modules/uoa-repository-dashboard-gui/tags/release-1.0/src/app/pages/sources/sources-register/register-datasource-select-existing.component.html
1
        <div>
2
          <div>
3
            <div class="animated fadeInRight stepContent">
4
              <div class="uk-alert uk-alert-danger" *ngIf="alertMessage" style="padding: 10px">
5
                {{ alertMessage }}
6
              </div>
7
              <div class="alert alert-info">
8
                Please make sure your repository is registered in
9
                <a target="_blank" href="{{ sourceUrl }}">
10
                  <i class="fas fa-external-link-alt" style="margin-right:3px;"></i>{{ sourceTitle }}
11
                </a>
12
                . <br>
13
                <span *ngIf="latestUpdate && (latestUpdate !== null)">
14
                  <b>Last Updated: </b>{{ latestUpdate }}
15
                </span>
16
              </div>
17
              <div>
18
                <div class="form-group">
19
                  <label class="control-label">Select repository's country</label>
20
                  <select class="form-control" (change) ="getReposInCountry($event.target.value)">
21
                    <option value="" disabled>-- none selected --</option>
22
                    <option *ngFor="let country of countries; let i = index" value="{{ i }}">{{ country.name ? country.name : country.code }}</option>
23
                  </select>
24
                </div>
25
                <div class="form-group">
26
                  <label class="control-label">Start typing in the name of your repository to narrow down the view</label>
27
                  <input #searchInput id="searchInput" class="form-control" type="text"
28
                         [disabled]="(!hasSelectedCountry)" (keyup)="searchTerm($event)" />
29
                </div>
30
              </div>
31
              <div *ngIf="selectedCountry">
32
                <div>
33
                  <h2>{{ sourceTitle }} Repositories in {{ selectedCountry.name ? selectedCountry.name : selectedCountry.code }}</h2>
34
                </div>
35
                <div *ngIf="loadingMessage" class="loading-big">
36
                  <div class="loader-big" style="text-align: center; padding-top: 170px; color: rgb(47, 64, 80); font-weight: bold;">
37
                    {{ loadingMessage }}
38
                  </div>
39
                  <div class="whiteFilm"></div>
40
                </div>
41
                <div class="uk-alert uk-alert-warning" *ngIf="noRepositories">{{ noRepositories }}</div>
42
                <div class="repositoriesRadioButtonForm" *ngIf="countryRepos && !loadingMessage">
43
                  <div class="form-group"
44
                       *ngFor="let repo of countryRepos | repoFilter: searchBox">
45
                    <label for="{{ repo.id }}"
46
                           class="uk-button uk-link-muted visible_uk_links"
47
                           style="display: block; text-align: left;">
48
                      <input type="radio" value="{{ repo.id }}" id="{{ repo.id }}" name="repositories"
49
                             (change)="onChooseRepository(repo.id)" [disabled]="repo.registeredby !== null">
50
                      <span>
51
                        {{(repo.officialname !== null) ? repo.officialname : repo.englishname }}
52
                        <span *ngIf="repo.registeredby !== null" class="uk-label uk-label-warning registeredLabel">Registered</span>
53
                        <a target="_blank" href="{{ (repo.websiteurl !== null) ? repo.websiteurl : '' }}" [ngStyle]="">
54
                          <i class="fas fa-external-link-alt externalLink"></i>
55
                        </a>
56
                      </span>
57
                      <div *ngIf="repoId == repo.id" class="uk-float-right">
58
                        <a class="uk-button uk-button-primary uk-border-rounded uk-vertical-align-middle"
59
                                style="border-color: grey;"
60
                                (click)="pushedNext()">NEXT</a>
61
                      </div>
62
                    </label>
63
                  </div>
64
                </div>
65
              </div>
66
            </div>
67
          </div>
68
        </div>
0 69

  
modules/uoa-repository-dashboard-gui/tags/release-1.0/src/app/pages/sources/sources-register/register-datasource-select-existing.component.ts
1
/*
2
*  updated by myrto on 19/12/2018
3
*/
4

  
5
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
6
import { RepositoryService } from '../../../services/repository.service';
7
import { loadingReposMessage, noRepositoriesFound, noRepositoryChosenMsg, noServiceMessage } from '../../../domain/shared-messages';
8
import { Country, RepositorySnippet } from '../../../domain/typeScriptClasses';
9

  
10
@Component({
11
  selector: 'app-select-existing-datasource',
12
  templateUrl: './register-datasource-select-existing.component.html'
13
})
14

  
15
export class RegisterDatasourceSelectExistingComponent implements OnInit {
16
  countries: Country[] = [];
17
  hasSelectedCountry: boolean;
18
  selectedCountry: Country;
19
  countryRepos: RepositorySnippet[] = [];
20
  hasSelectedRepo: boolean;
21

  
22
  noRepositories: string;
23
  alertMessage: string;
24
  loadingMessage: string = loadingReposMessage;
25

  
26
  repoId: string;
27

  
28
  sourceUrl: string;
29
  sourceTitle: string;
30
  latestUpdate: string;
31

  
32
  @Input() mode: string;
33

  
34
  @Output() emitRepoId: EventEmitter<string> = new EventEmitter();
35
  @Output() promptNext: EventEmitter<boolean> = new EventEmitter();
36

  
37
  searchBox = '';
38

  
39
  constructor(private repoService: RepositoryService) {}
40

  
41
  ngOnInit() {
42
    this.setUpSourceInfo();
43
    this.getCountries();
44
    this.hasSelectedCountry = false;
45
  }
46

  
47
  setUpSourceInfo() {
48
    if (this.mode === 'opendoar') {
49
      this.sourceUrl = 'http://v2.sherpa.ac.uk/opendoar/';
50
      this.sourceTitle = 'OpenDOAR';
51
    } else if (this.mode === 're3data') {
52
      this.sourceUrl = 'https://www.re3data.org/';
53
      this.sourceTitle = 'Re3data';
54
    }
55
    this.getLatestUpdate();
56
  }
57

  
58
  getCountries() {
59
    this.repoService.getCountries()
60
      .subscribe(
61
        countries => {
62
          // TODO: check again getCountries null return values
63
          /*/!* check for null values *!/
64
          let nullVals = countries.filter(el => el.name === null);
65
          /!* remove null values from array *!/
66
          for (let nullVal of nullVals) {
67
            let i = countries.findIndex(el => el === nullVal);
68
            /!* remove null value from array *!/
69
            if (i !== -1) { countries.splice(i, 1); }
70
          }*/
71

  
72
          /* sort countries array */
73
          this.countries = countries.sort( function(a, b) {
74
            if (a.name < b.name) {
75
              return -1;
76
            } else if (a.name > b.name) {
77
              return 1;
78
            } else {
79
              return 0;
80
            }
81
          } );
82
        },
83
        error => {
84
          this.alertMessage = noServiceMessage;
85
          console.log(error);
86
        });
87
  }
88

  
89
  getReposInCountry(i: number) {
90
    setTimeout( () => {
91
      const country = this.countries[i];
92
      console.log(`I got ${country} and ${this.mode}`);
93
      this.countryRepos = [];
94
      this.selectedCountry = country;
95
      this.hasSelectedCountry = false;
96
      this.loadingMessage = loadingReposMessage;
97
      this.noRepositories = '';
98
      this.repoService.getRepositoriesOfCountry(country.code, this.mode).subscribe (
99
        repos => {
100
          this.countryRepos = repos;
101
        },
102
        error => {
103
          console.log(error.statusText);
104
          this.loadingMessage = '';
105
          this.alertMessage = noServiceMessage;
106
          this.countryRepos = [];
107
        },
108
        () => {
109
          if (!this.countryRepos || !this.countryRepos.length) {
110
            this.noRepositories = noRepositoriesFound;
111
          } else {
112
            this.noRepositories = '';
113
            if (this.selectedCountry.code === country.code) {
114
              /* to make sure that the correct set of repositories is displayed - in case of consequent country selections */
115
              this.hasSelectedCountry = true;
116
            } else {
117
              this.countryRepos = [];
118
            }
119
          }
120
          this.loadingMessage = '';
121
          this.alertMessage = '';
122
          console.log('this.selectedCountry became', JSON.stringify(this.selectedCountry));
123
        }
124
      );
125
    }, 500);
126
  }
127

  
128
  getLatestUpdate() {
129
    return this.repoService.getListLatestUpdate(this.mode).subscribe (
130
      responseDate => this.latestUpdate = responseDate['lastCollectionDate'],
131
      error => console.log(error)
132
    );
133
  }
134

  
135
  onChooseRepository(id: string) {
136
    this.hasSelectedRepo = true;
137
    this.repoId = id;
138
  }
139

  
140
  pushedNext() {
141
    this.promptNext.emit(true);
142
  }
143

  
144
  public goToNextStep(): boolean {
145
    if (!this.hasSelectedRepo || this.noRepositories) {
146
      this.alertMessage = noRepositoryChosenMsg;
147
      return false;
148
    } else {
149
      this.emitRepoId.emit(this.repoId);
150
      return true;
151
    }
152
  }
153

  
154
  searchTerm(event: any) {
155
    this.searchBox = event.target.value;
156
  }
157

  
158
}
0 159

  
modules/uoa-repository-dashboard-gui/tags/release-1.0/src/app/pages/sources/sources-register/register-new-datasource.component.html
1
<div class="uk-grid-margin uk-grid uk-grid-stack" uk-grid="">
2
  <div class="uk-width-1-1@m uk-first-column">
3

  
4
    <h1 class="uk-h2">Register your datasource</h1>
5

  
6
    <!-- TOP HELP CONTENT -->
7
    <help-content #topHelperContent [position]="'top'"
8
                  [ngClass]="topHelperContent.isPresent()?'uk-margin-medium-top uk-margin-medium-bottom':'clear-style'">
9
    </help-content>
10

  
11
    <div class="uk-container uk-container-large uk-margin-medium-top uk-margin-medium-bottom">
12
      <div class="uk-grid">
13

  
14
        <!-- LEFT HELP CONTENT -->
15
        <aside-help-content #leftHelperContent [position]="'left'"
16
                            [ngClass]="leftHelperContent.isPresent()?'tm-sidebar uk-width-1-4@m uk-first-column':'clear-style'">
17
        </aside-help-content>
18

  
19
        <!-- MIDDLE -->
20
        <div class=" uk-width-expand@m">
21

  
22
          <div class="wizard">
23
            <div class="wizardBreadcrumbs">
24
              <div class="steps clearfix">
25
                <div class="step active">
26
                  <div>
27
                    Enter Information
28
                    <span></span>
29
                  </div>
30
                </div>
31
                <div class="step {{ (currentStep > 1) ? 'active' : '' }}">
32
                  <div>
33
                    Add Interfaces
34
                    <span></span>
35
                  </div>
36
                </div>
37
                <div class="step {{ (currentStep > 2) ? 'active' : '' }}">
38
                  <div>
39
                    Finish
40
                    <span></span>
41
                  </div>
42
                </div>
43
              </div>
44
            </div>
45
            <div class="content">
46
              <div>
47
                <div class="animated fadeInRight stepContent">
48
                  <div *ngIf="loadingMessage" class="loading-big">
49
                    <div class="loader-big" style="text-align: center; padding-top: 170px; color: rgb(47, 64, 80); font-weight: bold;">
50
                      {{ loadingMessage }}
51
                    </div>
52
                    <div class="whiteFilm"></div>
53
                  </div>
54
                  <div *ngIf="errorMessage" class="uk-alert uk-alert-danger">{{ errorMessage }}</div>
55

  
56
                  <div>
57
                    <datasource-create-form *ngIf="(currentStep === 1) && !loadingMessage"
58
                                            #registerDatasource
59
                                            [mode]="datasourceType"
60
                                            [selectedRepo]="repo"
61
                                            (emittedInfo)="getCurrentRepo($event)"></datasource-create-form>
62

  
63
                    <div *ngIf="(currentStep === 2) && repo && !loadingMessage" class="uk-grid uk-child-width-1-2">
64
                      <div *ngFor="let inter of dataForInterfaceComp"
65
                           class="interfacesForm el-item uk-card uk-card-default uk-card-body uk-scrollspy-inview uk-animation-fade uk-margin-bottom">
66
                        <app-repository-interface-form #interfacesArray
67
                                                       [data]="inter"
68
                                                       (emitDeleteInterface)="removeInterfaceFromList($event)">
69
                        </app-repository-interface-form>
70
                      </div>
71
                      <div class="el-item uk-card uk-card-default uk-card-body uk-scrollspy-inview uk-animation-fade uk-margin-bottom">
72
                        <div class="interface-box new" style="text-align: center">
73
                          <a class="add-new-element add-new-group" (click)="addInterfaceToList()">
74
                            <i class="far fa-plus-square" aria-hidden="true"></i>
75
                            <span class="info">Add New Interface</span>
76
                          </a>
77
                        </div>
78
                      </div>
79
                    </div>
80
                    <div *ngIf="(currentStep === 3) && !loadingMessage" class="row openAIRECompliantLogoDownload">
81
                      <div class="col-lg-12">
82
                        <div class="col-md-12">
83
                          <div>
84
                            <div class="openAIRECompliantLogo">
85
                              <h2 class="openAIRECompliantLogoMessage">
86
                                Congratulations! Your repository was successfully registered in OpenAIRE. You can download this logo to use in your site.
87
                              </h2>
88
                              <img src="../../../../assets/imgs/3_0ValidatedLogo.png" alt="OpenAireCompliant">
89
                            </div>
90
                          </div>
91
                          <a (click)="downloadLogo()">
92
                            Download
93
                            <i class="fa fa-download" style=""></i>
94
                          </a>
95
                        </div>
96
                      </div>
97
                    </div>
98
                  </div>
99
                </div>
100
              </div>
101
            </div>
102
            <div class="wizardActions">
103
              <button *ngIf="(currentStep === 2) && !loadingMessage" class="uk-button uk-button-grey-light uk-margin-small-right"
104
                      type="button" (click)="moveBackAStep()">
105
                <i class="fa fa-angle-double-left"></i>
106
                Back
107
              </button>
108
              <button *ngIf="(currentStep < 3) && !loadingMessage" class="uk-button uk-button-grey-light uk-margin-small-left"
109
                      type="button" (click)="moveAStep()">
110
                Next
111
                <i class="fa fa-angle-double-right"></i>
112
              </button>
113
            </div>
114
          </div>
115

  
116
        </div>
117

  
118
        <!-- RIGHT HELP CONTENT -->
119
        <aside-help-content #rightHelperContent [position]="'right'"
120
                            [ngClass]="rightHelperContent.isPresent()?'tm-sidebar uk-width-1-4@m uk-first-column':'clear-style'">
121
        </aside-help-content>
122

  
123
      </div>
124
    </div>
125

  
126

  
127
    <!-- BOTTOM HELP CONTENT -->
128
    <help-content #bottomHelperContent [position]="'bottom'"
129
                  [ngClass]="bottomHelperContent.isPresent()?'uk-margin-medium-top uk-margin-medium-bottom':'clear-style'">
130
    </help-content>
131

  
132

  
133
  </div>
134
</div>
modules/uoa-repository-dashboard-gui/tags/release-1.0/src/app/pages/sources/sources-register/register-existing-datasource.component.html
1
<div class="uk-grid-margin uk-grid uk-grid-stack" uk-grid="">
2
  <div class="uk-width-1-1@m uk-first-column">
3

  
4
    <h1 class="uk-h2">Register your datasource</h1>
5

  
6
    <!-- TOP HELP CONTENT -->
7
    <help-content #topHelperContent [position]="'top'"
8
                  [ngClass]="topHelperContent.isPresent()?'uk-margin-medium-top uk-margin-medium-bottom':'clear-style'">
9
    </help-content>
10

  
11
    <div class="uk-container uk-container-large uk-margin-medium-top uk-margin-medium-bottom">
12
      <div class="uk-grid">
13

  
14
        <!-- LEFT HELP CONTENT -->
15
        <aside-help-content #leftHelperContent [position]="'left'"
16
                            [ngClass]="leftHelperContent.isPresent()?'tm-sidebar uk-width-1-4@m uk-first-column':'clear-style'">
17
        </aside-help-content>
18

  
19
        <!-- MIDDLE -->
20
        <div class=" uk-width-expand@m">
21

  
22
          <div class="wizard">
23
            <div class="wizardBreadcrumbs">
24
              <div class="steps clearfix">
25
                <div class="step active">
26
                  <div>
27
                    Select repository
28
                    <span></span>
29
                  </div>
30
                </div>
31
                <div class="step {{ (currentStep > 0) ? 'active' : '' }}">
32
                  <div>
33
                    Enter Information
34
                    <span></span>
35
                  </div>
36
                </div>
37
                <div class="step {{ (currentStep > 1) ? 'active' : '' }}">
38
                  <div>
39
                    Add Interfaces
40
                    <span></span>
41
                  </div>
42
                </div>
43
                <div class="step {{ (currentStep > 2) ? 'active' : '' }}">
44
                  <div>
45
                    Finish
46
                    <span></span>
47
                  </div>
48
                </div>
49
              </div>
50
            </div>
51
            <div class="content">
52
              <div>
53
                <div class="animated fadeInRight stepContent">
54
                  <div *ngIf="loadingMessage" class="loading-big">
55
                    <div class="loader-big" style="text-align: center; padding-top: 170px; color: rgb(47, 64, 80); font-weight: bold;">
56
                      {{ loadingMessage }}
57
                    </div>
58
                    <div class="whiteFilm"></div>
59
                  </div>
60
                  <div *ngIf="errorMessage" class="uk-alert uk-alert-danger">{{ errorMessage }}</div>
61

  
62
                  <div>
63
                    <app-select-existing-datasource *ngIf="(currentStep === 0) && (currentMode !== null) && !loadingMessage"
64
                                                    #datasourcesByCountry
65
                                                    [mode]="currentMode"
66
                                                    (emitRepoId)="getRepoId($event)"
67
                                                    (promptNext)="goToStep2($event)"></app-select-existing-datasource>
68

  
69
                    <datasource-update-form *ngIf="(currentStep === 1) && (repo !== null) && !loadingMessage"
70
                                            #registerDatasource
71
                                            [selectedRepo]="repo"
72
                                            (emittedInfo)="getUpdatedRepo($event)"></datasource-update-form>
73

  
74
                    <div *ngIf="(currentStep === 2) && repo && !loadingMessage" class="uk-grid uk-child-width-1-2">
75
                      <div *ngFor="let inter of dataForInterfaceComp"
76
                           class="interfacesForm el-item uk-card uk-card-default uk-card-body uk-scrollspy-inview uk-animation-fade uk-margin-bottom">
77
                        <app-repository-interface-form #interfacesArray
78
                                                       [data]="inter"
79
                                                       (emitDeleteInterface)="removeInterfaceFromList($event)">
80
                        </app-repository-interface-form>
81
                      </div>
82
                      <div class="el-item uk-card uk-card-default uk-card-body uk-scrollspy-inview uk-animation-fade uk-margin-bottom">
83
                        <div class="interface-box new" style="text-align: center">
84
                          <a class="add-new-element add-new-group" (click)="addInterfaceToList()">
85
                            <i class="far fa-plus-square" aria-hidden="true"></i>
86
                            <span class="info">Add New Interface</span>
87
                          </a>
88
                        </div>
89
                      </div>
90
                    </div>
91
                    <div *ngIf="(currentStep === 3) && !loadingMessage" class="row openAIRECompliantLogoDownload">
92
                      <div class="col-lg-12">
93
                        <div class="col-md-12">
94
                          <div>
95
                            <div class="openAIRECompliantLogo">
96
                              <h2 class="openAIRECompliantLogoMessage">
97
                                Congratulations! Your repository was successfully registered in OpenAIRE. You can download this logo to use in your site.
98
                              </h2>
99
                              <img src="../../../../assets/imgs/3_0ValidatedLogo.png" alt="OpenAireCompliant">
100
                            </div>
101
                          </div>
102
                          <a (click)="downloadLogo()">
103
                            Download
104
                            <i class="fa fa-download" style=""></i>
105
                          </a>
106
                        </div>
107
                      </div>
108
                    </div>
109
                  </div>
110
                </div>
111
              </div>
112
            </div>
113
            <div class="wizardActions">
114
              <button *ngIf="((currentStep === 1) || (currentStep === 2)) && !loadingMessage"
115
                      class="uk-button uk-button-grey-light uk-margin-small-right"
116
                      type="button" (click)="moveBackAStep()">
117
                <i class="fa fa-angle-double-left"></i>
118
                Back
119
              </button>
120
              <button *ngIf="(currentStep < 3) && !loadingMessage"
121
                      class="uk-button uk-button-grey-light uk-margin-small-left"
122
                      type="button" (click)="moveAStep()">
123
                Next
124
                <i class="fa fa-angle-double-right"></i>
125
              </button>
126
            </div>
127
          </div>
128

  
129
        </div>
130

  
131
        <!-- RIGHT HELP CONTENT -->
132
        <aside-help-content #rightHelperContent [position]="'right'"
133
                            [ngClass]="rightHelperContent.isPresent()?'tm-sidebar uk-width-1-4@m uk-first-column':'clear-style'">
134
        </aside-help-content>
135

  
136
      </div>
137
    </div>
138

  
139

  
140
    <!-- BOTTOM HELP CONTENT -->
141
    <help-content #bottomHelperContent [position]="'bottom'"
142
                  [ngClass]="bottomHelperContent.isPresent()?'uk-margin-medium-top uk-margin-medium-bottom':'clear-style'">
143
    </help-content>
144

  
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff