renaming Record > Row

This commit is contained in:
Michael Shanks 2020-10-09 17:12:55 +01:00
parent 6ba65f56e5
commit 127ce3b59d
12 changed files with 17 additions and 29 deletions

View File

@ -6,7 +6,7 @@ export default {
const createScreen = () => ({ const createScreen = () => ({
props: { props: {
_id: "", _id: "",
_component: "@budibase/standard-components/recorddetail", _component: "@budibase/standard-components/newrow",
_styles: { _styles: {
normal: {}, normal: {},
hover: {}, hover: {},

View File

@ -6,7 +6,7 @@ export default {
const createScreen = () => ({ const createScreen = () => ({
props: { props: {
_id: "", _id: "",
_component: "@budibase/standard-components/recorddetail", _component: "@budibase/standard-components/rowdetail",
_styles: { _styles: {
normal: {}, normal: {},
hover: {}, hover: {},

View File

@ -1,10 +1,9 @@
export default function(models) { export default function(models) {
return models.map(model => { return models.map(model => {
const fields = Object.keys(model.schema) const fields = Object.keys(model.schema)
const heading = const heading = fields.length > 0 ? `{{ data.${fields[0]} }}` : "Add Row"
fields.length > 0 ? `{{ data.${fields[0]} }}` : "Create Record"
return { return {
name: `New Record - ${model.name}`, name: `New Row - ${model.name}`,
create: () => createScreen(model, heading), create: () => createScreen(model, heading),
id: NEW_RECORD_TEMPLATE, id: NEW_RECORD_TEMPLATE,
} }
@ -16,7 +15,7 @@ export const NEW_RECORD_TEMPLATE = "NEW_RECORD_TEMPLATE"
const createScreen = (model, heading) => ({ const createScreen = (model, heading) => ({
props: { props: {
_id: "", _id: "",
_component: "@budibase/standard-components/newrecord", _component: "@budibase/standard-components/newrow",
_styles: { _styles: {
normal: {}, normal: {},
hover: {}, hover: {},

View File

@ -1,10 +1,9 @@
export default function(models) { export default function(models) {
return models.map(model => { return models.map(model => {
const fields = Object.keys(model.schema) const fields = Object.keys(model.schema)
const heading = const heading = fields.length > 0 ? `{{ data.${fields[0]} }}` : "Detail"
fields.length > 0 ? `{{ data.${fields[0]} }}` : "Edit Record"
return { return {
name: `Record Detail - ${model.name}`, name: `Row Detail - ${model.name}`,
create: () => createScreen(model, heading), create: () => createScreen(model, heading),
id: RECORD_DETAIL_TEMPLATE, id: RECORD_DETAIL_TEMPLATE,
} }
@ -16,7 +15,7 @@ export const RECORD_DETAIL_TEMPLATE = "RECORD_DETAIL_TEMPLATE"
const createScreen = (model, heading) => ({ const createScreen = (model, heading) => ({
props: { props: {
_id: "", _id: "",
_component: "@budibase/standard-components/recorddetail", _component: "@budibase/standard-components/rowdetail",
_styles: { _styles: {
normal: {}, normal: {},
hover: {}, hover: {},

View File

@ -1,7 +1,7 @@
export default function(models) { export default function(models) {
return models.map(model => { return models.map(model => {
return { return {
name: `Record List - ${model.name}`, name: `List - ${model.name}`,
create: () => createScreen(model), create: () => createScreen(model),
id: RECORD_LIST_TEMPLATE, id: RECORD_LIST_TEMPLATE,
} }

View File

@ -73,7 +73,7 @@
{#if fields} {#if fields}
{#each fields as field} {#each fields as field}
<Label size="m" color="dark">Field</Label> <Label size="m" color="dark">Column</Label>
<Select secondary bind:value={field.name} on:blur={rebuildParameters}> <Select secondary bind:value={field.name} on:blur={rebuildParameters}>
<option value="" /> <option value="" />
{#each schemaFields as schemaField} {#each schemaFields as schemaField}

View File

@ -84,16 +84,6 @@
route = "/" + event.target.value route = "/" + event.target.value
} }
} }
const componentShortName = fullname => {
const parts = fullname.split("/")
const shortName = parts[parts.length - 1]
// make known ones a bit prettier
if (shortName === "container") return "Container"
if (shortName === "recorddetail") return "Record Detail"
if (shortName === "newrecord") return "New Record"
return shortName
}
</script> </script>
<ModalContent title="New Screen" confirmText="Create Screen" onConfirm={save}> <ModalContent title="New Screen" confirmText="Create Screen" onConfirm={save}>

View File

@ -1094,7 +1094,7 @@ export default {
// }, // },
{ {
name: "Record Detail", name: "Record Detail",
_component: "@budibase/standard-components/recorddetail", _component: "@budibase/standard-components/rowdetail",
description: description:
"Loads a record, using an id from the URL, which can be used with {{ context }}, in children", "Loads a record, using an id from the URL, which can be used with {{ context }}, in children",
icon: "ri-profile-line", icon: "ri-profile-line",
@ -1106,7 +1106,7 @@ export default {
}, },
{ {
name: "Record Detail", name: "Record Detail",
_component: "@budibase/standard-components/newrecord", _component: "@budibase/standard-components/newrow",
description: description:
"Sets up a new record for creation, which can be used with {{ context }}, in children", "Sets up a new record for creation, which can be used with {{ context }}, in children",
icon: "ri-profile-line", icon: "ri-profile-line",

View File

@ -261,7 +261,7 @@
"destinationUrl": "string" "destinationUrl": "string"
} }
}, },
"recorddetail": { "rowdetail": {
"description": "Loads a record, using an ID in the url", "description": "Loads a record, using an ID in the url",
"context": "model", "context": "model",
"children": true, "children": true,
@ -271,7 +271,7 @@
"model": "models" "model": "models"
} }
}, },
"newrecord": { "newrow": {
"description": "Prepares a new record for creation", "description": "Prepares a new record for creation",
"context": "model", "context": "model",
"children": true, "children": true,

View File

@ -40,7 +40,7 @@
throw new Error("Failed to fetch record.", response) throw new Error("Failed to fetch record.", response)
} }
} else { } else {
throw new Exception("Record ID was not supplied to RecordDetail") throw new Exception("Record ID was not supplied to RowDetail")
} }
if (record) { if (record) {

View File

@ -26,8 +26,8 @@ export { default as embed } from "./Embed.svelte"
export { default as stackedlist } from "./StackedList.svelte" export { default as stackedlist } from "./StackedList.svelte"
export { default as card } from "./Card.svelte" export { default as card } from "./Card.svelte"
export { default as cardhorizontal } from "./CardHorizontal.svelte" export { default as cardhorizontal } from "./CardHorizontal.svelte"
export { default as recorddetail } from "./RecordDetail.svelte" export { default as rowdetail } from "./RowDetail.svelte"
export { default as newrecord } from "./NewRecord.svelte" export { default as newrow } from "./NewRow.svelte"
export { default as datepicker } from "./DatePicker.svelte" export { default as datepicker } from "./DatePicker.svelte"
export * from "./Chart" export * from "./Chart"
export { default as icon } from "./Icon.svelte" export { default as icon } from "./Icon.svelte"