forked from Budibase/budibase
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Budibase#5174 from Budibase/develop
Develop -> Master
- Loading branch information
Showing
186 changed files
with
14,754 additions
and
5,131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,5 +44,8 @@ | |
], | ||
"rules": { | ||
"no-self-assign": "off" | ||
}, | ||
"globals": { | ||
"GeolocationPositionError": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,3 +98,4 @@ hosting/proxy/.generated-nginx.prod.conf | |
bin/ | ||
hosting/.generated* | ||
packages/builder/cypress.env.json | ||
stats.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "next/core-web-vitals" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# next.js | ||
/.next/ | ||
/out/ | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
*.pem | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
.pnpm-debug.log* | ||
|
||
# local env files | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
# vercel | ||
.vercel | ||
|
||
# typescript | ||
*.tsbuildinfo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Budibase API + Next.js example | ||
|
||
This is an example of how Budibase can be used as a backend for a Postgres database for a Next.js sales app. You will | ||
need to follow the walk-through that has been published in the Budibase docs to set up your Budibase app for this example. | ||
|
||
## Pre-requisites | ||
|
||
To use this example you will need: | ||
1. [Docker](https://www.docker.com/) | ||
2. [Docker Compose](https://docs.docker.com/compose/) | ||
3. [Node.js](https://nodejs.org/en/) | ||
4. A self-hosted Budibase installation | ||
|
||
## Getting Started | ||
|
||
The first step is to set up the database - you can do this by going to the `db/` directory and running the command: | ||
|
||
```bash | ||
docker-compose up | ||
``` | ||
|
||
The next step is to follow the example walk-through and set up a Budibase app as it describes. Once you've done | ||
this you can configure the settings in `next.config.js`, specifically the `apiKey`, `host` and `appName`. | ||
|
||
Finally, you can start the dev server with the following command: | ||
|
||
```bash | ||
npm run dev | ||
# or | ||
yarn dev | ||
``` | ||
|
||
## Accessing the app | ||
|
||
Open [http://localhost:3001](http://localhost:3001) with your browser to see the sales app. | ||
|
||
Look in the API routes (`pages/api/sales.ts` and `pages/api/salespeople.ts`) to see how this is integrated with Budibase. | ||
There is also a utility file where some core functions and types have been defined, in `utilities/index.ts`. | ||
|
||
## Attribution | ||
This example was set up using [Next.js](https://nextjs.org/) and bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import Link from "next/link" | ||
import Image from "next/image" | ||
import { ReactNotifications } from "react-notifications-component" | ||
|
||
function layout(props: any) { | ||
return ( | ||
<> | ||
<nav className="navbar" role="navigation" aria-label="main navigation"> | ||
<div id="navbar" className="navbar-menu"> | ||
<div className="logo"> | ||
<Image alt="logo" src="/bb-emblem.svg" width="50" height="50" /> | ||
</div> | ||
<div className="navbar-start"> | ||
<Link href="/"> | ||
<a className="navbar-item"> | ||
List | ||
</a> | ||
</Link> | ||
<Link href="/save"> | ||
<a className="navbar-item"> | ||
New sale | ||
</a> | ||
</Link> | ||
</div> | ||
<div className="navbar-end"> | ||
<div className="navbar-item"> | ||
<div className="buttons"> | ||
<a className="button is-primary" href="https://budibase.readme.io/reference"> | ||
<strong>API Documentation</strong> | ||
</a> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</nav> | ||
<ReactNotifications /> | ||
{props.children} | ||
</> | ||
) | ||
} | ||
|
||
export default layout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { Store } from "react-notifications-component" | ||
|
||
const notifications = { | ||
error: (error: string, title: string) => { | ||
Store.addNotification({ | ||
container: "top-right", | ||
type: "danger", | ||
message: error, | ||
title: title, | ||
dismiss: { | ||
duration: 10000, | ||
}, | ||
}) | ||
}, | ||
success: (message: string, title: string) => { | ||
Store.addNotification({ | ||
container: "top-right", | ||
type: "success", | ||
message: message, | ||
title: title, | ||
dismiss: { | ||
duration: 3000, | ||
}, | ||
}) | ||
}, | ||
} | ||
|
||
export default notifications |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
version: "3.8" | ||
services: | ||
db: | ||
container_name: postgres | ||
image: postgres | ||
restart: always | ||
environment: | ||
POSTGRES_USER: root | ||
POSTGRES_PASSWORD: root | ||
POSTGRES_DB: postgres | ||
ports: | ||
- "5432:5432" | ||
volumes: | ||
- pg_data:/var/lib/postgresql/data/ | ||
- ./init.sql:/docker-entrypoint-initdb.d/init.sql | ||
volumes: | ||
pg_data: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
CREATE TABLE IF NOT EXISTS sales_people ( | ||
person_id SERIAL PRIMARY KEY, | ||
name varchar(200) NOT NULL | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS sales ( | ||
sale_id SERIAL PRIMARY KEY, | ||
sale_name varchar(200) NOT NULL, | ||
sold_by INT, | ||
CONSTRAINT sold_by_fk | ||
FOREIGN KEY(sold_by) | ||
REFERENCES sales_people(person_id) | ||
); | ||
|
||
INSERT INTO sales_people (name) | ||
select 'Salesperson ' || id | ||
FROM GENERATE_SERIES(1, 50) as id; | ||
|
||
INSERT INTO sales (sale_name, sold_by) | ||
select 'Sale ' || id, floor(random() * 50 + 1)::int | ||
FROM GENERATE_SERIES(1, 200) as id; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { components } from "./openapi" | ||
|
||
export type App = components["schemas"]["applicationOutput"]["data"] | ||
export type Table = components["schemas"]["tableOutput"]["data"] | ||
export type TableSearch = components["schemas"]["tableSearch"] | ||
export type AppSearch = components["schemas"]["applicationSearch"] | ||
export type RowSearch = components["schemas"]["searchOutput"] |
Oops, something went wrong.