summaryrefslogtreecommitdiffstats
path: root/portal-FE-common/src/app/shared
diff options
context:
space:
mode:
Diffstat (limited to 'portal-FE-common/src/app/shared')
-rw-r--r--portal-FE-common/src/app/shared/services/admins/admins.service.spec.ts12
-rw-r--r--portal-FE-common/src/app/shared/services/admins/admins.service.ts66
-rw-r--r--portal-FE-common/src/app/shared/services/applications/applications.service.spec.ts50
-rw-r--r--portal-FE-common/src/app/shared/services/applications/applications.service.ts172
-rw-r--r--portal-FE-common/src/app/shared/services/widget-onboarding/widget-onboarding.service.spec.ts50
-rw-r--r--portal-FE-common/src/app/shared/services/widget-onboarding/widget-onboarding.service.ts104
6 files changed, 454 insertions, 0 deletions
diff --git a/portal-FE-common/src/app/shared/services/admins/admins.service.spec.ts b/portal-FE-common/src/app/shared/services/admins/admins.service.spec.ts
new file mode 100644
index 00000000..ea61061b
--- /dev/null
+++ b/portal-FE-common/src/app/shared/services/admins/admins.service.spec.ts
@@ -0,0 +1,12 @@
+import { TestBed } from '@angular/core/testing';
+
+import { AdminsService } from './admins.service';
+
+describe('AdminsService', () => {
+ beforeEach(() => TestBed.configureTestingModule({}));
+
+ it('should be created', () => {
+ const service: AdminsService = TestBed.get(AdminsService);
+ expect(service).toBeTruthy();
+ });
+});
diff --git a/portal-FE-common/src/app/shared/services/admins/admins.service.ts b/portal-FE-common/src/app/shared/services/admins/admins.service.ts
new file mode 100644
index 00000000..fe76bd4b
--- /dev/null
+++ b/portal-FE-common/src/app/shared/services/admins/admins.service.ts
@@ -0,0 +1,66 @@
+import { Injectable } from '@angular/core';
+import { HttpClient, HttpParams } from '@angular/common/http';
+import { environment } from 'src/environments/environment';
+import { Observable } from 'rxjs';
+
+@Injectable({
+ providedIn: 'root'
+})
+export class AdminsService {
+
+ constructor(private httpClient: HttpClient) { }
+ apiUrl = environment.api;
+
+ getAccountAdmins(): Observable<any> {
+ return this.httpClient.get(this.apiUrl.accountAdmins);
+ };
+
+ getAdminAppsRoles(orgUserId: string): Observable<any> {
+ let params = new HttpParams().set('user', orgUserId);
+ return this.httpClient.get(this.apiUrl.adminAppsRoles, { params: params });
+ };
+
+
+ getRolesByApp(_appId: any): Observable<any> {
+ return this.httpClient.get(this.apiUrl.adminAppsRoles + '/' + _appId);
+ };
+
+ updateAdminAppsRoles(_newAdminAppRoles: any): Observable<any> {
+ return this.httpClient.put(this.apiUrl.adminAppsRoles, _newAdminAppRoles);
+ };
+
+
+ isComplexPassword(str) {
+ let minLength = 8;
+ let message = 'Password is too simple. Minimum length is ' + minLength + ', '
+ + 'and it must use letters, digits and special characters.';
+ if (str == null)
+ return message;
+
+ let hasLetter = false;
+ let hasDigit = false;
+ let hasSpecial = false;
+ var code, i, len;
+ for (i = 0, len = str.length; i < len; i++) {
+ code = str.charCodeAt(i);
+ if (code > 47 && code < 58) // numeric (0-9)
+ hasDigit = true;
+ else if ((code > 64 && code < 91) || (code > 96 && code < 123)) // A-Z, a-z
+ hasLetter = true;
+ else
+ hasSpecial = true;
+ } // for
+
+ if (str.length < minLength || !hasLetter || !hasDigit || !hasSpecial)
+ return message;
+
+ // All is well.
+ return null;
+
+ };
+
+ addNewUser(newUser, checkDuplicate): Observable<any> {
+ return this.httpClient.post(this.apiUrl.saveNewUser + '?isCheck=' + checkDuplicate, newUser);
+ };
+
+}
diff --git a/portal-FE-common/src/app/shared/services/applications/applications.service.spec.ts b/portal-FE-common/src/app/shared/services/applications/applications.service.spec.ts
new file mode 100644
index 00000000..68017384
--- /dev/null
+++ b/portal-FE-common/src/app/shared/services/applications/applications.service.spec.ts
@@ -0,0 +1,50 @@
+/*-
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ *
+ */
+
+import { TestBed } from '@angular/core/testing';
+
+import { ApplicationsService } from './applications.service';
+
+describe('ApplicationsService', () => {
+ beforeEach(() => TestBed.configureTestingModule({}));
+
+ it('should be created', () => {
+ const service: ApplicationsService = TestBed.get(ApplicationsService);
+ expect(service).toBeTruthy();
+ });
+});
diff --git a/portal-FE-common/src/app/shared/services/applications/applications.service.ts b/portal-FE-common/src/app/shared/services/applications/applications.service.ts
new file mode 100644
index 00000000..828373ea
--- /dev/null
+++ b/portal-FE-common/src/app/shared/services/applications/applications.service.ts
@@ -0,0 +1,172 @@
+/*-
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ *
+ */
+
+import { Injectable } from '@angular/core';
+import { HttpClient, HttpParams } from '@angular/common/http';
+import { environment } from '../../../../environments/environment';
+import { Observable } from 'rxjs';
+import * as uuid from 'uuid';
+
+@Injectable({
+ providedIn: 'root'
+})
+export class ApplicationsService {
+
+ api = environment.api;
+ resp: string;
+ headerParams = { 'X-Widgets-Type': 'all' };
+
+ constructor(private http: HttpClient) { }
+
+ getOnboardingApps(): Observable<any> {
+ let getOnboardingAppsURL = this.api.onboardingApps;
+ return this.http.get(getOnboardingAppsURL);
+ };
+
+ getSingleAppInfo(appName): Observable<any> {
+ let getSingleAppInfoURL = this.api.singleAppInfo;
+ return this.http.get(getSingleAppInfoURL);
+ };
+
+ getSingleAppInfoById(appId) {
+ let httpParams = new HttpParams()
+ .set('appParam', appId);
+ return this.http.get(this.api.singleAppInfoById, { params: httpParams, responseType: 'json' })
+ }
+
+ getPersUserApps(): Observable<any> {
+ let getPersUserAppsURL = this.api.persUserApps;
+ return this.http.get(getPersUserAppsURL);
+ };
+
+ getAppsOrderBySortPref(userAppSortTypePref): Observable<any> {
+ let getAppsOrderBySortPrefURL = this.api.userAppsOrderBySortPref;
+ return this.http.get(getAppsOrderBySortPrefURL);
+ }
+
+ checkIfUserIsSuperAdmin(): Observable<any> {
+ let checkIfUserIsSuperAdminURL = this.api.checkIfUserIsSuperAdmin;
+ return this.http.get(checkIfUserIsSuperAdminURL);
+ }
+
+ saveAppsSortTypeManual(appsSortManual: any): Observable<any> {
+ let saveAppsSortTypeManualURL = this.api.saveUserAppsSortingManual;
+ return this.http.put(saveAppsSortTypeManualURL, appsSortManual);
+ }
+
+ saveAppsSortTypePreference(appsSortPreference: any): Observable<any> {
+ let saveAppsSortTypePreferenceURL = this.api.saveUserAppsSortingPreference;
+ return this.http.put(saveAppsSortTypePreferenceURL, appsSortPreference);
+ }
+
+ getUserAppsSortTypePreference(): Observable<any> {
+ let getUserAppsSortTypePreferenceURL = this.api.userAppsSortTypePreference;
+ return this.http.get(getUserAppsSortTypePreferenceURL);
+ }
+
+ saveWidgetsSortManual(widgetsSortManual: any): Observable<any> {
+ let saveWidgetsSortManualURL = this.api.saveUserWidgetsSortManual;
+ return this.http.put(saveWidgetsSortManualURL, widgetsSortManual);
+ }
+
+ delWidgetsSortPref(widgetsData: any): Observable<any> {
+ let delWidgetsSortPrefURL = this.api.updateWidgetsSortPref;
+ return this.http.put(delWidgetsSortPrefURL, widgetsData);
+ }
+
+ getAvailableApps(): Observable<any> {
+ let getAvailableAppsURL = this.api.availableApps;
+ return this.http.get(getAvailableAppsURL);
+ }
+
+ getAdminApps(): Observable<any> {
+ let getAdminAppsURL = this.api.adminApps;
+ return this.http.get(getAdminAppsURL);
+ }
+
+ getLeftMenuItems(): Observable<any> {
+ let getLeftMenuItemsURL = this.api.leftmenuItems;
+ return this.http.get(getLeftMenuItemsURL);
+ }
+
+ getAppsForSuperAdminAndAccountAdmin(): Observable<any> {
+ let getAppsForSuperAdminAndAccountAdminURL = this.api.appsForSuperAdminAndAccountAdmin;
+ return this.http.get(getAppsForSuperAdminAndAccountAdminURL);
+ }
+
+ getAdminAppsSimpler(): Observable<any> {
+ let getAdminAppsSimplerURL = this.api.adminApps;
+ return this.http.get(getAdminAppsSimplerURL);
+ }
+
+ addOnboardingApp(newApp: any): Observable<any> {
+ let addOnboardingAppURL = this.api.onboardingApps;
+ return this.http.post(addOnboardingAppURL, newApp);
+ }
+
+ updateOnboardingApp(appData: any): Observable<any> {
+ let updateOnboardingAppURL = this.api.onboardingApps;
+ return this.http.put(updateOnboardingAppURL, appData);
+ }
+
+ saveUserAppsRoles(UserAppRolesRequest: any): Observable<any> {
+ let saveUserAppsRolesURL = this.api.saveUserAppRoles;
+ return this.http.put(saveUserAppsRolesURL, UserAppRolesRequest);
+ }
+
+ deleteOnboardingApp(appId: any): Observable<any> {
+ let deleteOnboardingAppURL = this.api.onboardingApps + '/' + appId;
+ return this.http.delete(deleteOnboardingAppURL);
+ }
+
+ syncRolesEcompFromExtAuthSystem(appId: any): Observable<any> {
+ let syncRolesEcompFromExtAuthSystemURL = this.api.syncRolesFromExternalAuthSystem;
+ return this.http.post(syncRolesEcompFromExtAuthSystemURL, appId);
+ }
+
+ syncFunctionsFromExternalAuthSystem(appId: any): Observable<any> {
+ let syncFunctionsFromExternalAuthSystemURL = this.api.syncFunctionsFromExternalAuthSystem;
+ return this.http.post(syncFunctionsFromExternalAuthSystemURL, appId);
+ }
+
+ ping(appId): Observable<any> {
+ let pingURL = this.api.ping;
+ return this.http.get(pingURL);
+ }
+
+}
diff --git a/portal-FE-common/src/app/shared/services/widget-onboarding/widget-onboarding.service.spec.ts b/portal-FE-common/src/app/shared/services/widget-onboarding/widget-onboarding.service.spec.ts
new file mode 100644
index 00000000..90e53269
--- /dev/null
+++ b/portal-FE-common/src/app/shared/services/widget-onboarding/widget-onboarding.service.spec.ts
@@ -0,0 +1,50 @@
+/*-
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ *
+ */
+
+import { TestBed } from '@angular/core/testing';
+
+import { WidgetOnboardingService } from './widget-onboarding.service';
+
+describe('WidgetOnboardingService', () => {
+ beforeEach(() => TestBed.configureTestingModule({}));
+
+ it('should be created', () => {
+ const service: WidgetOnboardingService = TestBed.get(WidgetOnboardingService);
+ expect(service).toBeTruthy();
+ });
+});
diff --git a/portal-FE-common/src/app/shared/services/widget-onboarding/widget-onboarding.service.ts b/portal-FE-common/src/app/shared/services/widget-onboarding/widget-onboarding.service.ts
new file mode 100644
index 00000000..8d55b278
--- /dev/null
+++ b/portal-FE-common/src/app/shared/services/widget-onboarding/widget-onboarding.service.ts
@@ -0,0 +1,104 @@
+/*-
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ *
+ */
+
+import { Injectable } from '@angular/core';
+import { HttpClient, HttpParams, HttpHeaders } from '@angular/common/http';
+import { environment } from '../../../../environments/environment';
+import { Observable } from 'rxjs';
+import * as uuid from 'uuid';
+
+@Injectable({
+ providedIn: 'root'
+})
+export class WidgetOnboardingService {
+
+ api = environment.api;
+ resp:string;
+
+ headerParams = {'X-Widgets-Type': 'all', 'X-ECOMP-RequestID': uuid.v4() };
+
+ constructor(private http: HttpClient) { }
+
+ getManagedWidgets(): Observable<any>{
+ let getManagedWidgetsURL = this.api.widgetCommon + '/widgetCatalog';
+ return this.http.get(getManagedWidgetsURL , { withCredentials: true } );
+ }
+
+ deleteWidget(widgetId: any): Observable<any> {
+ let deleteWidgetURL = this.api.widgetCommon + '/widgetCatalog' + '/' + widgetId;
+ return this.http.delete(deleteWidgetURL , { withCredentials: true } );
+ }
+
+ downloadWidgetFile(widgetId: any): Observable<any> {
+ let downloadWidgetURL = this.api.widgetCommon + '/download/' + widgetId;
+ let httpParam = new HttpParams()
+ .append('requestType', 'downloadWidgetFile');
+ return this.http.get(downloadWidgetURL,{params: httpParam, responseType: "arraybuffer"});
+ }
+
+ getUploadFlag(): Observable<any> {
+ let getUploadFlagURL = this.api.widgetCommon + '/uploadFlag';
+ return this.http.get(getUploadFlagURL , { withCredentials: true } );
+ }
+
+ updateWidgetWithFile(formData: any, widgetId: any, newWidget: any): Observable<any>{
+ let updateWidgetWithFileURL = this.api.widgetCommon + '/widgetCatalog/' + widgetId;
+ let httpParam = new HttpParams()
+ .append('newWidget', JSON.stringify(newWidget))
+ .append('requestType', 'fileUpload');
+ return this.http.post(updateWidgetWithFileURL, formData, {params: httpParam, withCredentials: true})
+ }
+
+ updateWidget(widgetId: any, widgetData: any): Observable<any> {
+ let updateWidgetURL = this.api.widgetCommon + '/widgetCatalog' + '/' + widgetId;
+ return this.http.put(updateWidgetURL, widgetData, { withCredentials: true });
+ }
+
+ createWidget(newWidget: any, formData: any): Observable<any> {
+ let httpParam = new HttpParams()
+ .append('newWidget', JSON.stringify(newWidget))
+ .append('requestType', 'fileUpload');
+ let createWidgetURL = this.api.widgetCommon + '/widgetCatalog';
+ return this.http.post(createWidgetURL, formData, {params: httpParam, withCredentials: true})
+ }
+
+ populateAvailableApps(): Observable<any> {
+ let populateAvailableAppsURL = this.api.appsForSuperAdminAndAccountAdmin;
+ return this.http.get(populateAvailableAppsURL, { withCredentials: true })
+ }
+}