]> ToastFreeware Gitweb - philipp/winterrodeln/wradmin.git/blob - wradmin/templates/json_editor.html
Prevent some updates.
[philipp/winterrodeln/wradmin.git] / wradmin / templates / json_editor.html
1 {% extends "master.html" %}
2 {% block head %}
3     <meta charset="utf-8" />
4     <title>{% block title %}JSON Editor{% endblock %}</title>
5     <meta content="text/html; charset=UTF-8" http-equiv="content-type" />
6     <meta name="robots" content="noindex, nofollow" />
7     <link rel="shortcut icon" href="{{url_for('static', filename='favicon.png')}}" />
8     <script src="https://cdn.jsdelivr.net/npm/@json-editor/json-editor@latest/dist/jsoneditor.min.js"></script>
9     <link rel="stylesheet" type="text/css" media="screen" href="{{url_for('static', filename='style.css')}}" />
10 {% endblock %}
11
12 {% block content %}
13
14 <p><strong>Achtung:</strong> Das bearbeitete JSON wird derzeit nicht gespeichert. Es muss manuell eingetragen werden.</p>
15
16 <div id='editor_holder'></div>
17 <button id='submit'>Submit (console.log)</button>
18
19 <script>
20     JSONEditor.defaults.options = {simplemde: {spellChecker: false}};
21
22     JSONEditor.defaults.languages.de = {
23     }
24
25     JSONEditor.defaults.languages.de_ = {
26     error_notset: 'Eigenschaft ist nicht gesetzt',
27     error_notempty: 'Wert erforderlich',
28     error_enum: 'Wert muss einem der vorgegebenen entsprechen',
29     error_anyOf: 'Wert muss mindestens nach einem der vorgegebenen Schemas gültig sein',
30     error_oneOf: 'Wert muss genau einem der vorgegebenen Schemas entsprechen. Derzeit ist es nach {{0}} Schemas gültig.',
31     error_not: 'Wert darf nach dem vorgegebenen Schema nicht gültig sein',
32     error_type_union: 'Wert muss einer der vorgegebenen Typen entsprechen',
33     error_type: 'Wert muss vom Typ {{0}} sein',
34     error_disallow_union: 'Wert darf nicht einer der vorgegebenen unerlaubten Typen sein',
35     error_disallow: 'Wert darf nicht vom Typ {{0}} sein',
36     error_multipleOf: 'Wert muss das vielfache von {{0}} sein',
37     error_maximum_excl: 'Wert muss kleiner sein als {{0}}',
38     error_maximum_incl: 'Wert darf maximal {{0}} sein',
39     error_minimum_excl: 'Wert muss größer sein als {{0}}',
40     error_minimum_incl: 'Wert muss mindestens {{0}} sein',
41     error_maxLength: 'Wert darf maximal {{0}} Zeichen lang sein',
42     error_minLength: 'Wert muss mindestens {{0}} Zeichen lang sein',
43     error_pattern: 'Wert muss dem vorgegebenen Muster {{0}} entsprechen',
44     error_additionalItems: 'In der Liste sind keine zusätzlichen Einträge erlaubt',
45     /**
46      * When there are to many items in an array
47      * @variables This key takes one variable: The maximum item count
48      */
49     error_maxItems: 'Value must have at most {{0}} items',
50     /**
51      * When there are not enough items in an array
52      * @variables This key takes one variable: The minimum item count
53      */
54     error_minItems: 'Value must have at least {{0}} items',
55     /**
56      * When an array is supposed to have unique items but has duplicates
57      */
58     error_uniqueItems: 'Array must have unique items',
59     /**
60      * When there are too many properties in an object
61      * @variables This key takes one variable: The maximum property count
62      */
63     error_maxProperties: 'Object must have at most {{0}} properties',
64     /**
65      * When there are not enough properties in an object
66      * @variables This key takes one variable: The minimum property count
67      */
68     error_minProperties: 'Object must have at least {{0}} properties',
69     /**
70      * When a required property is not defined
71      * @variables This key takes one variable: The name of the missing property
72      */
73     error_required: "Object is missing the required property '{{0}}'",
74     /**
75      * When there is an additional property is set whereas there should be none
76      * @variables This key takes one variable: The name of the additional property
77      */
78     error_additional_properties: 'No additional properties allowed, but property {{0}} is set',
79     /**
80      * When there is a propertyName that sets a max length and a property name exceeds the max length
81      * @variables This key takes one variable: The name of the invalid property
82      */
83     error_property_names_exceeds_maxlength: 'Property name {{0}} exceeds maxLength',
84     /**
85      * When there is a propertyName that sets an enum and a property name matches none of the possible enum
86      * @variables This key takes one variable: The name of the invalid property
87      */
88     error_property_names_enum_mismatch: 'Property name {{0}} does not match any enum values',
89     /**
90      * When there is a propertyName that sets a pattern and a property name does not match the pattern
91      * @variables This key takes one variable: The name of the invalid property
92      */
93     error_property_names_pattern_mismatch: 'Property name {{0}} does not match pattern',
94     /**
95      * When the propertyName is set to false and there is at least one property
96      * @variables This key takes one variable: The name of the invalid property
97      */
98     error_property_names_false: 'Property name {{0}} fails when propertyName is false',
99     /**
100      * When the propertyName specifies a maxLength that is not a number
101      * @variables This key takes one variable: The name of the current property
102      */
103     error_property_names_maxlength: 'Property name {{0}} cannot match invalid maxLength',
104     /**
105      * When the propertyName specifies an enum that is not an array
106      * @variables This key takes one variable: The name of the current property
107      */
108     error_property_names_enum: 'Property name {{0}} cannot match invalid enum',
109     /**
110      * When the propertyName specifies a pattern that is not a string
111      * @variables This key takes one variable: The name of the current property
112      */
113     error_property_names_pattern: 'Property name {{0}} cannot match invalid pattern',
114     /**
115      * When the propertyName is unsupported
116      * @variables This key takes one variable: The name of the invalid propertyName
117      */
118     error_property_names_unsupported: 'Unsupported propertyName {{0}}',
119     /**
120      * When a dependency is not resolved
121      * @variables This key takes one variable: The name of the missing property for the dependency
122      */
123     error_dependency: 'Must have property {{0}}',
124     /**
125      * When a date is in incorrect format
126      * @variables This key takes one variable: The valid format
127      */
128     error_date: 'Date must be in the format {{0}}',
129     /**
130      * When a time is in incorrect format
131      * @variables This key takes one variable: The valid format
132      */
133     error_time: 'Time must be in the format {{0}}',
134     /**
135      * When a datetime-local is in incorrect format
136      * @variables This key takes one variable: The valid format
137      */
138     error_datetime_local: 'Datetime must be in the format {{0}}',
139     /**
140      * When a integer date is less than 1 January 1970
141      */
142     error_invalid_epoch: 'Date must be greater than 1 January 1970',
143     /**
144      * When an IPv4 is in incorrect format
145      */
146     error_ipv4: 'Value must be a valid IPv4 address in the form of 4 numbers between 0 and 255, separated by dots',
147     /**
148      * When an IPv6 is in incorrect format
149      */
150     error_ipv6: 'Value must be a valid IPv6 address',
151     /**
152      * When a hostname is in incorrect format
153      */
154     error_hostname: 'The hostname has the wrong format',
155     /**
156      * Text on Delete All buttons
157      */
158     button_delete_all: 'All',
159     /**
160      * Title on Delete All buttons
161      */
162     button_delete_all_title: 'Delete All',
163     /**
164      * Text on Delete Last buttons
165      * @variable This key takes one variable: The title of object to delete
166      */
167     button_delete_last: 'Last {{0}}',
168     /**
169      * Title on Delete Last buttons
170      * @variable This key takes one variable: The title of object to delete
171      */
172     button_delete_last_title: 'Delete Last {{0}}',
173     /**
174      * Title on Add Row buttons
175      * @variable This key takes one variable: The title of object to add
176      */
177     button_add_row_title: 'Add {{0}}',
178     /**
179      * Title on Move Down buttons
180      */
181     button_move_down_title: 'Move down',
182     /**
183      * Title on Move Up buttons
184      */
185     button_move_up_title: 'Move up',
186     /**
187      * Title on Object Properties buttons
188      */
189     button_object_properties: 'Object Properties',
190     /**
191      * Title on Delete Row buttons
192      * @variable This key takes one variable: The title of object to delete
193      */
194     button_delete_row_title: '{{0}} löschen',
195     /**
196      * Title on Delete Row buttons, short version (no parameter with the object title)
197      */
198     button_delete_row_title_short: 'Löschen',
199     /**
200      * Title on Copy Row buttons, short version (no parameter with the object title)
201      */
202     button_copy_row_title_short: 'Copy',
203     /**
204      * Title on Collapse buttons
205      */
206     button_collapse: 'Collapse',
207     /**
208      * Title on Expand buttons
209      */
210     button_expand: 'Expand',
211     /**
212      * Title on Flatpickr toggle buttons
213      */
214     flatpickr_toggle_button: 'Toggle',
215     /**
216      * Title on Flatpickr clear buttons
217      */
218     flatpickr_clear_button: 'Clear',
219     /**
220      * Choices input field placeholder text
221      */
222     choices_placeholder_text: 'Start typing to add value',
223     /**
224      * Default title for array items
225      */
226     default_array_item_title: 'item',
227     /**
228      * Warning when deleting a node
229      */
230     button_delete_node_warning: 'Are you sure you want to remove this node?'
231 }
232
233
234
235
236
237     JSONEditor.defaults.language = "de";
238
239
240     // Initialize the editor with a JSON schema
241     var editor = new JSONEditor(document.getElementById('editor_holder'), {
242         schema: {"$ref": {{schema_url|tojson}}},
243         theme: 'bootstrap4',
244         ajax: true
245     });
246
247     editor.on('ready',() => {
248         fetch({{json_url|tojson}}).then(
249             function(response) {
250                 return response.json();
251             }).then(
252                 function(data) {
253                     editor.setValue(data);
254                 }
255             ).catch(function (err) {
256                 console.log(err);
257             })
258     });
259
260
261     // Hook up the submit button to log to the console
262     document.getElementById('submit').addEventListener('click',function() {
263         // Get the value from the editor
264         console.log(editor.getValue());
265     });
266 </script>
267 {% endblock %}