[Library | Trunk]: Delete hasMiniMenu from LayoutService.
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60241 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
36effb0106
commit
b8ec43f7af
|
@ -26,10 +26,6 @@ export class LayoutService {
|
|||
* Add hasAdminMenu: true on data of route config, if global sidebar should be used.
|
||||
*/
|
||||
private hasAdminMenuSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
||||
/**
|
||||
* Add hasMiniMenu: true on data of route config, if sidebar should be closed to mini should be used.
|
||||
*/
|
||||
private hasMiniMenuSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
||||
/**
|
||||
* Add isFrontPage: true on data of route config, if current route is for front page.
|
||||
*/
|
||||
|
@ -78,12 +74,6 @@ export class LayoutService {
|
|||
} else {
|
||||
this.setHasAdminMenu(false);
|
||||
}
|
||||
if (data['hasMiniMenu'] !== undefined &&
|
||||
data['hasMiniMenu'] === true) {
|
||||
this.setHasMiniMenu(true);
|
||||
} else {
|
||||
this.setHasMiniMenu(false);
|
||||
}
|
||||
if (data['isFrontPage'] !== undefined &&
|
||||
data['isFrontPage'] === true) {
|
||||
this.setFrontPage(true);
|
||||
|
@ -139,14 +129,6 @@ export class LayoutService {
|
|||
this.hasAdminMenuSubject.next(value);
|
||||
}
|
||||
|
||||
get hasMiniMenu(): Observable<boolean> {
|
||||
return this.hasMiniMenuSubject.asObservable();
|
||||
}
|
||||
|
||||
setHasMiniMenu(value: boolean) {
|
||||
this.hasMiniMenuSubject.next(value);
|
||||
}
|
||||
|
||||
get isFrontPage(): Observable<boolean> {
|
||||
return this.isFrontPageSubject.asObservable();
|
||||
}
|
||||
|
|
|
@ -20,24 +20,27 @@ export interface Reorder {
|
|||
providedIn: "root"
|
||||
})
|
||||
export class StakeholderService {
|
||||
|
||||
|
||||
private stakeholderSubject: BehaviorSubject<Stakeholder> = null;
|
||||
private promise: Promise<any>;
|
||||
private sub;
|
||||
|
||||
constructor(private http: HttpClient, private route: ActivatedRoute) {
|
||||
this.stakeholderSubject = new BehaviorSubject<Stakeholder>(null);
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.clearSubscriptions();
|
||||
this.clearSubscriptions();
|
||||
}
|
||||
|
||||
clearSubscriptions(){
|
||||
|
||||
clearSubscriptions() {
|
||||
if (this.sub instanceof Subscriber) {
|
||||
this.sub.unsubscribe();
|
||||
}
|
||||
}
|
||||
getStakeholder(alias:string): Observable<Stakeholder> {
|
||||
if(!this.stakeholderSubject.value || this.stakeholderSubject.value.alias !== alias) {
|
||||
|
||||
getStakeholder(alias: string): Observable<Stakeholder> {
|
||||
if (!this.stakeholderSubject.value || this.stakeholderSubject.value.alias !== alias) {
|
||||
this.promise = new Promise<any>((resolve, reject) => {
|
||||
this.sub = this.http.get<Stakeholder>(properties.monitorServiceAPIURL + '/stakeholder/' + encodeURIComponent(alias), CustomOptions.registryOptions()).pipe(map(stakeholder => {
|
||||
return this.formalize(stakeholder);
|
||||
|
@ -66,77 +69,73 @@ export class StakeholderService {
|
|||
}
|
||||
|
||||
getStakeholders(url: string, type: string = null): Observable<(Stakeholder & StakeholderInfo)[]> {
|
||||
return this.http.get<Stakeholder[]>(url + '/stakeholder' + ((type)?('?type=' + type):''), CustomOptions.registryOptions()).pipe(map(stakeholders => {
|
||||
return this.http.get<Stakeholder[]>(url + '/stakeholder' + ((type) ? ('?type=' + type) : ''), CustomOptions.registryOptions()).pipe(map(stakeholders => {
|
||||
return this.formalize(stakeholders);
|
||||
}));
|
||||
}
|
||||
|
||||
getMyStakeholders(url: string, type: string = null): Observable<Stakeholder[]> {
|
||||
return this.http.get<Stakeholder[]>(url + '/my-stakeholder' + ((type)?('?type=' + type):''), CustomOptions.registryOptions()).pipe(map(stakeholders => {
|
||||
return this.http.get<Stakeholder[]>(url + '/my-stakeholder' + ((type) ? ('?type=' + type) : ''), CustomOptions.registryOptions()).pipe(map(stakeholders => {
|
||||
return this.formalize(stakeholders);
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
getDefaultStakeholders(url: string, type: string = null): Observable<Stakeholder[]> {
|
||||
return this.http.get<Stakeholder[]>(url + '/stakeholder/default' + ((type)?('?type=' + type):''), CustomOptions.registryOptions()).pipe(map(stakeholders => {
|
||||
return this.http.get<Stakeholder[]>(url + '/stakeholder/default' + ((type) ? ('?type=' + type) : ''), CustomOptions.registryOptions()).pipe(map(stakeholders => {
|
||||
return this.formalize(stakeholders);
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
buildStakeholder(url: string, stakeholder: Stakeholder): Observable<Stakeholder> {
|
||||
return this.http.post<Stakeholder>(url + '/build-stakeholder', stakeholder, CustomOptions.registryOptions()).pipe(map(stakeholder => {
|
||||
return this.formalize(stakeholder);
|
||||
}));
|
||||
}
|
||||
|
||||
changeVisibility(url: string, path: string[], visibility:Visibility): Observable<any> {
|
||||
return this.http.post<Visibility>(url + '/' + path.join('/') + '/change-visibility'+'?visibility=' + visibility, null, CustomOptions.registryOptions());
|
||||
changeVisibility(url: string, path: string[], visibility: Visibility): Observable<any> {
|
||||
return this.http.post<Visibility>(url + '/' + path.join('/') + '/change-visibility' + '?visibility=' + visibility, null, CustomOptions.registryOptions());
|
||||
}
|
||||
|
||||
|
||||
saveElement(url: string, element: any, path: string[] = []): Observable<any> {
|
||||
path = HelperFunctions.encodeArray(path);
|
||||
return this.http.post<any>(url + ((path.length > 0)?'/':'') + path.join('/') +
|
||||
return this.http.post<any>(url + ((path.length > 0) ? '/' : '') + path.join('/') +
|
||||
'/save', element, CustomOptions.registryOptions()).pipe(map(element => {
|
||||
return this.formalize(element);
|
||||
return this.formalize(element);
|
||||
}));
|
||||
}
|
||||
|
||||
saveSection(url: string, element: any, path: string[] = [], index: number = -1): Observable<Section> {
|
||||
path = HelperFunctions.encodeArray(path);
|
||||
return this.http.post<Section>(url + ((path.length > 0)?'/':'') + path.join('/') +
|
||||
return this.http.post<Section>(url + ((path.length > 0) ? '/' : '') + path.join('/') +
|
||||
'/save/' + index, element, CustomOptions.registryOptions()).pipe(map(element => {
|
||||
return this.formalize(element);
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
deleteElement(url: string, path: string[], childrenAction: string = null): Observable<any> {
|
||||
path = HelperFunctions.encodeArray(path);
|
||||
let params: string = "";
|
||||
if(childrenAction) {
|
||||
params = "?children="+childrenAction;
|
||||
if (childrenAction) {
|
||||
params = "?children=" + childrenAction;
|
||||
}
|
||||
return this.http.delete<any>(url + '/' + path.join('/') + '/delete'+params, CustomOptions.registryOptions());
|
||||
return this.http.delete<any>(url + '/' + path.join('/') + '/delete' + params, CustomOptions.registryOptions());
|
||||
}
|
||||
|
||||
|
||||
reorderIndicators(url: string, path: string[], reorder: Reorder, type: string = 'chart'): Observable<Indicator[]> {
|
||||
path = HelperFunctions.encodeArray(path);
|
||||
return this.http.post<Indicator[]>(url + '/' + path.join('/') + '/' + type + '/reorder', reorder, CustomOptions.registryOptions()).pipe(map(indicators => {
|
||||
return this.formalize(indicators);
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
getStakeholderAsObservable(): Observable<Stakeholder> {
|
||||
return this.stakeholderSubject.asObservable();
|
||||
}
|
||||
|
||||
get stakeholder(): Stakeholder {
|
||||
return this.stakeholderSubject.getValue();
|
||||
}
|
||||
|
||||
|
||||
setStakeholder(stakeholder: Stakeholder) {
|
||||
this.stakeholderSubject.next(stakeholder);
|
||||
}
|
||||
|
||||
|
||||
private formalize(element: any) {
|
||||
return HelperFunctions.copy(element);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue