-
Notifications
You must be signed in to change notification settings - Fork 409
/
Copy pathCatalogServiceEditor.jsx
110 lines (106 loc) · 4.07 KB
/
CatalogServiceEditor.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/*
* Copyright 2020, GeoSolutions Sas.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, {useState} from 'react';
import Spinner from "react-spinkit";
import { FormGroup, Form, Col } from "react-bootstrap";
import Button from '../misc/Button';
import BorderLayout from "../layout/BorderLayout";
import Message from "../I18N/Message";
import AdvancedSettings from './editor/AdvancedSettings';
import MainForm from './editor/MainForm';
export default ({
service = {
title: "",
type: "wms",
url: "",
format: "image/png"
},
serviceTypes = [{ name: "csw", label: "CSW" }],
onChangeTitle = () => {},
onChangeUrl = () => {},
onChangeType = () => {},
id,
urlTooltip,
formatOptions,
buttonStyle,
saving,
onChangeServiceFormat = () => {},
onChangeMetadataTemplate = () => {},
onToggleAdvancedSettings = () => { },
onChangeServiceProperty = () => {},
onToggleTemplate = () => {},
onToggleThumbnail = () => {},
onAddService = () => {},
onDeleteService = () => {},
onChangeCatalogMode = () => {},
onFormatOptionsFetch = () => {},
selectedService,
isLocalizedLayerStylesEnabled,
tileSizeOptions = [256, 512],
formatsLoading,
layerOptions = {},
services,
autoSetVisibilityLimits = false
}) => {
const [valid, setValid] = useState(true);
return (<BorderLayout
bodyClassName="ms2-border-layout-body catalog"
header={
<MainForm
setValid={setValid}
service={service}
serviceTypes={serviceTypes}
onChangeTitle={onChangeTitle}
onChangeUrl={onChangeUrl}
onChangeType={onChangeType}
onChangeServiceProperty={onChangeServiceProperty}
urlTooltip={urlTooltip}
/>
}>
<Form >
<AdvancedSettings
setValid={setValid}
id={id}
service={service}
formatOptions={formatOptions}
buttonStyle={buttonStyle}
saving={saving}
onChangeServiceFormat={onChangeServiceFormat}
onChangeMetadataTemplate={onChangeMetadataTemplate}
onToggleAdvancedSettings={onToggleAdvancedSettings}
onChangeServiceProperty={onChangeServiceProperty}
onToggleTemplate={onToggleTemplate}
onToggleThumbnail={onToggleThumbnail}
isLocalizedLayerStylesEnabled={isLocalizedLayerStylesEnabled}
tileSizeOptions={tileSizeOptions}
currentWMSCatalogLayerSize={layerOptions.tileSize ? layerOptions.tileSize : 256}
selectedService={selectedService}
onFormatOptionsFetch={onFormatOptionsFetch}
formatsLoading={formatsLoading}
autoSetVisibilityLimits={autoSetVisibilityLimits}
/>
<FormGroup controlId="buttons" key="buttons">
<Col xs={12}>
<Button style={buttonStyle} disabled={saving || !valid} onClick={() => onAddService()} key="catalog_add_service_button">
{saving ? <Spinner spinnerName="circle" noFadeIn overrideSpinnerClassName="spinner" /> : null}
<Message msgId="save" />
</Button>
{service && !service.isNew
? <Button style={buttonStyle} onClick={() => onDeleteService(service, services)} key="catalog_delete_service_button">
<Message msgId="catalog.delete" />
</Button>
: null
}
<Button style={buttonStyle} disabled={saving} onClick={() => onChangeCatalogMode("view")} key="catalog_back_view_button">
<Message msgId="cancel" />
</Button>
</Col>
</FormGroup>
</Form>
</BorderLayout>);
};