Browse Source
Merge pull request #5802 from Budibase/feature/add-default-screen
Feature/add default screen
master
deanhannigan
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
23 additions and
3 deletions
-
packages/builder/cypress/integration/createScreen.js
-
packages/builder/cypress/integration/revertApp.spec.js
-
packages/builder/cypress/support/commands.js
-
packages/builder/src/components/start/CreateAppModal.svelte
|
|
|
@ -9,7 +9,7 @@ filterTests(["smoke", "all"], () => { |
|
|
|
}) |
|
|
|
|
|
|
|
it("Should successfully create a screen", () => { |
|
|
|
cy.createScreen("/test") |
|
|
|
cy.createScreen("test") |
|
|
|
cy.get(".nav-items-container").within(() => { |
|
|
|
cy.contains("/test").should("exist") |
|
|
|
}) |
|
|
|
|
|
|
|
@ -26,6 +26,8 @@ filterTests(['smoke', 'all'], () => { |
|
|
|
}) |
|
|
|
|
|
|
|
it("should revert a published app", () => { |
|
|
|
cy.navigateToFrontend() |
|
|
|
|
|
|
|
// Add initial component - Paragraph
|
|
|
|
cy.addComponent("Elements", "Paragraph") |
|
|
|
// Publish app
|
|
|
|
@ -37,6 +39,7 @@ filterTests(['smoke', 'all'], () => { |
|
|
|
cy.get(".spectrum-ButtonGroup").within(() => { |
|
|
|
cy.get(".spectrum-Button").contains("Done").click({ force: true }) |
|
|
|
}) |
|
|
|
|
|
|
|
// Add second component - Button
|
|
|
|
cy.addComponent("Elements", "Button") |
|
|
|
// Click Revert
|
|
|
|
|
|
|
|
@ -145,7 +145,6 @@ Cypress.Commands.add("createTestApp", () => { |
|
|
|
const appName = "Cypress Tests" |
|
|
|
cy.deleteApp(appName) |
|
|
|
cy.createApp(appName, "This app is used for Cypress testing.") |
|
|
|
cy.createScreen("home") |
|
|
|
}) |
|
|
|
|
|
|
|
Cypress.Commands.add("createTestTableWithData", () => { |
|
|
|
|
|
|
|
@ -10,6 +10,8 @@ |
|
|
|
import { createValidationStore } from "helpers/validation/yup" |
|
|
|
import * as appValidation from "helpers/validation/yup/app" |
|
|
|
import TemplateCard from "components/common/TemplateCard.svelte" |
|
|
|
import createFromScratchScreen from "builderStore/store/screenTemplates/createFromScratchScreen" |
|
|
|
import { Roles } from "constants/backend" |
|
|
|
|
|
|
|
export let template |
|
|
|
|
|
|
|
@ -81,7 +83,7 @@ |
|
|
|
} |
|
|
|
data.append("useTemplate", template != null) |
|
|
|
if (template) { |
|
|
|
data.append("templateName", template.name) |
|
|
|
data.append("templateName", template.name) //or here? |
|
|
|
data.append("templateKey", template.key) |
|
|
|
data.append("templateFile", $values.file) |
|
|
|
} |
|
|
|
@ -104,6 +106,22 @@ |
|
|
|
// Create user |
|
|
|
await API.updateOwnMetadata({ roleId: $values.roleId }) |
|
|
|
await auth.setInitInfo({}) |
|
|
|
|
|
|
|
// Create a default home screen if no template was selected |
|
|
|
if (template == null) { |
|
|
|
let defaultScreenTemplate = createFromScratchScreen.create() |
|
|
|
defaultScreenTemplate.routing.route = "/home" |
|
|
|
defaultScreenTemplate.routing.roldId = Roles.BASIC |
|
|
|
try { |
|
|
|
await store.actions.screens.save(defaultScreenTemplate) |
|
|
|
} catch (err) { |
|
|
|
console.error("Could not create a default application screen", err) |
|
|
|
notifications.warning( |
|
|
|
"Encountered an issue creating the default screen." |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
$goto(`/builder/app/${createdApp.instance._id}`) |
|
|
|
} catch (error) { |
|
|
|
creating = false |
|
|
|
|