Project

General

Profile

« Previous | Next » 

Revision 50086

tried to pull repositories of user

View differences:

modules/uoa-repository-dashboard-gui/trunk/app/pages/metrics/metrics.component.html
77 77
                  </div>
78 78
                </div>
79 79
              </div>
80
              <div>
81
                <a *ngFor="let repo of reposOfUser" >
82
                  <h5>_{{ repo.repositoryName }}</h5>
83
                </a>
84
              </div>
80 85
            </div>
81 86
          </div>
82 87
        </div>
modules/uoa-repository-dashboard-gui/trunk/app/pages/metrics/metrics.component.ts
1 1
import {Component, OnInit} from '@angular/core';
2
import {RepositoryService} from "../../services/repository.service";
3
import {PiwikInfo} from "../../domain/typeScriptClasses";
2 4

  
3 5
@Component ({
4 6
  selector: 'app-metrics',
......
6 8
})
7 9

  
8 10
export class MetricsComponent implements OnInit {
9
  constructor() {}
11
  reposOfUser: PiwikInfo[];
10 12

  
11
  ngOnInit() {}
13
  constructor(private repoService: RepositoryService) {}
14

  
15
  ngOnInit() {
16
    this.getReposOfUser();
17
    if(this.reposOfUser) {
18
      console.log(`counted ${this.reposOfUser.length} repositories`);
19
    } else {
20
      console.log('no repos pulled');
21
    }
22
  }
23

  
24
  getReposOfUser(): void {
25
    this.repoService.getRepositoriesOfUser("ant.lebesis@gmail.com")
26
      .subscribe(repos => this.reposOfUser = repos);
27
  }
12 28
}
modules/uoa-repository-dashboard-gui/trunk/app/services/repository.service.ts
1
import {Injectable} from '@angular/core';
2
import {HttpClient, HttpHeaders} from '@angular/common/http';
3
import {Observable} from 'rxjs/Observable';
4
import {catchError, tap} from 'rxjs/operators';
1
/*
2
* Created by myrto on 12/05/2017
3
*/
5 4

  
5
/*
6
*  !!! USING TEMPORARY API ADDRESS AND USER
7
*/
8

  
9
import { Injectable } from '@angular/core';
10
import { HttpClient, HttpHeaders } from '@angular/common/http';
11

  
12
import { Observable } from 'rxjs/Observable';
13
import { catchError, map, tap } from 'rxjs/operators'
14

  
15
import {PiwikInfo, Repository} from '../domain/typeScriptClasses';
16
import {of} from "rxjs/observable/of";
17

  
6 18
const httpOptions = {
7
  headers: new HttpHeaders({ 'Content-Type': 'application/json' })
19
  headers: new HttpHeaders({ 'Content-Type': 'application/json','Access-Control-Allow-Origin': '*' })
8 20
};
9 21

  
10 22
@Injectable ()
......
13 25

  
14 26
  constructor(private http: HttpClient){}
15 27

  
16
  getRepositoriesOfUser(userEmail: string) : Observable<string[]> {
17
    return this.http.get(`${this.apiUrl}/users/${userEmail}`)
28
  getRepositoriesOfUser (userEmail: string): Observable<PiwikInfo[]> {
29
    console.log(`knocking on: ${this.apiUrl}/repository/getRepositoriesOfUser/${userEmail}/0/10`);
30
    return this.http.get<Repository[]>(`${this.apiUrl}/repositories/getRepositoryOfUser/${userEmail}/0/10`)
18 31
      .pipe(
19
      console.log(`accessing repositories of user with email ${userEmail}`)
20
    );
32
        tap( _ => console.log(`got respositories of user with email" ${userEmail}`)),
33
        map( (rep: Repository) => rep.piwikInfo),
34
        catchError(this.handleError(`get repositories of user with email: ${userEmail}`))
35
      );
21 36
  }
37

  
38
  private handleError<T> (operation = 'operation', result?: T) {
39
    return (error: any): Observable<T> => {
40
      console.error(error);
41
      console.log(`${operation} failed: ${error.message}`);
42
      return of(result as T);
43
    };
44
  }
22 45
}
modules/uoa-repository-dashboard-gui/trunk/app/services/authorization.service.ts
1
import {Injectable} from "@angular/core";
2

  
3
@Injectable()
4
export class AuthorizationService {
5
}
0 6

  
modules/uoa-repository-dashboard-gui/trunk/app/app.module.ts
1 1
/**
2 2
 * Created by stefania on 10/3/16.
3 3
 */
4
import {NgModule} from "@angular/core";
5
import {BrowserModule} from "@angular/platform-browser";
6
import {FormsModule, ReactiveFormsModule} from "@angular/forms";
7
import {HttpModule, JsonpModule} from "@angular/http";
4
import {NgModule} from '@angular/core';
5
import {BrowserModule} from '@angular/platform-browser';
6
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
7
import {JsonpModule} from '@angular/http';
8 8

  
9
import {TabsModule, ModalModule} from "ngx-bootstrap";
9
import {TabsModule, ModalModule} from 'ngx-bootstrap';
10 10

  
11
import {AppRouting} from "./app.routing";
12
import {AppComponent} from "./app.component";
13
import {ConfirmationDialogComponent} from "./shared/confirmation-dialog.component";
14
import {UserModule} from "./user/user.module";
11
import {AppRouting} from './app.routing';
12
import {AppComponent} from './app.component';
13
import {UserModule} from './user/user.module';
15 14
import {HomeComponent} from './pages/home/home.component';
16 15
import {TopMenuComponent} from './shared/topmenu/topmenu.component';
17 16
import {FooterComponent} from './shared/footer/footer.component';
18 17
import {MetricsModule} from './pages/metrics/metrics.module';
19 18
import {SourcesModule} from './pages/sources/sources.module';
20
import {CompatibilityModule} from "./pages/compatibility/compatibility.module";
21
import {ContentModule} from "./pages/content/content.module";
22
import {AdminPgModule} from "./pages/adminPg/adminPg.module";
19
import {CompatibilityModule} from './pages/compatibility/compatibility.module';
20
import {ContentModule} from './pages/content/content.module';
21
import {AdminPgModule} from './pages/adminPg/adminPg.module';
22
import {HttpClientModule} from '@angular/common/http';
23
import {RepositoryService} from "./services/repository.service";
23 24

  
24 25

  
25 26
@NgModule({
......
27 28
    BrowserModule,
28 29
    FormsModule,
29 30
    ReactiveFormsModule,
30
    HttpModule,
31
    HttpClientModule,
31 32
    JsonpModule,
32 33
    ModalModule.forRoot(),
33 34
//    routing,
......
48 49
  ],
49 50
  providers: [
50 51
//    appRoutingProviders
52
      RepositoryService
51 53
  ],
52 54
  bootstrap: [AppComponent]
53 55
})
modules/uoa-repository-dashboard-gui/trunk/package.json
30 30
    "ie-shim": "^0.1.0",
31 31
    "ngx-bootstrap": "^1.7.1",
32 32
    "reflect-metadata": "^0.1.8",
33
    "rxjs": "5.4.0",
33
    "rxjs": "^5.4.2",
34 34
    "zone.js": "^0.8.18"
35 35
  },
36 36
  "devDependencies": {
modules/uoa-repository-dashboard-gui/trunk/package-lock.json
8344 8344
      "dev": true
8345 8345
    },
8346 8346
    "rxjs": {
8347
      "version": "5.4.0",
8348
      "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-5.4.0.tgz",
8349
      "integrity": "sha1-p9sUqxV/nXqsalbmVeejhg05vyY=",
8347
      "version": "5.5.5",
8348
      "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-5.5.5.tgz",
8349
      "integrity": "sha512-D/MfQnPMBk8P8gfwGxvCkuaWBcG58W7dUMT//URPoYzIbDEKT0GezdirkK5whMgKFBATfCoTpxO8bJQGJ04W5A==",
8350 8350
      "requires": {
8351
        "symbol-observable": "1.0.4"
8351
        "symbol-observable": "1.0.1"
8352 8352
      }
8353 8353
    },
8354 8354
    "safe-buffer": {
......
9531 9531
      }
9532 9532
    },
9533 9533
    "symbol-observable": {
9534
      "version": "1.0.4",
9535
      "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.0.4.tgz",
9536
      "integrity": "sha1-Kb9hXUqnEhvdiYsi1LP5vE4qoD0="
9534
      "version": "1.0.1",
9535
      "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.0.1.tgz",
9536
      "integrity": "sha1-g0D8RwLDEi310iKI+IKD9RPT/dQ="
9537 9537
    },
9538 9538
    "tapable": {
9539 9539
      "version": "0.2.8",
modules/uoa-repository-dashboard-gui/trunk/webpack.config.js
1
/*
2
*   !!! ADD REAL API ADDRESSES BEFORE PRODUCTION !!!!
3
*/
4

  
1 5
var webpack = require('webpack');
2 6
var path = require('path');
3 7
var webpackMerge = require('webpack-merge');
......
93 97
      new webpack.DefinePlugin({
94 98
        "process.env": {
95 99
          PRODUCTION: JSON.stringify(false),
96
          API_ENDPOINT: JSON.stringify(process.env.API_ENDPOINT || "http://localhost:8080/omtd-registry"),
100
          API_ENDPOINT: JSON.stringify(process.env.API_ENDPOINT || "http://194.177.192.121:8380/uoa-repository-manager-service"),
97 101
          FAQ_ENDPOINT: JSON.stringify(process.env.FAQ_ENDPOINT || "http://83.212.101.85:5555/api/"),
98 102
          CONNECTOR_API_ENDPOINT: JSON.stringify(process.env.CONNECTOR_API_ENDPOINT || "http://localhost:8888/content-connector-service"),
99 103
          WORKFLOW_API_ENDPOINT: JSON.stringify(process.env.WORKFLOW_API_ENDPOINT || "https://dev.openminted.eu:8881"),

Also available in: Unified diff