Revision 60573
Added by Konstantinos Triantafyllou over 3 years ago
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/app.component.html | ||
---|---|---|
25 | 25 |
[centered]="true" [properties]="properties" [showMenuItems]="true"></bottom> |
26 | 26 |
<role-verification *ngIf="stakeholder" |
27 | 27 |
[id]="stakeholder.alias" [name]="stakeholder.name" [type]="stakeholder.type"></role-verification> |
28 |
<notification-sidebar *ngIf="properties.environment === 'development' && user && notificationGroupsInitialized" |
|
29 |
[user]="user" [availableGroups]="notificationGroups" service="monitor"></notification-sidebar> |
|
28 | 30 |
</div> |
29 | 31 |
</div> |
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/admin-tools/admin-tools-routing.module.ts | ||
---|---|---|
9 | 9 |
loadChildren: '../openaireLibrary/dashboard/entity/entities.module#EntitiesModule', |
10 | 10 |
pathMatch: 'full' |
11 | 11 |
}, |
12 |
/* { |
|
13 |
path: 'classContents', |
|
14 |
loadChildren: '../openaireLibrary/dashboard/divhelpcontent/div-help-contents.module#DivHelpContentsModule' |
|
15 |
}, |
|
12 |
/* { |
|
13 |
path: 'classContents', |
|
14 |
loadChildren: '../openaireLibrary/dashboard/divhelpcontent/div-help-contents.module#DivHelpContentsModule' |
|
15 |
}, |
|
16 |
{ |
|
17 |
path: 'classContents/new', |
|
18 |
loadChildren: '../openaireLibrary/dashboard/divhelpcontent/new-div-help-content.module#NewDivHelpContentModule', |
|
19 |
pathMatch: 'full' |
|
20 |
}, |
|
21 |
{ |
|
22 |
path: 'classContents/edit', |
|
23 |
loadChildren: '../openaireLibrary/dashboard/divhelpcontent/edit-div-help-content.module#EditDivHelpContentModule', |
|
24 |
pathMatch: 'full' |
|
25 |
},*/ |
|
16 | 26 |
{ |
17 |
path: 'classContents/new', |
|
18 |
loadChildren: '../openaireLibrary/dashboard/divhelpcontent/new-div-help-content.module#NewDivHelpContentModule', |
|
19 |
pathMatch: 'full' |
|
20 |
}, |
|
21 |
{ |
|
22 |
path: 'classContents/edit', |
|
23 |
loadChildren: '../openaireLibrary/dashboard/divhelpcontent/edit-div-help-content.module#EditDivHelpContentModule', |
|
24 |
pathMatch: 'full' |
|
25 |
},*/ |
|
26 |
{ |
|
27 | 27 |
path: 'helptexts', |
28 | 28 |
loadChildren: '../openaireLibrary/dashboard/helpTexts/page-help-contents.module#PageHelpContentsModule', |
29 | 29 |
pathMatch: 'full' |
30 | 30 |
}, |
31 | 31 |
{ |
32 | 32 |
path: 'helptexts/edit', |
33 |
loadChildren: '../openaireLibrary/dashboard/helpTexts/edit-page-help-content.module#EditPageHelpContentModule',
|
|
33 |
loadChildren: '../openaireLibrary/dashboard/helpTexts/page-help-content-form.module#PageHelpContentFormModule',
|
|
34 | 34 |
pathMatch: 'full' |
35 | 35 |
}, |
36 | 36 |
{ |
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/app.module.ts | ||
---|---|---|
24 | 24 |
import {ErrorInterceptorService} from "./openaireLibrary/error-interceptor.service"; |
25 | 25 |
import {AdminLoginGuard} from "./openaireLibrary/login/adminLoginGuard.guard"; |
26 | 26 |
import {AdminDashboardGuard} from "./utils/adminDashboard.guard"; |
27 |
import {NotificationsSidebarModule} from "./openaireLibrary/notifications/notifications-sidebar/notifications-sidebar.module"; |
|
27 | 28 |
import {LoginGuard} from "./openaireLibrary/login/loginGuard.guard"; |
28 | 29 |
|
29 | 30 |
@NgModule({ |
... | ... | |
41 | 42 |
BrowserModule.withServerTransition({appId: 'my-app'}), |
42 | 43 |
AppRoutingModule, |
43 | 44 |
BrowserTransferStateModule, |
44 |
SideBarModule, Schema2jsonldModule, RoleVerificationModule, LoadingModule |
|
45 |
SideBarModule, Schema2jsonldModule, RoleVerificationModule, LoadingModule, NotificationsSidebarModule
|
|
45 | 46 |
], |
46 | 47 |
declarations: [AppComponent, OpenaireErrorPageComponent], |
47 | 48 |
exports: [AppComponent], |
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/users/users.component.html | ||
---|---|---|
9 | 9 |
<li [class.uk-active]="tab === 'member'"><a routerLink="./" fragment="member"><span class="title">Members</span></a></li> |
10 | 10 |
</ul> |
11 | 11 |
</ng-template> |
12 |
<role-users *ngIf="!loading && alias" [id]="alias" [type]="type" [name]="name" [link]="link" [role]="tab" [message]="messages.get(tab)" [emailComposer]="emailComposer"> |
|
12 |
<role-users *ngIf="!loading && alias" [id]="alias" [type]="type" [name]="name" [link]="link" [role]="tab" [message]="messages.get(tab)" |
|
13 |
[emailComposer]="emailComposer" [notificationFn]="(properties.environment === 'development')?notificationFn:null"> |
|
13 | 14 |
<ng-container [ngTemplateOutlet]="tabs"></ng-container> |
14 | 15 |
</role-users> |
15 | 16 |
|
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/users/users.component.ts | ||
---|---|---|
6 | 6 |
import {Composer} from "../openaireLibrary/utils/email/composer"; |
7 | 7 |
import {Email} from "../openaireLibrary/utils/email/email"; |
8 | 8 |
import {ActivatedRoute} from "@angular/router"; |
9 |
import {NotificationUtils} from "../openaireLibrary/notifications/notification-utils"; |
|
10 |
import {Notification} from "../openaireLibrary/notifications/notifications"; |
|
11 |
import {User} from "../openaireLibrary/login/utils/helper.class"; |
|
12 |
import {UserManagementService} from "../openaireLibrary/services/user-management.service"; |
|
13 |
import {EnvProperties} from "../openaireLibrary/utils/properties/env-properties"; |
|
9 | 14 |
|
10 | 15 |
type Tab = 'member' | 'manager'; |
11 | 16 |
|
... | ... | |
22 | 27 |
public loading: boolean; |
23 | 28 |
public messages: Map<Tab, string> = new Map<Tab, string>(); |
24 | 29 |
public tab: Tab = 'manager'; |
30 |
public user: User; |
|
31 |
public properties: EnvProperties = properties; |
|
25 | 32 |
private subscriptions = []; |
26 | 33 |
public emailComposer: Function = (name, recipient, role): Email => { |
27 | 34 |
return Composer.composeEmailForMonitorDashboard(name, recipient, role); |
28 | 35 |
} |
36 |
public notificationFn: Function = (name, recipient, role, invitation): Notification => { |
|
37 |
if(invitation) { |
|
38 |
invitation.link = this.link + invitation.link; |
|
39 |
} |
|
40 |
let notification: Notification = NotificationUtils.invite(this.name, role, this.user.firstname + ' ' + this.user.lastname, invitation); |
|
41 |
notification.entity = recipient; |
|
42 |
notification.stakeholderType = this.type; |
|
43 |
notification.stakeholder = this.alias; |
|
44 |
notification.name = this.user.firstname; |
|
45 |
notification.surname = this.user.lastname; |
|
46 |
notification.groups = [recipient]; |
|
47 |
return notification; |
|
48 |
} |
|
29 | 49 |
|
30 | 50 |
constructor(private stakeholderService: StakeholderService, |
51 |
private userManagementService: UserManagementService, |
|
31 | 52 |
private route: ActivatedRoute, |
32 | 53 |
private title: Title) { |
33 | 54 |
} |
... | ... | |
55 | 76 |
this.loading = false; |
56 | 77 |
} |
57 | 78 |
})); |
79 |
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => { |
|
80 |
this.user = user; |
|
81 |
})); |
|
58 | 82 |
} |
59 | 83 |
|
60 | 84 |
ngOnDestroy() { |
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/app.component.ts | ||
---|---|---|
2 | 2 |
import {ActivatedRoute, NavigationEnd, Params, Router} from '@angular/router'; |
3 | 3 |
import {EnvProperties} from './openaireLibrary/utils/properties/env-properties'; |
4 | 4 |
import {EnvironmentSpecificService} from './openaireLibrary/utils/properties/environment-specific.service'; |
5 |
import {Session, User} from './openaireLibrary/login/utils/helper.class'; |
|
5 |
import {Role, Session, User} from './openaireLibrary/login/utils/helper.class';
|
|
6 | 6 |
import {UserManagementService} from "./openaireLibrary/services/user-management.service"; |
7 | 7 |
import {StakeholderService} from "./openaireLibrary/monitor/services/stakeholder.service"; |
8 | 8 |
import {BehaviorSubject, Subscriber} from "rxjs"; |
... | ... | |
14 | 14 |
import {arrow_left} from "./openaireLibrary/utils/icons/icons"; |
15 | 15 |
import {properties} from "../environments/environment"; |
16 | 16 |
import {ConfigurationService} from "./openaireLibrary/utils/configuration/configuration.service"; |
17 |
import {Option} from "./openaireLibrary/sharedComponents/input/input.component"; |
|
18 |
import {StakeholderUtils} from "./utils/indicator-utils"; |
|
17 | 19 |
|
18 | 20 |
|
19 | 21 |
@Component({ |
... | ... | |
33 | 35 |
sideBarItems: MenuItem[] = []; |
34 | 36 |
specialSideBarMenuItem: MenuItem = null; |
35 | 37 |
menuItems: RootMenuItem[] = []; |
38 |
notificationGroups: Option[] = []; |
|
39 |
notificationGroupsInitialized: boolean = false; |
|
40 |
stakeholderUtils: StakeholderUtils = new StakeholderUtils(); |
|
36 | 41 |
menuHeader: Header = { |
37 | 42 |
route: "/", |
38 | 43 |
url: null, |
... | ... | |
169 | 174 |
this.user = user; |
170 | 175 |
if (user) { |
171 | 176 |
this.buildMenu(); |
177 |
if(!this.notificationGroupsInitialized && this.properties.environment === 'development') { |
|
178 |
this.setNotificationGroups(); |
|
179 |
} |
|
172 | 180 |
} |
173 | 181 |
})); |
174 | 182 |
} |
175 | 183 |
|
184 |
public setNotificationGroups() { |
|
185 |
this.notificationGroups = []; |
|
186 |
if(Session.isPortalAdministrator(this.user)) { |
|
187 |
this.notificationGroups.push({value: Role.PORTAL_ADMIN, label: 'Portal Administrators'}); |
|
188 |
} |
|
189 |
for(let type of this.stakeholderUtils.types) { |
|
190 |
if(Session.isCurator(type.value, this.user) || Session.isPortalAdministrator(this.user)) { |
|
191 |
this.notificationGroups.push({value: Role.curator(type.value), label: type.label + ' Curators'}); |
|
192 |
} |
|
193 |
} |
|
194 |
this.subscriptions.push(this.stakeholderService.getMyStakeholders(this.properties.monitorServiceAPIURL).subscribe(stakeholders => { |
|
195 |
stakeholders.forEach(stakeholder => { |
|
196 |
this.notificationGroups.push({value: Role.manager(stakeholder.type, stakeholder.alias), label: stakeholder.name + ' Managers'}); |
|
197 |
this.notificationGroups.push({value: Role.member(stakeholder.type, stakeholder.alias), label: stakeholder.name + ' Members'}); |
|
198 |
}); |
|
199 |
this.notificationGroupsInitialized = true; |
|
200 |
})); |
|
201 |
} |
|
202 |
|
|
176 | 203 |
public ngOnDestroy() { |
177 | 204 |
this.subscriptions.forEach(value => { |
178 | 205 |
if (value instanceof Subscriber) { |
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/general/edit-stakeholder/edit-stakeholder.module.ts | ||
---|---|---|
6 | 6 |
import {IconsModule} from "../../openaireLibrary/utils/icons/icons.module"; |
7 | 7 |
import {IconsService} from "../../openaireLibrary/utils/icons/icons.service"; |
8 | 8 |
import {cloud_upload, edit, remove} from "../../openaireLibrary/utils/icons/icons"; |
9 |
import {NotifyFormModule} from "../../openaireLibrary/notifications/notify-form/notify-form.module"; |
|
9 | 10 |
|
10 | 11 |
@NgModule({ |
11 |
imports: [CommonModule, InputModule, ReactiveFormsModule, IconsModule], |
|
12 |
imports: [CommonModule, InputModule, ReactiveFormsModule, IconsModule, NotifyFormModule],
|
|
12 | 13 |
declarations: [EditStakeholderComponent], |
13 | 14 |
exports: [EditStakeholderComponent] |
14 | 15 |
}) |
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/general/edit-stakeholder/edit-stakeholder.component.ts | ||
---|---|---|
1 |
import {Component, Input, OnDestroy} from "@angular/core"; |
|
1 |
import {Component, Input, OnDestroy, ViewChild} from "@angular/core";
|
|
2 | 2 |
import {Stakeholder} from "../../openaireLibrary/monitor/entities/stakeholder"; |
3 | 3 |
import {FormBuilder, FormGroup, Validators} from "@angular/forms"; |
4 | 4 |
import {StakeholderUtils} from "../../utils/indicator-utils"; |
... | ... | |
8 | 8 |
import {properties} from "../../../environments/environment"; |
9 | 9 |
import {StakeholderService} from "../../openaireLibrary/monitor/services/stakeholder.service"; |
10 | 10 |
import {UtilitiesService} from "../../openaireLibrary/services/utilities.service"; |
11 |
import {Session, User} from "../../openaireLibrary/login/utils/helper.class"; |
|
11 |
import {Role, Session, User} from "../../openaireLibrary/login/utils/helper.class";
|
|
12 | 12 |
import {UserManagementService} from "../../openaireLibrary/services/user-management.service"; |
13 | 13 |
import {StringUtils} from "../../openaireLibrary/utils/string-utils.class"; |
14 |
import {NotifyFormComponent} from "../../openaireLibrary/notifications/notify-form/notify-form.component"; |
|
15 |
import {NotificationUtils} from "../../openaireLibrary/notifications/notification-utils"; |
|
16 |
import {Notification} from "../../openaireLibrary/notifications/notifications"; |
|
14 | 17 |
|
15 | 18 |
declare var UIkit; |
16 | 19 |
|
17 | 20 |
@Component({ |
18 | 21 |
selector: 'edit-stakeholder', |
19 | 22 |
template: ` |
20 |
<div *ngIf="stakeholderFb && user" [ngStyle]="{'max-height': maxHeight}"
|
|
23 |
<div [ngStyle]="{'max-height': maxHeight}" |
|
21 | 24 |
[class.uk-padding-small]="!paddingLarge" [class.uk-padding-large]="paddingLarge" |
22 |
class="uk-overflow-auto uk-padding-remove-bottom" |
|
23 |
[formGroup]="stakeholderFb"> |
|
24 |
<div class="uk-grid" [class.uk-margin-small-bottom]="!paddingLarge" [class.uk-margin-large-bottom]="paddingLarge" uk-grid uk-height-match=".uk-form-hint"> |
|
25 |
<div dashboard-input class="uk-width-1-2@m" [formInput]="stakeholderFb.get('name')" label="Name" |
|
26 |
placeholder="Write a name..." |
|
27 |
hint="Set a name for your profile."></div> |
|
28 |
<div dashboard-input class="uk-width-1-2@m" [formInput]="stakeholderFb.get('alias')" |
|
29 |
hint="Set an URL alias for your profile." |
|
30 |
label="URL Alias" placeholder="Write an alias..."></div> |
|
31 |
<div dashboard-input class="uk-width-1-3@m" [formInput]="stakeholderFb.get('index_id')" |
|
32 |
label="Index ID" placeholder="Write index ID."> |
|
33 |
</div> |
|
34 |
<div dashboard-input class="uk-width-1-3@m" [formInput]="stakeholderFb.get('index_name')" |
|
35 |
label="Index Name" placeholder="Write index name."> |
|
36 |
</div> |
|
37 |
<div dashboard-input class="uk-width-1-3@m" [formInput]="stakeholderFb.get('index_shortName')" |
|
38 |
label="Index Short Name" placeholder="Write index short name."> |
|
39 |
</div> |
|
40 |
<div dashboard-input class="uk-width-1-1" [type]="'textarea'" placeholder="Write a description..." |
|
41 |
hint="Write a description for your profile" |
|
42 |
[rows]="4" [formInput]="stakeholderFb.get('description')" label="Description"></div> |
|
43 |
<input #file id="photo" type="file" class="uk-hidden" (change)="fileChangeEvent($event)"/> |
|
44 |
<div dashboard-input class="uk-width-1-1" [hideControl]="stakeholderFb.get('isUpload').value" |
|
45 |
hint="Upload or link the logo of your profile" [placeholder]="'Write link to the logo'" |
|
46 |
[formInput]="stakeholderFb.get('logoUrl')" label="Logo"> |
|
47 |
<div *ngIf="!stakeholderFb.get('isUpload').value" class="uk-width-2-5@l uk-width-1-1"> |
|
48 |
<div class="uk-grid uk-flex uk-flex-middle" uk-grid> |
|
49 |
<div class="uk-width-3-4@l uk-width-1-1 uk-flex uk-flex-center"> |
|
50 |
<button class="uk-button uk-button-secondary uk-flex uk-flex-middle uk-flex-wrap" |
|
51 |
(click)="file.click()"> |
|
52 |
<icon name="cloud_upload" [flex]="true"></icon> |
|
53 |
<span class="uk-margin-small-left">Upload a file</span> |
|
25 |
class="uk-overflow-auto uk-padding-remove-bottom"> |
|
26 |
<form *ngIf="stakeholderFb" [formGroup]="stakeholderFb"> |
|
27 |
<div class="uk-grid" [class.uk-margin-small-bottom]="!paddingLarge" |
|
28 |
[class.uk-margin-large-bottom]="paddingLarge" uk-grid uk-height-match=".uk-form-hint"> |
|
29 |
<div dashboard-input class="uk-width-1-2@m" [formInput]="stakeholderFb.get('name')" label="Name" |
|
30 |
placeholder="Write a name..." |
|
31 |
hint="Set a name for your profile."></div> |
|
32 |
<div dashboard-input class="uk-width-1-2@m" [formInput]="stakeholderFb.get('alias')" |
|
33 |
hint="Set an URL alias for your profile." |
|
34 |
label="URL Alias" placeholder="Write an alias..."></div> |
|
35 |
<div dashboard-input class="uk-width-1-3@m" [formInput]="stakeholderFb.get('index_id')" |
|
36 |
label="Index ID" placeholder="Write index ID."> |
|
37 |
</div> |
|
38 |
<div dashboard-input class="uk-width-1-3@m" [formInput]="stakeholderFb.get('index_name')" |
|
39 |
label="Index Name" placeholder="Write index name."> |
|
40 |
</div> |
|
41 |
<div dashboard-input class="uk-width-1-3@m" [formInput]="stakeholderFb.get('index_shortName')" |
|
42 |
label="Index Short Name" placeholder="Write index short name."> |
|
43 |
</div> |
|
44 |
<div dashboard-input class="uk-width-1-1" [type]="'textarea'" placeholder="Write a description..." |
|
45 |
hint="Write a description for your profile" |
|
46 |
[rows]="4" [formInput]="stakeholderFb.get('description')" label="Description"></div> |
|
47 |
<input #file id="photo" type="file" class="uk-hidden" (change)="fileChangeEvent($event)"/> |
|
48 |
<div dashboard-input class="uk-width-1-1" type="logoURL" flex="top" [hideControl]="stakeholderFb.get('isUpload').value" |
|
49 |
hint="Upload or link the logo of your profile" [placeholder]="'Write link to the logo'" |
|
50 |
[formInput]="stakeholderFb.get('logoUrl')" label="Logo"> |
|
51 |
<div *ngIf="!stakeholderFb.get('isUpload').value" style="margin-top: 7px;" class="uk-width-2-5@l uk-width-1-1"> |
|
52 |
<div class="uk-grid uk-flex uk-flex-middle" uk-grid> |
|
53 |
<div class="uk-width-3-4@l uk-width-1-1 uk-flex uk-flex-center"> |
|
54 |
<button class="uk-button uk-button-secondary uk-flex uk-flex-middle uk-flex-wrap" |
|
55 |
(click)="file.click()"> |
|
56 |
<icon name="cloud_upload" [flex]="true"></icon> |
|
57 |
<span class="uk-margin-small-left">Upload a file</span> |
|
58 |
</button> |
|
59 |
</div> |
|
60 |
<div class="uk-text-center uk-text-bold uk-width-expand"> |
|
61 |
OR |
|
62 |
</div> |
|
63 |
</div> |
|
64 |
</div> |
|
65 |
<div *ngIf="stakeholderFb.get('isUpload').value" class="uk-width-1-1 uk-flex uk-flex-middle"> |
|
66 |
<div class="uk-card uk-card-default uk-text-center uk-border-circle"> |
|
67 |
<img class="uk-position-center" [src]="photo"> |
|
68 |
</div> |
|
69 |
<div class="uk-margin-left"> |
|
70 |
<button (click)="remove()" class="uk-button-secondary outlined uk-icon-button"> |
|
71 |
<icon name="remove"></icon> |
|
54 | 72 |
</button> |
55 | 73 |
</div> |
56 |
<div class="uk-text-center uk-text-bold uk-width-expand"> |
|
57 |
OR |
|
74 |
<div class="uk-margin-small-left"> |
|
75 |
<button class="uk-button-secondary uk-icon-button" (click)="file.click()"> |
|
76 |
<icon name="edit"></icon> |
|
77 |
</button> |
|
58 | 78 |
</div> |
59 | 79 |
</div> |
60 | 80 |
</div> |
61 |
<div *ngIf="stakeholderFb.get('isUpload').value" class="uk-width-1-1 uk-flex uk-flex-middle"> |
|
62 |
<div class="uk-card uk-card-default uk-text-center uk-border-circle"> |
|
63 |
<img class="uk-position-center" [src]="photo"> |
|
81 |
<div *ngIf="uploadError" class="uk-text-danger uk-width-1-1">{{uploadError}}</div> |
|
82 |
<div class="uk-width-1-1 uk-grid uk-child-width-1-1" [class.uk-child-width-1-2@m]="!canChooseType" |
|
83 |
[class.uk-child-width-1-3@m]="canChooseType" uk-grid> |
|
84 |
<div dashboard-input [formInput]="stakeholderFb.get('visibility')" |
|
85 |
[placeholder]="'Select a status'" |
|
86 |
label="Status" hint="Select the visibility status of your profile" |
|
87 |
[options]="stakeholderUtils.statuses" type="select"> |
|
64 | 88 |
</div> |
65 |
<div class="uk-margin-left"> |
|
66 |
<button (click)="remove()" class="uk-button-secondary outlined uk-icon-button"> |
|
67 |
<icon name="remove"></icon> |
|
68 |
</button> |
|
89 |
<div dashboard-input [formInput]="stakeholderFb.get('type')" |
|
90 |
[placeholder]="'Select a type'" hint="Select the type of your profile" |
|
91 |
label="Type" [options]="types" type="select"> |
|
69 | 92 |
</div> |
70 |
<div class="uk-margin-small-left"> |
|
71 |
<button class="uk-button-secondary uk-icon-button" (click)="file.click()"> |
|
72 |
<icon name="edit"></icon> |
|
73 |
</button> |
|
74 |
</div> |
|
93 |
<ng-container *ngIf="canChooseType"> |
|
94 |
<div [placeholder]="'Select a template'" |
|
95 |
hint="Select a template for your profile" |
|
96 |
dashboard-input class="uk-width-1-3@m" [formInput]="stakeholderFb.get('defaultId')" |
|
97 |
label="Template" [options]="defaultStakeholdersOptions" type="select"></div> |
|
98 |
</ng-container> |
|
75 | 99 |
</div> |
76 | 100 |
</div> |
77 |
<div *ngIf="!stakeholderFb.get('isUpload').value && !secure" class="uk-margin-remove-top uk-width-1-1"> |
|
78 |
<div class="uk-flex uk-flex-right" uk-grid> |
|
79 |
<div class="uk-width-3-5@l uk-width-1-1 uk-text-small uk-text-warning"> |
|
80 |
<span class="uk-text-bold">Note:</span> Prefer urls like "<span class="uk-text-bold">https://</span>example.com/my-secure-image.png" |
|
81 |
instead of "<span class="uk-text-bold">http://</span>example.com/my-image.png". |
|
82 |
<span class="uk-text-bold">Browsers may not load non secure content.</span> |
|
83 |
</div> |
|
84 |
</div> |
|
85 |
</div> |
|
86 |
<div *ngIf="uploadError" class="uk-text-danger uk-width-1-1">{{uploadError}}</div> |
|
87 |
<div dashboard-input class="uk-width-1-3@m" [formInput]="stakeholderFb.get('visibility')" |
|
88 |
[placeholder]="'Select a status'" |
|
89 |
label="Status" hint="Select the visibility status of your profile" |
|
90 |
[options]="stakeholderUtils.statuses" type="select"> |
|
91 |
</div> |
|
92 |
<div dashboard-input class="uk-width-1-3@m" [formInput]="stakeholderFb.get('type')" |
|
93 |
[placeholder]="'Select a type'" hint="Select the type of your profile" |
|
94 |
label="Type" [options]="types" type="select"> |
|
95 |
</div> |
|
96 |
<ng-container |
|
97 |
*ngIf="!stakeholderFb.get('isDefault').value && isNew && stakeholderFb.get('type').valid && defaultStakeholdersOptions"> |
|
98 |
<div [placeholder]="'Select a template'" |
|
99 |
hint="Select a template for your profile" |
|
100 |
dashboard-input class="uk-width-1-3@m" [formInput]="stakeholderFb.get('defaultId')" |
|
101 |
label="Template" [options]="defaultStakeholdersOptions" type="select"></div> |
|
102 |
</ng-container> |
|
103 |
</div> |
|
101 |
</form> |
|
102 |
<div #notify notify-form [class.uk-hidden]="properties.environment !== 'development'" class="uk-width-1-1 uk-margin-medium-top uk-margin-medium-bottom"></div> |
|
104 | 103 |
</div>`, |
105 | 104 |
styleUrls: ['edit-stakeholder.component.css'] |
106 | 105 |
}) |
... | ... | |
132 | 131 |
public deleteCurrentPhoto: boolean = false; |
133 | 132 |
private maxsize: number = 200 * 1024; |
134 | 133 |
user: User; |
134 |
@ViewChild('notify') notify: NotifyFormComponent; |
|
135 |
private notification: Notification; |
|
135 | 136 |
|
136 | 137 |
constructor(private fb: FormBuilder, |
137 | 138 |
private stakeholderService: StakeholderService, |
... | ... | |
204 | 205 |
this.stakeholderFb.setControl('defaultId', this.fb.control(stakeholder.defaultId, Validators.required)); |
205 | 206 |
} |
206 | 207 |
if (!isNew) { |
208 |
this.notification = NotificationUtils.editStakeholder(this.user.firstname + ' ' + this.user.lastname, this.stakeholder.name); |
|
209 |
this.notify.reset(this.notification.message); |
|
207 | 210 |
if (this.isAdmin) { |
208 | 211 |
if (this.disableAlias) { |
209 | 212 |
setTimeout(() => { |
... | ... | |
222 | 225 |
this.stakeholderFb.get('type').disable(); |
223 | 226 |
}, 0); |
224 | 227 |
} else { |
228 |
this.notification = NotificationUtils.createStakeholder(this.user.firstname + ' ' + this.user.lastname); |
|
229 |
this.notify.reset(this.notification.message); |
|
225 | 230 |
setTimeout(() => { |
226 | 231 |
this.stakeholderFb.get('type').enable(); |
227 | 232 |
}, 0); |
... | ... | |
244 | 249 |
return this.stakeholderFb && this.stakeholderFb.dirty; |
245 | 250 |
} |
246 | 251 |
|
252 |
public get canChooseType(): boolean { |
|
253 |
return !this.stakeholderFb.get('isDefault').value && this.isNew && this.stakeholderFb.get('type').valid && !!this.defaultStakeholdersOptions; |
|
254 |
} |
|
255 |
|
|
247 | 256 |
reset() { |
248 | 257 |
this.uploadError = null; |
249 | 258 |
this.stakeholderFb = null; |
... | ... | |
298 | 307 |
this.removePhoto(); |
299 | 308 |
this.subscriptions.push(this.stakeholderService.buildStakeholder(this.properties.monitorServiceAPIURL, |
300 | 309 |
this.stakeholderFb.value).subscribe(stakeholder => { |
310 |
this.notification.entity = stakeholder._id; |
|
311 |
this.notification.stakeholder = stakeholder.alias; |
|
312 |
this.notification.stakeholderType = stakeholder.type; |
|
313 |
this.notification.groups = [Role.curator(stakeholder.type)]; |
|
314 |
this.notify.sendNotification(this.notification); |
|
301 | 315 |
UIkit.notification(stakeholder.name + ' has been <b>successfully created</b>', { |
302 | 316 |
status: 'success', |
303 | 317 |
timeout: 6000, |
... | ... | |
321 | 335 |
this.stakeholderFb.get('index_name').enable(); |
322 | 336 |
this.stakeholderFb.get('index_shortName').enable(); |
323 | 337 |
this.subscriptions.push(this.stakeholderService.saveElement(this.properties.monitorServiceAPIURL, this.stakeholderFb.value).subscribe(stakeholder => { |
338 |
this.notification.entity = stakeholder._id; |
|
339 |
this.notification.stakeholder = stakeholder.alias; |
|
340 |
this.notification.stakeholderType = stakeholder.type; |
|
341 |
this.notification.groups = [Role.curator(stakeholder.type), Role.manager(stakeholder.type, stakeholder.alias)]; |
|
342 |
this.notify.sendNotification(this.notification); |
|
324 | 343 |
UIkit.notification(stakeholder.name + ' has been <b>successfully saved</b>', { |
325 | 344 |
status: 'success', |
326 | 345 |
timeout: 6000, |
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/topic/indicators.component.html | ||
---|---|---|
229 | 229 |
[large]="true" |
230 | 230 |
(alertOutput)="saveIndicator()" |
231 | 231 |
[okDisabled]="numberIndicatorFb && (numberIndicatorFb.invalid || numberIndicatorFb.pristine)"> |
232 |
<div *ngIf="numberIndicatorFb" class="uk-padding-small" [formGroup]="numberIndicatorFb">
|
|
233 |
<div class="uk-grid" uk-grid>
|
|
232 |
<div class="uk-padding-small">
|
|
233 |
<div *ngIf="numberIndicatorFb" class="uk-grid" [formGroup]="numberIndicatorFb" uk-grid>
|
|
234 | 234 |
<div dashboard-input class="uk-width-1-1" [formInput]="numberIndicatorFb.get('name')" placeholder="Write a title" label="Title"></div> |
235 | 235 |
<div dashboard-input class="uk-width-1-1" *ngIf="stakeholder.defaultId !=-1 && ( (indicator.description && |
236 | 236 |
indicator.description.length > 0) || !stakeholder.defaultId)" |
... | ... | |
345 | 345 |
</div> |
346 | 346 |
</div> |
347 | 347 |
</div> |
348 |
<div #editNumberNotify notify-form class="uk-width-1-1 uk-margin-medium-top" |
|
349 |
[class.uk-hidden]="properties.environment !== 'development'"></div> |
|
348 | 350 |
</div> |
349 | 351 |
</modal-alert> |
350 | 352 |
<modal-alert #editChartModal |
351 | 353 |
[large]="true" |
352 | 354 |
(alertOutput)="saveIndicator()" |
353 | 355 |
[okDisabled]="chartIndicatorFb && (chartIndicatorFb.invalid || chartIndicatorFb.pristine)"> |
354 |
<div *ngIf="chartIndicatorFb" class="uk-padding-small" [formGroup]="chartIndicatorFb">
|
|
355 |
<div class="uk-grid" uk-grid> |
|
356 |
<div class="uk-padding-small">
|
|
357 |
<div *ngIf="chartIndicatorFb" [formGroup]="chartIndicatorFb" class="uk-grid" uk-grid>
|
|
356 | 358 |
<div dashboard-input class="uk-width-1-1" [formInput]="chartIndicatorFb.get('name')" placeholder="Write a title" label="Title"></div> |
357 | 359 |
<div dashboard-input class="uk-width-1-1" *ngIf="stakeholder.defaultId !=-1 && ( (indicator.description && |
358 | 360 |
indicator.description.length > 0) || !stakeholder.defaultId)" |
... | ... | |
472 | 474 |
</div> |
473 | 475 |
</div> |
474 | 476 |
</div> |
477 |
<div #editChartNotify notify-form class="uk-width-1-1 uk-margin-medium-top" |
|
478 |
[class.uk-hidden]="properties.environment !== 'development'"></div> |
|
475 | 479 |
</div> |
476 | 480 |
</modal-alert> |
477 | 481 |
<modal-alert #deleteModal (alertOutput)="deleteIndicator()"> |
... | ... | |
484 | 488 |
<!-- Indicators of all profiles based on this default indicator, will not be marked as copied from default anymore.--> |
485 | 489 |
<!-- </span>--> |
486 | 490 |
Are you sure you want to proceed? |
491 |
<div #deleteNotify notify-form class="uk-width-1-1 uk-margin-medium-top" |
|
492 |
[class.uk-hidden]="properties.environment !== 'development'"></div> |
|
487 | 493 |
</modal-alert> |
488 | 494 |
<!--<modal-alert #deleteAllModal (alertOutput)="deleteIndicator('delete')"> |
489 | 495 |
You are about to delete <span class="uk-text-bold" *ngIf="indicator && index !== -1"> |
... | ... | |
550 | 556 |
</div> |
551 | 557 |
</div> |
552 | 558 |
</ng-template> |
553 |
|
|
554 |
|
|
555 | 559 |
<ng-template #description let-indicator="indicator"> |
556 | 560 |
<span class="descriptionIcon" |
557 | 561 |
*ngIf="(indicator.description && indicator.description.length > 0) |
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/topic/indicators.component.ts | ||
---|---|---|
28 | 28 |
import {Subscriber} from "rxjs"; |
29 | 29 |
import {LayoutService} from "../openaireLibrary/dashboard/sharedComponents/sidebar/layout.service"; |
30 | 30 |
import {Router} from "@angular/router"; |
31 |
import {Session} from "../openaireLibrary/login/utils/helper.class";
|
|
31 |
import {Role, Session, User} from "../openaireLibrary/login/utils/helper.class";
|
|
32 | 32 |
import {UserManagementService} from "../openaireLibrary/services/user-management.service"; |
33 | 33 |
import {StringUtils} from "../openaireLibrary/utils/string-utils.class"; |
34 |
import {Notification} from "../openaireLibrary/notifications/notifications"; |
|
35 |
import {NotificationUtils} from "../openaireLibrary/notifications/notification-utils"; |
|
36 |
import {NotifyFormComponent} from "../openaireLibrary/notifications/notify-form/notify-form.component"; |
|
34 | 37 |
|
35 | 38 |
declare var UIkit; |
36 | 39 |
|
... | ... | |
50 | 53 |
@Input() |
51 | 54 |
public subcategoryIndex: number = 0; |
52 | 55 |
public stakeholder: Stakeholder = null; |
53 |
public user = null; |
|
56 |
public user: User = null;
|
|
54 | 57 |
public preview: string; |
55 | 58 |
public indicatorUtils: IndicatorUtils = new IndicatorUtils(); |
56 | 59 |
public stakeholderUtils: StakeholderUtils = new StakeholderUtils(); |
... | ... | |
95 | 98 |
|
96 | 99 |
urlParameterizedMessage = null; |
97 | 100 |
showCheckForSchemaEnhancements:boolean = false; |
101 |
private notification: Notification; |
|
102 |
@ViewChild('editNumberNotify') editNumberNotify: NotifyFormComponent; |
|
103 |
@ViewChild('editChartNotify') editChartNotify: NotifyFormComponent; |
|
104 |
@ViewChild('deleteNotify') deleteNotify: NotifyFormComponent; |
|
98 | 105 |
constructor(private layoutService: LayoutService, |
99 | 106 |
private stakeholderService: StakeholderService, |
100 | 107 |
private statisticsService: StatisticsService, |
... | ... | |
734 | 741 |
if (this.index === -1) { |
735 | 742 |
this.editNumberModal.alertTitle = 'Create a new number indicator'; |
736 | 743 |
this.editNumberModal.okButtonText = 'Save'; |
744 |
this.notification = NotificationUtils.createIndicator(this.user.firstname + ' ' + this.user.lastname, this.stakeholder.name); |
|
745 |
this.editNumberNotify.reset(this.notification.message); |
|
737 | 746 |
} else { |
738 | 747 |
this.editNumberModal.alertTitle = 'Edit number indicator\'s information'; |
739 | 748 |
this.editNumberModal.okButtonText = 'Save Changes'; |
749 |
this.notification = NotificationUtils.editIndicator(this.user.firstname + ' ' + this.user.lastname, this.stakeholder.name); |
|
750 |
this.editNumberNotify.reset(this.notification.message); |
|
740 | 751 |
} |
741 | 752 |
this.editNumberModal.open(); |
742 | 753 |
} |
... | ... | |
795 | 806 |
if (this.index === -1) { |
796 | 807 |
this.editChartModal.alertTitle = 'Create a new chart indicator'; |
797 | 808 |
this.editChartModal.okButtonText = 'Save'; |
809 |
this.notification = NotificationUtils.createIndicator(this.user.firstname + ' ' + this.user.lastname, this.stakeholder.name); |
|
810 |
this.editChartNotify.reset(this.notification.message); |
|
798 | 811 |
} else { |
799 | 812 |
this.editChartModal.alertTitle = 'Edit chart indicator\'s information'; |
800 | 813 |
this.editChartModal.okButtonText = 'Save Changes'; |
814 |
this.notification = NotificationUtils.editIndicator(this.user.firstname + ' ' + this.user.lastname, this.stakeholder.name);; |
|
815 |
this.editChartNotify.reset(this.notification.message); |
|
801 | 816 |
} |
802 | 817 |
this.editChartModal.open(); |
803 | 818 |
} |
... | ... | |
826 | 841 |
} else { |
827 | 842 |
this.section.indicators.push(indicator); |
828 | 843 |
} |
829 |
if (this.indicator.type === "chart") { |
|
830 |
this.filterCharts(); |
|
831 |
this.chartIndicatorFb = null; |
|
844 |
this.notification.entity = indicator._id; |
|
845 |
this.notification.stakeholder = this.stakeholder.alias; |
|
846 |
this.notification.stakeholderType = this.stakeholder.type; |
|
847 |
this.notification.groups = [Role.curator( this.stakeholder.type)]; |
|
848 |
if(this.stakeholder.defaultId) { |
|
849 |
this.notification.groups.push(Role.manager(this.stakeholder.type, this.stakeholder.alias)); |
|
850 |
if (this.indicator.type === "chart") { |
|
851 |
this.filterCharts(); |
|
852 |
this.chartIndicatorFb = null; |
|
853 |
this.editChartNotify.sendNotification(this.notification); |
|
854 |
} else { |
|
855 |
this.filterNumbers(); |
|
856 |
this.numberIndicatorFb = null; |
|
857 |
this.editNumberNotify.sendNotification(this.notification); |
|
858 |
} |
|
832 | 859 |
} else { |
833 |
this.filterNumbers(); |
|
834 |
this.numberIndicatorFb = null; |
|
860 |
this.stakeholderService.getStakeholders(this.properties.monitorServiceAPIURL, null, this.stakeholder._id).subscribe(stakeholders => { |
|
861 |
stakeholders.forEach(value => { |
|
862 |
this.notification.groups.push(Role.manager(value.type, value.alias)) |
|
863 |
}); |
|
864 |
if (this.indicator.type === "chart") { |
|
865 |
this.filterCharts(); |
|
866 |
this.chartIndicatorFb = null; |
|
867 |
this.editChartNotify.sendNotification(this.notification); |
|
868 |
} else { |
|
869 |
this.filterNumbers(); |
|
870 |
this.numberIndicatorFb = null; |
|
871 |
this.editNumberNotify.sendNotification(this.notification); |
|
872 |
} |
|
873 |
}); |
|
835 | 874 |
} |
836 | 875 |
UIkit.notification('Indicator has been <b>successfully saved</b>', { |
837 | 876 |
status: 'success', |
... | ... | |
916 | 955 |
this.deleteModal.alertTitle = 'Delete indicator'; |
917 | 956 |
this.deleteModal.cancelButtonText = 'No'; |
918 | 957 |
this.deleteModal.okButtonText = 'Yes'; |
958 |
this.notification = NotificationUtils.deleteIndicator(this.user.firstname + ' ' + this.user.lastname, this.stakeholder.name); |
|
959 |
this.deleteNotify.reset(this.notification.message); |
|
919 | 960 |
this.deleteModal.open(); |
920 | 961 |
} |
921 | 962 |
|
... | ... | |
942 | 983 |
timeout: 6000, |
943 | 984 |
pos: 'bottom-right' |
944 | 985 |
}); |
986 |
this.notification.entity = this.indicator._id; |
|
987 |
this.notification.stakeholder = this.stakeholder.alias; |
|
988 |
this.notification.stakeholderType = this.stakeholder.type; |
|
989 |
this.notification.groups = [Role.curator( this.stakeholder.type)]; |
|
990 |
if(this.stakeholder.defaultId) { |
|
991 |
this.notification.groups.push(Role.manager(this.stakeholder.type, this.stakeholder.alias)); |
|
992 |
this.deleteNotify.sendNotification(this.notification); |
|
993 |
} else { |
|
994 |
this.stakeholderService.getStakeholders(this.properties.monitorServiceAPIURL, null, this.stakeholder._id).subscribe(stakeholders => { |
|
995 |
stakeholders.forEach(value => { |
|
996 |
this.notification.groups.push(Role.manager(value.type, value.alias)) |
|
997 |
}); |
|
998 |
this.deleteNotify.sendNotification(this.notification); |
|
999 |
}); |
|
1000 |
} |
|
945 | 1001 |
this.editing = false; |
946 | 1002 |
}, error => { |
947 | 1003 |
UIkit.notification(error.error.message, { |
modules/uoa-monitor-portal/trunk/monitor_dashboard/src/app/topic/topic.module.ts | ||
---|---|---|
27 | 27 |
import {IconsModule} from "../openaireLibrary/utils/icons/icons.module"; |
28 | 28 |
import {PageContentModule} from "../openaireLibrary/dashboard/sharedComponents/page-content/page-content.module"; |
29 | 29 |
import {LoadingModule} from "../openaireLibrary/utils/loading/loading.module"; |
30 |
import {NotifyFormModule} from "../openaireLibrary/notifications/notify-form/notify-form.module"; |
|
30 | 31 |
|
31 | 32 |
@NgModule({ |
32 | 33 |
imports: [ |
33 | 34 |
CommonModule, TopicRoutingModule, ClickModule, RouterModule, FormsModule, AlertModalModule, |
34 |
ReactiveFormsModule, InputModule, IconsModule, PageContentModule, LoadingModule |
|
35 |
ReactiveFormsModule, InputModule, IconsModule, PageContentModule, LoadingModule, NotifyFormModule
|
|
35 | 36 |
], |
36 | 37 |
declarations: [ |
37 | 38 |
TopicComponent, IndicatorsComponent |
Also available in: Unified diff
[Monitor dashboard | Trunk]: Notifications for development