From 4b5fa6a0932709430a11cccda8859ae5ddaf9001 Mon Sep 17 00:00:00 2001 From: Dean Date: Thu, 6 Oct 2022 13:02:17 +0100 Subject: [PATCH] Review feedback changes. Changed 'Code' labelling to 'Scanned Code' --- .../store/screenTemplates/utils/commonComponents.js | 2 +- .../backend/DataTable/modals/CreateEditColumn.svelte | 2 +- .../backend/TableNavigator/TableDataImport.svelte | 4 ++-- .../src/components/design/settings/componentSettings.js | 2 +- .../design/settings/controls/FormFieldSelect.svelte | 2 +- packages/builder/src/constants/backend/index.js | 8 ++++---- packages/client/manifest.json | 2 +- .../src/components/app/forms/CodeScannerField.svelte | 2 +- packages/client/src/constants.js | 2 +- packages/server/src/constants/index.js | 4 ++-- packages/server/src/integrations/base/sqlTable.ts | 2 +- packages/server/src/utilities/csvParser.js | 2 +- packages/server/src/utilities/rowProcessor/index.js | 2 +- 13 files changed, 18 insertions(+), 18 deletions(-) diff --git a/packages/builder/src/builderStore/store/screenTemplates/utils/commonComponents.js b/packages/builder/src/builderStore/store/screenTemplates/utils/commonComponents.js index cc8c5ef712..a6c71ae54e 100644 --- a/packages/builder/src/builderStore/store/screenTemplates/utils/commonComponents.js +++ b/packages/builder/src/builderStore/store/screenTemplates/utils/commonComponents.js @@ -138,7 +138,7 @@ const fieldTypeToComponentMap = { attachment: "attachmentfield", link: "relationshipfield", json: "jsonfield", - code: "codescanner", + scannedcode: "codescanner", } export function makeDatasourceFormComponents(datasource) { diff --git a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte index 8f6b4a746e..a4cddf512f 100644 --- a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte +++ b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte @@ -261,7 +261,7 @@ } else { return [ FIELDS.STRING, - FIELDS.CODE, + FIELDS.SCANNEDCODE, FIELDS.LONGFORM, FIELDS.OPTIONS, FIELDS.DATETIME, diff --git a/packages/builder/src/components/backend/TableNavigator/TableDataImport.svelte b/packages/builder/src/components/backend/TableNavigator/TableDataImport.svelte index 2b53a75152..4d827b59b5 100644 --- a/packages/builder/src/components/backend/TableNavigator/TableDataImport.svelte +++ b/packages/builder/src/components/backend/TableNavigator/TableDataImport.svelte @@ -125,8 +125,8 @@ value: FIELDS.ARRAY.type, }, { - label: "Code", - value: FIELDS.CODE.type, + label: "Scanned Code", + value: FIELDS.SCANNEDCODE.type, }, ] diff --git a/packages/builder/src/components/design/settings/componentSettings.js b/packages/builder/src/components/design/settings/componentSettings.js index 21dbeb4beb..eadaecd8cc 100644 --- a/packages/builder/src/components/design/settings/componentSettings.js +++ b/packages/builder/src/components/design/settings/componentSettings.js @@ -51,7 +51,7 @@ const componentMap = { "field/link": FormFieldSelect, "field/array": FormFieldSelect, "field/json": FormFieldSelect, - "field/code": FormFieldSelect, + "field/scannedcode": FormFieldSelect, // Some validation types are the same as others, so not all types are // explicitly listed here. e.g. options uses string validation "validation/string": ValidationEditor, diff --git a/packages/builder/src/components/design/settings/controls/FormFieldSelect.svelte b/packages/builder/src/components/design/settings/controls/FormFieldSelect.svelte index 48e8213ee1..81b01b2b77 100644 --- a/packages/builder/src/components/design/settings/controls/FormFieldSelect.svelte +++ b/packages/builder/src/components/design/settings/controls/FormFieldSelect.svelte @@ -26,7 +26,7 @@ let entries = Object.entries(schema ?? {}) let types = [] - if ((type === "field/options", type === "field/code")) { + if ((type === "field/options", type === "field/scannedcode")) { // allow options to be used on both options and string fields types = [type, "field/string"] } else { diff --git a/packages/builder/src/constants/backend/index.js b/packages/builder/src/constants/backend/index.js index bd2d5bc4e3..93bb90344e 100644 --- a/packages/builder/src/constants/backend/index.js +++ b/packages/builder/src/constants/backend/index.js @@ -8,9 +8,9 @@ export const FIELDS = { presence: false, }, }, - CODE: { - name: "Code", - type: "code", + SCANNEDCODE: { + name: "Scanned Code", + type: "scannedcode", constraints: { type: "string", length: {}, @@ -157,7 +157,7 @@ export const ALLOWABLE_STRING_OPTIONS = [ FIELDS.STRING, FIELDS.OPTIONS, FIELDS.LONGFORM, - FIELDS.CODE, + FIELDS.SCANNEDCODE, ] export const ALLOWABLE_STRING_TYPES = ALLOWABLE_STRING_OPTIONS.map( opt => opt.type diff --git a/packages/client/manifest.json b/packages/client/manifest.json index acb05d58bc..64d90875a7 100644 --- a/packages/client/manifest.json +++ b/packages/client/manifest.json @@ -3169,7 +3169,7 @@ ], "settings": [ { - "type": "field/code", + "type": "field/scannedcode", "label": "Field", "key": "field", "required": true diff --git a/packages/client/src/components/app/forms/CodeScannerField.svelte b/packages/client/src/components/app/forms/CodeScannerField.svelte index e2da89d1b5..38eab79dc8 100644 --- a/packages/client/src/components/app/forms/CodeScannerField.svelte +++ b/packages/client/src/components/app/forms/CodeScannerField.svelte @@ -4,7 +4,7 @@ export let field export let label - export let type = "code" + export let type = "scannedcode" export let disabled = false export let validation export let defaultValue = "" diff --git a/packages/client/src/constants.js b/packages/client/src/constants.js index 9bd6d27bb0..bad0c30371 100644 --- a/packages/client/src/constants.js +++ b/packages/client/src/constants.js @@ -1,6 +1,6 @@ export const FieldTypes = { STRING: "string", - CODE: "code", + SCANNEDCODE: "scannedcode", LONGFORM: "longform", OPTIONS: "options", NUMBER: "number", diff --git a/packages/server/src/constants/index.js b/packages/server/src/constants/index.js index ef15711cb7..4b54424efa 100644 --- a/packages/server/src/constants/index.js +++ b/packages/server/src/constants/index.js @@ -31,7 +31,7 @@ exports.NoEmptyFilterStrings = [ exports.FieldTypes = { STRING: "string", - CODE: "code", + SCANNEDCODE: "scannedcode", LONGFORM: "longform", OPTIONS: "options", NUMBER: "number", @@ -52,7 +52,7 @@ exports.CanSwitchTypes = [ exports.FieldTypes.STRING, exports.FieldTypes.OPTIONS, exports.FieldTypes.LONGFORM, - exports.FieldTypes.CODE, + exports.FieldTypes.SCANNEDCODE, ], [exports.FieldTypes.BOOLEAN, exports.FieldTypes.NUMBER], ] diff --git a/packages/server/src/integrations/base/sqlTable.ts b/packages/server/src/integrations/base/sqlTable.ts index 4626297ddc..52eb25be9d 100644 --- a/packages/server/src/integrations/base/sqlTable.ts +++ b/packages/server/src/integrations/base/sqlTable.ts @@ -40,7 +40,7 @@ function generateSchema( case FieldTypes.STRING: case FieldTypes.OPTIONS: case FieldTypes.LONGFORM: - case FieldTypes.CODE: + case FieldTypes.SCANNEDCODE: schema.text(key) break case FieldTypes.NUMBER: diff --git a/packages/server/src/utilities/csvParser.js b/packages/server/src/utilities/csvParser.js index 7eba0493eb..08962032b6 100644 --- a/packages/server/src/utilities/csvParser.js +++ b/packages/server/src/utilities/csvParser.js @@ -4,7 +4,7 @@ const { FieldTypes } = require("../constants") const VALIDATORS = { [FieldTypes.STRING]: () => true, [FieldTypes.OPTIONS]: () => true, - [FieldTypes.CODE]: () => true, + [FieldTypes.SCANNEDCODE]: () => true, [FieldTypes.NUMBER]: attribute => { // allow not to be present if (!attribute) { diff --git a/packages/server/src/utilities/rowProcessor/index.js b/packages/server/src/utilities/rowProcessor/index.js index 55b1c09538..b61fbe66e1 100644 --- a/packages/server/src/utilities/rowProcessor/index.js +++ b/packages/server/src/utilities/rowProcessor/index.js @@ -48,7 +48,7 @@ const TYPE_TRANSFORM_MAP = { [null]: "", [undefined]: undefined, }, - [FieldTypes.CODE]: { + [FieldTypes.SCANNEDCODE]: { "": "", [null]: "", [undefined]: undefined,