File tree Expand file tree Collapse file tree 3 files changed +28
-9
lines changed Expand file tree Collapse file tree 3 files changed +28
-9
lines changed Original file line number Diff line number Diff line change @@ -4,11 +4,12 @@ import Select from "react-select";
44
55import { pyWpsUrl , version } from "../../config" ;
66import ProcessForm from "../ProcessForm/ProcessForm" ;
7+ import { wpsServerUrl , version } from "../../config" ;
8+ import ProcessForm from "../ProcessForm" ;
9+ import { GetInputGenerator , CreateClientInstance , GetOutputGenerator } from "../../utils/wpsjs" ;
710
811export 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
Original file line number Diff line number Diff line change 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
33export const version = "1.0.0" ;
Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments