summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/admin/menus/menus.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/admin/menus/menus.component.ts')
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/admin/menus/menus.component.ts203
1 files changed, 203 insertions, 0 deletions
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/admin/menus/menus.component.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/admin/menus/menus.component.ts
new file mode 100644
index 00000000..c6fbc8c4
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/admin/menus/menus.component.ts
@@ -0,0 +1,203 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 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 { Component, OnInit, ViewChild } from '@angular/core';
+import { MatTableDataSource } from '@angular/material/table';
+import { MatPaginator } from '@angular/material/paginator';
+import { MatSort } from '@angular/material/sort';
+import { AdminService } from '../admin.service';
+import { NgbModal, ModalDismissReasons, NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
+import { InformationModalComponent } from 'src/app/modals/information-modal/information-modal.component';
+import { NewMenuComponent } from './new-menu/new-menu.component';
+import { Column, DataTableSettings, RdpCrudInterface , ColumnTypes} from 'portalsdk-tag-lib';
+import { element } from '@angular/core/src/render3';
+import { MenusService } from './menus.service';
+
+@Component({
+ selector: 'app-menus',
+ templateUrl: './menus.component.html',
+ styleUrls: ['./menus.component.scss']
+})
+export class MenusComponent implements OnInit {
+
+ constructor(public adminService: AdminService, private ngModal: NgbModal, public menuService : MenusService) { }
+
+ // menuHeaders = ["menuId", "label", "paretId", "sortOrder", "action", "functionCd", "active", "servlet", "queryString", "externalUrl", "target", "menuSetCode", "separator", "imageSrc", "Edit", "Delete"];
+
+ response: any;
+ result: any;
+ functionalMenuRes: any;
+ tableData;
+ dataSource: MatTableDataSource<[]>;
+ closeResult: string;
+ isEditMode: boolean;
+ showSpinner: boolean;
+
+ public settings;
+ public columns: any = [];
+
+ activeStatusOptions = [
+ {id: '0', name: 'Y'},
+ {id: '1', name: 'N'}
+ ];
+ separatorStatusOptions = [
+ {id: '0', name: 'Y'},
+ {id: '1', name: 'N'}
+ ];
+ functionCDselectData = [];
+ parentListSelectData = [];
+ parentList = [];
+
+ @ViewChild(MatPaginator, {}) paginator: MatPaginator;
+ @ViewChild(MatSort, {}) sort: MatSort;
+
+ ngOnInit() {
+ this.showSpinner = false;
+ this.getParentData();
+ this.getFunctionCDselectData();
+ this.getMenus();
+ }
+
+ getMenus() {
+ console.log(">>>>>>>>>>>>>>> GetMenus calles >>>>>>>>>>>>>>")
+ this.showSpinner = true;
+ let response;
+ this.response = this.adminService.getFnMenuItems();
+ this.response.subscribe(data => {
+ response = data;
+
+ this.functionalMenuRes = JSON.parse(response.data);
+ this.tableData = this.functionalMenuRes.fnMenuItems;
+ this.tableData.forEach(element => {
+ if (element.active) { element.active = "Y"; }
+ else { element.active = "N"; }
+ if (element.separator) { element.separator = "Y"; }
+ else { element.separator = "N"; }
+ });
+
+ //rdp table data
+ let menuIdColumn = new Column("id", "Menu ID", ColumnTypes.TEXT, true, null);
+ menuIdColumn.isColumnDisabled = true;
+ this.columns.push(menuIdColumn);
+
+ let label = new Column("label", "Label", ColumnTypes.TEXT, true, null);
+ label.setIsColumnMandatory = true;
+ this.columns.push(label);
+
+ let parent = new Column("parentId", "ParentId", ColumnTypes.DROPDOWN, true, this.parentList);
+ parent.setIsColumnMandatory = true;
+ this.columns.push(parent);
+
+ let sortOrder = new Column("sortOrder", "Sort Order", ColumnTypes.TEXT, true, null);
+ sortOrder.setIsColumnMandatory = true;
+ this.columns.push(sortOrder);
+
+ let action = new Column("action", "Action", ColumnTypes.TEXT, true, null);
+ action.setIsColumnMandatory = true;
+ this.columns.push(action);
+
+ let functionCd = new Column("functionCd", "Function", ColumnTypes.DROPDOWN, true, this.functionCDselectData);
+ functionCd.setIsColumnMandatory = true;
+ this.columns.push(functionCd);
+
+ let active = new Column("active", "Active", ColumnTypes.DROPDOWN, true, this.activeStatusOptions);
+ active.setIsColumnMandatory = true;
+ this.columns.push(active);
+
+ this.columns.push(new Column("servlet", "Servlet", ColumnTypes.TEXT, true, null));
+ this.columns.push(new Column("queryString", " Query String", ColumnTypes.TEXT, true, null));
+ this.columns.push(new Column("externalUrl", "External URL", ColumnTypes.TEXT, true, null));
+ this.columns.push(new Column("target", "Target", ColumnTypes.TEXT, true, null));
+
+ let menuSetCode = new Column("menuSetCode", "Menu Set Code", ColumnTypes.TEXT, false, null);
+ menuSetCode.setIsColumnMandatory = true;
+ this.columns.push(menuSetCode);
+
+ let separator = new Column("separator", "Separator", ColumnTypes.DROPDOWN, false, this.separatorStatusOptions);
+ separator.setIsColumnMandatory = true;
+ this.columns.push(separator);
+ this.columns.push(new Column("imageSrc", "Image Source", ColumnTypes.TEXT, true, null));
+
+ this.settings = new DataTableSettings()
+ this.settings.columns = this.columns;
+ this.settings.isPaginationEnabled = true;
+ this.settings.paginationsSize = "5";
+ this.settings.isReadOnly = false;
+ this.settings.isTableSearchEnabled = true;
+ this.settings.applicationService = this.menuService;
+
+ this.showSpinner = false;
+
+ });
+ }
+
+ getFunctionCDselectData = function () {
+ this.adminService.getFunctionCdList()
+ .subscribe(_data => {
+ this.result = _data;
+ if (_data) {
+
+ for(let i = 0; i< _data.length; i++){
+ this.functionCDselectData.push({id: i, name: _data[i]});
+ }
+ }
+ }, error => {
+ this.showSpinner = false;
+ console.log(error);
+ this.openConfirmationModal("", "Function Code Data not available !");
+ });
+ }
+
+ getParentData() {
+ this.adminService.getParentData()
+ .subscribe(_data => {
+ this.result = _data;
+ if (_data) {
+ for(let i = 0; i< _data.length; i++){
+ this.parentList.push({id: _data[i][0], name: _data[i][1]});
+ }
+ console.log("Actual parent list : ", this.parentList);
+ this.menuService.getParentList(this.parentList);
+ }
+ }, error => {
+ this.showSpinner = false;
+ console.log(error);
+ });
+ }
+
+}