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============================================
39 import { Injectable } from '@angular/core';
40 import { HttpClient, HttpParams } from '@angular/common/http';
41 import { environment } from '../../../../environments/environment';
42 import { Observable } from 'rxjs';
43 import * as uuid from 'uuid';
48 export class ApplicationsService {
50 api = environment.api;
52 headerParams = { 'X-Widgets-Type': 'all' };
54 constructor(private http: HttpClient) { }
56 getOnboardingApps(): Observable<any> {
57 let getOnboardingAppsURL = this.api.onboardingApps;
58 return this.http.get(getOnboardingAppsURL);
61 getSingleAppInfo(appName): Observable<any> {
62 let getSingleAppInfoURL = this.api.singleAppInfo;
63 return this.http.get(getSingleAppInfoURL);
66 getSingleAppInfoById(appId) {
67 let httpParams = new HttpParams()
68 .set('appParam', appId);
69 return this.http.get(this.api.singleAppInfoById, { params: httpParams, responseType: 'json' })
72 getPersUserApps(): Observable<any> {
73 let getPersUserAppsURL = this.api.persUserApps;
74 return this.http.get(getPersUserAppsURL);
77 getAppsOrderBySortPref(userAppSortTypePref): Observable<any> {
78 let getAppsOrderBySortPrefURL = this.api.userAppsOrderBySortPref;
79 return this.http.get(getAppsOrderBySortPrefURL);
82 checkIfUserIsSuperAdmin(): Observable<any> {
83 let checkIfUserIsSuperAdminURL = this.api.checkIfUserIsSuperAdmin;
84 return this.http.get(checkIfUserIsSuperAdminURL);
87 saveAppsSortTypeManual(appsSortManual: any): Observable<any> {
88 let saveAppsSortTypeManualURL = this.api.saveUserAppsSortingManual;
89 return this.http.put(saveAppsSortTypeManualURL, appsSortManual);
92 saveAppsSortTypePreference(appsSortPreference: any): Observable<any> {
93 let saveAppsSortTypePreferenceURL = this.api.saveUserAppsSortingPreference;
94 return this.http.put(saveAppsSortTypePreferenceURL, appsSortPreference);
97 getUserAppsSortTypePreference(): Observable<any> {
98 let getUserAppsSortTypePreferenceURL = this.api.userAppsSortTypePreference;
99 return this.http.get(getUserAppsSortTypePreferenceURL);
102 saveWidgetsSortManual(widgetsSortManual: any): Observable<any> {
103 let saveWidgetsSortManualURL = this.api.saveUserWidgetsSortManual;
104 return this.http.put(saveWidgetsSortManualURL, widgetsSortManual);
107 delWidgetsSortPref(widgetsData: any): Observable<any> {
108 let delWidgetsSortPrefURL = this.api.updateWidgetsSortPref;
109 return this.http.put(delWidgetsSortPrefURL, widgetsData);
112 getAvailableApps(): Observable<any> {
113 let getAvailableAppsURL = this.api.availableApps;
114 return this.http.get(getAvailableAppsURL);
117 getAdminApps(): Observable<any> {
118 let getAdminAppsURL = this.api.adminApps;
119 return this.http.get(getAdminAppsURL);
122 getLeftMenuItems(): Observable<any> {
123 let getLeftMenuItemsURL = this.api.leftmenuItems;
124 return this.http.get(getLeftMenuItemsURL);
127 getAppsForSuperAdminAndAccountAdmin(): Observable<any> {
128 let getAppsForSuperAdminAndAccountAdminURL = this.api.appsForSuperAdminAndAccountAdmin;
129 return this.http.get(getAppsForSuperAdminAndAccountAdminURL);
132 getAdminAppsSimpler(): Observable<any> {
133 let getAdminAppsSimplerURL = this.api.adminApps;
134 return this.http.get(getAdminAppsSimplerURL);
137 addOnboardingApp(newApp: any): Observable<any> {
138 let addOnboardingAppURL = this.api.onboardingApps;
139 return this.http.post(addOnboardingAppURL, newApp);
142 updateOnboardingApp(appData: any): Observable<any> {
143 let updateOnboardingAppURL = this.api.onboardingApps;
144 return this.http.put(updateOnboardingAppURL, appData);
147 saveUserAppsRoles(UserAppRolesRequest: any): Observable<any> {
148 let saveUserAppsRolesURL = this.api.saveUserAppRoles;
149 return this.http.put(saveUserAppsRolesURL, UserAppRolesRequest);
152 deleteOnboardingApp(appId: any): Observable<any> {
153 let deleteOnboardingAppURL = this.api.onboardingApps + '/' + appId;
154 return this.http.delete(deleteOnboardingAppURL);
157 syncRolesEcompFromExtAuthSystem(appId: any): Observable<any> {
158 let syncRolesEcompFromExtAuthSystemURL = this.api.syncRolesFromExternalAuthSystem;
159 return this.http.post(syncRolesEcompFromExtAuthSystemURL, appId);
162 syncFunctionsFromExternalAuthSystem(appId: any): Observable<any> {
163 let syncFunctionsFromExternalAuthSystemURL = this.api.syncFunctionsFromExternalAuthSystem;
164 return this.http.post(syncFunctionsFromExternalAuthSystemURL, appId);
167 ping(appId): Observable<any> {
168 let pingURL = this.api.ping;
169 return this.http.get(pingURL);