1
0
Fork 0
mirror of synced 2024-09-28 07:11:40 +12:00
This commit is contained in:
Keviin Åberg Kultalahti 2021-04-01 08:40:30 +02:00
parent 958cae212d
commit 214243fc22
11 changed files with 941 additions and 951 deletions

View file

@ -67,10 +67,8 @@ export const getFrontendStore = () => {
await hostingStore.actions.fetch()
// Initialise backend stores
const [
_integrations,
] = await Promise.all([
api.get("/api/integrations").then(r => r.json())
const [_integrations] = await Promise.all([
api.get("/api/integrations").then(r => r.json()),
])
datasources.init()
integrations.set(_integrations)

View file

@ -3,11 +3,11 @@ import { queries } from "./"
import api from "../../builderStore/api"
export const INITIAL_DATASOURCE_VALUES = {
list: [],
selected: null,
}
list: [],
selected: null,
}
export function createDatasourcesStore(_api = api) {
export function createDatasourcesStore() {
const { subscribe, update, set } = writable(INITIAL_DATASOURCE_VALUES)
return {
@ -48,7 +48,9 @@ export function createDatasourcesStore(_api = api) {
return json
},
delete: async datasource => {
const response = await api.delete(`/api/datasources/${datasource._id}/${datasource._rev}`)
const response = await api.delete(
`/api/datasources/${datasource._id}/${datasource._rev}`
)
update(state => {
const sources = state.list.filter(
existing => existing._id !== datasource._id

View file

@ -1,7 +1,6 @@
import { writable } from "svelte/store"
import api from "builderStore/api"
export function createPermissionStore() {
const { subscribe } = writable([])

View file

@ -2,7 +2,6 @@ import { writable, get } from "svelte/store"
import { datasources, integrations } from "./"
import api from "builderStore/api"
export function createQueriesStore() {
const { subscribe, set, update } = writable({ list: [], selected: null })
@ -59,7 +58,9 @@ export function createQueriesStore() {
datasources.update(state => ({ ...state, selected: query.datasourceId }))
},
delete: async query => {
const response = await api.delete(`/api/queries/${query._id}/${query._rev}`)
const response = await api.delete(
`/api/queries/${query._id}/${query._rev}`
)
update(state => {
state.list = state.list.filter(existing => existing._id !== query._id)
if (state.selected === query._id) {
@ -68,7 +69,7 @@ export function createQueriesStore() {
return state
})
return response;
return response
},
}
}

View file

@ -1,7 +1,6 @@
import { writable } from "svelte/store"
import api from "builderStore/api"
export function createRolesStore() {
const { subscribe, update, set } = writable([])

View file

@ -3,7 +3,6 @@ import { views } from "./"
import { cloneDeep } from "lodash/fp"
import api from "builderStore/api"
export function createTablesStore() {
const store = writable({})
const { subscribe, update, set } = store

View file

@ -1,26 +1,25 @@
export const SOME_DATASOURCE = [
{
"type": "datasource",
"name": "erterter",
"source": "REST",
"config": {
"url": "localhost",
"defaultHeaders": {}
},
"_id": "datasource_04b003a7b4a8428eadd3bb2f7eae0255",
"_rev": "1-4e72002f1011e9392e655948469b7908"
}
]
export const SAVE_DATASOURCE = {
"type": "datasource",
"name": "CoolDB",
"source": "REST",
"config": {
"url": "localhost",
"defaultHeaders": {}
},
"_id": "datasource_04b003a7b4a8428eadd3bb2f7eae0255",
"_rev": "1-4e72002f1011e9392e655948469b7908"
}
{
type: "datasource",
name: "erterter",
source: "REST",
config: {
url: "localhost",
defaultHeaders: {},
},
_id: "datasource_04b003a7b4a8428eadd3bb2f7eae0255",
_rev: "1-4e72002f1011e9392e655948469b7908",
},
]
export const SAVE_DATASOURCE = {
type: "datasource",
name: "CoolDB",
source: "REST",
config: {
url: "localhost",
defaultHeaders: {},
},
_id: "datasource_04b003a7b4a8428eadd3bb2f7eae0255",
_rev: "1-4e72002f1011e9392e655948469b7908",
}

View file

@ -1,80 +1,82 @@
export const SOME_QUERY = {
"datasourceId": "datasource_04b003a7b4a8428eadd3bb2f7eae0255",
"parameters": [],
"fields": {
"headers": {},
"queryString": "",
"path": "Speakers"
},
"queryVerb": "read",
"schema": {},
"name": "Speakers",
"_id": "query_datasource_04b003a7b4a8428eadd3bb2f7eae0255_bcb8ffc6fcbc484e8d63121fc0bf986f",
"_rev": "2-941f8699eb0adf995f8bd59c99203b26",
"readable": true
}
datasourceId: "datasource_04b003a7b4a8428eadd3bb2f7eae0255",
parameters: [],
fields: {
headers: {},
queryString: "",
path: "Speakers",
},
queryVerb: "read",
schema: {},
name: "Speakers",
_id:
"query_datasource_04b003a7b4a8428eadd3bb2f7eae0255_bcb8ffc6fcbc484e8d63121fc0bf986f",
_rev: "2-941f8699eb0adf995f8bd59c99203b26",
readable: true,
}
export const SAVE_QUERY_RESPONSE = {
"datasourceId": "datasource_04b003a7b4a8428eadd3bb2f7eae0255",
"parameters": [],
"fields": {
"headers": {},
"queryString": "",
"path": "Speakers"
datasourceId: "datasource_04b003a7b4a8428eadd3bb2f7eae0255",
parameters: [],
fields: {
headers: {},
queryString: "",
path: "Speakers",
},
queryVerb: "read",
schema: {
id: {
name: "id",
type: "string",
},
"queryVerb": "read",
"schema": {
"id": {
"name": "id",
"type": "string"
},
"firstName": {
"name": "firstName",
"type": "string"
},
"lastName": {
"name": "lastName",
"type": "string"
},
"fullName": {
"name": "fullName",
"type": "string"
},
"bio": {
"name": "bio",
"type": "string"
},
"tagLine": {
"name": "tagLine",
"type": "string"
},
"profilePicture": {
"name": "profilePicture",
"type": "string"
},
"sessions": {
"name": "sessions",
"type": "string"
},
"isTopSpeaker": {
"name": "isTopSpeaker",
"type": "string"
},
"links": {
"name": "links",
"type": "string"
},
"questionAnswers": {
"name": "questionAnswers",
"type": "string"
},
"categories": {
"name": "categories",
"type": "string"
}
firstName: {
name: "firstName",
type: "string",
},
"name": "Speakers",
"_id": "query_datasource_04b003a7b4a8428eadd3bb2f7eae0255_bcb8ffc6fcbc484e8d63121fc0bf986f",
"_rev": "3-5a64adef494b1e9c793dc91b51ce73c6",
"readable": true
}
lastName: {
name: "lastName",
type: "string",
},
fullName: {
name: "fullName",
type: "string",
},
bio: {
name: "bio",
type: "string",
},
tagLine: {
name: "tagLine",
type: "string",
},
profilePicture: {
name: "profilePicture",
type: "string",
},
sessions: {
name: "sessions",
type: "string",
},
isTopSpeaker: {
name: "isTopSpeaker",
type: "string",
},
links: {
name: "links",
type: "string",
},
questionAnswers: {
name: "questionAnswers",
type: "string",
},
categories: {
name: "categories",
type: "string",
},
},
name: "Speakers",
_id:
"query_datasource_04b003a7b4a8428eadd3bb2f7eae0255_bcb8ffc6fcbc484e8d63121fc0bf986f",
_rev: "3-5a64adef494b1e9c793dc91b51ce73c6",
readable: true,
}

View file

@ -1,32 +1,32 @@
export const ROLES = [
{
"name": "Test",
"permissionId": "admin",
"inherits": "ADMIN",
"_id": "role_04681b7e71914a0aa53e09a5bea3584f",
"_rev": "1-179c71ea61d7fd987306b84b6d64b00e"
},
{
"_id": "ADMIN",
"name": "Admin",
"permissionId": "admin",
"inherits": "POWER"
},
{
"_id": "POWER",
"name": "Power",
"permissionId": "power",
"inherits": "BASIC"
},
{
"_id": "BASIC",
"name": "Basic",
"permissionId": "write",
"inherits": "PUBLIC"
},
{
"_id": "PUBLIC",
"name": "Public",
"permissionId": "public"
}
]
{
name: "Test",
permissionId: "admin",
inherits: "ADMIN",
_id: "role_04681b7e71914a0aa53e09a5bea3584f",
_rev: "1-179c71ea61d7fd987306b84b6d64b00e",
},
{
_id: "ADMIN",
name: "Admin",
permissionId: "admin",
inherits: "POWER",
},
{
_id: "POWER",
name: "Power",
permissionId: "power",
inherits: "BASIC",
},
{
_id: "BASIC",
name: "Basic",
permissionId: "write",
inherits: "PUBLIC",
},
{
_id: "PUBLIC",
name: "Public",
permissionId: "public",
},
]

File diff suppressed because it is too large Load diff

View file

@ -1,102 +1,102 @@
export const A_VIEW = {
"name": "Published",
"tableId": "ta_3c78cffe33664ca9bfb6b2b6cb3ee55a",
"filters": [],
"schema": {
"Auto ID": {
"name": "Auto ID",
"type": "number",
"subtype": "autoID",
"icon": "ri-magic-line",
"autocolumn": true,
"constraints": {
"type": "number",
"presence": false,
"numericality": {
"greaterThanOrEqualTo": "",
"lessThanOrEqualTo": ""
}
},
"lastID": 2
name: "Published",
tableId: "ta_3c78cffe33664ca9bfb6b2b6cb3ee55a",
filters: [],
schema: {
"Auto ID": {
name: "Auto ID",
type: "number",
subtype: "autoID",
icon: "ri-magic-line",
autocolumn: true,
constraints: {
type: "number",
presence: false,
numericality: {
greaterThanOrEqualTo: "",
lessThanOrEqualTo: "",
},
"Created By": {
"name": "Created By",
"type": "link",
"subtype": "createdBy",
"icon": "ri-magic-line",
"autocolumn": true,
"constraints": {
"type": "array",
"presence": false
},
"tableId": "ta_users",
"fieldName": "Guest-Created By",
"relationshipType": "many-to-many"
},
lastID: 2,
},
"Created By": {
name: "Created By",
type: "link",
subtype: "createdBy",
icon: "ri-magic-line",
autocolumn: true,
constraints: {
type: "array",
presence: false,
},
tableId: "ta_users",
fieldName: "Guest-Created By",
relationshipType: "many-to-many",
},
"Created At": {
name: "Created At",
type: "datetime",
subtype: "createdAt",
icon: "ri-magic-line",
autocolumn: true,
constraints: {
type: "string",
length: {},
presence: false,
datetime: {
latest: "",
earliest: "",
},
"Created At": {
"name": "Created At",
"type": "datetime",
"subtype": "createdAt",
"icon": "ri-magic-line",
"autocolumn": true,
"constraints": {
"type": "string",
"length": {},
"presence": false,
"datetime": {
"latest": "",
"earliest": ""
}
}
},
},
"Updated By": {
name: "Updated By",
type: "link",
subtype: "updatedBy",
icon: "ri-magic-line",
autocolumn: true,
constraints: {
type: "array",
presence: false,
},
tableId: "ta_users",
fieldName: "Guest-Updated By",
relationshipType: "many-to-many",
},
"Updated At": {
name: "Updated At",
type: "datetime",
subtype: "updatedAt",
icon: "ri-magic-line",
autocolumn: true,
constraints: {
type: "string",
length: {},
presence: false,
datetime: {
latest: "",
earliest: "",
},
"Updated By": {
"name": "Updated By",
"type": "link",
"subtype": "updatedBy",
"icon": "ri-magic-line",
"autocolumn": true,
"constraints": {
"type": "array",
"presence": false
},
"tableId": "ta_users",
"fieldName": "Guest-Updated By",
"relationshipType": "many-to-many"
},
},
Episode: {
name: "Episode",
type: "link",
tableId: "ta_d4bf541ce0d84b16a1a8e0a060e5f7f7",
fieldName: "Guest",
relationshipType: "one-to-many",
},
Names: {
type: "string",
constraints: {
type: "string",
length: {
maximum: "",
},
"Updated At": {
"name": "Updated At",
"type": "datetime",
"subtype": "updatedAt",
"icon": "ri-magic-line",
"autocolumn": true,
"constraints": {
"type": "string",
"length": {},
"presence": false,
"datetime": {
"latest": "",
"earliest": ""
}
}
},
"Episode": {
"name": "Episode",
"type": "link",
"tableId": "ta_d4bf541ce0d84b16a1a8e0a060e5f7f7",
"fieldName": "Guest",
"relationshipType": "one-to-many"
},
"Names": {
"type": "string",
"constraints": {
"type": "string",
"length": {
"maximum": ""
},
"presence": false
},
"fieldName": "Guest",
"name": "Names"
}
}
}
presence: false,
},
fieldName: "Guest",
name: "Names",
},
},
}