Skip to content

Commit cd6d8bd

Browse files
committed
fix issue with the new "list" UI URL
1 parent bd70086 commit cd6d8bd

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

angular/src/app/pages/api/manage/manage.component.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export class ApiManageComponent implements OnInit {
3434

3535
quick_links: linkElement[] = []
3636
quick_actions: actionElement[] = []
37+
not_detail: string[] = ["new", "list"]
3738

3839
msp_id: string | undefined = undefined;
3940
org_id: string | undefined = undefined;
@@ -154,7 +155,7 @@ export class ApiManageComponent implements OnInit {
154155

155156
setName(obj_name: string = "", detail: string | undefined) {
156157
obj_name = obj_name.toLowerCase();
157-
if (detail && detail != "new") {
158+
if (detail && !this.not_detail.includes(detail)) {
158159
this.obj_name = obj_name
159160
} else {
160161
if (obj_name.includes("switch")) {
@@ -174,7 +175,7 @@ export class ApiManageComponent implements OnInit {
174175
if (!ui_name) {
175176
ui_name = this.obj_name;
176177
}
177-
if (detail && detail != "new") {//} || this.obj_id) { <- this is causing issues with the quick links where the site_id is in the org url
178+
if (detail && !this.not_detail.includes(detail)) {//} || this.obj_id) { <- this is causing issues with the quick links where the site_id is in the org url
178179
// set QUICK LINK
179180
url = "https://api." + host + "/api/v1/orgs/" + this.org_id + "/" + obj_name + "/" + this.obj_id;
180181
this.quick_links.push({ url: url, name: ui_name });
@@ -189,7 +190,7 @@ export class ApiManageComponent implements OnInit {
189190

190191
forgeOrgObjectStats(obj_name: string, host: string, detail: string, extra_param: string | undefined = undefined): void {
191192
let url = "";
192-
if (detail && detail != "new") {
193+
if (detail && !this.not_detail.includes(detail)) {
193194
// set QUICK LINK
194195
url = "https://api." + host + "/api/v1/orgs/" + this.org_id + "/stats/" + obj_name + "/" + this.obj_id;
195196
if (extra_param) url += "?" + extra_param;
@@ -201,7 +202,7 @@ export class ApiManageComponent implements OnInit {
201202
forgeOrgObjectEvents(obj_name: string, host: string, detail: string, extra_param: string | undefined = undefined): void {
202203
let url = "";
203204
let filter = "";
204-
if (detail && detail != "new" && this.obj_id) {
205+
if (detail && !this.not_detail.includes(detail) && this.obj_id) {
205206
// MAC
206207
const mac = this.getMac(this.obj_id);
207208
if (obj_name == "mxedges") {
@@ -247,7 +248,7 @@ export class ApiManageComponent implements OnInit {
247248
////////////////////// COMMON SITE FUNCTIONS
248249
forgeSiteObject(obj_name: string, host: string | undefined, detail: string | undefined, extra_param: string | undefined = undefined): void {
249250
let url = "";
250-
if (detail && detail != "new") {
251+
if (detail && !this.not_detail.includes(detail)) {
251252
// set QUICK LINK
252253
url = "https://api." + host + "/api/v1/sites/" + this.site_id + "/" + obj_name + "/" + this.obj_id;
253254
this.quick_links.push({ url: url, name: this.obj_name });
@@ -308,7 +309,7 @@ export class ApiManageComponent implements OnInit {
308309

309310
forgeSiteObjectStats(obj_name: string, host: string, detail: string, extra_param: string | undefined = undefined): void {
310311
let url = "";
311-
if (detail && detail != "new") {
312+
if (detail && !this.not_detail.includes(detail)) {
312313
// set QUICK LINK
313314
url = "https://api." + host + "/api/v1/sites/" + this.site_id + "/stats/" + obj_name + "/" + this.obj_id;
314315
if (extra_param) url += "?" + extra_param;
@@ -323,7 +324,7 @@ export class ApiManageComponent implements OnInit {
323324

324325
forgeSiteObjectEvents(obj_name: string, device_type: string | undefined, host: string, detail: string, extra_param: string | undefined = undefined): void {
325326
let url = "";
326-
if (detail && detail != "new" && this.obj_id) {
327+
if (detail && !this.not_detail.includes(detail) && this.obj_id) {
327328
// MAC
328329
const mac = this.getMac(this.obj_id);
329330
// set QUICK LINK
@@ -354,7 +355,7 @@ export class ApiManageComponent implements OnInit {
354355
if (device_type == "ap") filter = "&aps=";
355356
else if (device_type == "switch") filter = "&switches=";
356357
else if (device_type == "gateway") filter = "&gateways="
357-
if (detail && detail != "new" && this.obj_id) {
358+
if (detail && !this.not_detail.includes(detail) && this.obj_id) {
358359
// MAC
359360
const mac = this.getMac(this.obj_id);
360361
if (filter) filter += mac;
@@ -509,7 +510,7 @@ export class ApiManageComponent implements OnInit {
509510

510511
forgeSiteAssetStats(obj_name: string, host: string, detail: string, extra_param: string | undefined = undefined): void {
511512
let url = "";
512-
if (detail && detail != "new") {
513+
if (detail && !this.not_detail.includes(detail)) {
513514
// set QUICK LINK
514515
url = "https://api." + host + "/api/v1/sites/" + this.site_id + "/stats/" + obj_name + "/" + this.obj_id;
515516
if (extra_param) url += "?" + extra_param;

0 commit comments

Comments
 (0)