Skip to content

Commit 99dc2dc

Browse files
committed
refactor(wps functions)
change LayerSelect to controlled input fixed loading issues handle results
1 parent 47fa4d8 commit 99dc2dc

File tree

16 files changed

+356
-171
lines changed

16 files changed

+356
-171
lines changed

src/App.css

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,27 @@
2323
}
2424

2525
@keyframes App-logo-spin {
26-
from { transform: rotate(0deg); }
27-
to { transform: rotate(360deg); }
26+
from {
27+
transform: rotate(0deg);
28+
}
29+
to {
30+
transform: rotate(360deg);
31+
}
2832
}
2933

30-
.screen{
31-
width: 50%;
34+
.screen-left,
35+
.screen-right {
36+
position: relative;
3237
flex-grow: 1;
3338
}
3439

40+
.screen-left{
41+
width: 65%
42+
}
43+
.screen-right{
44+
width: 35%
45+
}
46+
3547
.root {
3648
display: flex;
3749
flex-direction: row;

src/App.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ class App extends Component {
1919
render() {
2020
return (
2121
<div className="root">
22-
<div className="screen">
22+
<div className="screen-left">
2323
<Layers onRef={ref => (this.layers = ref)} />
2424
<Map />
2525
</div>
26-
<div className="screen">
26+
<div className="screen-right">
2727
<ToolsScreen
2828
addLayer={this.state.addLayer}
2929
setQueryHistory={setQueryHistory}

src/components/Icons/Icons.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import React from "react";
2+
3+
export function LayersIcon({ className }) {
4+
return (
5+
<svg
6+
className={className}
7+
xmlns="http://www.w3.org/2000/svg"
8+
version="1.1"
9+
viewBox="0 0 56.018 56.018"
10+
>
11+
<g>
12+
<path d="M55.741,53.809l-5.969-6.244c1.746-1.919,2.82-4.458,2.82-7.25c0-5.953-4.843-10.796-10.796-10.796S31,34.362,31,40.315 s4.843,10.796,10.796,10.796c2.441,0,4.688-0.824,6.499-2.196l6.001,6.277c0.196,0.205,0.459,0.309,0.723,0.309 c0.249,0,0.497-0.092,0.691-0.277C56.108,54.841,56.123,54.209,55.741,53.809z M41.796,49.111c-4.85,0-8.796-3.946-8.796-8.796 s3.946-8.796,8.796-8.796s8.796,3.946,8.796,8.796S46.646,49.111,41.796,49.111z" />
13+
<path d="M37,27.396v-0.002c1.495-0.56,3.108-0.875,4.796-0.875c6.222,0,11.49,4.142,13.204,9.812V1.519 c0-0.321-0.154-0.623-0.416-0.812s-0.597-0.241-0.901-0.137l-17.73,5.91L19.229,2.545c-0.076-0.018-0.152-0.026-0.228-0.026 c-0.048,0-0.094,0.017-0.142,0.024c-0.026,0.004-0.051-0.006-0.076,0l-18,4C0.326,6.645,0,7.05,0,7.519v43 c0,0.304,0.138,0.59,0.375,0.78c0.179,0.144,0.4,0.22,0.625,0.22c0.072,0,0.145-0.008,0.217-0.023l17.807-3.957l12.772,2.254 C29.45,47.318,28,43.986,28,40.315C28,34.396,31.754,29.351,37,27.396z M20,45.68V4.782l15,3.529v17.764 c-5.436,2.604-9,8.16-9,14.24c0,2.338,0.516,4.613,1.493,6.687L20,45.68z" />
14+
</g>
15+
</svg>
16+
);
17+
}
18+
19+
export function TextIcon({ className }) {
20+
return (
21+
<svg
22+
className={className}
23+
xmlns="http://www.w3.org/2000/svg"
24+
version="1.1"
25+
viewBox="0 0 299.898 299.898"
26+
>
27+
<g>
28+
<g>
29+
<g>
30+
<path d="M92.488,15.666c-0.428-1.329-1.214-2.44-2.213-3.274c-0.025-0.021-0.049-0.043-0.074-0.064 c-0.131-0.107-0.267-0.205-0.405-0.302c-0.06-0.043-0.119-0.087-0.181-0.128c-0.111-0.072-0.225-0.138-0.339-0.204 c-0.093-0.054-0.185-0.111-0.281-0.161c-0.09-0.047-0.184-0.087-0.276-0.13c-0.123-0.058-0.246-0.118-0.374-0.169 c-0.06-0.024-0.122-0.042-0.183-0.065c-0.146-0.054-0.291-0.112-0.443-0.157c-0.111-0.032-0.222-0.052-0.333-0.078 c-1.201-0.294-2.491-0.283-3.758,0.099c-0.034,0.01-0.07,0.017-0.104,0.028c-0.011,0.003-0.021,0.005-0.032,0.009 c-0.122,0.039-0.237,0.09-0.356,0.135c-0.092,0.035-0.185,0.066-0.275,0.104c-0.131,0.056-0.255,0.121-0.381,0.184 c-0.082,0.041-0.166,0.079-0.247,0.124c-0.12,0.066-0.234,0.139-0.349,0.211c-0.083,0.052-0.167,0.102-0.248,0.157 c-0.1,0.069-0.195,0.143-0.291,0.217c-0.092,0.07-0.184,0.138-0.272,0.213c-0.075,0.064-0.146,0.132-0.219,0.198 c-0.102,0.094-0.204,0.188-0.301,0.288c-0.051,0.053-0.098,0.108-0.148,0.163c-0.11,0.12-0.218,0.242-0.32,0.371 c-0.032,0.04-0.06,0.082-0.091,0.122c-0.11,0.146-0.218,0.294-0.317,0.449c-0.019,0.03-0.036,0.062-0.055,0.092 c-0.103,0.165-0.201,0.333-0.291,0.509c-0.014,0.027-0.026,0.056-0.039,0.084c-0.088,0.178-0.172,0.359-0.247,0.546 c-0.01,0.025-0.017,0.05-0.027,0.075c-0.065,0.169-0.13,0.338-0.183,0.514l-78.54,264.18c-1.121,3.777,1.035,7.754,4.812,8.882 c0.685,0.193,1.364,0.293,2.035,0.293c3.084,0,5.919-1.992,6.847-5.105l17.587-59.155h113.755l19.241,59.326 c0.978,3.006,3.777,4.934,6.79,4.934c0.728,0,1.471-0.114,2.206-0.336c3.763-1.214,5.819-5.255,4.598-8.996L92.488,15.666z M35.823,210.638L85.982,41.921l54.719,168.717H35.823z" />
31+
<path d="M298.77,166.506c-7.668-11.967-18.214-19.292-31.38-21.798c-32.544-6.205-69.529,20.213-71.093,21.334 c-3.206,2.313-3.913,6.769-1.614,9.967s6.769,3.906,9.967,1.607c0.328-0.25,33.444-23.89,60.069-18.885 c8.661,1.649,15.508,6.169,20.884,13.787v24.607c-16.495-0.857-60.987-1.067-82.888,19.054 c-8.668,7.954-12.981,18.078-12.831,30.109c0.207,16.551,9.175,29.588,25.247,36.742c9.082,4.041,20.135,5.969,31.395,5.969 c13.801,0,27.898-2.889,39.077-8.251v1.289c0,3.948,3.192,7.14,7.14,7.14s7.14-3.192,7.154-7.14V170.354 C299.898,168.99,299.512,167.648,298.77,166.506z M220.944,269.993c-10.988-4.905-16.636-12.938-16.779-23.883 c-0.1-7.904,2.578-14.23,8.197-19.407c18.059-16.615,59.143-16.012,73.242-15.259v52.861 C271.461,274.307,241.203,279.02,220.944,269.993z" />
32+
</g>
33+
</g>
34+
</g>
35+
</svg>
36+
);
37+
}

src/components/Icons/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default } from "./Icons";

src/components/LayerInput/LayerInput.css

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/components/LayerInput/LayerInput.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,12 @@ import PropTypes from "prop-types";
33
import Select from "react-select";
44

55
import "./LayerInput.css";
6+
import { LayersIcon } from "../Icons/Icons";
67

78
class LayerInput extends React.Component {
89
constructor(props) {
9-
console.log(props);
1010
super(props);
1111

12-
this.state = {
13-
urlValue: ""
14-
};
15-
1612
this.handleSelect = this.handleSelect.bind(this);
1713
}
1814

@@ -21,14 +17,22 @@ class LayerInput extends React.Component {
2117
}
2218

2319
render() {
20+
const { layers, className } = this.props;
21+
const layerId = this.props.value;
22+
const selectableLayers = layers.map(layer => ({
23+
value: layer.id,
24+
label: layer.displayName
25+
}));
2426
return (
27+
// <div>
28+
// <LayersIcon className="layer-icon" />
2529
<Select
30+
className={className}
31+
value={selectableLayers.filter(l => l.value === layerId)}
2632
onChange={this.handleSelect}
27-
options={this.props.layers.map(layer => ({
28-
value: layer.id,
29-
label: layer.displayName
30-
}))}
33+
options={selectableLayers}
3134
/>
35+
// </div>
3236
);
3337
}
3438
}
Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,42 @@
1-
input[type=text]{
2-
width: 80%;
3-
padding: 12px 20px;
4-
margin: 8px 0;
5-
display: inline-block;
6-
border: 1px solid #ccc;
7-
border-radius: 4px;
8-
box-sizing: border-box;
9-
}
1+
.process-form {
2+
position: absolute;
3+
left: 0;
4+
right: 0;
5+
overflow-y: auto;
6+
padding: 0 12px;
7+
max-height: calc(65% - 51px);
8+
}
9+
.process-form .literal-text-input {
10+
width: 80%;
11+
padding: 12px 20px;
12+
margin: 8px 10px;
13+
display: inline-block;
14+
border: 1px solid #ccc;
15+
border-radius: 4px;
16+
box-sizing: border-box;
17+
width: calc(100% - 55px);
18+
}
19+
20+
.process-form .execute-button {
21+
font-weight: bold;
22+
margin-top: 12px;
23+
background-color: #3b5998;
24+
font-size: 15px;
25+
color: white;
26+
border: 0;
27+
width: 100%;
28+
padding: 20px;
29+
border-radius: 0px;
30+
}
31+
32+
.process-form .process-form-icon {
33+
width: 30px;
34+
padding: 13px 0;
35+
vertical-align: middle;
36+
}
37+
38+
.process-form .layer-select {
39+
display: inline-block;
40+
width: calc(100% - 35px);
41+
padding: 0 10px;
42+
}

src/components/ProcessForm/ProcessForm.js

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import LayerInput from "../LayerInput";
88
// import LayerInput from '../../containers/LayerInputContainer'; todo remove LayerInputContainer
99

1010
import "./ProcessForm.css";
11+
import { TextIcon, LayersIcon } from "../Icons/Icons";
1112

1213
class ProcessForm extends React.Component {
1314
constructor(props) {
@@ -50,32 +51,41 @@ class ProcessForm extends React.Component {
5051
}
5152

5253
render() {
53-
const { inputs, handleOnSubmit } = this.props;
54+
const { inputs, layers, onSubmit } = this.props;
5455
return (
55-
<form>
56+
<form className="process-form">
5657
{inputs.map((formInput, i) => (
5758
<div>
5859
<h3>{formInput.title}</h3>
5960
<p>{formInput.abstractValue}</p>
6061
{formInput.type === InputTypes.COMPLEX ? (
61-
<LayerInput
62-
layers={this.props.layers}
63-
key={i}
64-
id={i}
65-
onSelect={this.handleAddComplexData}
66-
/>
62+
<div>
63+
<LayersIcon className="process-form-icon" />
64+
<LayerInput
65+
className="layer-select"
66+
layers={layers}
67+
key={i}
68+
id={i}
69+
value={formInput.values[0]}
70+
onSelect={this.handleAddComplexData}
71+
/>
72+
</div>
6773
) : (
68-
<input
69-
key={formInput.identifier}
70-
onChange={this.handleAddLiteralData}
71-
value={formInput.values[0]}
72-
id={`form-input-${i}`}
73-
type="text"
74-
/>
74+
<div>
75+
<TextIcon className="process-form-icon" />
76+
<input
77+
className="literal-text-input"
78+
key={formInput.identifier}
79+
onChange={this.handleAddLiteralData}
80+
value={formInput.values[0]}
81+
id={`form-input-${i}`}
82+
type="text"
83+
/>
84+
</div>
7585
)}
7686
</div>
7787
))}
78-
<button type="button" onClick={this.props.onSubmit}>
88+
<button type="button" className="execute-button" onClick={onSubmit}>
7989
Execute
8090
</button>
8191
</form>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#results-panel {
2+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React from "react";
2+
3+
import "./ResultsPanel";
4+
5+
export default function({ outputs }) {
6+
return (
7+
<div className="results-panel">
8+
<h3>Results</h3>
9+
{outputs.map(output => (<div className="result-item" key={output.identifier}>
10+
{output.identifier}
11+
</div>))}
12+
</div>
13+
);
14+
}

0 commit comments

Comments
 (0)