collection name uses nodeId by default, and field is removed

This commit is contained in:
Michael Shanks 2020-03-25 10:45:11 +00:00
parent e20bb608dd
commit bcd8b602b3
3 changed files with 5 additions and 8 deletions

View File

@ -101,12 +101,8 @@
<h4 class="budibase__label--big">Settings</h4> <h4 class="budibase__label--big">Settings</h4>
<form class="uk-form-stacked"> <form class="uk-form-stacked">
<Textbox label="Name" bind:text={record.name} on:change={nameChanged} />
<div class="horizontal-stack"> <div class="horizontal-stack">
{#if !record.isSingle} <Textbox label="Name" bind:text={record.name} on:change={nameChanged} />
<Textbox label="Collection Name" bind:text={record.collectionName} />
{/if}
<div> <div>
<label class="uk-form-label">Parent</label> <label class="uk-form-label">Parent</label>
<div class="uk-form-controls"> <div class="uk-form-controls">

View File

@ -160,16 +160,17 @@ export const getNewRootLevel = () =>
}) })
const _getNewRecordTemplate = (parent, name, createDefaultIndex, isSingle) => { const _getNewRecordTemplate = (parent, name, createDefaultIndex, isSingle) => {
const nodeId = getNodeId(parent)
const node = constructNode(parent, { const node = constructNode(parent, {
name, name,
type: "record", type: "record",
fields: [], fields: [],
children: [], children: [],
validationRules: [], validationRules: [],
nodeId: getNodeId(parent), nodeId: nodeId,
indexes: [], indexes: [],
estimatedRecordCount: isRecord(parent) ? 500 : 1000000, estimatedRecordCount: isRecord(parent) ? 500 : 1000000,
collectionName: "", collectionName: (nodeId || "").toString(),
isSingle, isSingle,
}) })

View File

@ -25,7 +25,7 @@ describe("hierarchy node creation", () => {
expect(record.validationRules).toEqual([]) expect(record.validationRules).toEqual([])
expect(record.indexes).toEqual([]) expect(record.indexes).toEqual([])
expect(record.parent()).toBe(root) expect(record.parent()).toBe(root)
expect(record.collectionName).toBe("") expect(record.collectionName).toBe(record.nodeId.toString())
expect(record.estimatedRecordCount).toBe(1000000) expect(record.estimatedRecordCount).toBe(1000000)
expect(record.isSingle).toBe(false) expect(record.isSingle).toBe(false)