Project

General

Profile

« Previous | Next » 

Revision 62559

Added by John Balasis about 1 year ago

finaly after so much rage it works probaply...

View differences:

modules/uoa-repository-dashboard-gui/trunk/src/app/app-routing.module.ts
3 3
import { HomeComponent } from './pages/landing/home/home.component';
4 4
import { AuthGuardService } from './services/auth-guard.service';
5 5
import { ForbiddenPageComponent } from './shared/reusablecomponents/403-forbidden-page.component';
6
import { EmptyPageComponent } from "./pages/emptypage/empty-page.component";
7
import { JoinComponent } from "./pages/join/join.component";
8
import { AboutComponent } from "./pages/landing/about/about.component";
6
import { EmptyPageComponent } from './pages/emptypage/empty-page.component';
7
import { JoinComponent } from './pages/join/join.component';
8
import { AboutComponent } from './pages/landing/about/about.component';
9 9

  
10 10
const appRoutes: Routes = [
11 11
  {
......
34 34
  {
35 35
    path: 'repository',
36 36
    loadChildren: () => import('./pages/repository/repository.module').then(m => m.RepositoryModule),
37
    // loadChildren: () => import('./pages/repository/repository.module').then(m => m.RepositoryModule),
38 37
    canActivate: [AuthGuardService]
39 38
  },
40 39
  {
41 40
    path: 'repositoryAdmin',
42 41
    loadChildren: () => import('./pages/repository/repository.module').then(m => m.RepositoryModule),
43
    // loadChildren: () => import('./pages/repository/repository.module').then(m => m.RepositoryModule),
44 42
    canActivate: [AuthGuardService]
45 43
  },
46

  
47

  
48
  // {
49
  //   path: 'dashboard',
50
  //   component: DashboardComponent,
51
  //   canActivate: [AuthGuardService]
52
  // },
53 44
  {
54 45
    path: 'sources',
55 46
    loadChildren: () => import('./pages/sources/sources.module').then(m => m.SourcesModule),
......
64 55
    loadChildren: () => import('./pages/content/content.module').then(m => m.ContentModule),
65 56
    canActivate: [AuthGuardService]
66 57
  },
67
  // {
68
  //   path: 'getImpact',
69
  //   loadChildren: './pages/metrics/metrics.module#MetricsModule',
70
  //   canActivate: [AuthGuardService]
71
  // },
72 58
  {
73 59
    path: 'admin',
74 60
    loadChildren: () => import('./pages/adminPg/adminPg.module').then(m => m.AdminPgModule),
......
77 63
    path: '403-forbidden',
78 64
    component: ForbiddenPageComponent
79 65
  },
80
  // {
81
  //   path: '',
82
  //   redirectTo: '/home',
83
  //   pathMatch: 'full'
84
  // },
85 66
  {
86
    //fixme redirect to 404
67
    // fixme redirect to 404
87 68
    path: '**',
88 69
    redirectTo: '/403-forbidden',
89 70
    // component: ForbiddenPageComponent
modules/uoa-repository-dashboard-gui/trunk/src/app/app.component.html
56 56
  <form class="" [formGroup]="agreementForm">
57 57
    <div formArrayName="terms">
58 58
      <table class="table">
59
        <tr>
60
          Thanks for being part of OpenAIRE. Please confirm the acceptance of our datasources policy.
61
        </tr>
59
        <tr>Thanks for being part of OpenAIRE. Please confirm the acceptance of our datasources policy.</tr>
62 60
        <br>
63
        <tr>
64
          Being registered in OpenAIRE, you are giving consent to OpenAIRE to download, transform and enrich the metadata records, publishing them in the OpenAIRE Research Graph.
61
        <tr>Being registered in OpenAIRE, you are giving consent to OpenAIRE to download, transform and enrich the
62
          metadata records, publishing them in the OpenAIRE Research Graph.
65 63
        </tr>
66 64
        <tbody>
67 65
        <tr class="el-item" *ngFor="let term of terms.controls; let i=index">
68 66
          <br> {{term.get('name').value}} <br>
69 67
          <div [formGroupName]="i">
70 68
            <label>
71
              <input id="consentTerms" type="checkbox" formControlName="consentTermsOfUse"> Accept the <a href="https://www.openaire.eu/terms-of-use-for-content-providers" target="_blank">Terms of Use</a>
69
              <input id="consentTerms" type="checkbox" formControlName="consentTermsOfUse">
70
              Accept the <a href="https://www.openaire.eu/terms-of-use-for-content-providers" target="_blank">Terms of Use</a>
72 71
            </label>
73 72
            <br>
74 73
            <label>
75
              <input id="consentText" type="checkbox" formControlName="fullTextDownload"> Agree to the <a href="https://www.openaire.eu/terms-of-use-for-content-providers#consent" target="_blank">re-use of full texts</a>
74
              <input id="consentText" type="checkbox" formControlName="fullTextDownload">Agree to the
75
              <a href="https://www.openaire.eu/terms-of-use-for-content-providers#consent" target="_blank">
76
              re-use of full texts</a>
76 77
            </label>
77 78
          </div>
78 79
        </tr>
79 80
        </tbody>
80
        <p class="uk-text-meta">Note: OpenAIRE will not provide the full text files for public distribution, the users will access from the original datasource.</p>
81
        <p class="uk-text-meta">Note: OpenAIRE will not provide the full text files for public distribution,
82
          the users will access from the original datasource.
83
        </p>
81 84
      </table>
82 85
    </div>
83 86
  </form>
modules/uoa-repository-dashboard-gui/trunk/src/app/app.component.ts
1 1
import {Component, OnInit, ViewChild} from '@angular/core';
2
import { NavigationEnd, Router, RoutesRecognized } from '@angular/router';
3
import { AuthenticationService } from './services/authentication.service';
4
import { environment } from '../environments/environment';
5
import { MatomoTracker } from 'ngx-matomo';
6
import { ConfirmationDialogComponent } from './shared/reusablecomponents/confirmation-dialog.component';
7
import { RepositoryService } from './services/repository.service';
8
import {RepositorySnippet, TermsOfUse} from './domain/typeScriptClasses';
9
import {FormBuilder, FormGroup, FormControl, FormArray} from '@angular/forms';
10
import {element} from 'protractor';
11
import {timeout, timestamp} from 'rxjs/operators';
2
import {NavigationEnd, Router} from '@angular/router';
3
import {AuthenticationService} from './services/authentication.service';
4
import {environment} from '../environments/environment';
5
import {MatomoTracker} from 'ngx-matomo';
6
import {ConfirmationDialogComponent} from './shared/reusablecomponents/confirmation-dialog.component';
7
import {RepositoryService} from './services/repository.service';
8
import {RepositorySnippet} from './domain/typeScriptClasses';
9
import {FormBuilder, FormGroup, FormArray} from '@angular/forms';
12 10

  
13 11
@Component({
14 12
  selector: 'oa-repo-manager',
......
32 30

  
33 31
  open: boolean = true;
34 32

  
35
  constructor(private router: Router,
36
              private authService: AuthenticationService,
37
              private matomoTracker: MatomoTracker,
38
              private repositoryService: RepositoryService,
39
              private fb: FormBuilder) {
33
  constructor(private router: Router, private authService: AuthenticationService, private matomoTracker: MatomoTracker,
34
              private repositoryService: RepositoryService, private fb: FormBuilder) {
40 35

  
41 36
    // console.log('21-06-2019. Fixed matomo to log userIds?');
42 37

  
......
56 51
    this.authService.tryLogin();
57 52
  }
58 53

  
54
  ngOnInit() {
55
    this.router.events.subscribe((evt) => {
56
      if (!(evt instanceof NavigationEnd)) {
57
        return;
58
      }
59
      if (this.authService.isLoggedIn_) {
60
        this.matomoTracker.setUserId(this.authService.getUserEmail());
61
      }
62
      window.scrollTo(0, 0);
63
    });
64

  
65
    this.authService.isLoggedIn.subscribe(
66
      logged => {if (logged) {this.getReposOfUser(); }},
67
      error => {console.log(error); }
68
    );
69

  
70
  }
71

  
59 72
  getReposOfUser(): void {
60 73
      this.repositoryService.getRepositoriesSnippetsOfUser().subscribe(
61 74
        repos => {
......
66 79
        },
67 80
        () => {
68 81
          // console.log(this.reposOfUser);
69
          this.reposOfUser.forEach(repo => {
70
            if (repo.consentTermsOfUse === null || repo.fullTextDownload === null) {
71
              this.addTerm(repo.officialname, repo.id, repo.consentTermsOfUse);
72
              this.isModalShown = true;
73
            }
74
          });
82
          if (this.agreementForm.get('terms').value.length === 0) {
83
            this.reposOfUser.forEach(repo => {
84
              if (repo.consentTermsOfUse === null || repo.fullTextDownload === null) {
85
                this.addTerm(repo.officialname, repo.id, repo.consentTermsOfUse);
86
                this.isModalShown = true;
87
              }
88
            });
89
          }
75 90
        }
76 91
      );
77 92
  }
......
79 94
  updateTerms() {
80 95
    this.repositoryService.updateRepositoriesTerms(this.agreementForm.value.terms).subscribe(
81 96
      res => {},
82
      err => {console.log(err)}
97
      err => {console.log(err); }
83 98
    );
84 99
  }
85 100

  
86
  ngOnInit() {
87
    this.router.events.subscribe((evt) => {
88
      if (!(evt instanceof NavigationEnd)) {
89
        return;
90
      }
91
      if (this.authService.isLoggedIn_) {
92
        this.matomoTracker.setUserId(this.authService.getUserEmail());
93
      }
94
      window.scrollTo(0, 0);
95
    });
96

  
97
    this.authService.isLoggedIn.subscribe(
98
      logged => {if(logged){this.getReposOfUser()}},
99
      error => {console.log(error)}
100
    );
101

  
102
  }
103

  
104 101
  addTerm(name: string, id: string, consent: boolean) {
105 102
    this.terms.push(this.newTerm(name, id, consent));
106 103
  }
modules/uoa-repository-dashboard-gui/trunk/src/app/pages/sources/sources-register/register-new-datasource.component.ts
246 246
        concatMap(intrf => {
247 247
          if (intrf.id) {
248 248
            // console.log('comments', intrf.comments);
249
            return this.repoService.updateInterface(this.repo.id, this.repo.registeredby, intrf.comments, intrf, intrf.desiredCompatibilityLevel);
249
            return this.repoService.updateInterface(this.repo.id, this.repo.registeredby, intrf.comments, intrf,
250
                                                      intrf.desiredCompatibilityLevel);
250 251
          } else {
251 252
            // console.log('comments', intrf.comments);
252
            return this.repoService.addInterface(this.repo.eoscDatasourceType, this.repo.id, this.repo.registeredby, intrf.comments, intrf, intrf.desiredCompatibilityLevel);
253
            return this.repoService.addInterface(this.repo.eoscDatasourceType, this.repo.id, this.repo.registeredby,
254
                                                  intrf.comments, intrf, intrf.desiredCompatibilityLevel);
253 255
          }
254 256
        })
255 257
      ).subscribe(
modules/uoa-repository-dashboard-gui/trunk/src/app/services/authentication.service.ts
25 25
  public isLoggedIn_ = new BehaviorSubject(false);
26 26

  
27 27
  public get isLoggedIn() {
28
    return this.isLoggedIn_.asObservable();
28
    return this.isLoggedIn_;
29 29
  }
30 30

  
31 31
  public loginWithState() {
modules/uoa-repository-dashboard-gui/trunk/src/app/services/repository.service.ts
33 33

  
34 34
  constructor(private httpClient: HttpClient) { }
35 35

  
36
  addInterface(datatype: string, repoId: string, registeredBy: string, comment: string, newInterface: RepositoryInterface, desiredCompatibilityLevel?: string): Observable<RepositoryInterface> {
36
  addInterface(datatype: string, repoId: string, registeredBy: string, comment: string,
37
               newInterface: RepositoryInterface, desiredCompatibilityLevel: string): Observable<RepositoryInterface> {
37 38
    let url;
38 39
    comment = newInterface.comments; // temp fix for emailing comment
39 40
    if (comment == null || comment === '') {
......
46 47
    return this.httpClient.post<RepositoryInterface>(url, newInterface, headerOptions);
47 48
  }
48 49

  
49
  updateInterface(repoId: string, registeredBy: string, comment: string, interfaceInfo: RepositoryInterface, desiredCompatibilityLevel?: string): Observable<RepositoryInterface> {
50
  updateInterface(repoId: string, registeredBy: string, comment: string, interfaceInfo: RepositoryInterface,
51
                  desiredCompatibilityLevel?: string): Observable<RepositoryInterface> {
50 52
    let url;
51 53
    comment = interfaceInfo.comments; // temp fix for emailing comment
52 54
    if (comment == null || comment === '') {
modules/uoa-repository-dashboard-gui/trunk/src/app/shared/reusablecomponents/sources-forms/datasource-new-interface-form.component.ts
57 57
  existingCompLevel: string;
58 58
  classCodes: string[] = [];
59 59
  compClasses: Map<string, string> = new Map<string, string>();
60
  existingValSet: boolean;
61 60
  interfaceInfo: InterfaceInformation;
62 61

  
63 62
  constructor(private fb: FormBuilder,
......
196 195
    this.successMessage = '';
197 196
    if (this.formIsValid()) {
198 197
      const baseurl = this.repoInterfaceForm.get('baseurl').value;
199
      let valset = '';
200
      if (this.existingValSet) {
201
        valset = this.repoInterfaceForm.get('selectValidationSet').value;
202
      }
203
      let desiredCompLvl = '';
204
      if (this.repoInterfaceForm.get('compatibilityLevel').value) {
205
        // this.existingCompLevel = this.compClasses[this.repoInterfaceForm.get('compatibilityLevel').value];
206
        // console.log('this.existingCompLevel is', this.existingCompLevel);
207
        this.currentInterface.desiredCompatibilityLevel = this.repoInterfaceForm.get('desiredCompatibilityLevel').value;
208
        desiredCompLvl = this.repoInterfaceForm.get('desiredCompatibilityLevel').value;
209
      }
198
      const valset = this.repoInterfaceForm.get('selectValidationSet').value;
199
      const desiredCompLvl = this.repoInterfaceForm.get('desiredCompatibilityLevel').value;
210 200
      const compLvl = this.existingCompLevel;
211 201
      let comment = '';
212 202
      if (this.repoInterfaceForm.get('comment').value) {
......
231 221
      intrf = new RepositoryInterface();
232 222
    }
233 223
    intrf.baseurl = this.repoInterfaceForm.get('baseurl').value;
234
    this.updateValidationSet(intrf, this.repoInterfaceForm.get(this.existingValSet ? 'selectValidationSet' : 'customValidationSet').value);
224
    this.updateValidationSet(intrf, this.repoInterfaceForm.get('selectValidationSet').value);
235 225
    console.log(intrf);
236 226
    if (this.repoInterfaceForm.get('compatibilityLevel').value) {
237 227
      intrf.compatibilityOverride = this.repoInterfaceForm.get('compatibilityLevel').value;
......
266 256
    this.currentInterface.comments = comment;
267 257

  
268 258
    if (!this.inRegister) {
269
      this.addInterface(this.currentInterface);
259
      this.addInterface();
270 260
    } else {
271 261
      this.successMessage = 'The harvesting settings are valid!';
272 262
      console.log('SAVED !');
......
274 264
    }
275 265
  }
276 266

  
277
  addInterface(newInterface: RepositoryInterface) {
267
  addInterface() {
278 268
    this.loadingMessage = formSubmitting;
279 269
    this.repoService.addInterface(this.currentRepo.datasourceType, this.currentRepo.id,
280 270
                                  this.currentRepo.registeredBy, this.currentRepo.comments, this.currentInterface,
281 271
                                  this.repoInterfaceForm.get('desiredCompatibilityLevel').value).subscribe(
282 272
      addedInterface => {
283 273
        console.log(`addInterface responded ${JSON.stringify(addedInterface)}`);
284
        // this.currentInterface = addedInterface;
274
        this.currentInterface = addedInterface;
285 275
      },
286 276
      error => {
287 277
        console.log(error);
......
307 297
    this.updateValidationSet(this.currentInterface, valset);
308 298
    this.currentInterface.baseurl = baseurl;
309 299
    this.currentInterface.desiredCompatibilityLevel = desiredCompLvl;
300
    console.log(this.currentInterface.desiredCompatibilityLevel);
310 301
    this.currentInterface.compatibility = compLvl;
311 302
    this.currentInterface.typology = this.currentRepo.datasourceClass;
312 303
    this.currentInterface.comments = comment;
modules/uoa-repository-dashboard-gui/trunk/src/app/shared/topmenulanding/topmenu-landing.component.html
36 36
                    <a class="uk-search-input" [routerLink]="['emptyPage']" [routerLinkActive]="['uk-active']">Dashboard</a>
37 37
                  </li>
38 38

  
39
                    <!--Sources-->
40
                    <!--<ul>-->
41
                      <!--<li><a [routerLink]="['sources', 'register']" [routerLinkActive]="['uk-active']">Register</a></li>-->
42
                      <!--<li><a [routerLink]="['sources', 'update']" [routerLinkActive]="['uk-active']">Update</a></li>-->
43
                    <!--</ul>-->
44
                  <!--</li>-->
45
                  <!--<li>-->
46
                    <!--Compatibility-->
47
                    <!--<ul>-->
48
                      <!--<li><a [routerLink]="['compatibility', 'validate']" [routerLinkActive]="['uk-active']">Validate</a></li>-->
49
                      <!--<li><a [routerLink]="['compatibility', 'browseHistory']" [routerLinkActive]="['uk-active']">Validation History</a></li>-->
50
                      <!--<li><a [routerLink]="['compatibility', 'monitor']" [routerLinkActive]="['uk-active']">Collection Monitor</a></li>-->
51
                    <!--</ul>-->
52
                  <!--</li>-->
53
                  <!--<li>-->
54
                    <!--Content-->
55
                    <!--<ul>-->
56
                      <!--<li><a [routerLink]="['content', 'events']" [routerLinkActive]="['uk-active']">Events</a></li>-->
57
                      <!--<li><a [routerLink]="['content', 'notifications']" [routerLinkActive]="['uk-active']">Notifications</a></li>-->
58
                    <!--</ul>-->
59
                  <!--</li>-->
60
                  <!--<li>-->
61
                    <!--<a class="uk-search-input" [routerLink]="['getImpact']" [routerLinkActive]="['uk-active']">Metrics</a>-->
62
                  <!--</li>-->
63
                  <!--<li *ngIf="getIsUserAdmin()">-->
64
                    <!--Admin-->
65
                    <!--<ul>-->
66
                      <!--<li><a href="{{adminHomePage}}" target="_blank">Help Texts</a></li>-->
67
                      <!--<li><a [routerLink]="['admin', 'metrics']" [routerLinkActive]="['uk-active']">Validate</a></li>s-->
68
                    <!--</ul>-->
69
                  <!--</li>-->
70 39
                  <li><a (click)="logout()">Logout</a></li>
71 40
                </ul>
72 41
              </div>
......
118 87
        <div class="uk-container uk-container-expand">
119 88
          <nav class="uk-navbar" uk-navbar="{&quot;align&quot;:&quot;left&quot;}">
120 89
            <div class="uk-navbar-left">
121
              <a [routerLink]="['landing']" class="uk-logo uk-navbar-item">
90
              <a [routerLink]="['join']" class="uk-logo uk-navbar-item">
122 91
                <img src="../../../assets/imgs/OA_PROVIDE_B.png" alt="OpenAIRE" class="uk-responsive-height">
123 92
              </a>
124 93
            </div>
......
127 96

  
128 97
              <ul class="uk-navbar-nav" >
129 98
                <li class="uk-parent" [routerLinkActive]="['uk-active']">
130
                  <a [routerLink]="['home']" [routerLinkActive]="['uk-active']">
131
                    Home
132
                  </a>
99
                  <a [routerLink]="['home']" [routerLinkActive]="['uk-active']">Home</a>
133 100
                </li>
134 101
                <li class="uk-parent" [routerLinkActive]="['uk-active']">
135
                  <a [routerLink]="['about']" [routerLinkActive]="['uk-active']">
136
                    About
137
                  </a>
102
                  <a [routerLink]="['about']" [routerLinkActive]="['uk-active']">About</a>
138 103
                </li>
139 104
                <li *ngIf="getIsUserLoggedIn()" class="uk-parent" [routerLinkActive]="['uk-active']">
140
                  <a [routerLink]="['join']" [routerLinkActive]="['uk-active']">
141
                    Dashboard
142
                  </a>
105
                  <a [routerLink]="['join']" [routerLinkActive]="['uk-active']">Dashboard</a>
143 106
                </li>
144 107

  
145 108
                <li *ngIf="!getIsUserLoggedIn()" class="uk-parent">
......
183 146

  
184 147
              </ul>
185 148

  
186
              <!--<div class="uk-navbar-item">-->
187

  
188
                <!--<ul *ngIf="!getIsUserLoggedIn()" class="uk-navbar-nav">-->
189
                  <!--<li class="uk-parent">-->
190
                    <!--<a class="" (click)="login()">-->
191
                      <!--Sign in-->
192
                      <!--<span class="uk-margin-small-left uk-icon">-->
193
                      <!--<svg height="20" ratio="1" viewBox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg">-->
194
                        <!--<circle cx="9.9" cy="6.4" fill="none" r="4.4" stroke="#000" stroke-width="1.1"></circle>-->
195
                        <!--<path d="M1.5,19 C2.3,14.5 5.8,11.2 10,11.2 C14.2,11.2 17.7,14.6 18.5,19.2" fill="none" stroke="#000" stroke-width="1.1"></path>-->
196
                      <!--</svg>-->
197
                    <!--</span>-->
198
                    <!--</a>-->
199
                  <!--</li>-->
200
                <!--</ul>-->
201

  
202
                <!--<ul *ngIf="getIsUserLoggedIn()" class="uk-navbar-nav">-->
203
                  <!--<li class="uk-parent">-->
204
                    <!--<a class="" aria-expanded="false">-->
205
                      <!--{{ getUserName() }}-->
206
                      <!--<span class="uk-margin-small-left uk-icon">-->
207
                      <!--<svg height="20" ratio="1" viewBox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg">-->
208
                        <!--<circle cx="9.9" cy="6.4" fill="none" r="4.4" stroke="#000" stroke-width="1.1"></circle>-->
209
                        <!--<path d="M1.5,19 C2.3,14.5 5.8,11.2 10,11.2 C14.2,11.2 17.7,14.6 18.5,19.2" fill="none" stroke="#000" stroke-width="1.1"></path>-->
210
                      <!--</svg>-->
211
                    <!--</span>-->
212
                    <!--</a>-->
213
                    <!--<div class="uk-navbar-dropdown uk-navbar-dropdown-bottom-left" style="top: 80px; left: 106.55px;"-->
214
                         <!--id="userMenu" (click)="onClick('userMenu')">-->
215
                      <!--<div class="uk-navbar-dropdown-grid uk-child-width-1-1 uk-grid uk-grid-stack" uk-grid="">-->
216
                        <!--<div class="uk-first-column">-->
217
                          <!--<ul class="uk-nav uk-navbar-dropdown-nav">-->
218
                            <!--&lt;!&ndash;<ul *ngIf="getIsUserAdmin()" class="uk-nav uk-navbar-dropdown-nav">&ndash;&gt;-->
219
                              <!--&lt;!&ndash;<li class="uk-nav-header" style="display: block;">Admin</li>&ndash;&gt;-->
220
                              <!--&lt;!&ndash;<li style="display: block"><a href="{{adminHomePage}}" target="_blank">Help Texts</a></li>&ndash;&gt;-->
221
                              <!--&lt;!&ndash;<li style="display: block"><a [routerLink]="['/admin/metrics']">Metrics</a></li>&ndash;&gt;-->
222
                              <!--&lt;!&ndash;<li style="display: block" class="uk-margin-small-bottom"><a [routerLink]="['/admin/registrations']">Registrations</a></li>&ndash;&gt;-->
223
                            <!--&lt;!&ndash;</ul>&ndash;&gt;-->
224
                            <!--<li><a class="" (click)="logout()">Log out</a></li>-->
225
                          <!--</ul>-->
226
                        <!--</div>-->
227
                      <!--</div>-->
228
                    <!--</div>-->
229
                  <!--</li>-->
230
                <!--</ul>-->
231

  
232
              <!--</div>-->
233

  
234

  
235 149
            </div>
236 150

  
237 151
          </nav>

Also available in: Unified diff