From 1381cefc4130cafbf9376850699c563576f8b586 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Mon, 20 Apr 2020 16:17:11 +0100 Subject: [PATCH] backend allowing creation of models, records and databases --- lerna.json | 1 - package.json | 3 - packages/builder/rollup.config.js | 2 +- .../builder/src/builderStore/store/backend.js | 16 +- .../builder/src/builderStore/store/index.js | 3 +- .../src/components/common/NumberBox.svelte | 2 +- .../src/components/database/FieldView.svelte | 156 - .../ModelDataTable/ModelDataTable.svelte | 58 +- .../components/database/ModelDataTable/api.js | 36 +- ...odel.svelte => CreateEditModel.old.svelte} | 0 .../CreateEditModel/CreateEditModel.svelte | 156 + .../modals/CreateEditModel/FieldView.svelte | 102 + .../modals/CreateEditRecord.svelte | 68 +- .../ModelDataTable/modals/DeleteRecord.svelte | 7 +- .../modals/RecordFieldControl.old.svelte | 66 + .../modals/RecordFieldControl.svelte | 83 +- .../database/ModelDataTable/modals/index.js | 2 +- .../src/components/nav/DatabasesList.svelte | 6 +- .../src/components/nav/HierarchyRow.svelte | 39 +- .../nav/SchemaManagementDrawer.svelte | 19 +- .../src/components/nav/UsersList.svelte | 2 +- .../src/components/start/AppList.svelte | 2 +- .../pagesParsing/validatePages.js | 2 +- .../src/pages/[application]/_layout.svelte | 2 +- .../database/[selectedDatabase]/index.svelte | 4 +- .../backend/database/_layout.svelte | 2 - .../[application]/frontend/_layout.svelte | 2 - packages/builder/src/pages/index.svelte | 2 +- packages/cli/src/commands/new/newHandler.js | 11 +- packages/common/lib/index.js | 3 +- packages/common/lib/index.js.map | 2 +- .../common/lib/records/validateRecord.js.map | 2 +- .../lib/schema/types/typeHelpers.js.map | 2 +- packages/common/lib/schemaValidation/index.js | 6 + .../common/lib/schemaValidation/index.js.map | 1 + packages/common/node_modules/.bin/babel | 2 +- .../node_modules/.bin/babel-external-helpers | 2 +- packages/common/node_modules/.bin/cross-env | 2 +- .../common/node_modules/.bin/cross-env-shell | 2 +- packages/common/node_modules/.bin/jest | 2 +- packages/common/node_modules/.bin/rimraf | 2 +- .../@babel/template/node_modules/.bin/parser | 2 +- .../node_modules/@jest/transform/LICENSE | 21 - .../transform/build/ScriptTransformer.d.ts | 12 +- .../build/ScriptTransformer.d.ts.map | 2 +- .../transform/build/ScriptTransformer.js | 417 +- .../build/enhanceUnexpectedTokenMessage.d.ts | 7 +- .../enhanceUnexpectedTokenMessage.d.ts.map | 2 +- .../build/enhanceUnexpectedTokenMessage.js | 23 +- .../@jest/transform/build/index.d.ts | 5 +- .../@jest/transform/build/index.d.ts.map | 2 +- .../@jest/transform/build/index.js | 78 +- .../transform/build/shouldInstrument.d.ts | 4 +- .../transform/build/shouldInstrument.d.ts.map | 2 +- .../@jest/transform/build/shouldInstrument.js | 76 +- .../build/ts3.4/ScriptTransformer.d.ts | 35 - .../ts3.4/enhanceUnexpectedTokenMessage.d.ts | 13 - .../@jest/transform/build/ts3.4/index.d.ts | 11 - .../build/ts3.4/shouldInstrument.d.ts | 10 - .../@jest/transform/build/ts3.4/types.d.ts | 43 - .../@jest/transform/build/types.d.ts | 47 +- .../@jest/transform/build/types.d.ts.map | 2 +- .../node_modules/@jest/transform/package.json | 42 +- .../@jest/types/build/Circus.d.ts | 29 +- .../@jest/types/build/Circus.d.ts.map | 2 +- .../@jest/types/build/Config.d.ts | 347 +- .../@jest/types/build/Config.d.ts.map | 2 +- .../node_modules/@jest/types/build/Config.js | 14 - .../@jest/types/build/Global.d.ts | 7 +- .../@jest/types/build/Global.d.ts.map | 2 +- .../@jest/types/build/TestResult.d.ts | 31 - .../@jest/types/build/TestResult.d.ts.map | 1 - .../@jest/types/build/TestResult.js | 1 - .../@jest/types/build/Transform.d.ts | 13 - .../@jest/types/build/Transform.d.ts.map | 1 - .../@jest/types/build/Transform.js | 1 - .../node_modules/@jest/types/build/index.d.ts | 10 +- .../@jest/types/build/index.d.ts.map | 2 +- .../node_modules/@jest/types/build/index.js | 42 + .../@jest/types/build/ts3.4/Circus.d.ts | 178 - .../@jest/types/build/ts3.4/Config.d.ts | 421 - .../@jest/types/build/ts3.4/Global.d.ts | 78 - .../@jest/types/build/ts3.4/TestResult.d.ts | 31 - .../@jest/types/build/ts3.4/Transform.d.ts | 13 - .../@jest/types/build/ts3.4/index.d.ts | 13 - .../node_modules/@jest/types/package.json | 19 +- .../node_modules/@types/yargs/README.md | 10 +- .../node_modules/@types/yargs/index.d.ts | 47 +- .../node_modules/@types/yargs/package.json | 16 +- .../node_modules/@types/yargs/yargs.d.ts | 2 +- .../node_modules/ansi-styles/index.d.ts | 197 - .../common/node_modules/ansi-styles/index.js | 136 +- .../node_modules/ansi-styles/package.json | 23 +- .../common/node_modules/ansi-styles/readme.md | 41 +- packages/common/node_modules/anymatch/LICENSE | 2 +- .../common/node_modules/anymatch/README.md | 52 +- .../common/node_modules/anymatch/index.d.ts | 19 - .../common/node_modules/anymatch/index.js | 151 +- .../common/node_modules/anymatch/package.json | 29 +- .../babel-plugin-istanbul/CHANGELOG.md | 12 - .../babel-plugin-istanbul/README.md | 6 - .../babel-plugin-istanbul/lib/index.js | 131 +- .../lib/load-nyc-config-sync.js | 20 - .../babel-plugin-istanbul/package.json | 35 +- .../common/node_modules/braces/CHANGELOG.md | 184 - packages/common/node_modules/braces/README.md | 329 +- packages/common/node_modules/braces/index.js | 376 +- .../common/node_modules/braces/lib/compile.js | 57 - .../node_modules/braces/lib/constants.js | 57 - .../common/node_modules/braces/lib/expand.js | 113 - .../common/node_modules/braces/lib/parse.js | 333 - .../node_modules/braces/lib/stringify.js | 32 - .../common/node_modules/braces/lib/utils.js | 387 +- .../common/node_modules/braces/package.json | 47 +- packages/common/node_modules/chalk/index.d.ts | 411 - .../common/node_modules/chalk/package.json | 50 +- packages/common/node_modules/chalk/readme.md | 94 +- .../common/node_modules/chalk/source/index.js | 233 - .../node_modules/chalk/source/templates.js | 134 - .../common/node_modules/chalk/source/util.js | 39 - .../node_modules/color-convert/conversions.js | 583 +- .../node_modules/color-convert/index.js | 51 +- .../node_modules/color-convert/package.json | 12 +- .../node_modules/color-convert/route.js | 44 +- .../common/node_modules/fill-range/LICENSE | 2 +- .../common/node_modules/fill-range/README.md | 111 +- .../common/node_modules/fill-range/index.js | 403 +- .../node_modules/fill-range/package.json | 35 +- packages/common/node_modules/fsevents/LICENSE | 2 +- .../common/node_modules/fsevents/README.md | 97 +- .../node_modules/fsevents/fsevents.d.ts | 55 - .../common/node_modules/fsevents/fsevents.js | 143 +- .../node_modules/fsevents/fsevents.node | Bin 36204 -> 0 bytes .../common/node_modules/fsevents/package.json | 53 +- .../common/node_modules/has-flag/index.d.ts | 39 - .../common/node_modules/has-flag/index.js | 10 +- .../common/node_modules/has-flag/package.json | 86 +- .../common/node_modules/has-flag/readme.md | 19 - .../common/node_modules/is-number/LICENSE | 2 +- .../common/node_modules/is-number/README.md | 200 +- .../common/node_modules/is-number/index.js | 22 +- .../node_modules/is-number/package.json | 55 +- .../istanbul-lib-coverage/CHANGELOG.md | 43 - .../istanbul-lib-coverage/index.js | 6 +- .../istanbul-lib-coverage/lib/coverage-map.js | 225 +- .../lib/coverage-summary.js | 102 - .../lib/data-properties.js | 12 - .../lib/file-coverage.js | 264 - .../istanbul-lib-coverage/lib/percent.js | 15 - .../istanbul-lib-coverage/package.json | 16 +- .../istanbul-lib-instrument/CHANGELOG.md | 84 - .../istanbul-lib-instrument/dist/index.js | 22 +- .../dist/instrumenter.js | 138 +- .../dist/read-coverage.js | 31 +- .../istanbul-lib-instrument/dist/visitor.js | 47 +- .../node_modules/.bin/parser | 2 +- .../node_modules/.bin/semver | 2 +- .../istanbul-lib-instrument/package.json | 38 +- .../jest-haste-map/build/HasteFS.d.ts | 4 +- .../jest-haste-map/build/HasteFS.d.ts.map | 2 +- .../jest-haste-map/build/HasteFS.js | 156 +- .../jest-haste-map/build/ModuleMap.d.ts | 4 +- .../jest-haste-map/build/ModuleMap.d.ts.map | 2 +- .../jest-haste-map/build/ModuleMap.js | 122 +- .../jest-haste-map/build/blacklist.js | 1 - .../jest-haste-map/build/constants.d.ts | 2 +- .../jest-haste-map/build/constants.d.ts.map | 2 +- .../jest-haste-map/build/constants.js | 6 +- .../jest-haste-map/build/crawlers/node.d.ts | 4 +- .../build/crawlers/node.d.ts.map | 2 +- .../jest-haste-map/build/crawlers/node.js | 271 +- .../build/crawlers/watchman.d.ts | 6 +- .../build/crawlers/watchman.d.ts.map | 2 +- .../jest-haste-map/build/crawlers/watchman.js | 800 +- .../jest-haste-map/build/getMockName.js | 52 +- .../jest-haste-map/build/index.d.ts | 9 +- .../jest-haste-map/build/index.d.ts.map | 2 +- .../jest-haste-map/build/index.js | 360 +- .../build/lib/FSEventsWatcher.d.ts | 9 +- .../build/lib/FSEventsWatcher.d.ts.map | 2 +- .../build/lib/FSEventsWatcher.js | 102 +- .../build/lib/WatchmanWatcher.js | 26 +- .../jest-haste-map/build/lib/fast_path.js | 58 +- .../build/lib/normalizePathSep.js | 52 +- .../jest-haste-map/build/ts3.4/HasteFS.d.ts | 28 - .../jest-haste-map/build/ts3.4/ModuleMap.d.ts | 49 - .../jest-haste-map/build/ts3.4/blacklist.d.ts | 9 - .../jest-haste-map/build/ts3.4/constants.d.ts | 10 - .../build/ts3.4/crawlers/node.d.ts | 13 - .../build/ts3.4/crawlers/watchman.d.ts | 14 - .../build/ts3.4/getMockName.d.ts | 9 - .../jest-haste-map/build/ts3.4/index.d.ts | 192 - .../build/ts3.4/lib/FSEventsWatcher.d.ts | 46 - .../build/ts3.4/lib/dependencyExtractor.d.ts | 8 - .../build/ts3.4/lib/fast_path.d.ts | 9 - .../build/ts3.4/lib/getPlatformExtension.d.ts | 8 - .../build/ts3.4/lib/isRegExpSupported.d.ts | 8 - .../build/ts3.4/lib/normalizePathSep.d.ts | 9 - .../jest-haste-map/build/ts3.4/types.d.ts | 97 - .../jest-haste-map/build/ts3.4/worker.d.ts | 10 - .../jest-haste-map/build/types.d.ts | 14 +- .../jest-haste-map/build/types.d.ts.map | 2 +- .../jest-haste-map/build/worker.d.ts | 2 +- .../jest-haste-map/build/worker.d.ts.map | 2 +- .../jest-haste-map/build/worker.js | 301 +- .../node_modules/.bin/node-which | 1 - .../jest-haste-map/node_modules/.bin/sane | 2 +- .../node_modules/jest-haste-map/package.json | 42 +- .../jest-regex-util/build/index.js | 10 +- .../jest-regex-util/build/ts3.4/index.d.ts | 11 - .../node_modules/jest-regex-util/package.json | 16 +- .../node_modules/jest-serializer/README.md | 2 +- .../jest-serializer/build/index.d.ts | 2 +- .../jest-serializer/build/index.d.ts.map | 2 +- .../jest-serializer/build/index.js | 197 +- .../jest-serializer/build/ts3.4/index.d.ts | 23 - .../node_modules/jest-serializer/package.json | 16 +- .../jest-util/build/clearLine.d.ts | 3 +- .../jest-util/build/clearLine.d.ts.map | 2 +- .../node_modules/jest-util/build/clearLine.js | 10 +- .../jest-util/build/createDirectory.d.ts | 2 +- .../jest-util/build/createDirectory.d.ts.map | 2 +- .../jest-util/build/createDirectory.js | 8 +- .../jest-util/build/createProcessObject.d.ts | 3 +- .../build/createProcessObject.d.ts.map | 2 +- .../jest-util/build/createProcessObject.js | 13 - .../jest-util/build/deepCyclicCopy.d.ts.map | 2 +- .../jest-util/build/deepCyclicCopy.js | 17 +- .../node_modules/jest-util/build/index.d.ts | 53 +- .../jest-util/build/index.d.ts.map | 2 +- .../node_modules/jest-util/build/index.js | 213 +- .../jest-util/build/installCommonGlobals.d.ts | 2 +- .../build/installCommonGlobals.d.ts.map | 2 +- .../jest-util/build/installCommonGlobals.js | 56 +- .../build/interopRequireDefault.d.ts.map | 2 +- .../jest-util/build/interopRequireDefault.js | 1 - .../jest-util/build/isInteractive.js | 2 +- .../node_modules/jest-util/build/isPromise.js | 1 - .../jest-util/build/pluralize.d.ts.map | 2 +- .../jest-util/build/preRunMessage.d.ts | 4 +- .../jest-util/build/preRunMessage.d.ts.map | 2 +- .../jest-util/build/preRunMessage.js | 2 +- .../build/replacePathSepForGlob.d.ts | 2 +- .../build/replacePathSepForGlob.d.ts.map | 2 +- .../build/testPathPatternToRegExp.d.ts.map | 2 +- .../jest-util/build/ts3.4/ErrorWithStack.d.ts | 10 - .../jest-util/build/ts3.4/clearLine.d.ts | 10 - .../ts3.4/convertDescriptorToString.d.ts | 8 - .../build/ts3.4/createDirectory.d.ts | 9 - .../build/ts3.4/createProcessObject.d.ts | 10 - .../jest-util/build/ts3.4/deepCyclicCopy.d.ts | 12 - .../jest-util/build/ts3.4/index.d.ts | 23 - .../build/ts3.4/installCommonGlobals.d.ts | 11 - .../build/ts3.4/interopRequireDefault.d.ts | 8 - .../jest-util/build/ts3.4/isInteractive.d.ts | 9 - .../jest-util/build/ts3.4/isPromise.d.ts | 9 - .../jest-util/build/ts3.4/pluralize.d.ts | 8 - .../jest-util/build/ts3.4/preRunMessage.d.ts | 11 - .../build/ts3.4/replacePathSepForGlob.d.ts | 9 - .../jest-util/build/ts3.4/setGlobal.d.ts | 11 - .../jest-util/build/ts3.4/specialChars.d.ts | 15 - .../build/ts3.4/testPathPatternToRegExp.d.ts | 9 - .../jest-util/node_modules/.bin/is-ci | 2 +- .../node_modules/jest-util/package.json | 30 +- .../common/node_modules/jest-worker/README.md | 32 +- .../jest-worker/build/Farm.d.ts.map | 2 +- .../jest-worker/build/WorkerPool.d.ts | 2 +- .../jest-worker/build/WorkerPool.d.ts.map | 2 +- .../build/base/BaseWorkerPool.d.ts | 4 +- .../build/base/BaseWorkerPool.d.ts.map | 2 +- .../jest-worker/build/base/BaseWorkerPool.js | 103 +- .../node_modules/jest-worker/build/index.d.ts | 4 +- .../jest-worker/build/index.d.ts.map | 2 +- .../node_modules/jest-worker/build/index.js | 49 +- .../jest-worker/build/ts3.4/Farm.d.ts | 27 - .../jest-worker/build/ts3.4/WorkerPool.d.ts | 14 - .../build/ts3.4/base/BaseWorkerPool.d.ts | 23 - .../jest-worker/build/ts3.4/index.d.ts | 47 - .../jest-worker/build/ts3.4/types.d.ts | 104 - .../ts3.4/workers/ChildProcessWorker.d.ts | 52 - .../ts3.4/workers/NodeThreadsWorker.d.ts | 35 - .../build/ts3.4/workers/processChild.d.ts | 8 - .../build/ts3.4/workers/threadChild.d.ts | 8 - .../node_modules/jest-worker/build/types.d.ts | 15 +- .../jest-worker/build/types.d.ts.map | 2 +- .../node_modules/jest-worker/build/types.js | 17 +- .../build/workers/ChildProcessWorker.d.ts | 16 +- .../build/workers/ChildProcessWorker.d.ts.map | 2 +- .../build/workers/ChildProcessWorker.js | 135 +- .../build/workers/NodeThreadsWorker.d.ts | 17 +- .../build/workers/NodeThreadsWorker.d.ts.map | 2 +- .../build/workers/NodeThreadsWorker.js | 164 +- .../jest-worker/build/workers/processChild.js | 68 +- .../jest-worker/build/workers/threadChild.js | 73 +- .../node_modules/jest-worker/package.json | 18 +- .../common/node_modules/make-dir/index.d.ts | 91 +- .../common/node_modules/make-dir/index.js | 87 +- .../make-dir/node_modules/.bin/semver | 2 +- .../common/node_modules/make-dir/package.json | 26 +- .../common/node_modules/make-dir/readme.md | 28 +- .../node_modules/micromatch/CHANGELOG.md | 101 +- .../common/node_modules/micromatch/LICENSE | 2 +- .../common/node_modules/micromatch/README.md | 1054 ++- .../common/node_modules/micromatch/index.js | 982 +- .../node_modules/micromatch/package.json | 85 +- .../node_modules/readable-stream/README.md | 11 +- .../readable-stream/lib/_stream_readable.js | 71 +- .../readable-stream/lib/_stream_writable.js | 28 +- .../lib/internal/streams/buffer_list.js | 299 +- .../lib/internal/streams/destroy.js | 32 +- .../lib/internal/streams/from-browser.js | 3 - .../lib/internal/streams/from.js | 64 - .../node_modules/readable-stream/package.json | 4 +- .../node_modules/realpath-native/README.md | 2 +- .../node_modules/realpath-native/index.js | 6 +- .../node_modules/realpath-native/package.json | 25 +- .../common/node_modules/semver/CHANGELOG.md | 31 - packages/common/node_modules/semver/README.md | 39 +- .../common/node_modules/semver/bin/semver.js | 174 - .../common/node_modules/semver/package.json | 8 +- packages/common/node_modules/semver/semver.js | 383 +- packages/common/node_modules/slash/index.d.ts | 25 - packages/common/node_modules/slash/index.js | 10 +- .../common/node_modules/slash/package.json | 17 +- packages/common/node_modules/slash/readme.md | 8 +- .../node_modules/supports-color/index.js | 29 +- .../node_modules/supports-color/package.json | 12 +- .../node_modules/supports-color/readme.md | 33 +- .../node_modules/test-exclude/CHANGELOG.md | 66 +- .../node_modules/test-exclude/README.md | 100 +- .../common/node_modules/test-exclude/index.js | 87 +- .../test-exclude/is-outside-dir-posix.js | 7 - .../test-exclude/is-outside-dir-win32.js | 10 - .../test-exclude/is-outside-dir.js | 7 - .../node_modules/test-exclude/package.json | 32 +- .../node_modules/to-regex-range/LICENSE | 2 +- .../node_modules/to-regex-range/README.md | 190 +- .../node_modules/to-regex-range/index.js | 282 +- .../node_modules/to-regex-range/package.json | 68 +- .../common/node_modules/which/CHANGELOG.md | 14 - packages/common/node_modules/which/README.md | 3 - .../common/node_modules/which/bin/node-which | 52 - .../common/node_modules/which/package.json | 29 +- packages/common/node_modules/which/which.js | 162 +- .../write-file-atomic/CHANGELOG.md | 17 - .../node_modules/write-file-atomic/README.md | 22 +- .../node_modules/write-file-atomic/index.js | 319 +- .../write-file-atomic/package.json | 34 +- packages/common/package.json | 1 + packages/common/src/index.js | 3 +- packages/common/src/schemaValidation/index.js | 5 + packages/common/test/testSchema.js | 10 +- packages/common/yarn.lock | 15 + packages/core/src/recordApi/load.js | 2 + packages/server/index.js | 3 +- .../middleware/controllers/application.js | 18 +- .../server/middleware/controllers/auth.js | 12 + .../server/middleware/controllers/database.js | 28 - .../server/middleware/controllers/instance.js | 54 + .../server/middleware/controllers/model.js | 47 +- .../server/middleware/controllers/record.js | 128 +- .../server/middleware/controllers/user.js | 13 +- .../server/middleware/controllers/view.js | 2 +- packages/server/middleware/routers.js | 37 +- .../middleware/routes/neo/application.js | 3 +- .../server/middleware/routes/neo/database.js | 10 - .../server/middleware/routes/neo/instance.js | 10 + .../server/middleware/routes/neo/record.js | 8 +- .../neo/tests/__snapshots__/view.spec.js.snap | 16 - .../routes/neo/tests/application.spec.js | 5 +- .../routes/neo/tests/couchTestUtils.js | 32 +- .../{database.spec.js => instance.spec.js} | 24 +- .../middleware/routes/neo/tests/model.spec.js | 12 +- .../middleware/routes/neo/tests/user.spec.js | 14 +- .../middleware/routes/neo/tests/view.spec.js | 1 - packages/server/middleware/routes/neo/user.js | 6 +- packages/server/middleware/session.js | 2 +- packages/server/utilities/builder/index.js | 4 +- packages/server/yarn.lock | 1882 ++-- yarn.lock | 8083 +---------------- 380 files changed, 9156 insertions(+), 21380 deletions(-) delete mode 100644 packages/builder/src/components/database/FieldView.svelte rename packages/builder/src/components/database/ModelDataTable/modals/{CreateEditModel.svelte => CreateEditModel.old.svelte} (100%) create mode 100644 packages/builder/src/components/database/ModelDataTable/modals/CreateEditModel/CreateEditModel.svelte create mode 100644 packages/builder/src/components/database/ModelDataTable/modals/CreateEditModel/FieldView.svelte create mode 100644 packages/builder/src/components/database/ModelDataTable/modals/RecordFieldControl.old.svelte create mode 100644 packages/common/lib/schemaValidation/index.js create mode 100644 packages/common/lib/schemaValidation/index.js.map delete mode 100644 packages/common/node_modules/@jest/transform/LICENSE delete mode 100644 packages/common/node_modules/@jest/transform/build/ts3.4/ScriptTransformer.d.ts delete mode 100644 packages/common/node_modules/@jest/transform/build/ts3.4/enhanceUnexpectedTokenMessage.d.ts delete mode 100644 packages/common/node_modules/@jest/transform/build/ts3.4/index.d.ts delete mode 100644 packages/common/node_modules/@jest/transform/build/ts3.4/shouldInstrument.d.ts delete mode 100644 packages/common/node_modules/@jest/transform/build/ts3.4/types.d.ts delete mode 100644 packages/common/node_modules/@jest/types/build/TestResult.d.ts delete mode 100644 packages/common/node_modules/@jest/types/build/TestResult.d.ts.map delete mode 100644 packages/common/node_modules/@jest/types/build/TestResult.js delete mode 100644 packages/common/node_modules/@jest/types/build/Transform.d.ts delete mode 100644 packages/common/node_modules/@jest/types/build/Transform.d.ts.map delete mode 100644 packages/common/node_modules/@jest/types/build/Transform.js delete mode 100644 packages/common/node_modules/@jest/types/build/ts3.4/Circus.d.ts delete mode 100644 packages/common/node_modules/@jest/types/build/ts3.4/Config.d.ts delete mode 100644 packages/common/node_modules/@jest/types/build/ts3.4/Global.d.ts delete mode 100644 packages/common/node_modules/@jest/types/build/ts3.4/TestResult.d.ts delete mode 100644 packages/common/node_modules/@jest/types/build/ts3.4/Transform.d.ts delete mode 100644 packages/common/node_modules/@jest/types/build/ts3.4/index.d.ts delete mode 100644 packages/common/node_modules/ansi-styles/index.d.ts delete mode 100644 packages/common/node_modules/anymatch/index.d.ts delete mode 100644 packages/common/node_modules/babel-plugin-istanbul/lib/load-nyc-config-sync.js delete mode 100644 packages/common/node_modules/braces/CHANGELOG.md delete mode 100644 packages/common/node_modules/braces/lib/compile.js delete mode 100644 packages/common/node_modules/braces/lib/constants.js delete mode 100644 packages/common/node_modules/braces/lib/expand.js delete mode 100644 packages/common/node_modules/braces/lib/parse.js delete mode 100644 packages/common/node_modules/braces/lib/stringify.js delete mode 100644 packages/common/node_modules/chalk/index.d.ts delete mode 100644 packages/common/node_modules/chalk/source/index.js delete mode 100644 packages/common/node_modules/chalk/source/templates.js delete mode 100644 packages/common/node_modules/chalk/source/util.js delete mode 100644 packages/common/node_modules/fsevents/fsevents.d.ts delete mode 100755 packages/common/node_modules/fsevents/fsevents.node delete mode 100644 packages/common/node_modules/has-flag/index.d.ts delete mode 100644 packages/common/node_modules/istanbul-lib-coverage/lib/coverage-summary.js delete mode 100644 packages/common/node_modules/istanbul-lib-coverage/lib/data-properties.js delete mode 100644 packages/common/node_modules/istanbul-lib-coverage/lib/file-coverage.js delete mode 100644 packages/common/node_modules/istanbul-lib-coverage/lib/percent.js delete mode 100644 packages/common/node_modules/jest-haste-map/build/ts3.4/HasteFS.d.ts delete mode 100644 packages/common/node_modules/jest-haste-map/build/ts3.4/ModuleMap.d.ts delete mode 100644 packages/common/node_modules/jest-haste-map/build/ts3.4/blacklist.d.ts delete mode 100644 packages/common/node_modules/jest-haste-map/build/ts3.4/constants.d.ts delete mode 100644 packages/common/node_modules/jest-haste-map/build/ts3.4/crawlers/node.d.ts delete mode 100644 packages/common/node_modules/jest-haste-map/build/ts3.4/crawlers/watchman.d.ts delete mode 100644 packages/common/node_modules/jest-haste-map/build/ts3.4/getMockName.d.ts delete mode 100644 packages/common/node_modules/jest-haste-map/build/ts3.4/index.d.ts delete mode 100644 packages/common/node_modules/jest-haste-map/build/ts3.4/lib/FSEventsWatcher.d.ts delete mode 100644 packages/common/node_modules/jest-haste-map/build/ts3.4/lib/dependencyExtractor.d.ts delete mode 100644 packages/common/node_modules/jest-haste-map/build/ts3.4/lib/fast_path.d.ts delete mode 100644 packages/common/node_modules/jest-haste-map/build/ts3.4/lib/getPlatformExtension.d.ts delete mode 100644 packages/common/node_modules/jest-haste-map/build/ts3.4/lib/isRegExpSupported.d.ts delete mode 100644 packages/common/node_modules/jest-haste-map/build/ts3.4/lib/normalizePathSep.d.ts delete mode 100644 packages/common/node_modules/jest-haste-map/build/ts3.4/types.d.ts delete mode 100644 packages/common/node_modules/jest-haste-map/build/ts3.4/worker.d.ts delete mode 120000 packages/common/node_modules/jest-haste-map/node_modules/.bin/node-which delete mode 100644 packages/common/node_modules/jest-regex-util/build/ts3.4/index.d.ts delete mode 100644 packages/common/node_modules/jest-serializer/build/ts3.4/index.d.ts delete mode 100644 packages/common/node_modules/jest-util/build/ts3.4/ErrorWithStack.d.ts delete mode 100644 packages/common/node_modules/jest-util/build/ts3.4/clearLine.d.ts delete mode 100644 packages/common/node_modules/jest-util/build/ts3.4/convertDescriptorToString.d.ts delete mode 100644 packages/common/node_modules/jest-util/build/ts3.4/createDirectory.d.ts delete mode 100644 packages/common/node_modules/jest-util/build/ts3.4/createProcessObject.d.ts delete mode 100644 packages/common/node_modules/jest-util/build/ts3.4/deepCyclicCopy.d.ts delete mode 100644 packages/common/node_modules/jest-util/build/ts3.4/index.d.ts delete mode 100644 packages/common/node_modules/jest-util/build/ts3.4/installCommonGlobals.d.ts delete mode 100644 packages/common/node_modules/jest-util/build/ts3.4/interopRequireDefault.d.ts delete mode 100644 packages/common/node_modules/jest-util/build/ts3.4/isInteractive.d.ts delete mode 100644 packages/common/node_modules/jest-util/build/ts3.4/isPromise.d.ts delete mode 100644 packages/common/node_modules/jest-util/build/ts3.4/pluralize.d.ts delete mode 100644 packages/common/node_modules/jest-util/build/ts3.4/preRunMessage.d.ts delete mode 100644 packages/common/node_modules/jest-util/build/ts3.4/replacePathSepForGlob.d.ts delete mode 100644 packages/common/node_modules/jest-util/build/ts3.4/setGlobal.d.ts delete mode 100644 packages/common/node_modules/jest-util/build/ts3.4/specialChars.d.ts delete mode 100644 packages/common/node_modules/jest-util/build/ts3.4/testPathPatternToRegExp.d.ts delete mode 100644 packages/common/node_modules/jest-worker/build/ts3.4/Farm.d.ts delete mode 100644 packages/common/node_modules/jest-worker/build/ts3.4/WorkerPool.d.ts delete mode 100644 packages/common/node_modules/jest-worker/build/ts3.4/base/BaseWorkerPool.d.ts delete mode 100644 packages/common/node_modules/jest-worker/build/ts3.4/index.d.ts delete mode 100644 packages/common/node_modules/jest-worker/build/ts3.4/types.d.ts delete mode 100644 packages/common/node_modules/jest-worker/build/ts3.4/workers/ChildProcessWorker.d.ts delete mode 100644 packages/common/node_modules/jest-worker/build/ts3.4/workers/NodeThreadsWorker.d.ts delete mode 100644 packages/common/node_modules/jest-worker/build/ts3.4/workers/processChild.d.ts delete mode 100644 packages/common/node_modules/jest-worker/build/ts3.4/workers/threadChild.d.ts delete mode 100644 packages/common/node_modules/readable-stream/lib/internal/streams/from-browser.js delete mode 100644 packages/common/node_modules/readable-stream/lib/internal/streams/from.js delete mode 100755 packages/common/node_modules/semver/bin/semver.js delete mode 100644 packages/common/node_modules/slash/index.d.ts delete mode 100644 packages/common/node_modules/test-exclude/is-outside-dir-posix.js delete mode 100644 packages/common/node_modules/test-exclude/is-outside-dir-win32.js delete mode 100644 packages/common/node_modules/test-exclude/is-outside-dir.js delete mode 100755 packages/common/node_modules/which/bin/node-which create mode 100644 packages/common/src/schemaValidation/index.js delete mode 100644 packages/server/middleware/controllers/database.js create mode 100644 packages/server/middleware/controllers/instance.js delete mode 100644 packages/server/middleware/routes/neo/database.js create mode 100644 packages/server/middleware/routes/neo/instance.js delete mode 100644 packages/server/middleware/routes/neo/tests/__snapshots__/view.spec.js.snap rename packages/server/middleware/routes/neo/tests/{database.spec.js => instance.spec.js} (73%) diff --git a/lerna.json b/lerna.json index 2febd9ce70..360bc19a6a 100644 --- a/lerna.json +++ b/lerna.json @@ -4,7 +4,6 @@ "packages": [ "packages/*" ], - "useWorkspaces": true, "command": { "publish": { "ignoreChanges": [ diff --git a/package.json b/package.json index 4b253e395d..278a91a8f6 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,6 @@ { "name": "root", "private": true, - "workspaces": [ - "packages/*" - ], "devDependencies": { "babel-eslint": "^10.0.3", "eslint": "^6.8.0", diff --git a/packages/builder/rollup.config.js b/packages/builder/rollup.config.js index 38a1a42a34..8552401356 100644 --- a/packages/builder/rollup.config.js +++ b/packages/builder/rollup.config.js @@ -118,7 +118,7 @@ const coreExternal = [ ] const customResolver = resolve({ - extensions: [".mjs", ".js", ".jsx", ".json", ".sass", ".scss", ".svelte"] + extensions: [".mjs", ".js", ".jsx", ".json", ".sass", ".scss", ".svelte", ".css"] }) const projectRootDir = path.resolve(__dirname) diff --git a/packages/builder/src/builderStore/store/backend.js b/packages/builder/src/builderStore/store/backend.js index 34b3212a58..3005eaf659 100644 --- a/packages/builder/src/builderStore/store/backend.js +++ b/packages/builder/src/builderStore/store/backend.js @@ -19,6 +19,7 @@ export const getBackendUiStore = () => { name: "", }, breadcrumbs: [], + models: [], selectedDatabase: {}, selectedModel: {}, } @@ -27,12 +28,16 @@ export const getBackendUiStore = () => { store.actions = { database: { - select: db => + select: async db => { + const response = await api.get(`/api/${db.id}/models`) + const models = await response.json() store.update(state => { state.selectedDatabase = db state.breadcrumbs = [db.name] + state.models = models return state - }), + }) + } }, records: { delete: () => @@ -51,6 +56,13 @@ export const getBackendUiStore = () => { return state }), }, + models: { + create: model => store.update(state => { + state.models.push(model) + state.models = state.models + return state + }) + }, views: { select: view => store.update(state => { diff --git a/packages/builder/src/builderStore/store/index.js b/packages/builder/src/builderStore/store/index.js index f135ceb070..d5675f953f 100644 --- a/packages/builder/src/builderStore/store/index.js +++ b/packages/builder/src/builderStore/store/index.js @@ -42,7 +42,8 @@ export const getStore = () => { currentNode: null, libraries: null, showSettings: false, - useAnalytics: true + useAnalytics: true, + neoAppId: "84a14e3065c5f15ef8410a5e4c000d68" } const store = writable(initial) diff --git a/packages/builder/src/components/common/NumberBox.svelte b/packages/builder/src/components/common/NumberBox.svelte index ca7443ba48..f3a348dbef 100644 --- a/packages/builder/src/components/common/NumberBox.svelte +++ b/packages/builder/src/components/common/NumberBox.svelte @@ -16,6 +16,6 @@
- +
diff --git a/packages/builder/src/components/database/FieldView.svelte b/packages/builder/src/components/database/FieldView.svelte deleted file mode 100644 index 3bf2ed4b93..0000000000 --- a/packages/builder/src/components/database/FieldView.svelte +++ /dev/null @@ -1,156 +0,0 @@ - - -
- - - -
- - - - - - {#if clonedField.type === 'string'} - - - - {:else if clonedField.type === 'bool'} - - {:else if clonedField.type === 'datetime'} - - - {:else if clonedField.type === 'number'} - - - - {:else if clonedField.type === 'reference'} - n.nodeKey()} - textMember={n => n.name} - bind:selected={clonedField.typeOptions.indexNodeKey} /> - - n.nodeKey()} - textMember={n => n.name} - bind:selected={clonedField.typeOptions.reverseIndexNodeKeys} /> - - - {:else if clonedField.type.startsWith('array')} - - - {/if} - -
- - - diff --git a/packages/builder/src/components/database/ModelDataTable/ModelDataTable.svelte b/packages/builder/src/components/database/ModelDataTable/ModelDataTable.svelte index 971afcf3b0..23d16ab483 100644 --- a/packages/builder/src/components/database/ModelDataTable/ModelDataTable.svelte +++ b/packages/builder/src/components/database/ModelDataTable/ModelDataTable.svelte @@ -27,7 +27,7 @@ CreateEditRecordModal, { onClosed: close, - record: await selectRecord(row), + record: row, }, { styleContent: { padding: "0" } } ) @@ -38,7 +38,7 @@ DeleteRecordModal, { onClosed: close, - record: await selectRecord(row), + record: row, }, { styleContent: { padding: "0" } } ) @@ -53,7 +53,7 @@ const ITEMS_PER_PAGE = 10 // Internal headers we want to hide from the user - const INTERNAL_HEADERS = ["key", "sortKey", "type", "id", "isNew"] + const INTERNAL_HEADERS = ["_id", "_rev", "modelId", "type"] let modalOpen = false let data = [] @@ -61,50 +61,25 @@ let views = [] let currentPage = 0 - $: views = $backendUiStore.selectedRecord - ? childViewsForRecord($store.hierarchy) - : $store.hierarchy.indexes + $: instanceId = $backendUiStore.selectedDatabase.id - $: currentAppInfo = { - appname: $store.appname, - instanceId: $backendUiStore.selectedDatabase.id, + $: { + if ($backendUiStore.selectedView) { + api.fetchDataForView($backendUiStore.selectedView, instanceId).then(records => { + data = records || [] + headers = Object.keys($backendUiStore.selectedModel.schema).filter(key => !INTERNAL_HEADERS.includes(key)); + }) + } } - $: fetchRecordsForView( - $backendUiStore.selectedView, - $backendUiStore.selectedDatabase - ).then(records => { - data = records || [] - headers = hideInternalHeaders($backendUiStore.selectedView) - }) - $: paginatedData = data.slice( currentPage * ITEMS_PER_PAGE, currentPage * ITEMS_PER_PAGE + ITEMS_PER_PAGE ) - const getSchema = getIndexSchema($store.hierarchy) - - const childViewsForRecord = compose(flatten, map("indexes"), get("children")) - - const hideInternalHeaders = compose( - remove(headerName => INTERNAL_HEADERS.includes(headerName)), - map(get("name")), - getSchema - ) - - async function fetchRecordsForView(view, instance) { - if (!view || !view.name) return - - const viewName = $backendUiStore.selectedRecord - ? `${$backendUiStore.selectedRecord.key}/${view.name}` - : view.name - - return await api.fetchDataForView(viewName, { - appname: $store.appname, - instanceId: instance.id, - }) - } + // async function fetchRecordsForView(view, instance) { + // return await api.fetchDataForView($backendUiStore.selectedView) + // } function drillIntoRecord(record) { backendUiStore.update(state => { @@ -127,11 +102,6 @@

{takeRight(2, $backendUiStore.breadcrumbs).join(' / ')}

- diff --git a/packages/builder/src/components/database/ModelDataTable/api.js b/packages/builder/src/components/database/ModelDataTable/api.js index b7a19801df..596b3f695e 100644 --- a/packages/builder/src/components/database/ModelDataTable/api.js +++ b/packages/builder/src/components/database/ModelDataTable/api.js @@ -14,8 +14,8 @@ export async function createDatabase(appname, instanceName) { return await response.json() } -export async function deleteRecord(record, { appname, instanceId }) { - const DELETE_RECORDS_URL = `/_builder/instance/${appname}/${instanceId}/api/record${record.key}` +export async function deleteRecord(record, instanceId) { + const DELETE_RECORDS_URL = `/api/${instanceId}/records/${record._id}/${record._rev}` const response = await api.delete(DELETE_RECORDS_URL) return response } @@ -26,34 +26,16 @@ export async function loadRecord(key, { appname, instanceId }) { return await response.json() } -export async function saveRecord(record, { appname, instanceId }) { - let recordBase = { ...record } - - // brand new record - // car-model-id or name/specific-car-id/manus - if (record.collectionName) { - const collectionKey = `/${record.collectionName}` - recordBase = getNewRecord(recordBase, collectionKey) - recordBase = overwritePresentProperties(recordBase, record) - } - - const SAVE_RECORDS_URL = `/_builder/instance/${appname}/${instanceId}/api/record/` - const response = await api.post(SAVE_RECORDS_URL, recordBase) +export async function saveRecord({ record, instanceId, modelId }) { + const SAVE_RECORDS_URL = `/api/${instanceId}/${modelId}/records` + const response = await api.post(SAVE_RECORDS_URL, record) return await response.json() } -export async function fetchDataForView(viewName, { appname, instanceId }) { - const FETCH_RECORDS_URL = `/_builder/instance/${appname}/${instanceId}/api/listRecords/${viewName}` +export async function fetchDataForView(viewName, instanceId) { + // const FETCH_RECORDS_URL = `/_builder/instance/${appname}/${instanceId}/api/listRecords/${viewName}` + const FETCH_RECORDS_URL = `/api/${instanceId}/${viewName}/records` const response = await api.get(FETCH_RECORDS_URL) return await response.json() -} - -function overwritePresentProperties(baseObj, overwrites) { - const base = { ...baseObj } - - for (let key in base) { - if (overwrites[key]) base[key] = overwrites[key] - } - return base -} +} \ No newline at end of file diff --git a/packages/builder/src/components/database/ModelDataTable/modals/CreateEditModel.svelte b/packages/builder/src/components/database/ModelDataTable/modals/CreateEditModel.old.svelte similarity index 100% rename from packages/builder/src/components/database/ModelDataTable/modals/CreateEditModel.svelte rename to packages/builder/src/components/database/ModelDataTable/modals/CreateEditModel.old.svelte diff --git a/packages/builder/src/components/database/ModelDataTable/modals/CreateEditModel/CreateEditModel.svelte b/packages/builder/src/components/database/ModelDataTable/modals/CreateEditModel/CreateEditModel.svelte new file mode 100644 index 0000000000..af190c7c61 --- /dev/null +++ b/packages/builder/src/components/database/ModelDataTable/modals/CreateEditModel/CreateEditModel.svelte @@ -0,0 +1,156 @@ + + + + {#if !showFieldView} + +

Create / Edit Model

+ {:else} + +

Create / Edit Field

+ {/if} +
+{#if !showFieldView} +
+

Settings

+ + {#if $store.errors && $store.errors.length > 0} + + {/if} + + + +
+ Fields +

(showFieldView = true)}> + Add new field +

+
+ +
+ + + + + + + + + + {#each modelFields as [key, meta]} + + + + + + + + {/each} + +
EditNameTypeValues +
+ editField(meta)} /> + +
{key}
+
{meta.type} + deleteField(meta)} /> +
+
+ + Save + +
+ +{:else} + showFieldView = false} + /> +{/if} + + diff --git a/packages/builder/src/components/database/ModelDataTable/modals/CreateEditModel/FieldView.svelte b/packages/builder/src/components/database/ModelDataTable/modals/CreateEditModel/FieldView.svelte new file mode 100644 index 0000000000..c8f4abcd5a --- /dev/null +++ b/packages/builder/src/components/database/ModelDataTable/modals/CreateEditModel/FieldView.svelte @@ -0,0 +1,102 @@ + + +
+ + + +
+ + + + {#if field.type === 'string'} + + + {:else if field.type === 'bool'} + + + {:else if field.format === 'datetime'} + + + + {:else if field.type === 'number'} + + + {:else if draftField.type.startsWith('array')} + + + + {/if} + +
+
+ Save + Cancel +
+ + diff --git a/packages/builder/src/components/database/ModelDataTable/modals/CreateEditRecord.svelte b/packages/builder/src/components/database/ModelDataTable/modals/CreateEditRecord.svelte index d8eec31859..380442fa71 100644 --- a/packages/builder/src/components/database/ModelDataTable/modals/CreateEditRecord.svelte +++ b/packages/builder/src/components/database/ModelDataTable/modals/CreateEditRecord.svelte @@ -13,63 +13,57 @@ import * as api from "../api" import ErrorsBox from "components/common/ErrorsBox.svelte" - export let record + export let record = {} export let onClosed let errors = [] let selectedModel - const childModelsForModel = compose(flatten, map("children"), get("children")) + $: instanceId = $backendUiStore.selectedDatabase.id - $: currentAppInfo = { - appname: $store.appname, - instanceId: $backendUiStore.selectedDatabase.id, - } $: models = $backendUiStore.selectedRecord ? childModelsForModel($store.hierarchy) : $store.hierarchy.children - $: { - if (record) { - selectedModel = getExactNodeForKey($store.hierarchy)(record.key) - } else { - selectedModel = selectedModel || models[0] - } - } - - $: modelFields = selectedModel ? selectedModel.fields : [] - - function getCurrentCollectionKey(selectedRecord) { - return selectedRecord - ? joinKey(selectedRecord.key, selectedModel.collectionName) - : joinKey(selectedModel.collectionName) - } - - $: editingRecord = - record || - getNewRecord( - selectedModel, - getCurrentCollectionKey($backendUiStore.selectedRecord) - ) + $: modelSchema = $backendUiStore.selectedModel + ? Object.entries($backendUiStore.selectedModel.schema) + : [] function closed() { - editingRecord = null + // editingRecord = null onClosed() } + function determineInputType(meta) { + if (meta.type === "datetime") return "date" + if (meta.type === "number") return "number" + if (meta.type === "boolean") return "checkbox" + + return "text" + } + async function saveRecord() { - const recordResponse = await api.saveRecord(editingRecord, currentAppInfo) + const recordResponse = await api.saveRecord({ + record, + instanceId, + modelId: $backendUiStore.selectedModel._id + }) + if (recordResponse.errors) { + errors = recordResponse.errors; + return; + } + backendUiStore.update(state => { state.selectedView = state.selectedView return state }) - closed() }

Create / Edit Record

- + + {JSON.stringify(errors)}
{#if !record}
@@ -81,8 +75,14 @@
{/if} - {#each modelFields || [] as field} - + {#each modelSchema as [key, meta]} +
+ +
{/each}
diff --git a/packages/builder/src/components/database/ModelDataTable/modals/DeleteRecord.svelte b/packages/builder/src/components/database/ModelDataTable/modals/DeleteRecord.svelte index fc27c6566f..d771a32da8 100644 --- a/packages/builder/src/components/database/ModelDataTable/modals/DeleteRecord.svelte +++ b/packages/builder/src/components/database/ModelDataTable/modals/DeleteRecord.svelte @@ -6,10 +6,7 @@ export let record export let onClosed - $: currentAppInfo = { - appname: $store.appname, - instanceId: $backendUiStore.selectedDatabase.id, - } + $: instanceId = $backendUiStore.selectedDatabase.id
@@ -28,7 +25,7 @@ { - await api.deleteRecord(record, currentAppInfo) + await api.deleteRecord(record, instanceId) backendUiStore.actions.records.delete(record) onClosed() }}> diff --git a/packages/builder/src/components/database/ModelDataTable/modals/RecordFieldControl.old.svelte b/packages/builder/src/components/database/ModelDataTable/modals/RecordFieldControl.old.svelte new file mode 100644 index 0000000000..1491f7878f --- /dev/null +++ b/packages/builder/src/components/database/ModelDataTable/modals/RecordFieldControl.old.svelte @@ -0,0 +1,66 @@ + + +
+ {#if !isCheckbox} + + {/if} +
+ {#if isDropdown} + + {:else if isText} + + {:else if isNumber} + + {:else if isDatetime} + + {:else if isCheckbox} + + {/if} +
+
diff --git a/packages/builder/src/components/database/ModelDataTable/modals/RecordFieldControl.svelte b/packages/builder/src/components/database/ModelDataTable/modals/RecordFieldControl.svelte index 1491f7878f..1c7692d464 100644 --- a/packages/builder/src/components/database/ModelDataTable/modals/RecordFieldControl.svelte +++ b/packages/builder/src/components/database/ModelDataTable/modals/RecordFieldControl.svelte @@ -1,66 +1,29 @@ -
- {#if !isCheckbox} - - {/if} -
- {#if isDropdown} - - {:else if isText} - - {:else if isNumber} - - {:else if isDatetime} - - {:else if isCheckbox} - - {/if} -
-
+ + 0} + {type} + {value} + on:input={handleInput} + on:change={handleInput} /> diff --git a/packages/builder/src/components/database/ModelDataTable/modals/index.js b/packages/builder/src/components/database/ModelDataTable/modals/index.js index c986160961..dc0e1a42d3 100644 --- a/packages/builder/src/components/database/ModelDataTable/modals/index.js +++ b/packages/builder/src/components/database/ModelDataTable/modals/index.js @@ -1,6 +1,6 @@ export { default as DeleteRecordModal } from "./DeleteRecord.svelte" export { default as CreateEditRecordModal } from "./CreateEditRecord.svelte" -export { default as CreateEditModelModal } from "./CreateEditModel.svelte" +export { default as CreateEditModelModal } from "./CreateEditModel/CreateEditModel.svelte" export { default as CreateEditViewModal } from "./CreateEditView.svelte" export { default as CreateDatabaseModal } from "./CreateDatabase.svelte" export { default as CreateUserModal } from "./CreateUser.svelte" diff --git a/packages/builder/src/components/nav/DatabasesList.svelte b/packages/builder/src/components/nav/DatabasesList.svelte index b24a0c2d9a..4da787808a 100644 --- a/packages/builder/src/components/nav/DatabasesList.svelte +++ b/packages/builder/src/components/nav/DatabasesList.svelte @@ -6,16 +6,14 @@ import { CheckIcon } from "../common/Icons" $: instances = $store.appInstances - $: views = $store.hierarchy.indexes + // $: views = $store.hierarchy.indexes async function selectDatabase(database) { - backendUiStore.actions.records.select(null) - backendUiStore.actions.views.select(views[0]) backendUiStore.actions.database.select(database) } async function deleteDatabase(database) { - const DELETE_DATABASE_URL = `/_builder/instance/_master/0/api/record/applications/${$store.appId}/instances/${database.id}` + const DELETE_DATABASE_URL = `/api/instances/${database.id}` const response = await api.delete(DELETE_DATABASE_URL) store.update(state => { state.appInstances = state.appInstances.filter( diff --git a/packages/builder/src/components/nav/HierarchyRow.svelte b/packages/builder/src/components/nav/HierarchyRow.svelte index c19f7f8cd7..db16275b33 100644 --- a/packages/builder/src/components/nav/HierarchyRow.svelte +++ b/packages/builder/src/components/nav/HierarchyRow.svelte @@ -10,7 +10,7 @@ const { open, close } = getContext("simple-modal") - export let level = 0 + // export let level = 0 export let node export let type @@ -27,31 +27,35 @@ } }) - function selectHierarchyItem(node) { - store.selectExistingNode(node.nodeId) - const modalType = - node.type === "index" ? CreateEditViewModal : CreateEditModelModal - open( - modalType, - { - onClosed: close, - }, - { styleContent: { padding: "0" } } - ) + function selectModel(model) { + backendUiStore.update(state => { + state.selectedModel = model + state.selectedView = `all_${model._id}` + return state; + }) + // store.selectExistingNode(node.nodeId) + // const modalType = + // node.type === "index" ? CreateEditViewModal : CreateEditModelModal + // open( + // modalType, + // { + // onClosed: close, + // }, + // { styleContent: { padding: "0" } } + // ) }
selectHierarchyItem(node)} + on:click={() => selectModel(node)} class="budibase__nav-item hierarchy-item" class:capitalized={type === 'model'} - style="padding-left: {20 + level * 20}px" - class:selected={navActive}> + class:selected={$backendUiStore.selectedModel._id === node._id}> {node.name}
- {#if node.children} +