Skip to content

Commit 68b9d70

Browse files
Replace copy pasted function with import to new library function where possible
1 parent fd237ef commit 68b9d70

File tree

11 files changed

+12
-160
lines changed

11 files changed

+12
-160
lines changed

src/Moryx.CommandCenter.Web/app/src/common/api/RestClientBase.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ export default class RestClientBase {
1616

1717
}
1818

19+
// reimplementation of getPathBase from @moryx/ngx-web-framework/environments,
20+
// because I don't think it's smart to entagle the angualr and react dependencies for this small function
1921
private static getPathBase(modulePrefix: string): string {
2022

2123
const baseElement = document.querySelector("base");

src/Moryx.ControlSystem.ProcessEngine.Web/app/src/environments/environment.prod.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,7 @@
33
* Licensed under the Apache License, Version 2.0
44
*/
55

6-
function getPathBase(modulePrefix: string) {
7-
8-
let baseElement = document.querySelector('base');
9-
let href = baseElement?.href; // routingPrefix/commandcenter
10-
if(modulePrefix == null || modulePrefix == undefined || modulePrefix == "")
11-
return href;
12-
13-
if(!modulePrefix.startsWith('/')) {
14-
modulePrefix = '/' + modulePrefix;
15-
}
16-
if(href?.endsWith(modulePrefix)) {
17-
return href.substring(0, href.length - modulePrefix.length); // routingPrefix
18-
}
19-
throw Error("Not implemented");
20-
}
21-
6+
import { getPathBase } from @moryx/ngx-web-framework/environments;
227

238
let path_base = getPathBase("/Processes");
249

src/Moryx.FactoryMonitor.Web/app/src/environments/environment.prod.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,7 @@
33
* Licensed under the Apache License, Version 2.0
44
*/
55

6-
function getPathBase(modulePrefix: string) {
7-
8-
let baseElement = document.querySelector('base');
9-
let href = baseElement?.href; // routingPrefix/commandcenter
10-
if(modulePrefix == null || modulePrefix == undefined || modulePrefix == "")
11-
return href;
12-
13-
if(!modulePrefix.startsWith('/')) {
14-
modulePrefix = '/' + modulePrefix;
15-
}
16-
if(href?.endsWith(modulePrefix)) {
17-
return href.substring(0, href.length - modulePrefix.length); // routingPrefix
18-
}
19-
throw Error("Not implemented");
20-
}
21-
6+
import { getPathBase } from @moryx/ngx-web-framework/environments;
227

238
let path_base = getPathBase("/FactoryMonitor");
249

src/Moryx.Media.Web/app/src/environments/environment.prod.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,7 @@
33
* Licensed under the Apache License, Version 2.0
44
*/
55

6-
function getPathBase(modulePrefix: string) {
7-
8-
let baseElement = document.querySelector('base');
9-
let href = baseElement?.href; // routingPrefix/commandcenter
10-
if(modulePrefix == null || modulePrefix == undefined || modulePrefix == "")
11-
return href;
12-
13-
if(!modulePrefix.startsWith('/')) {
14-
modulePrefix = '/' + modulePrefix;
15-
}
16-
if(href?.endsWith(modulePrefix)) {
17-
return href.substring(0, href.length - modulePrefix.length); // routingPrefix
18-
}
19-
throw Error("Not implemented");
20-
}
21-
6+
import { getPathBase } from @moryx/ngx-web-framework/environments;
227

238
let path_base = getPathBase("/Media");
249

src/Moryx.Notifications.Web/app/src/environments/environment.prod.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,7 @@
33
* Licensed under the Apache License, Version 2.0
44
*/
55

6-
function getPathBase(modulePrefix: string) {
7-
8-
let baseElement = document.querySelector('base');
9-
let href = baseElement?.href; // routingPrefix/commandcenter
10-
if(modulePrefix == null || modulePrefix == undefined || modulePrefix == "")
11-
return href;
12-
13-
if(!modulePrefix.startsWith('/')) {
14-
modulePrefix = '/' + modulePrefix;
15-
}
16-
if(href?.endsWith(modulePrefix)) {
17-
return href.substring(0, href.length - modulePrefix.length); // routingPrefix
18-
}
19-
throw Error("Not implemented");
20-
}
21-
6+
import { getPathBase } from @moryx/ngx-web-framework/environments;
227

238
let path_base = getPathBase("/Notifications");
249

src/Moryx.Operators.Web/app/src/environments/environment.prod.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,7 @@
33
* Licensed under the Apache License, Version 2.0
44
*/
55

6-
function getPathBase(modulePrefix: string) {
7-
8-
let baseElement = document.querySelector('base');
9-
let href = baseElement?.href; // routingPrefix/commandcenter
10-
if(modulePrefix == null || modulePrefix == undefined || modulePrefix == "")
11-
return href;
12-
13-
if(!modulePrefix.startsWith('/')) {
14-
modulePrefix = '/' + modulePrefix;
15-
}
16-
if(href?.endsWith(modulePrefix)) {
17-
return href.substring(0, href.length - modulePrefix.length); // routingPrefix
18-
}
19-
throw Error("Not implemented");
20-
}
21-
6+
import { getPathBase } from @moryx/ngx-web-framework/environments;
227

238
let path_base = getPathBase("/Operators");
249

src/Moryx.Orders.Web/app/src/environments/environment.prod.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,7 @@
33
* Licensed under the Apache License, Version 2.0
44
*/
55

6-
function getPathBase(modulePrefix: string) {
7-
8-
let baseElement = document.querySelector('base');
9-
let href = baseElement?.href; // routingPrefix/commandcenter
10-
if(modulePrefix == null || modulePrefix == undefined || modulePrefix == "")
11-
return href;
12-
13-
if(!modulePrefix.startsWith('/')) {
14-
modulePrefix = '/' + modulePrefix;
15-
}
16-
if(href?.endsWith(modulePrefix)) {
17-
return href.substring(0, href.length - modulePrefix.length); // routingPrefix
18-
}
19-
throw Error("Not implemented");
20-
}
21-
6+
import { getPathBase } from @moryx/ngx-web-framework/environments;
227

238
let path_base = getPathBase("/Orders");
249

src/Moryx.Products.Web/app/src/environments/environment.prod.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,7 @@
33
* Licensed under the Apache License, Version 2.0
44
*/
55

6-
function getPathBase(modulePrefix: string) {
7-
8-
let baseElement = document.querySelector('base');
9-
let href = baseElement?.href; // routingPrefix/commandcenter
10-
if(modulePrefix == null || modulePrefix == undefined || modulePrefix == "")
11-
return href;
12-
13-
if(!modulePrefix.startsWith('/')) {
14-
modulePrefix = '/' + modulePrefix;
15-
}
16-
if(href?.endsWith(modulePrefix)) {
17-
return href.substring(0, href.length - modulePrefix.length); // routingPrefix
18-
}
19-
throw Error("Not implemented");
20-
}
21-
6+
import { getPathBase } from @moryx/ngx-web-framework/environments;
227

238
let path_base = getPathBase("/Products");
249

src/Moryx.Resources.Web/app/src/environments/environment.prod.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,7 @@
33
* Licensed under the Apache License, Version 2.0
44
*/
55

6-
function getPathBase(modulePrefix: string) {
7-
8-
let baseElement = document.querySelector('base');
9-
let href = baseElement?.href; // routingPrefix/commandcenter
10-
if(modulePrefix == null || modulePrefix == undefined || modulePrefix == "")
11-
return href;
12-
13-
if(!modulePrefix.startsWith('/')) {
14-
modulePrefix = '/' + modulePrefix;
15-
}
16-
if(href?.endsWith(modulePrefix)) {
17-
return href.substring(0, href.length - modulePrefix.length); // routingPrefix
18-
}
19-
throw Error("Not implemented");
20-
}
21-
6+
import { getPathBase } from @moryx/ngx-web-framework/environments;
227

238
let path_base = getPathBase("/Resources");
249

src/Moryx.VisualInstructions.Web/app/src/environments/environment.prod.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,7 @@
33
* Licensed under the Apache License, Version 2.0
44
*/
55

6-
function getPathBase(modulePrefix: string) {
7-
8-
let baseElement = document.querySelector('base');
9-
let href = baseElement?.href; // routingPrefix/commandcenter
10-
if(modulePrefix == null || modulePrefix == undefined || modulePrefix == "")
11-
return href;
12-
13-
if(!modulePrefix.startsWith('/')) {
14-
modulePrefix = '/' + modulePrefix;
15-
}
16-
if(href?.endsWith(modulePrefix)) {
17-
return href.substring(0, href.length - modulePrefix.length); // routingPrefix
18-
}
19-
throw Error("Not implemented");
20-
}
21-
6+
import { getPathBase } from @moryx/ngx-web-framework/environments;
227

238
let path_base = getPathBase("/VisualInstructions");
249

0 commit comments

Comments
 (0)