Revision 51512
Added by Myrto Koukouli about 6 years ago
modules/uoa-repository-dashboard-gui/trunk/app/pages/adminPg/adminPg-metrics.component.ts | ||
---|---|---|
71 | 71 |
approvePiwik(id: string) { |
72 | 72 |
this.loadingMessage = enablingMetrics; |
73 | 73 |
this.errorMessage = ''; |
74 |
this.piwikService.approvePiwikSite(id).subscribe( |
|
74 |
/*this.piwikService.approvePiwikSite(id).subscribe(*/ |
|
75 |
this.piwikService.markPiwikSiteAsValidated(id).subscribe( |
|
75 | 76 |
response => console.log(`approvePiwikSite responded: ${response}`), |
76 | 77 |
error => { |
77 | 78 |
console.log(error); |
modules/uoa-repository-dashboard-gui/trunk/app/pages/metrics/metrics-enable.component.ts | ||
---|---|---|
97 | 97 |
validationDate: null, |
98 | 98 |
comment: '' |
99 | 99 |
}; |
100 |
this.piwikService.savePiwikInfo(piwik).subscribe( |
|
100 |
/*this.piwikService.savePiwikInfo(piwik).subscribe(*/ |
|
101 |
this.piwikService.enableMetricsForRepository(piwik).subscribe( |
|
101 | 102 |
response => { |
102 | 103 |
console.log(`answered ${response}`); |
103 | 104 |
this.successMessage = enabledMetricsSuccess; |
... | ... | |
107 | 108 |
console.log(error); |
108 | 109 |
this.errorMessage = enabledMetricsError; |
109 | 110 |
this.loadingMessage = ''; |
110 |
this.getRepo(); |
|
111 | 111 |
} |
112 | 112 |
); |
113 | 113 |
} |
modules/uoa-repository-dashboard-gui/trunk/app/services/piwik.service.ts | ||
---|---|---|
34 | 34 |
.catch(this.handleError); |
35 | 35 |
} |
36 | 36 |
|
37 |
enableMetricsForRepository(piwik: PiwikInfo): Observable<PiwikInfo> { |
|
38 |
let url = `${this.apiUrl}enableMetricsForRepository`; |
|
39 |
console.log(`knocking on: ${url}`); |
|
40 |
httpOptions.withCredentials = true; |
|
41 |
return this.http.post(url,piwik,httpOptions) |
|
42 |
.map( res => <PiwikInfo>res.json() ) |
|
43 |
.catch(this.handleError); |
|
44 |
} |
|
45 |
|
|
37 | 46 |
getOpenaireId(id: string): Observable<string> { |
38 | 47 |
let url = `${this.apiUrl}getOpenaireId/${id}`; |
39 | 48 |
console.log(`knocking on: ${url}`); |
... | ... | |
58 | 67 |
.catch(this.handleError); |
59 | 68 |
} |
60 | 69 |
|
61 |
savePiwikInfo(piwik: PiwikInfo): Observable<string>{ |
|
70 |
|
|
71 |
markPiwikSiteAsValidated(repositoryId: string): Observable<string> { |
|
72 |
let url = `${this.apiUrl}markPiwikSiteAsValidated/${repositoryId}`; |
|
73 |
console.log(`knocking on: ${url}`); |
|
74 |
httpOptions.withCredentials = true; |
|
75 |
return this.http.post(url,httpOptions) |
|
76 |
.map(res => res.status.toString()) |
|
77 |
.catch(this.handleError); |
|
78 |
} |
|
79 |
|
|
80 |
savePiwikInfo(piwik: PiwikInfo): Observable<PiwikInfo>{ |
|
62 | 81 |
let url = `${this.apiUrl}savePiwikInfo`; |
63 | 82 |
console.log(`knocking on: ${url}`); |
64 | 83 |
httpOptions.withCredentials = true; |
65 | 84 |
return this.http.post(url,piwik,httpOptions) |
66 |
.map( res => { |
|
67 |
console.log(`responded ${res.statusText}`); |
|
68 |
return res.status.toString(); |
|
69 |
}) |
|
70 |
.catch(this.handleError).share(); |
|
85 |
.map( res => <PiwikInfo>res.json() ) |
|
86 |
.catch(this.handleError); |
|
71 | 87 |
} |
72 | 88 |
|
73 | 89 |
private handleError(error: Response | any) { |
modules/uoa-repository-dashboard-gui/trunk/app/shared/topmenu/topmenu.component.ts | ||
---|---|---|
47 | 47 |
} |
48 | 48 |
|
49 | 49 |
isUserAdmin() { |
50 |
/* ACTUAL ADMINS WILL HAVE A ROLE OF 'ROLE_ADMIN' */ |
|
51 |
return this.authService.getUserRole().includes('ROLE_USER'); |
|
50 |
return this.authService.getUserRole().includes('ROLE_ADMIN'); |
|
52 | 51 |
} |
53 | 52 |
} |
Also available in: Unified diff
changed piwik enable and approve methods