This commit is contained in:
mike12345567 2020-11-17 18:13:21 +00:00
parent 3252b2d630
commit 63f7641c9e
8 changed files with 43 additions and 27 deletions

View File

@ -1,7 +1,12 @@
import sanitizeUrl from "./utils/sanitizeUrl"
import { Component } from "./utils/Component"
import { Screen } from "./utils/Screen"
import { makeBreadcrumbContainer, makeMainContainer, makeTitleContainer, makeSaveButton } from "./utils/commonComponents"
import {
makeBreadcrumbContainer,
makeMainContainer,
makeTitleContainer,
makeSaveButton,
} from "./utils/commonComponents"
export default function(tables) {
return tables.map(table => {
@ -17,20 +22,21 @@ export const newRowUrl = table => sanitizeUrl(`/${table.name}/new`)
export const NEW_ROW_TEMPLATE = "NEW_ROW_TEMPLATE"
function generateTitleContainer(table) {
return makeTitleContainer("New Row")
.addChild(makeSaveButton(table))
return makeTitleContainer("New Row").addChild(makeSaveButton(table))
}
const createScreen = table => {
const dataform = new Component("@budibase/standard-components/dataformwide")
.instanceName("Form")
const dataform = new Component(
"@budibase/standard-components/dataformwide"
).instanceName("Form")
const container = makeMainContainer()
.addChild(makeBreadcrumbContainer(table.name, "New"))
.addChild(generateTitleContainer(table))
.addChild(dataform)
return new Screen().component("@budibase/standard-components/newrow")
return new Screen()
.component("@budibase/standard-components/newrow")
.table(table._id)
.route(newRowUrl(table))
.instanceName(`${table.name} - New`)

View File

@ -2,7 +2,12 @@ import sanitizeUrl from "./utils/sanitizeUrl"
import { rowListUrl } from "./rowListScreen"
import { Screen } from "./utils/Screen"
import { Component } from "./utils/Component"
import { makeMainContainer, makeBreadcrumbContainer, makeTitleContainer, makeSaveButton } from "./utils/commonComponents"
import {
makeMainContainer,
makeBreadcrumbContainer,
makeTitleContainer,
makeSaveButton,
} from "./utils/commonComponents"
export default function(tables) {
return tables.map(table => {
@ -22,16 +27,15 @@ export const rowDetailUrl = table => sanitizeUrl(`/${table.name}/:id`)
function generateTitleContainer(table, title) {
// have to override style for this, its missing margin
const saveButton = makeSaveButton(table)
.normalStyle({
background: "#000000",
"border-width": "0",
"border-style": "None",
color: "#fff",
"font-family": "Inter",
"font-weight": "500",
"font-size": "14px",
})
const saveButton = makeSaveButton(table).normalStyle({
background: "#000000",
"border-width": "0",
"border-style": "None",
color: "#fff",
"font-family": "Inter",
"font-weight": "500",
"font-size": "14px",
})
const deleteButton = new Component("@budibase/standard-components/button")
.normalStyle({
@ -78,8 +82,9 @@ function generateTitleContainer(table, title) {
}
const createScreen = (table, heading) => {
const dataform = new Component("@budibase/standard-components/dataformwide")
.instanceName("Form")
const dataform = new Component(
"@budibase/standard-components/dataformwide"
).instanceName("Form")
const container = makeMainContainer()
.addChild(makeBreadcrumbContainer(table.name, heading || "Edit"))

View File

@ -82,7 +82,7 @@ const createScreen = table => {
theme: "alpine",
height: "540",
pagination: true,
detailUrl: `${table.name.toLowerCase()}/:id`
detailUrl: `${table.name.toLowerCase()}/:id`,
})
.instanceName("Grid")
@ -107,7 +107,8 @@ const createScreen = table => {
.addChild(generateTitleContainer(table))
.addChild(datagrid)
return new Screen().component("@budibase/standard-components/container")
return new Screen()
.component("@budibase/standard-components/container")
.mainType("div")
.route(rowListUrl(table))
.instanceName(`${table.name} - List`)

View File

@ -4,8 +4,7 @@ export class BaseStructure {
constructor(isScreen) {
this._isScreen = isScreen
this._children = []
this._json = {
}
this._json = {}
}
addChild(child) {

View File

@ -142,4 +142,4 @@ export function makeTitleContainer(title) {
})
.instanceName("Title Container")
.addChild(heading)
}
}

View File

@ -62,7 +62,10 @@
const listScreen = screens.find(screen =>
screen.props._instanceName.endsWith("List")
)
await store.actions.components.links.save(listScreen.routing.route, table.name)
await store.actions.components.links.save(
listScreen.routing.route,
table.name
)
// Navigate to new table
$goto(`./table/${table._id}`)

View File

@ -25,7 +25,9 @@
<DataList on:change bind:value={parameter.value}>
<option value="" />
{#each $allScreens as screen}
<option value={screen.routing.route}>{screen.props._instanceName}</option>
<option value={screen.routing.route}>
{screen.props._instanceName}
</option>
{/each}
</DataList>
{:else}

View File

@ -4,7 +4,7 @@ const compress = require("koa-compress")
const zlib = require("zlib")
const { budibaseAppsDir } = require("../utilities/budibaseDir")
const { isDev } = require("../utilities")
const {mainRoutes, authRoutes, staticRoutes} = require("./routes")
const { mainRoutes, authRoutes, staticRoutes } = require("./routes")
const router = new Router()
const env = require("../environment")