Change version to 1.0.0

This commit is contained in:
kostis30fyllou 2019-05-31 15:30:55 +03:00
parent eb94b1ace3
commit cbfe3c2e6e
5 changed files with 67 additions and 58 deletions

View File

@ -1,4 +1,5 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import {environment} from '../environments/environment.prod';
@Component({ @Component({
selector: 'app-root', selector: 'app-root',
@ -8,7 +9,7 @@ import { Component, OnInit } from '@angular/core';
export class AppComponent implements OnInit { export class AppComponent implements OnInit {
private _userid = 'user5649231'; private _userid = 'user5649231';
private _backendserveraddress = 'https://beta.services.openaire.eu/interactive-mining'; private _backendserveraddress = environment.miningbackendserveraddress;
private _isCommunityManager = 'true'; private _isCommunityManager = 'true';
title = 'app'; title = 'app';

View File

@ -17,7 +17,7 @@
<tfoot> <tfoot>
</tfoot> </tfoot>
<tbody> <tbody>
<tr *ngFor="let profile of allUsersProfiles | paginate: config; let i = index"> <tr *ngFor="let profile of allUsersProfiles | paginate: allProfiles; let i = index">
<td class="uk-text-nowrap">{{profile.user}}</td> <td class="uk-text-nowrap">{{profile.user}}</td>
<td class="uk-table-link"> <td class="uk-table-link">
<a class="uk-link-reset" (click)="loadUserProfileAdmin(profile.userId, profile.profileId, profile.profile)">{{profile.profile}}</a> <a class="uk-link-reset" (click)="loadUserProfileAdmin(profile.userId, profile.profileId, profile.profile)">{{profile.profile}}</a>
@ -36,8 +36,8 @@
</tbody> </tbody>
</table> </table>
<pagination-template *ngIf="allUsersProfiles.length" #p="paginationApi" <pagination-template *ngIf="allUsersProfiles.length" #p="paginationApi"
[id]="config.id" [id]="allProfiles.id"
(pageChange)="config.currentPage = $event"> (pageChange)="allProfiles.currentPage = $event">
<ul class="uk-pagination uk-flex-center" uk-margin> <ul class="uk-pagination uk-flex-center" uk-margin>
<li [class.uk-disabled]="p.isFirstPage()"><a (click)="p.previous()"><span uk-pagination-previous></span></a></li> <li [class.uk-disabled]="p.isFirstPage()"><a (click)="p.previous()"><span uk-pagination-previous></span></a></li>
<li *ngFor="let page of p.pages" [class.uk-active]="p.getCurrent() === page.value"> <li *ngFor="let page of p.pages" [class.uk-active]="p.getCurrent() === page.value">
@ -89,7 +89,7 @@
</div> </div>
</td> </td>
</tr> </tr>
<tr *ngFor="let profile of userSavedProfiles | paginate: config; let i = index"> <tr *ngFor="let profile of userSavedProfiles| paginate: userProfiles; let i = index" >
<!--<td class="download">--> <!--<td class="download">-->
<!--<a class="uk-icon-link uk-icon" uk-icon="icon: download" contenteditable="false" (click)="downloadProfile(profile.id, profile.name)"></a>--> <!--<a class="uk-icon-link uk-icon" uk-icon="icon: download" contenteditable="false" (click)="downloadProfile(profile.id, profile.name)"></a>-->
<!--</td>--> <!--</td>-->
@ -99,7 +99,7 @@
<td class="cm-text-muted uk-text-nowrap">{{profile.datecreated}}</td> <td class="cm-text-muted uk-text-nowrap">{{profile.datecreated}}</td>
<td class="cm-text-muted uk-text-nowrap"> <td class="cm-text-muted uk-text-nowrap">
<button *ngIf="!profile.notified && !pending" class="uk-button uk-button-secondary uk-button-small uk-text-center cm-margin" (click)="notifyProfile(profile)">Notify</button> <button *ngIf="!profile.notified && !pending" class="uk-button uk-button-secondary uk-button-small uk-text-center cm-margin" (click)="notifyProfile(profile)">Notify</button>
<button *ngIf="pending" class="uk-button uk-button-secondary uk-button-small uk-text-center cm-margin" disabled>Notifing... <span uk-spinner="ratio: 0.8"></span></button> <button *ngIf="pending" class="uk-button uk-button-secondary uk-button-small uk-text-center cm-margin" disabled>Notifying... <span uk-spinner="ratio: 0.8"></span></button>
<span *ngIf="profile.notified " class="uk-label uk-label-success">Notified</span> <span *ngIf="profile.notified " class="uk-label uk-label-success">Notified</span>
</td> </td>
<td class="uk-text-nowrap uk-text-warning">{{profile.status}}</td> <td class="uk-text-nowrap uk-text-warning">{{profile.status}}</td>
@ -110,18 +110,18 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
<pagination-template *ngIf="userSavedProfiles.length" #p="paginationApi" <pagination-template *ngIf="userSavedProfiles.length" #u="paginationApi"
[id]="config.id" [id]="userProfiles.id"
(pageChange)="config.currentPage = $event"> (pageChange)="userProfiles.currentPage = $event">
<ul class="uk-pagination uk-flex-center" uk-margin> <ul class="uk-pagination uk-flex-center" uk-margin>
<li [class.uk-disabled]="p.isFirstPage()"><a (click)="p.previous()"><span uk-pagination-previous></span></a></li> <li [class.uk-disabled]="u.isFirstPage()"><a (click)="u.previous()"><span uk-pagination-previous></span></a></li>
<li *ngFor="let page of p.pages" [class.uk-active]="p.getCurrent() === page.value"> <li *ngFor="let page of u.pages" [class.uk-active]="u.getCurrent() === page.value">
<a (click)="p.setCurrent(page.value)" *ngIf="p.getCurrent() !== page.value"> <a (click)="u.setCurrent(page.value)" *ngIf="u.getCurrent() !== page.value">
<span>{{ page.label }}</span> <span>{{ page.label }}</span>
</a> </a>
<span *ngIf="p.getCurrent() === page.value">{{ page.label }}</span> <span *ngIf="u.getCurrent() === page.value">{{ page.label }}</span>
</li> </li>
<li [class.uk-disabled]="p.isLastPage()"><a (click)="p.next()"><span uk-pagination-next></span></a></li> <li [class.uk-disabled]="u.isLastPage()"><a (click)="u.next()"><span uk-pagination-next></span></a></li>
</ul> </ul>
</pagination-template> </pagination-template>
</div> </div>
@ -140,7 +140,7 @@
<!--&lt;!&ndash;</div>&ndash;&gt;--> <!--&lt;!&ndash;</div>&ndash;&gt;-->
<!--</div>--> <!--</div>-->
<!--</div>--> <!--</div>-->
<div *ngIf="userSavedProfiles.length" class="uk-container-small"> <div *ngIf="userSavedProfiles.length > 0" class="uk-container-small">
<a class="test-upload uk-button cm-button-primary uk-text-center cm-margin" (click)="createNewProfile()"> <a class="test-upload uk-button cm-button-primary uk-text-center cm-margin" (click)="createNewProfile()">
<span class="uk-text-middle">Create a new mining profile</span> <span class="uk-text-middle">Create a new mining profile</span>
</a> </a>

View File

@ -10,8 +10,7 @@ import {saveFile} from '../util';
@Component({ @Component({
selector: 'app-manageprofiles', selector: 'app-manageprofiles',
templateUrl: './manageprofiles.component.html', templateUrl: './manageprofiles.component.html'
styleUrls: ['./manageprofiles.component.css']
}) })
export class ManageprofilesComponent implements OnInit { export class ManageprofilesComponent implements OnInit {
@ -30,8 +29,14 @@ export class ManageprofilesComponent implements OnInit {
public userSavedProfiles: Array<ProfileMetadata> = []; public userSavedProfiles: Array<ProfileMetadata> = [];
public exampleProfiles: Array<ExampleProfilesMetadata> = []; public exampleProfiles: Array<ExampleProfilesMetadata> = [];
public config: PaginationInstance = { public allProfiles: PaginationInstance = {
id: 'custom', id: 'all',
itemsPerPage: 5,
currentPage: 1
};
public userProfiles: PaginationInstance = {
id: 'user',
itemsPerPage: 5, itemsPerPage: 5,
currentPage: 1 currentPage: 1
}; };
@ -47,12 +52,12 @@ export class ManageprofilesComponent implements OnInit {
params => { params => {
// console.log('queryParams', params['communityId']); // console.log('queryParams', params['communityId']);
this.communityId = params['communityId']; this.communityId = params['communityId'];
this.initialServerhandshake(this.communityId); this.initialServerHandshake(this.communityId);
}); });
this.isCommunityManager = this.manageProfilesService.isCommunityManager === 'true'; this.isCommunityManager = this.manageProfilesService.isCommunityManager === 'true';
} }
initialServerhandshake(communityId: string): void { private initialServerHandshake(communityId: string): void {
this.manageProfilesService.initialServerHandshake(communityId) this.manageProfilesService.initialServerHandshake(communityId)
.subscribe(() => { .subscribe(() => {
if (this.isCommunityManager) { if (this.isCommunityManager) {
@ -63,7 +68,7 @@ export class ManageprofilesComponent implements OnInit {
}); });
} }
getAllUsersProfiles(): void { private getAllUsersProfiles(): void {
this.manageProfilesService.getUsersProfiles() this.manageProfilesService.getUsersProfiles()
.subscribe(res => { .subscribe(res => {
if (res) { if (res) {
@ -72,6 +77,41 @@ export class ManageprofilesComponent implements OnInit {
}); });
} }
private getSavedProfiles(): void {
this.manageProfilesService.getSavedProfiles()
.subscribe(res => {
if (res) {
this.userSavedProfiles = res;
}
});
}
private getExampleProfiles(): void {
this.manageProfilesService.getExampleProfiles()
.subscribe(res => this.exampleProfiles = res);
}
private clearLocalStorage(): void {
// clear localstorage values
localStorage.removeItem('grants');
localStorage.removeItem('profilename');
localStorage.removeItem('profileid');
localStorage.removeItem('docname');
localStorage.removeItem('docsnumber');
localStorage.removeItem('concepts');
localStorage.removeItem('poswords');
localStorage.removeItem('negwords');
localStorage.removeItem('contextprev');
localStorage.removeItem('contextmiddle');
localStorage.removeItem('contextnext');
localStorage.removeItem('wordssplitnum');
localStorage.removeItem('punctuation');
localStorage.removeItem('stopwords');
localStorage.removeItem('lowercase');
localStorage.removeItem('stemming');
localStorage.removeItem('documentarea');
}
loadUserProfileAdmin(userId: string, profileId: string, name: string): void { loadUserProfileAdmin(userId: string, profileId: string, name: string): void {
this.manageProfilesService.loadUserProfileAdmin(userId, profileId) this.manageProfilesService.loadUserProfileAdmin(userId, profileId)
.subscribe(res => { .subscribe(res => {
@ -108,15 +148,6 @@ export class ManageprofilesComponent implements OnInit {
.subscribe(); .subscribe();
} }
getSavedProfiles(): void {
this.manageProfilesService.getSavedProfiles()
.subscribe(res => {
if (res) {
this.userSavedProfiles = res;
}
});
}
loadSavedProfile(id: string, name: string): void { loadSavedProfile(id: string, name: string): void {
this.manageProfilesService.loadSavedProfile(id) this.manageProfilesService.loadSavedProfile(id)
.subscribe(res => { .subscribe(res => {
@ -193,14 +224,12 @@ export class ManageprofilesComponent implements OnInit {
} }
} }
getExampleProfiles(): void {
this.manageProfilesService.getExampleProfiles()
.subscribe(res => this.exampleProfiles = res);
}
notifyProfile(profile: ProfileMetadata ): void { notifyProfile(profile: ProfileMetadata ): void {
UIkit.modal.confirm('<span class="uk-text-bold">' + UIkit.modal.confirm('<span class="uk-text-bold">' +
'A notification will be sent to the OpenAIRE Mining experts, that your profile is in its final version!</br></br>Are you sure you want to proceed?</span>', {escClose: true}).then(() => { 'A notification will be sent to the OpenAIRE Mining experts, ' +
'that your profile is in its final version!</br></br>' +
'Are you sure you want to proceed?</span>', {escClose: true}).then(() => {
this.pending = true; this.pending = true;
this.manageProfilesService.notifyProfile(this.communityId, profile.id) this.manageProfilesService.notifyProfile(this.communityId, profile.id)
.subscribe(res => { .subscribe(res => {
@ -235,25 +264,4 @@ export class ManageprofilesComponent implements OnInit {
}); });
} }
clearLocalStorage(): void {
// clear localstorage values
localStorage.removeItem('grants');
localStorage.removeItem('profilename');
localStorage.removeItem('profileid');
localStorage.removeItem('docname');
localStorage.removeItem('docsnumber');
localStorage.removeItem('concepts');
localStorage.removeItem('poswords');
localStorage.removeItem('negwords');
localStorage.removeItem('contextprev');
localStorage.removeItem('contextmiddle');
localStorage.removeItem('contextnext');
localStorage.removeItem('wordssplitnum');
localStorage.removeItem('punctuation');
localStorage.removeItem('stopwords');
localStorage.removeItem('lowercase');
localStorage.removeItem('stemming');
localStorage.removeItem('documentarea');
}
} }

View File

@ -5,5 +5,5 @@
export const environment = { export const environment = {
production: false, production: false,
miningbackendserveraddress: 'http://localhost' miningbackendserveraddress: 'http://localhost:8081'
}; };