File tree Expand file tree Collapse file tree 7 files changed +53
-21
lines changed
openig-ui/src/main/js/org/forgerock/openig/ui Expand file tree Collapse file tree 7 files changed +53
-21
lines changed Original file line number Diff line number Diff line change @@ -18,20 +18,20 @@ define([
18
18
"jquery" ,
19
19
"lodash" ,
20
20
"backbone" ,
21
- "org/forgerock/openig/ui/common/util/Constants " ,
21
+ "org/forgerock/openig/ui/admin/services/ServerUrls " ,
22
22
"org/forgerock/openig/ui/admin/services/ServerInfoService"
23
23
] , (
24
24
$ ,
25
25
_ ,
26
26
Backbone ,
27
- Constants ,
27
+ serverUrls ,
28
28
server
29
29
) => (
30
30
/* Define Route structure + add defaults, constants, orders */
31
31
class RouteModel extends Backbone . Model {
32
32
constructor ( options ) {
33
33
super ( options ) ;
34
- this . url = `${ Constants . systemObjectsPath } /ui/record` ;
34
+ this . url = `${ serverUrls . systemObjectsPath } /ui/record` ;
35
35
}
36
36
37
37
get idAttribute ( ) { return "_id" ; }
Original file line number Diff line number Diff line change 17
17
define ( [
18
18
"jquery" ,
19
19
"backbone" ,
20
- "org/forgerock/commons /ui/common/util/Constants " ,
20
+ "org/forgerock/openig /ui/admin/services/ServerUrls " ,
21
21
"org/forgerock/openig/ui/admin/models/RouteModel"
22
22
] , (
23
23
$ ,
24
24
Backbone ,
25
- Constants ,
25
+ serverUrls ,
26
26
RouteModel
27
27
) => {
28
28
/* Get and keep Routes */
29
29
class RoutesCollection extends Backbone . Collection {
30
30
constructor ( ) {
31
31
super ( ) ;
32
- this . url = `${ Constants . systemObjectsPath } /ui/record` ;
32
+ this . url = `${ serverUrls . systemObjectsPath } /ui/record` ;
33
33
this . model = RouteModel ;
34
34
this . routesCache = { } ;
35
35
}
Original file line number Diff line number Diff line change 16
16
17
17
define ( [
18
18
"backbone" ,
19
- "org/forgerock/openig/ui/common/util/Constants "
19
+ "org/forgerock/openig/ui/admin/services/ServerUrls "
20
20
] , (
21
21
Backbone ,
22
- Constants
22
+ serverUrls
23
23
) => (
24
24
Backbone . Model . extend ( {
25
- url : `${ Constants . systemObjectsPath } /_router/routes` ,
25
+ url : `${ serverUrls . systemObjectsPath } /_router/routes` ,
26
26
idAttribute : "_id" ,
27
27
28
28
getMVCCRev ( ) {
Original file line number Diff line number Diff line change @@ -18,18 +18,18 @@ define([
18
18
"jquery" ,
19
19
"lodash" ,
20
20
"backbone" ,
21
- "org/forgerock/openig/ui/common/util/Constants " ,
21
+ "org/forgerock/openig/ui/admin/services/ServerUrls " ,
22
22
"org/forgerock/openig/ui/admin/models/ServerRouteModel"
23
23
] , (
24
24
$ ,
25
25
_ ,
26
26
Backbone ,
27
- Constants ,
27
+ serverUrls ,
28
28
ServerRouteModel
29
29
) => {
30
30
/* Collection of routes */
31
31
const ServerRoutesCollection = Backbone . Collection . extend ( {
32
- url : `${ Constants . systemObjectsPath } /_router/routes` ,
32
+ url : `${ serverUrls . systemObjectsPath } /_router/routes` ,
33
33
model : ServerRouteModel ,
34
34
parse ( response ) {
35
35
return response . result ;
Original file line number Diff line number Diff line change 16
16
17
17
define ( [
18
18
"jquery" ,
19
- "org/forgerock/commons /ui/common/util/Constants " ,
19
+ "org/forgerock/openig /ui/admin/services/ServerUrls " ,
20
20
"org/forgerock/commons/ui/common/main/AbstractDelegate"
21
21
] , (
22
22
$ ,
23
- Constants ,
23
+ serverUrls ,
24
24
AbstractDelegate
25
25
) => {
26
26
class ServerInfoService {
27
27
constructor ( ) {
28
- this . infoDelegate = new AbstractDelegate ( `${ Constants . apiPath } /info` ) ;
28
+ this . infoDelegate = new AbstractDelegate ( `${ serverUrls . apiPath } /info` ) ;
29
29
}
30
30
31
31
getInfo ( ) {
Original file line number Diff line number Diff line change
1
+ /*
2
+ * The contents of this file are subject to the terms of the Common Development and
3
+ * Distribution License (the License). You may not use this file except in compliance with the
4
+ * License.
5
+ *
6
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
7
+ * specific language governing permission and limitations under the License.
8
+ *
9
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
10
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
11
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
12
+ * information: "Portions copyright [year] [name of copyright owner]".
13
+ *
14
+ * Copyright 2016 ForgeRock AS.
15
+ */
16
+
17
+ define ( [
18
+ "org/forgerock/commons/ui/common/util/URIUtils"
19
+ ] , (
20
+ URIUtils
21
+ ) => {
22
+ class ServerUrls {
23
+ constructor ( pathname ) {
24
+ // Infer base path from URL
25
+ const index = pathname . indexOf ( "/studio" ) ;
26
+ this . context = pathname . substring ( 0 , index ) ;
27
+ }
28
+
29
+ get apiPath ( ) {
30
+ return `${ this . context } /api` ;
31
+ }
32
+
33
+ get systemObjectsPath ( ) {
34
+ return `${ this . apiPath } /system/objects` ;
35
+ }
36
+ }
37
+ return new ServerUrls ( URIUtils . getCurrentPathName ( ) ) ;
38
+ } ) ;
Original file line number Diff line number Diff line change @@ -18,12 +18,6 @@ define([
18
18
"org/forgerock/commons/ui/common/util/Constants"
19
19
] , ( commonConstants ) => {
20
20
21
- commonConstants . context = "openig" ;
22
-
23
- commonConstants . apiPath = "/openig/api" ;
24
-
25
- commonConstants . systemObjectsPath = `${ commonConstants . apiPath } /system/objects` ;
26
-
27
21
commonConstants . DOC_URL = "https://backstage.forgerock.com/#!/docs/openig/5.0/" ;
28
22
29
23
commonConstants . defaultFiltersOrder = {
You can’t perform that action at this time.
0 commit comments