From 3bbe53685e53a57edbff76f1d219e2871aefd9fd Mon Sep 17 00:00:00 2001 From: rijkvanzanten Date: Thu, 23 Jul 2020 10:48:56 -0400 Subject: [PATCH] Add actions --- src/interfaces/datetime/index.ts | 10 +- src/interfaces/many-to-one/index.ts | 3 +- src/interfaces/types.ts | 3 +- src/lang/en-US/index.json | 42 ++++-- .../field-detail/components/actions.vue | 100 ++++++++++++++ .../field-detail/components/display.vue | 85 ++++++++++++ .../field-detail/components/interface.vue | 85 ++++++++++++ .../field-detail/components/relationship.vue | 9 ++ .../field-detail/components/schema.vue | 125 ++++++++++++++++++ .../field-detail/components/tabs.vue | 34 +++++ .../data-model/field-detail/field-detail.vue | 99 ++++++++++++-- src/stores/fields/types.ts | 2 + 12 files changed, 573 insertions(+), 24 deletions(-) create mode 100644 src/modules/settings/routes/data-model/field-detail/components/actions.vue create mode 100644 src/modules/settings/routes/data-model/field-detail/components/display.vue create mode 100644 src/modules/settings/routes/data-model/field-detail/components/interface.vue create mode 100644 src/modules/settings/routes/data-model/field-detail/components/relationship.vue create mode 100644 src/modules/settings/routes/data-model/field-detail/components/schema.vue create mode 100644 src/modules/settings/routes/data-model/field-detail/components/tabs.vue diff --git a/src/interfaces/datetime/index.ts b/src/interfaces/datetime/index.ts index d399dd7309..bd7a79c59a 100644 --- a/src/interfaces/datetime/index.ts +++ b/src/interfaces/datetime/index.ts @@ -11,9 +11,13 @@ export default defineInterface(({ i18n }) => ({ { field: 'includeSeconds', name: i18n.t('include_seconds'), - width: 'half', - interface: 'toggle', - default_value: false, + system: { + width: 'half', + interface: 'toggle', + }, + database: { + default_value: false, + }, }, ], })); diff --git a/src/interfaces/many-to-one/index.ts b/src/interfaces/many-to-one/index.ts index c4c767d6ff..ccee92fdc8 100644 --- a/src/interfaces/many-to-one/index.ts +++ b/src/interfaces/many-to-one/index.ts @@ -6,7 +6,8 @@ export default defineInterface(({ i18n }) => ({ name: i18n.t('many_to_one'), icon: 'arrow_right_alt', component: InterfaceManyToOne, - types: ['string', 'text', 'integer', 'bigInteger'], + types: ['uuid', 'string', 'text', 'integer', 'bigInteger'], + relationship: 'm2o', options: [ { field: 'template', diff --git a/src/interfaces/types.ts b/src/interfaces/types.ts index ef6aac680a..0d8aacdbfa 100644 --- a/src/interfaces/types.ts +++ b/src/interfaces/types.ts @@ -7,8 +7,9 @@ export type InterfaceConfig = { icon: string; name: string | VueI18n.TranslateResult; component: Component; - options: Partial[] | Component; + options: DeepPartial[] | Component; types: Type[]; + relationship?: null | 'm2o' | 'o2m' | 'm2m'; hideLabel?: boolean; hideLoader?: boolean; }; diff --git a/src/lang/en-US/index.json b/src/lang/en-US/index.json index 9f64ec532a..7027e6200b 100644 --- a/src/lang/en-US/index.json +++ b/src/lang/en-US/index.json @@ -26,9 +26,42 @@ "duplicate_where_to": "Where would you like to duplicate this field to?", "editing_field": "Editing {field}", "within_collectoin": "within {collection}", + + "schema_setup_title": "How should this field save to the database?", + + "key": "Key", + + "alias": "Alias", + "bigInteger": "Big Integer", + "boolean": "Boolean", + "date": "Date", + "datetime": "DateTime", + "decimal": "Decimal", + "float": "Float", + "integer": "Integer", + "json": "JSON", + "string": "String", + "text": "Text", + "time": "Time", + "timestamp": "Timestamp", + "binary": "Binary", + "uuid": "UUID", + "unknown": "Unknown", + + "include_seconds": "Include Seconds", + + "add_note": "Add a helpful note for users...", + + "default_value": "Default Value", + "add_a_default_value": "Add a default value...", + + "allow_null": "Allow NULL", + "allow_null_label": "Can be set to \"NULL\"", + + "interface_setup_title": "How will users view or interact with this field?", + "field_setup_title": "What type of field are you creating?", "relationship_setup_title": "What kind of relationship are you creating?", - "interface_setup_title": "How will users view or interact with this field?", "display_setup_title": "How should this field’s value be displayed?", "schema_options_title": "All set! Below are some optional configuration options...", "creating_field": "Creating New Field", @@ -48,8 +81,6 @@ "database_column_name": "Database Column Name", "translations": "Translations", "note": "Note", - "add_helpful_note": "Enter a helpful comment for App users...", - "default_value": "Default Value", "enter_a_value": "Enter a value...", "length": "Length", "required": "Required", @@ -151,7 +182,6 @@ "interfaces": "Interfaces", "interface_count": "No Interfaces | One Interface | {count} Interfaces", - "datetime": "DateTime", "today": "Today", "yesterday": "Yesterday", @@ -163,7 +193,6 @@ "date-fns_date_short": "MMM d, u", "date-fns_date_short_no_year": "MMM d", "month": "Month", - "date": "Date", "year": "Year", "select_all": "Select All", @@ -225,7 +254,6 @@ "primary_key_field": "Primary Key Field", "type": "Type", "number": "Number", - "string": "String", "creating_new_collection": "Creating New Collection", "status": "Status", "sort": "Sort", @@ -660,7 +688,6 @@ "activity_log": "Activity Log", "add_field_filter": "Add a field filter", "add_new": "Add New", - "add_note": "Add a helpful note for users...", "additional_info": "Additional Info", "admin_email": "Admin Email", "admin_password": "Admin Password", @@ -1026,7 +1053,6 @@ "spacing": "Spacing", "statuses": "Statuses", "template": "Template", - "text": "Text", "translation": "Translation", "translated_field_name": "Translated field name...", "not_translated_in_language": "Not Translated in {language}", diff --git a/src/modules/settings/routes/data-model/field-detail/components/actions.vue b/src/modules/settings/routes/data-model/field-detail/components/actions.vue new file mode 100644 index 0000000000..3cc7486414 --- /dev/null +++ b/src/modules/settings/routes/data-model/field-detail/components/actions.vue @@ -0,0 +1,100 @@ + + + + + diff --git a/src/modules/settings/routes/data-model/field-detail/components/display.vue b/src/modules/settings/routes/data-model/field-detail/components/display.vue new file mode 100644 index 0000000000..dbb9339851 --- /dev/null +++ b/src/modules/settings/routes/data-model/field-detail/components/display.vue @@ -0,0 +1,85 @@ + + + + + diff --git a/src/modules/settings/routes/data-model/field-detail/components/interface.vue b/src/modules/settings/routes/data-model/field-detail/components/interface.vue new file mode 100644 index 0000000000..34673af5dc --- /dev/null +++ b/src/modules/settings/routes/data-model/field-detail/components/interface.vue @@ -0,0 +1,85 @@ + + + + + diff --git a/src/modules/settings/routes/data-model/field-detail/components/relationship.vue b/src/modules/settings/routes/data-model/field-detail/components/relationship.vue new file mode 100644 index 0000000000..d5ee57859b --- /dev/null +++ b/src/modules/settings/routes/data-model/field-detail/components/relationship.vue @@ -0,0 +1,9 @@ + + + diff --git a/src/modules/settings/routes/data-model/field-detail/components/schema.vue b/src/modules/settings/routes/data-model/field-detail/components/schema.vue new file mode 100644 index 0000000000..26e2830335 --- /dev/null +++ b/src/modules/settings/routes/data-model/field-detail/components/schema.vue @@ -0,0 +1,125 @@ + + + + + diff --git a/src/modules/settings/routes/data-model/field-detail/components/tabs.vue b/src/modules/settings/routes/data-model/field-detail/components/tabs.vue new file mode 100644 index 0000000000..453646da9c --- /dev/null +++ b/src/modules/settings/routes/data-model/field-detail/components/tabs.vue @@ -0,0 +1,34 @@ + + + diff --git a/src/modules/settings/routes/data-model/field-detail/field-detail.vue b/src/modules/settings/routes/data-model/field-detail/field-detail.vue index b15b82865b..6f0f54f764 100644 --- a/src/modules/settings/routes/data-model/field-detail/field-detail.vue +++ b/src/modules/settings/routes/data-model/field-detail/field-detail.vue @@ -1,14 +1,40 @@ - - diff --git a/src/stores/fields/types.ts b/src/stores/fields/types.ts index 2dbb188262..c22a838851 100644 --- a/src/stores/fields/types.ts +++ b/src/stores/fields/types.ts @@ -24,6 +24,7 @@ export type Type = | 'json' | 'uuid' | 'binary' + | 'uuid' | 'unknown'; export const types: Type[] = [ @@ -41,6 +42,7 @@ export const types: Type[] = [ 'time', 'timestamp', 'binary', + 'uuid', 'unknown', ];