-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathservice.js
51 lines (47 loc) · 1.26 KB
/
service.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/**
* Created by geng on 16/6/7.
*/
BACKEND_URL = {
version: {
agent: 'omega-agent',
app: 'omega-app',
cluster: 'omega-cluster',
frontend: 'frontend',
metrics: 'omega-metrics',
webpage: 'webpage',
es: 'omega-es',
harbor: 'harbor',
drone: 'drone',
alert: 'sryun-alert',
billing: 'omega-billing'
}
};
FRONTEND_URL = {
login: CONFIG.dashboard + "auth/login",
register: CONFIG.dashboard + "auth/register",
demo: CONFIG.dashboard + "auth/demoLogin",
};
var login = $('a[data-ng-href="{/FRONTEND_URL.login/}"]');
var register = $('a[data-ng-href="{/FRONTEND_URL.register/}"]');
var demo = $('a[data-ng-href="{/FRONTEND_URL.demo/}"]');
login.each(function () {
this.href = FRONTEND_URL.login;
});
register.each(function () {
this.href = FRONTEND_URL.register;
});
demo.each(function () {
this.href = FRONTEND_URL.demo;
});
function getUrlTemplate(name) {
var confs = name.split('.');
var categoryKey = confs[0];
var detailKey = confs[1];
var base;
if(BACKEND_URL_BASE[categoryKey]){
base = BACKEND_URL_BASE[categoryKey];
} else {
base = BACKEND_URL_BASE.defaultBase;
}
return base + BACKEND_URL[categoryKey][detailKey];
}