Skip to content

Commit a20ed9d

Browse files
authored
Merge pull request #427 from pchemguy/docs-cleanup
Added "parameter_type" table and associated FK
2 parents 1360d54 + 6ae4f35 commit a20ed9d

File tree

4 files changed

+35
-29
lines changed

4 files changed

+35
-29
lines changed

examples/official-site/sqlpage/migrations/01_documentation.sql

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,19 @@ CREATE TABLE component(
55
introduced_in_version TEXT
66
);
77

8+
CREATE TABLE parameter_type(
9+
name TEXT PRIMARY KEY
10+
);
11+
INSERT INTO parameter_type(name) VALUES
12+
('BOOLEAN'), ('COLOR'), ('HTML'), ('ICON'), ('INTEGER'), ('JSON'), ('REAL'), ('TEXT'), ('TIMESTAMP'), ('URL');
13+
814
CREATE TABLE parameter(
915
top_level BOOLEAN DEFAULT FALSE,
1016
name TEXT,
1117
component TEXT REFERENCES component(name) ON DELETE CASCADE,
1218
description TEXT,
1319
description_md TEXT,
14-
type TEXT,
20+
type TEXT REFERENCES parameter_type(name) ON DELETE CASCADE,
1521
optional BOOLEAN DEFAULT FALSE,
1622
PRIMARY KEY (component, top_level, name)
1723
);
@@ -221,29 +227,29 @@ INSERT INTO parameter(component, name, description, type, top_level, optional) S
221227
('placeholder', 'A placeholder text that will be shown in the field when is is empty.', 'TEXT', FALSE, TRUE),
222228
('value', 'A default value that will already be present in the field when the user loads the page.', 'TEXT', FALSE, TRUE),
223229
('options', 'A json array of objects containing the label and value of all possible options of a select field. Used only when type=select. JSON objects in the array can contain the properties "label", "value" and "selected".', 'JSON', FALSE, TRUE),
224-
('required', 'Set this to true to prevent the form contents from being sent if this field is left empty by the user.', 'BOOL', FALSE, TRUE),
225-
('min', 'The minimum value to accept for an input of type number', 'NUMBER', FALSE, TRUE),
226-
('max', 'The minimum value to accept for an input of type number', 'NUMBER', FALSE, TRUE),
227-
('checked', 'Used only for checkboxes and radio buttons. Indicates whether the checkbox should appear as already checked.', 'BOOL', FALSE, TRUE),
228-
('multiple', 'Used only for select elements. Indicates that multiple elements can be selected simultaneously. When using multiple, you should add square brackets after the variable name: ''my_variable[]'' as name', 'BOOL', FALSE, TRUE),
229-
('searchable', 'For select and multiple-select elements, displays them with a nice dropdown that allows searching for options.', 'BOOL', FALSE, TRUE),
230-
('dropdown', 'An alias for "searchable".', 'BOOL', FALSE, TRUE),
231-
('create_new', 'In a multiselect with a dropdown, this option allows the user to enter new values, that are not in the list of options.', 'BOOL', FALSE, TRUE),
232-
('step', 'The increment of values in an input of type number. Set to 1 to allow only integers.', 'NUMBER', FALSE, TRUE),
230+
('required', 'Set this to true to prevent the form contents from being sent if this field is left empty by the user.', 'BOOLEAN', FALSE, TRUE),
231+
('min', 'The minimum value to accept for an input of type number', 'REAL', FALSE, TRUE),
232+
('max', 'The minimum value to accept for an input of type number', 'REAL', FALSE, TRUE),
233+
('checked', 'Used only for checkboxes and radio buttons. Indicates whether the checkbox should appear as already checked.', 'BOOLEAN', FALSE, TRUE),
234+
('multiple', 'Used only for select elements. Indicates that multiple elements can be selected simultaneously. When using multiple, you should add square brackets after the variable name: ''my_variable[]'' as name', 'BOOLEAN', FALSE, TRUE),
235+
('searchable', 'For select and multiple-select elements, displays them with a nice dropdown that allows searching for options.', 'BOOLEAN', FALSE, TRUE),
236+
('dropdown', 'An alias for "searchable".', 'BOOLEAN', FALSE, TRUE),
237+
('create_new', 'In a multiselect with a dropdown, this option allows the user to enter new values, that are not in the list of options.', 'BOOLEAN', FALSE, TRUE),
238+
('step', 'The increment of values in an input of type number. Set to 1 to allow only integers.', 'REAL', FALSE, TRUE),
233239
('description', 'A helper text to display near the input field.', 'TEXT', FALSE, TRUE),
234240
('pattern', 'A regular expression that the value must match. For instance, [0-9]{3} will only accept 3 digits.', 'TEXT', FALSE, TRUE),
235-
('autofocus', 'Automatically focus the field when the page is loaded', 'BOOL', FALSE, TRUE),
236-
('width', 'Width of the form field, between 1 and 12.', 'NUMBER', FALSE, TRUE),
237-
('autocomplete', 'Whether the browser should suggest previously entered values for this field.', 'BOOL', FALSE, TRUE),
238-
('minlength', 'Minimum length of text allowed in the field.', 'NUMBER', FALSE, TRUE),
239-
('maxlength', 'Maximum length of text allowed in the field.', 'NUMBER', FALSE, TRUE),
241+
('autofocus', 'Automatically focus the field when the page is loaded', 'BOOLEAN', FALSE, TRUE),
242+
('width', 'Width of the form field, between 1 and 12.', 'INTEGER', FALSE, TRUE),
243+
('autocomplete', 'Whether the browser should suggest previously entered values for this field.', 'BOOLEAN', FALSE, TRUE),
244+
('minlength', 'Minimum length of text allowed in the field.', 'INTEGER', FALSE, TRUE),
245+
('maxlength', 'Maximum length of text allowed in the field.', 'INTEGER', FALSE, TRUE),
240246
('formaction', 'When type is "submit", this specifies the URL of the file that will handle the form submission. Useful when you need multiple submit buttons.', 'TEXT', FALSE, TRUE),
241247
('class', 'A CSS class to apply to the form element.', 'TEXT', FALSE, TRUE),
242248
('prefix_icon','Icon to display on the left side of the input field, on the same line.','ICON',FALSE,TRUE),
243249
('prefix','Text to display on the left side of the input field, on the same line.','TEXT',FALSE,TRUE),
244250
('suffix','Short text to display after th input, on the same line. Useful to add units or a currency symbol to an input.','TEXT',FALSE,TRUE),
245-
('readonly','Set to true to prevent the user from modifying the value of the input field.','BOOL',FALSE,TRUE),
246-
('disabled','Makes the field non-editable, non-focusable, and not submitted with the form. Use readonly instead for simple non-editable fields.','BOOL',FALSE,TRUE),
251+
('readonly','Set to true to prevent the user from modifying the value of the input field.','BOOLEAN',FALSE,TRUE),
252+
('disabled','Makes the field non-editable, non-focusable, and not submitted with the form. Use readonly instead for simple non-editable fields.','BOOLEAN',FALSE,TRUE),
247253
('id','A unique identifier for the input, which can then be used to select and manage the field with Javascript code. Usefull for advanced using as setting client side event listeners, interactive control of input field (disabled, visibility, read only, e.g.) and AJAX requests.','TEXT',FALSE,TRUE)
248254
) x;
249255
INSERT INTO example(component, description, properties) VALUES
@@ -467,14 +473,14 @@ INSERT INTO parameter(component, name, description, type, top_level, optional) S
467473
('title', 'The name of the chart.', 'TEXT', TRUE, TRUE),
468474
('type', 'The type of chart: "line", "area", "bar", "column", "pie", "scatter", "bubble", or "heatmap".', 'TEXT', TRUE, FALSE),
469475
('time', 'Whether the x-axis represents time. If set to true, the x values will be parsed and formatted as dates for the user.', 'BOOLEAN', TRUE, TRUE),
470-
('ymin', 'The minimal value for the y-axis.', 'NUMBER', TRUE, TRUE),
471-
('ymax', 'The maximum value for the y-axis.', 'NUMBER', TRUE, TRUE),
476+
('ymin', 'The minimal value for the y-axis.', 'REAL', TRUE, TRUE),
477+
('ymax', 'The maximum value for the y-axis.', 'REAL', TRUE, TRUE),
472478
('xtitle', 'Title of the x axis, displayed below it.', 'TEXT', TRUE, TRUE),
473479
('ytitle', 'Title of the y axis, displayed to its left.', 'TEXT', TRUE, TRUE),
474480
('ztitle', 'Title of the z axis, displayed in tooltips.', 'TEXT', TRUE, TRUE),
475-
('xticks', 'Number of ticks on the x axis.', 'NUMBER', TRUE, TRUE),
476-
('ystep', 'Step between ticks on the y axis.', 'NUMBER', TRUE, TRUE),
477-
('marker', 'Marker size', 'NUMBER', TRUE, TRUE),
481+
('xticks', 'Number of ticks on the x axis.', 'INTEGER', TRUE, TRUE),
482+
('ystep', 'Step between ticks on the y axis.', 'REAL', TRUE, TRUE),
483+
('marker', 'Marker size', 'REAL', TRUE, TRUE),
478484
('labels', 'Whether to show the data labels on the chart or not.', 'BOOLEAN', TRUE, TRUE),
479485
('color', 'The name of a color in which to display the chart. If there are multiple series in the chart, this parameter can be repeated multiple times.', 'COLOR', TRUE, TRUE),
480486
('stacked', 'Whether to cumulate values from different series.', 'BOOLEAN', TRUE, TRUE),
@@ -483,10 +489,10 @@ INSERT INTO parameter(component, name, description, type, top_level, optional) S
483489
('horizontal', 'Displays a bar chart with horizontal bars instead of vertical ones.', 'BOOLEAN', TRUE, TRUE),
484490
('height', 'Height of the chart, in pixels. By default: 250', 'INTEGER', TRUE, TRUE),
485491
-- item level
486-
('x', 'The value of the point on the horizontal axis', 'NUMBER', FALSE, FALSE),
487-
('y', 'The value of the point on the vertical axis', 'NUMBER', FALSE, FALSE),
488-
('label', 'An alias for parameter "x"', 'NUMBER', FALSE, TRUE),
489-
('value', 'An alias for parameter "y"', 'NUMBER', FALSE, TRUE),
492+
('x', 'The value of the point on the horizontal axis', 'REAL', FALSE, FALSE),
493+
('y', 'The value of the point on the vertical axis', 'REAL', FALSE, FALSE),
494+
('label', 'An alias for parameter "x"', 'REAL', FALSE, TRUE),
495+
('value', 'An alias for parameter "y"', 'REAL', FALSE, TRUE),
490496
('series', 'If multiple series are represented and share the same y-axis, this parameter can be used to distinguish between them.', 'TEXT', FALSE, TRUE)
491497
) x;
492498
INSERT INTO example(component, description, properties) VALUES

examples/official-site/sqlpage/migrations/28_tracking_component.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ VALUES (
5050
'tracking',
5151
'width',
5252
'Width of the component, between 1 and 12.',
53-
'NUMBER',
53+
'INTEGER',
5454
TRUE,
5555
TRUE
5656
),

examples/official-site/sqlpage/migrations/34_carousel.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ VALUES
5050
'carousel',
5151
'width',
5252
'Width of the component, between 1 and 12. Default is 12.',
53-
'NUMBER',
53+
'INTEGER',
5454
TRUE,
5555
TRUE
5656
),

examples/official-site/sqlpage/migrations/35_code_title.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ INSERT INTO parameter (component,name,description,type,top_level,optional) VALUE
2424
'title',
2525
'level',
2626
'Set the heading level (default level is 1)',
27-
'NUMBER',
27+
'INTEGER',
2828
TRUE,
2929
TRUE
3030
);

0 commit comments

Comments
 (0)