2 * ============LICENSE_START==========================================
4 * ===================================================================
5 * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
6 * ===================================================================
8 * Unless otherwise specified, all software contained herein is licensed
9 * under the Apache License, Version 2.0 (the "License");
10 * you may not use this software except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
21 * Unless otherwise specified, all documentation contained herein is licensed
22 * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
23 * you may not use this documentation except in compliance with the License.
24 * You may obtain a copy of the License at
26 * https://creativecommons.org/licenses/by/4.0/
28 * Unless required by applicable law or agreed to in writing, documentation
29 * distributed under the License is distributed on an "AS IS" BASIS,
30 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31 * See the License for the specific language governing permissions and
32 * limitations under the License.
34 * ============LICENSE_END============================================
38 import { Injectable } from '@angular/core';
39 import { GridsterConfig, GridsterItem, DisplayGrid, GridType } from 'angular-gridster2';
40 import { Observable } from 'rxjs';
41 import { IApplicationCatalog } from '../../model/application-catalog.model';
42 import { environment } from 'src/environments/environment';
43 import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
48 export class ApplicationCatalogService {
49 public options: GridsterConfig = {
65 gridType: GridType.ScrollVertical,
68 displayGrid: DisplayGrid.None,
69 itemChangeCallback: this.itemChange,
80 public layout: GridsterItem[] = [];
81 constructor(private api: HttpClient) { }
83 addItem(appData: any): void {
84 this.layout.push(appData);
86 getAppCatalog(): Observable<any> {
87 return this.api.get(environment.api.appCatalog);
89 updateAppCatalog(appData: any): Observable<any> {
90 return this.api.put(environment.api.appCatalog, appData);
92 updateManualAppSort(appData: any): Observable<any> {
93 return this.api.put(environment.api.UpdateUserAppsSortManual, appData);
95 getuserAppRolesCatalog(appName: string): Observable<any> {
96 return this.api.get(environment.api.appCatalogRoles);
98 getAppsFullList(): Observable<any> {
99 return this.api.get(environment.api.appsFullList);
101 getUserAppsSortTypePreference(): Observable<any> {
102 const headers = new HttpHeaders().set('Content-Type','text/plain;charset=utf-8');
103 return this.api.get(environment.api.userAppsSortTypePreference,{headers,responseType:'text'});
105 getAppsOrderBySortPref(appSortPrefData: any): Observable<any> {
106 let httpParam = new HttpParams().set('mparams', appSortPrefData);
107 return this.api.get(environment.api.userAppsOrderBySortPref, {params: httpParam});
109 saveAppsSortTypePreference(userPrefData: any): Observable<any> {
110 return this.api.put(environment.api.saveUserAppsSortingPreference, userPrefData);
112 itemChange(item, itemComponent) {
113 //console.info('itemChanged', item, itemComponent);
116 //console.log("check the layout value "+this.layout.values);
119 checkIfUserIsSuperAdmin(): Observable<any> {
120 let checkIfUserIsSuperAdminURL = environment.api.checkIfUserIsSuperAdmin;
121 return this.api.get(checkIfUserIsSuperAdminURL);
123 clearCatalog(): void {