Skip to content

Commit 21b964f

Browse files
committed
fix missing stats buttons
1 parent 68cf3e8 commit 21b964f

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,15 @@ export class ApiComponent implements OnInit {
7777
}
7878
forgeSiteStats(groups: { [key: string]: string; }, obj: string, extra_param: string): string {
7979
let url = "";
80+
this.obj_name = obj.substr(0, obj.length - 1).toUpperCase();
8081
if (groups.detail && groups.detail != "new") {
8182
this.obj_id = groups.uuid_1;
8283
this.site_id = groups.uuid_2;
8384
url = "https://api." + groups.host + "/api/v1/sites/" + groups.uuid_2 + "/stats/" + obj + "/" + groups.uuid_1;
85+
} else {
86+
this.site_id = groups.uuid_1;
87+
url = "https://api." + groups.host + "/api/v1/sites/" + groups.uuid_1 + "/stats/" + obj;
88+
if (extra_param) url += "?" + extra_param
8489
}
8590
return url;
8691
}
@@ -90,10 +95,9 @@ export class ApiComponent implements OnInit {
9095
this.api_url_stats_obj = "";
9196
const re = /https:\/\/manage\.(?<host>[a-z0-1.]*mist\.com)\/admin\/\?org_id=(?<org_id>[0-9a-f-]*)#!(?<obj>[a-z]+)\/?(?<detail>detail|template|site|rfTemplate|admin|edgedetail|clusterdetail|new)?\/?([0-9])*?\/?(?<uuid_1>[0-9a-f-]*)?\/?(?<uuid_2>[0-9a-f-]*)?/gi;
9297
let res = re.exec(this.tabUrl);
93-
console.log(res)
9498
if (res) {
9599
this.org_id = res.groups.org_id;
96-
if (res.groups.host && res.groups.org_id && res.groups.obj) {
100+
if (res.groups.host && res.groups.org_id && res.groups.obj) {
97101
switch (res.groups.obj.toLowerCase()) {
98102
// SITE
99103
case "ap":

0 commit comments

Comments
 (0)