[angular-16-irish-monitor]: Fix overlay in indicators. Fix admin calls for managers/ivnitations.

This commit is contained in:
Konstantinos Triantafyllou 2024-01-24 20:13:05 +02:00
parent 017b54f57c
commit a40f1431ed
5 changed files with 14 additions and 28 deletions

View File

@ -140,9 +140,8 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
updateLists() {
this.loadActive = true;
this.loadPending = true;
this.subs.push(this.userRegistryService.getActive(this.type, this.id, this.role).subscribe(users => {
this.subs.push(this.userRegistryService.getActive(this.type, this.id, this.role, true).subscribe(users => {
this.active = users;
// users.forEach(user => this.active.push(user));
this.filterActiveBySearch(this.filterForm.value.active);
this.loadActive = false;
this.exists = true;
@ -154,7 +153,7 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
}
this.loadActive = false;
}));
this.subs.push(this.userRegistryService.getPending(this.type, this.id, this.role).subscribe(users => {
this.subs.push(this.userRegistryService.getPending(this.type, this.id, this.role, true).subscribe(users => {
this.pending = users;
this.filterPendingBySearch(this.filterForm.value.pending);
this.loadPending = false;

View File

@ -105,7 +105,7 @@ export class SubscribersComponent implements OnInit, OnDestroy, OnChanges {
updateList() {
this.loading = true;
this.subs.push( this.userRegistryService.getActive(this.type, this.id, 'member').subscribe(users => {
this.subs.push( this.userRegistryService.getActive(this.type, this.id, 'member', true).subscribe(users => {
this.subscribers = users;
this.filterBySearch(this.filterForm.value.keyword);
this.loading = false;

View File

@ -14,6 +14,7 @@ export type IndicatorPathType = 'table' | 'bar' | 'column' | 'pie' | 'line' | 'o
export type SourceType = 'statistics' | 'search' |'stats-tool' | 'old' | 'image';
export type Format = 'NUMBER' | 'PERCENTAGE';
export type Visibility = 'PUBLIC' | 'PRIVATE' | 'RESTRICTED';
export type Overlay = 'embed' | 'description' | false;
export class Stakeholder {
_id: string;
@ -171,7 +172,7 @@ export class Indicator {
visibility: Visibility;
defaultId: string;
indicatorPaths: IndicatorPath[];
overlay: boolean = false;
overlay: Overlay = false;
constructor(name: string, description: string, additionalDescription:string, type: IndicatorType, width: IndicatorSize,height: IndicatorSize, visibility: Visibility, indicatorPaths: IndicatorPath[], defaultId: string = null) {
this._id = null;

View File

@ -4,7 +4,7 @@ import {DomSanitizer} from "@angular/platform-browser";
import {
Category,
Indicator, IndicatorPath,
IndicatorSize,
IndicatorSize, Overlay,
Section,
Stakeholder,
SubCategory,
@ -55,8 +55,6 @@ export abstract class MonitorIndicatorStakeholderBaseComponent extends Indicator
public chartsActiveType: Map<string, IndicatorPath> = new Map<string, IndicatorPath>();
public currentYear = new Date().getFullYear();
public clipboard;
public embedOverlay: boolean = false;
public descriptionOverlay: boolean = false;
/** Services */
protected sanitizer: DomSanitizer;
@ -394,7 +392,7 @@ export abstract class MonitorIndicatorStakeholderBaseComponent extends Indicator
}
}
public getChartClassBySize(size: IndicatorSize) {
public getChartClassBySize(size: IndicatorSize): string {
if (size === 'small') {
return 'uk-width-1-3@xl uk-width-1-2@m uk-width-1-1';
} else if (size === 'medium') {
@ -408,26 +406,14 @@ export abstract class MonitorIndicatorStakeholderBaseComponent extends Indicator
window.print();
}
toggleOverlay(event, indicator: Indicator, overlayType: string) {
changeOverlay(event, indicator: Indicator, overlay: Overlay) {
event.stopPropagation();
indicator.overlay = !indicator.overlay;
if (overlayType == 'embed') {
this.embedOverlay = !this.embedOverlay;
}
if (overlayType == 'desc') {
this.descriptionOverlay = !this.descriptionOverlay;
}
indicator.overlay = overlay;
}
closeOverlay(event: ClickEvent, indicator: Indicator, overlayType: string) {
closeOverlay(event: ClickEvent, indicator: Indicator) {
if(event.clicked && indicator.overlay) {
indicator.overlay = false;
if (overlayType == 'embed') {
this.embedOverlay = false;
}
if (overlayType == 'desc') {
this.descriptionOverlay = false;
}
}
}

View File

@ -58,9 +58,9 @@ export class UserRegistryService {
return this.http.delete<any>(properties.registryUrl + 'verification/' + id, CustomOptions.registryOptions());
}
public getActive(type: string, id: string, role: "member" | "manager" = "manager"): Observable<any[]> {
public getActive(type: string, id: string, role: "member" | "manager" = "manager", admin = false): Observable<any[]> {
let url = properties.registryUrl + Role.GROUP + type + '/' + id + "/" + role + 's';
return this.http.get<any>((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url,
return this.http.get<any>((properties.useCache && !admin) ? (properties.cacheUrl + encodeURIComponent(url)) : url,
CustomOptions.registryOptions()).pipe(map((response:any) => response.response), map(users => {
if(users.length > 0 && !users[0].email) {
return [];
@ -70,9 +70,9 @@ export class UserRegistryService {
}));
}
public getPending(type: string, id: string, role: "member" | "manager" = "manager"): Observable<any[]> {
public getPending(type: string, id: string, role: "member" | "manager" = "manager", admin = false): Observable<any[]> {
let url = properties.registryUrl + 'invite/' + Role.GROUP + type + '/' +id + "/" + role + 's/';
return this.http.get<any>((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url,
return this.http.get<any>((properties.useCache && !admin) ? (properties.cacheUrl + encodeURIComponent(url)) : url,
CustomOptions.registryOptions()).pipe(map((response: any) => response.response));
}