Skip to content

Commit 52d3c4b

Browse files
authored
Merge branch 'master' into LayersWindow
2 parents b73fc98 + 5fb6c40 commit 52d3c4b

File tree

3 files changed

+28
-9
lines changed

3 files changed

+28
-9
lines changed

src/components/ToolsScreen/ToolsScreen.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ import Select from "react-select";
44

55
import { pyWpsUrl, version } from "../../config";
66
import ProcessForm from "../ProcessForm/ProcessForm";
7+
import { wpsServerUrl, version } from "../../config";
8+
import ProcessForm from "../ProcessForm";
9+
import { GetInputGenerator, CreateClientInstance, GetOutputGenerator } from "../../utils/wpsjs";
710

811
export default class ToolsScreen extends React.Component {
9-
constructor(props) {
10-
super(props);
11-
12+
constructor (props) {
1213
this.state = {
1314
processes: [],
1415
processInputs: []
@@ -22,11 +23,7 @@ export default class ToolsScreen extends React.Component {
2223
}
2324

2425
componentDidMount() {
25-
this.wps = new window.WpsService({
26-
url: pyWpsUrl,
27-
version: version
28-
});
29-
26+
this.wps = CreateClientInstance(wpsServerUrl, version);
3027
this.wps.getCapabilities_GET(this.getCapabilitiesCallback);
3128
}
3229

src/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export const pyWpsUrl = "http://geoprocessing.demo.52north.org:8080/wps/WebProcessingService";
1+
export const wpsServerUrl = "http://geoprocessing.demo.52north.org:8080/wps/WebProcessingService";
22

33
export const version = "1.0.0";

src/utils/wpsjs.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
if(!window.WpsService) {
2+
console.error("wpsjs Failed to load")
3+
}
4+
5+
let inputGenerator = null;
6+
let outputGenerator = null;
7+
8+
export function CreateClientInstance(url, version) {
9+
return new window.WpsService({ url, version });
10+
}
11+
12+
export function GetInputGenerator(url, version) {
13+
if(!inputGenerator)
14+
inputGenerator = new window.InputGenerator();
15+
return inputGenerator;
16+
}
17+
18+
export function GetOutputGenerator(url, version) {
19+
if(!outputGenerator)
20+
outputGenerator = new window.OutputGenerator();
21+
return outputGenerator;
22+
}

0 commit comments

Comments
 (0)