linting.
This commit is contained in:
parent
e20a26a84d
commit
40bfb53771
|
@ -1,7 +1,12 @@
|
||||||
import sanitizeUrl from "./utils/sanitizeUrl"
|
import sanitizeUrl from "./utils/sanitizeUrl"
|
||||||
import { Component } from "./utils/Component"
|
import { Component } from "./utils/Component"
|
||||||
import { Screen } from "./utils/Screen"
|
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) {
|
export default function(tables) {
|
||||||
return tables.map(table => {
|
return tables.map(table => {
|
||||||
|
@ -17,20 +22,21 @@ export const newRowUrl = table => sanitizeUrl(`/${table.name}/new`)
|
||||||
export const NEW_ROW_TEMPLATE = "NEW_ROW_TEMPLATE"
|
export const NEW_ROW_TEMPLATE = "NEW_ROW_TEMPLATE"
|
||||||
|
|
||||||
function generateTitleContainer(table) {
|
function generateTitleContainer(table) {
|
||||||
return makeTitleContainer("New Row")
|
return makeTitleContainer("New Row").addChild(makeSaveButton(table))
|
||||||
.addChild(makeSaveButton(table))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const createScreen = table => {
|
const createScreen = table => {
|
||||||
const dataform = new Component("@budibase/standard-components/dataformwide")
|
const dataform = new Component(
|
||||||
.instanceName("Form")
|
"@budibase/standard-components/dataformwide"
|
||||||
|
).instanceName("Form")
|
||||||
|
|
||||||
const container = makeMainContainer()
|
const container = makeMainContainer()
|
||||||
.addChild(makeBreadcrumbContainer(table.name, "New"))
|
.addChild(makeBreadcrumbContainer(table.name, "New"))
|
||||||
.addChild(generateTitleContainer(table))
|
.addChild(generateTitleContainer(table))
|
||||||
.addChild(dataform)
|
.addChild(dataform)
|
||||||
|
|
||||||
return new Screen().component("@budibase/standard-components/newrow")
|
return new Screen()
|
||||||
|
.component("@budibase/standard-components/newrow")
|
||||||
.table(table._id)
|
.table(table._id)
|
||||||
.route(newRowUrl(table))
|
.route(newRowUrl(table))
|
||||||
.instanceName(`${table.name} - New`)
|
.instanceName(`${table.name} - New`)
|
||||||
|
|
|
@ -2,7 +2,12 @@ import sanitizeUrl from "./utils/sanitizeUrl"
|
||||||
import { rowListUrl } from "./rowListScreen"
|
import { rowListUrl } from "./rowListScreen"
|
||||||
import { Screen } from "./utils/Screen"
|
import { Screen } from "./utils/Screen"
|
||||||
import { Component } from "./utils/Component"
|
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) {
|
export default function(tables) {
|
||||||
return tables.map(table => {
|
return tables.map(table => {
|
||||||
|
@ -22,16 +27,15 @@ export const rowDetailUrl = table => sanitizeUrl(`/${table.name}/:id`)
|
||||||
|
|
||||||
function generateTitleContainer(table, title) {
|
function generateTitleContainer(table, title) {
|
||||||
// have to override style for this, its missing margin
|
// have to override style for this, its missing margin
|
||||||
const saveButton = makeSaveButton(table)
|
const saveButton = makeSaveButton(table).normalStyle({
|
||||||
.normalStyle({
|
background: "#000000",
|
||||||
background: "#000000",
|
"border-width": "0",
|
||||||
"border-width": "0",
|
"border-style": "None",
|
||||||
"border-style": "None",
|
color: "#fff",
|
||||||
color: "#fff",
|
"font-family": "Inter",
|
||||||
"font-family": "Inter",
|
"font-weight": "500",
|
||||||
"font-weight": "500",
|
"font-size": "14px",
|
||||||
"font-size": "14px",
|
})
|
||||||
})
|
|
||||||
|
|
||||||
const deleteButton = new Component("@budibase/standard-components/button")
|
const deleteButton = new Component("@budibase/standard-components/button")
|
||||||
.normalStyle({
|
.normalStyle({
|
||||||
|
@ -78,8 +82,9 @@ function generateTitleContainer(table, title) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const createScreen = (table, heading) => {
|
const createScreen = (table, heading) => {
|
||||||
const dataform = new Component("@budibase/standard-components/dataformwide")
|
const dataform = new Component(
|
||||||
.instanceName("Form")
|
"@budibase/standard-components/dataformwide"
|
||||||
|
).instanceName("Form")
|
||||||
|
|
||||||
const container = makeMainContainer()
|
const container = makeMainContainer()
|
||||||
.addChild(makeBreadcrumbContainer(table.name, heading || "Edit"))
|
.addChild(makeBreadcrumbContainer(table.name, heading || "Edit"))
|
||||||
|
|
|
@ -82,7 +82,7 @@ const createScreen = table => {
|
||||||
theme: "alpine",
|
theme: "alpine",
|
||||||
height: "540",
|
height: "540",
|
||||||
pagination: true,
|
pagination: true,
|
||||||
detailUrl: `${table.name.toLowerCase()}/:id`
|
detailUrl: `${table.name.toLowerCase()}/:id`,
|
||||||
})
|
})
|
||||||
.instanceName("Grid")
|
.instanceName("Grid")
|
||||||
|
|
||||||
|
@ -107,7 +107,8 @@ const createScreen = table => {
|
||||||
.addChild(generateTitleContainer(table))
|
.addChild(generateTitleContainer(table))
|
||||||
.addChild(datagrid)
|
.addChild(datagrid)
|
||||||
|
|
||||||
return new Screen().component("@budibase/standard-components/container")
|
return new Screen()
|
||||||
|
.component("@budibase/standard-components/container")
|
||||||
.mainType("div")
|
.mainType("div")
|
||||||
.route(rowListUrl(table))
|
.route(rowListUrl(table))
|
||||||
.instanceName(`${table.name} - List`)
|
.instanceName(`${table.name} - List`)
|
||||||
|
|
|
@ -4,8 +4,7 @@ export class BaseStructure {
|
||||||
constructor(isScreen) {
|
constructor(isScreen) {
|
||||||
this._isScreen = isScreen
|
this._isScreen = isScreen
|
||||||
this._children = []
|
this._children = []
|
||||||
this._json = {
|
this._json = {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
addChild(child) {
|
addChild(child) {
|
||||||
|
|
|
@ -62,7 +62,10 @@
|
||||||
const listScreen = screens.find(screen =>
|
const listScreen = screens.find(screen =>
|
||||||
screen.props._instanceName.endsWith("List")
|
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
|
// Navigate to new table
|
||||||
$goto(`./table/${table._id}`)
|
$goto(`./table/${table._id}`)
|
||||||
|
|
|
@ -25,7 +25,9 @@
|
||||||
<DataList on:change bind:value={parameter.value}>
|
<DataList on:change bind:value={parameter.value}>
|
||||||
<option value="" />
|
<option value="" />
|
||||||
{#each $allScreens as screen}
|
{#each $allScreens as screen}
|
||||||
<option value={screen.routing.route}>{screen.props._instanceName}</option>
|
<option value={screen.routing.route}>
|
||||||
|
{screen.props._instanceName}
|
||||||
|
</option>
|
||||||
{/each}
|
{/each}
|
||||||
</DataList>
|
</DataList>
|
||||||
{:else}
|
{:else}
|
||||||
|
|
|
@ -4,7 +4,7 @@ const compress = require("koa-compress")
|
||||||
const zlib = require("zlib")
|
const zlib = require("zlib")
|
||||||
const { budibaseAppsDir } = require("../utilities/budibaseDir")
|
const { budibaseAppsDir } = require("../utilities/budibaseDir")
|
||||||
const { isDev } = require("../utilities")
|
const { isDev } = require("../utilities")
|
||||||
const {mainRoutes, authRoutes, staticRoutes} = require("./routes")
|
const { mainRoutes, authRoutes, staticRoutes } = require("./routes")
|
||||||
|
|
||||||
const router = new Router()
|
const router = new Router()
|
||||||
const env = require("../environment")
|
const env = require("../environment")
|
||||||
|
|
Loading…
Reference in New Issue