gamma-app-controller 2.0.1 → 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.
@@ -8139,11 +8139,10 @@ class BreadCrumbsComponent {
8139
8139
  return;
8140
8140
  }
8141
8141
  else {
8142
- let relativePath = 'rakpiBrowser';
8143
- this.getKpiName(value, relativePath);
8144
- setTimeout(() => {
8145
- this.loadBreadCrumbs();
8146
- }, 500);
8142
+ debugger;
8143
+ this.kpiListData = value;
8144
+ this.getBreadCrumbsData(value);
8145
+ this.loadBreadCrumbs();
8147
8146
  this.isBreadCrumbs = true;
8148
8147
  }
8149
8148
  }
@@ -8180,75 +8179,72 @@ class BreadCrumbsComponent {
8180
8179
  let structures = {};
8181
8180
  data.forEach(result => {
8182
8181
  const item = {};
8183
- item["relativePath"] = result.relativePath;
8184
- item["name"] = result["name"];
8185
- item["pageId"] = result["pageId"];
8186
- item["tid"] = result["tid"].trim();
8187
- if (result["nodes"] !== undefined) {
8188
- item["nodes"] = this.getBreadCrumbsData(result["nodes"]);
8189
- }
8182
+ item["name"] = result["kpiName"];
8183
+ item["pageId"] = result.tagType == 'child' ? result["pageId"] : null;
8184
+ item["tid"] = result.tagType == 'child' ? result["childTid"].trim() : result["parentTid"].trim();
8190
8185
  this.kpi_names[result["pageId"]] = item["tid"];
8191
- structures[result["tid"]] = item;
8192
- this.kpi_structures[result["tid"]] = item;
8186
+ structures[result["childTid"]] = item;
8187
+ this.kpi_structures[result["childTid"]] = item;
8193
8188
  });
8194
8189
  return structures;
8195
8190
  }
8196
8191
  loadBreadCrumbs() {
8197
- let kpiRoot = this.kpiBrowserName ? "fmskpi" : "rakpi";
8198
- let kpiContainer;
8199
- if (this.kpiListData.length > 0 || this.kpiListData != undefined) {
8200
- kpiContainer = this.getBreadCrumbsData(this.kpiListData);
8201
- }
8202
- else {
8203
- kpiContainer = this.getBreadCrumbsData(this.commonService.allKpibrowserDetailContainer);
8204
- }
8205
- const kpiId = this.activatedRoute.snapshot.queryParams['pageId'];
8206
- const kpiTid = this.kpi_names[kpiId];
8192
+ debugger;
8193
+ const pageId = this.activatedRoute.snapshot.queryParams['pageId'];
8194
+ const kpiTid = this.kpi_names[pageId];
8207
8195
  const props = this.kpi_structures[kpiTid];
8208
- const propsList = props["relativePath"] + "/" + props["name"];
8196
+ const propsList = this.buildKpiPath(this.kpiListData, props["tid"]);
8209
8197
  this.breadcrumbList = propsList.split("/");
8210
8198
  if (this.location.path() !== "") {
8211
8199
  let link = {};
8212
8200
  this.breadcrumbLinksList = [];
8201
+ this.breadcrumbLinksList.unshift({
8202
+ name: "RA KPI Browser",
8203
+ url: "/apps/raKpi/rakpiBrowser",
8204
+ kpiName: "RA KPI Browser"
8205
+ });
8213
8206
  for (let i = 0; i < this.breadcrumbList.length; i++) {
8214
- if (i == 0) {
8215
- if (!this.kpiBrowserName) {
8216
- link = {
8217
- name: this.breadcrumbList[i],
8218
- url: "/apps/raKpi/rakpiBrowser",
8219
- kpiName: "RA KPI Browser",
8220
- };
8221
- }
8222
- else {
8223
- link = {
8224
- name: this.breadcrumbList[i],
8225
- url: "/apps/fmsKpi",
8226
- kpiName: "FMS KPI Browser",
8227
- };
8228
- }
8229
- }
8230
- else {
8231
- let returnId = "";
8232
- for (let j = 0; j <= i; j++) {
8233
- if (j != 0) {
8234
- returnId += "/";
8235
- }
8236
- returnId += this.breadcrumbList[j];
8207
+ let returnId = "";
8208
+ for (let j = 0; j <= i; j++) {
8209
+ if (j != 0) {
8210
+ returnId += "/";
8237
8211
  }
8238
- link = {
8239
- name: this.breadcrumbList[i],
8240
- url: this.breadcrumbLinksList[i - 1]["url"],
8241
- id: this.breadcrumbList[i],
8242
- kpiName: this.breadcrumbList[i],
8243
- returnId: returnId,
8244
- };
8245
- this.commonService.global_kpi_name = this.breadcrumbList[i];
8246
- }
8212
+ returnId += this.breadcrumbList[j];
8213
+ }
8214
+ link = {
8215
+ name: this.breadcrumbList[i],
8216
+ url: this.breadcrumbLinksList[i]["url"],
8217
+ id: this.breadcrumbList[i],
8218
+ kpiName: this.breadcrumbList[i],
8219
+ returnId: returnId,
8220
+ };
8221
+ this.commonService.global_kpi_name = this.breadcrumbList[i];
8247
8222
  this.breadcrumbLinksList.push(link);
8248
8223
  }
8249
8224
  this.count = this.breadcrumbList.length;
8250
8225
  }
8251
8226
  }
8227
+ buildKpiPath(kpiListData, startTid) {
8228
+ const path = [];
8229
+ const tidArray = this.buildTidArray(startTid);
8230
+ tidArray.forEach((tid, index) => {
8231
+ const kpi = kpiListData.find(kpi => index === 0
8232
+ ? kpi.parentTid === tid
8233
+ : kpi.childTid === tid);
8234
+ if (kpi) {
8235
+ path.push(kpi.kpiName);
8236
+ }
8237
+ });
8238
+ return path.join(" / ");
8239
+ }
8240
+ buildTidArray(startTid) {
8241
+ const parts = startTid.split(".");
8242
+ const result = [];
8243
+ for (let i = 0; i < parts.length; i++) {
8244
+ result.push(parts.slice(0, i + 1).join("."));
8245
+ }
8246
+ return result;
8247
+ }
8252
8248
  }
8253
8249
  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 });
8254
8250
  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"] }] });
@@ -18023,6 +18019,14 @@ class KpiWithSingleLayoutService {
18023
18019
  return response;
18024
18020
  }), catchError(this.handleError));
18025
18021
  }
18022
+ listKpiEntryConfigs() {
18023
+ const apiUrl = this.environment.appUrl + this.environment.apiVersion + this.environment.packageBasePath + '/listKpiEntryConfigs?caller=app';
18024
+ return this.http
18025
+ .get(apiUrl, { withCredentials: true })
18026
+ .pipe(map((response) => {
18027
+ return response;
18028
+ }), catchError(this.handleError));
18029
+ }
18026
18030
  }
18027
18031
  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 });
18028
18032
  KpiWithSingleLayoutService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: KpiWithSingleLayoutService, providedIn: "root" });
@@ -18545,6 +18549,28 @@ class PermissionHelper {
18545
18549
  }
18546
18550
  return false;
18547
18551
  }
18552
+ buildMenuTree(userName, kpiData) {
18553
+ let filteredMenus = kpiData;
18554
+ const menuMap = new Map();
18555
+ const menuTree = [];
18556
+ filteredMenus.forEach(menu => {
18557
+ if (!this.getPermissionEntity(menu.permissions))
18558
+ return;
18559
+ menuMap.set(menu.childTid || menu.parentTid, Object.assign(Object.assign({ id: menu.kpiId, title: menu.kpiName, icon: menu.icon, type: menu.kpiType, tagType: menu.tagType, visibility: menu.visibility }, (menu.link && { link: menu.link.replace(/^\/+/, '') })), { children: [] }));
18560
+ });
18561
+ filteredMenus.forEach(kpi => {
18562
+ if (kpi.parentTid && kpi.childTid) {
18563
+ const parent = menuMap.get(kpi.parentTid);
18564
+ if (parent) {
18565
+ parent.children.push(menuMap.get(kpi.childTid));
18566
+ }
18567
+ }
18568
+ else {
18569
+ menuTree.push(menuMap.get(kpi.parentTid));
18570
+ }
18571
+ });
18572
+ return menuTree;
18573
+ }
18548
18574
  }
18549
18575
  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 });
18550
18576
  PermissionHelper.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PermissionHelper, providedIn: 'root' });
@@ -18784,10 +18810,10 @@ class KpiWithDataSetTestComponent {
18784
18810
  this.isDefaultFilterParams = false;
18785
18811
  }
18786
18812
  ngOnInit() {
18787
- this.service.getlistKpiBrowser().subscribe({
18788
- next: ((data) => {
18789
- this.kpi_breadcrumbs_container = data;
18790
- })
18813
+ this.service.listKpiEntryConfigs().subscribe((data) => {
18814
+ this.kpi_breadcrumbs_container = data;
18815
+ }, err => {
18816
+ this.toastr.error('Unexpected Server Exception. Please contact System Admin.', 'KPI Config');
18791
18817
  });
18792
18818
  this.loadingModal = true;
18793
18819
  this.pageId = this.activatedRoute.snapshot.queryParams['pageId'];