gamma-app-controller 2.0.0 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8122,11 +8122,10 @@ class BreadCrumbsComponent {
8122
8122
  return;
8123
8123
  }
8124
8124
  else {
8125
- let relativePath = 'rakpiBrowser';
8126
- this.getKpiName(value, relativePath);
8127
- setTimeout(() => {
8128
- this.loadBreadCrumbs();
8129
- }, 500);
8125
+ debugger;
8126
+ this.kpiListData = value;
8127
+ this.getBreadCrumbsData(value);
8128
+ this.loadBreadCrumbs();
8130
8129
  this.isBreadCrumbs = true;
8131
8130
  }
8132
8131
  }
@@ -8163,75 +8162,72 @@ class BreadCrumbsComponent {
8163
8162
  let structures = {};
8164
8163
  data.forEach(result => {
8165
8164
  const item = {};
8166
- item["relativePath"] = result.relativePath;
8167
- item["name"] = result["name"];
8168
- item["pageId"] = result["pageId"];
8169
- item["tid"] = result["tid"].trim();
8170
- if (result["nodes"] !== undefined) {
8171
- item["nodes"] = this.getBreadCrumbsData(result["nodes"]);
8172
- }
8165
+ item["name"] = result["kpiName"];
8166
+ item["pageId"] = result.tagType == 'child' ? result["pageId"] : null;
8167
+ item["tid"] = result.tagType == 'child' ? result["childTid"].trim() : result["parentTid"].trim();
8173
8168
  this.kpi_names[result["pageId"]] = item["tid"];
8174
- structures[result["tid"]] = item;
8175
- this.kpi_structures[result["tid"]] = item;
8169
+ structures[result["childTid"]] = item;
8170
+ this.kpi_structures[result["childTid"]] = item;
8176
8171
  });
8177
8172
  return structures;
8178
8173
  }
8179
8174
  loadBreadCrumbs() {
8180
- let kpiRoot = this.kpiBrowserName ? "fmskpi" : "rakpi";
8181
- let kpiContainer;
8182
- if (this.kpiListData.length > 0 || this.kpiListData != undefined) {
8183
- kpiContainer = this.getBreadCrumbsData(this.kpiListData);
8184
- }
8185
- else {
8186
- kpiContainer = this.getBreadCrumbsData(this.commonService.allKpibrowserDetailContainer);
8187
- }
8188
- const kpiId = this.activatedRoute.snapshot.queryParams['pageId'];
8189
- const kpiTid = this.kpi_names[kpiId];
8175
+ debugger;
8176
+ const pageId = this.activatedRoute.snapshot.queryParams['pageId'];
8177
+ const kpiTid = this.kpi_names[pageId];
8190
8178
  const props = this.kpi_structures[kpiTid];
8191
- const propsList = props["relativePath"] + "/" + props["name"];
8179
+ const propsList = this.buildKpiPath(this.kpiListData, props["tid"]);
8192
8180
  this.breadcrumbList = propsList.split("/");
8193
8181
  if (this.location.path() !== "") {
8194
8182
  let link = {};
8195
8183
  this.breadcrumbLinksList = [];
8184
+ this.breadcrumbLinksList.unshift({
8185
+ name: "RA KPI Browser",
8186
+ url: "/apps/raKpi/rakpiBrowser",
8187
+ kpiName: "RA KPI Browser"
8188
+ });
8196
8189
  for (let i = 0; i < this.breadcrumbList.length; i++) {
8197
- if (i == 0) {
8198
- if (!this.kpiBrowserName) {
8199
- link = {
8200
- name: this.breadcrumbList[i],
8201
- url: "/apps/raKpi/rakpiBrowser",
8202
- kpiName: "RA KPI Browser",
8203
- };
8190
+ let returnId = "";
8191
+ for (let j = 0; j <= i; j++) {
8192
+ if (j != 0) {
8193
+ returnId += "/";
8204
8194
  }
8205
- else {
8206
- link = {
8207
- name: this.breadcrumbList[i],
8208
- url: "/apps/fmsKpi",
8209
- kpiName: "FMS KPI Browser",
8210
- };
8211
- }
8212
- }
8213
- else {
8214
- let returnId = "";
8215
- for (let j = 0; j <= i; j++) {
8216
- if (j != 0) {
8217
- returnId += "/";
8218
- }
8219
- returnId += this.breadcrumbList[j];
8220
- }
8221
- link = {
8222
- name: this.breadcrumbList[i],
8223
- url: this.breadcrumbLinksList[i - 1]["url"],
8224
- id: this.breadcrumbList[i],
8225
- kpiName: this.breadcrumbList[i],
8226
- returnId: returnId,
8227
- };
8228
- this.commonService.global_kpi_name = this.breadcrumbList[i];
8229
- }
8195
+ returnId += this.breadcrumbList[j];
8196
+ }
8197
+ link = {
8198
+ name: this.breadcrumbList[i],
8199
+ url: this.breadcrumbLinksList[i]["url"],
8200
+ id: this.breadcrumbList[i],
8201
+ kpiName: this.breadcrumbList[i],
8202
+ returnId: returnId,
8203
+ };
8204
+ this.commonService.global_kpi_name = this.breadcrumbList[i];
8230
8205
  this.breadcrumbLinksList.push(link);
8231
8206
  }
8232
8207
  this.count = this.breadcrumbList.length;
8233
8208
  }
8234
8209
  }
8210
+ buildKpiPath(kpiListData, startTid) {
8211
+ const path = [];
8212
+ const tidArray = this.buildTidArray(startTid);
8213
+ tidArray.forEach((tid, index) => {
8214
+ const kpi = kpiListData.find(kpi => index === 0
8215
+ ? kpi.parentTid === tid
8216
+ : kpi.childTid === tid);
8217
+ if (kpi) {
8218
+ path.push(kpi.kpiName);
8219
+ }
8220
+ });
8221
+ return path.join(" / ");
8222
+ }
8223
+ buildTidArray(startTid) {
8224
+ const parts = startTid.split(".");
8225
+ const result = [];
8226
+ for (let i = 0; i < parts.length; i++) {
8227
+ result.push(parts.slice(0, i + 1).join("."));
8228
+ }
8229
+ return result;
8230
+ }
8235
8231
  }
8236
8232
  BreadCrumbsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: BreadCrumbsComponent, deps: [{ token: i4$2.Location }, { token: i2.Router }, { token: i1.HttpClient }, { token: i2.ActivatedRoute }, { token: CommonService }], target: i0.ɵɵFactoryTarget.Component });
8237
8233
  BreadCrumbsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: BreadCrumbsComponent, selector: "gamma-bread-crumbs", inputs: { kpi_data_container: "kpi_data_container" }, ngImport: i0, template: "<nav class=\"flex mt-1\" aria-label=\"Breadcrumb\" *ngIf=\"isBreadCrumbs\">\n <ol class=\"inline-flex items-center space-x-1 md:space-x-3\">\n <li class=\"inline-flex items-center cursor-pointer\" *ngFor=\"let breadcrumbLabel of breadcrumbLinksList;\">\n <a [routerLink]=\"breadcrumbLabel.url\" [queryParams]=\"{returnId: breadcrumbLabel.returnId }\"\n class=\"inline-flex items-center text-sm font-medium text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white\">\n <svg class=\"w-6 h-6 text-gray-400\" fill=\"currentColor\" viewBox=\"0 0 20 20\"\n xmlns=\"http://www.w3.org/2000/svg\">\n <path fill-rule=\"evenodd\"\n d=\"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z\"\n clip-rule=\"evenodd\"></path>\n </svg>\n {{breadcrumbLabel.kpiName}}\n </a>\n </li>\n </ol>\n</nav>", styles: [".breadcrumb{padding:0!important;margin-bottom:0!important;font-weight:400;font-size:12px}\n"], dependencies: [{ kind: "directive", type: i4$2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "preserveFragment", "skipLocationChange", "replaceUrl", "state", "relativeTo", "routerLink"] }] });
@@ -17393,6 +17389,7 @@ class CreateKpiTreeComponent {
17393
17389
  });
17394
17390
  }
17395
17391
  makeNewKpiWithUserEntity() {
17392
+ const pageData = (this.selected_page_id) ? this.templateDataSource.find((item) => item.pageId === this.selected_page_id) : null;
17396
17393
  let kpiObj = {
17397
17394
  "kpiId": this.selected_id,
17398
17395
  "kpiName": this.select_kpi_name,
@@ -17406,7 +17403,7 @@ class CreateKpiTreeComponent {
17406
17403
  "externalKpi": this.kpi_external,
17407
17404
  "target": "",
17408
17405
  "icon": "",
17409
- "url": "",
17406
+ "url": pageData ? pageData.pageUrl : "",
17410
17407
  "kpiType": this.select_tag_type == "parent" ? "collapsable" : "basic",
17411
17408
  "parentTid": this.selected_kpi_tid,
17412
17409
  "childTid": this.selected_kpi_child_tid,
@@ -17440,6 +17437,7 @@ class CreateKpiTreeComponent {
17440
17437
  this.isEditKpiAdded = true;
17441
17438
  }
17442
17439
  getUpdateKpi() {
17440
+ const pageData = (this.selected_page_id) ? this.templateDataSource.find((item) => item.pageId === this.selected_page_id) : null;
17443
17441
  let kpiObj = {
17444
17442
  "kpiId": this.selected_id,
17445
17443
  "kpiName": this.select_kpi_name,
@@ -17453,7 +17451,7 @@ class CreateKpiTreeComponent {
17453
17451
  "externalKpi": this.kpi_external,
17454
17452
  "target": "",
17455
17453
  "icon": "",
17456
- "url": "",
17454
+ "url": pageData ? pageData.pageUrl : "",
17457
17455
  "kpiType": this.select_tag_type == "parent" ? "collapsable" : "basic",
17458
17456
  "parentTid": this.selected_kpi_tid,
17459
17457
  "childTid": this.selected_kpi_child_tid,
@@ -18015,6 +18013,14 @@ class KpiWithSingleLayoutService {
18015
18013
  return response;
18016
18014
  }), catchError(this.handleError));
18017
18015
  }
18016
+ listKpiEntryConfigs() {
18017
+ const apiUrl = this.environment.appUrl + this.environment.apiVersion + this.environment.packageBasePath + '/listKpiEntryConfigs?caller=app';
18018
+ return this.http
18019
+ .get(apiUrl, { withCredentials: true })
18020
+ .pipe(map((response) => {
18021
+ return response;
18022
+ }), catchError(this.handleError));
18023
+ }
18018
18024
  }
18019
18025
  KpiWithSingleLayoutService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: KpiWithSingleLayoutService, deps: [{ token: i1.HttpClient }, { token: APP_ENVIRONMENT }], target: i0.ɵɵFactoryTarget.Injectable });
18020
18026
  KpiWithSingleLayoutService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: KpiWithSingleLayoutService, providedIn: "root" });
@@ -18527,6 +18533,37 @@ class PermissionHelper {
18527
18533
  }
18528
18534
  return false;
18529
18535
  }
18536
+ buildMenuTree(userName, kpiData) {
18537
+ let filteredMenus = kpiData;
18538
+ const menuMap = new Map();
18539
+ const menuTree = [];
18540
+ filteredMenus.forEach(menu => {
18541
+ if (!this.getPermissionEntity(menu.permissions))
18542
+ return;
18543
+ menuMap.set(menu.childTid || menu.parentTid, {
18544
+ id: menu.kpiId,
18545
+ title: menu.kpiName,
18546
+ icon: menu.icon,
18547
+ type: menu.kpiType,
18548
+ tagType: menu.tagType,
18549
+ visibility: menu.visibility,
18550
+ ...(menu.link && { link: menu.link.replace(/^\/+/, '') }),
18551
+ children: []
18552
+ });
18553
+ });
18554
+ filteredMenus.forEach(kpi => {
18555
+ if (kpi.parentTid && kpi.childTid) {
18556
+ const parent = menuMap.get(kpi.parentTid);
18557
+ if (parent) {
18558
+ parent.children.push(menuMap.get(kpi.childTid));
18559
+ }
18560
+ }
18561
+ else {
18562
+ menuTree.push(menuMap.get(kpi.parentTid));
18563
+ }
18564
+ });
18565
+ return menuTree;
18566
+ }
18530
18567
  }
18531
18568
  PermissionHelper.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PermissionHelper, deps: [{ token: APP_SECURITY_PRINCIPAL }], target: i0.ɵɵFactoryTarget.Injectable });
18532
18569
  PermissionHelper.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PermissionHelper, providedIn: 'root' });
@@ -18764,10 +18801,10 @@ class KpiWithDataSetTestComponent {
18764
18801
  this.isDefaultFilterParams = false;
18765
18802
  }
18766
18803
  ngOnInit() {
18767
- this.service.getlistKpiBrowser().subscribe({
18768
- next: ((data) => {
18769
- this.kpi_breadcrumbs_container = data;
18770
- })
18804
+ this.service.listKpiEntryConfigs().subscribe((data) => {
18805
+ this.kpi_breadcrumbs_container = data;
18806
+ }, err => {
18807
+ this.toastr.error('Unexpected Server Exception. Please contact System Admin.', 'KPI Config');
18771
18808
  });
18772
18809
  this.loadingModal = true;
18773
18810
  this.pageId = this.activatedRoute.snapshot.queryParams['pageId'];