From ff3f3012e0dfd3c76d19f881b426f9f1966782c4 Mon Sep 17 00:00:00 2001 From: Kevin <70767149+kschmelter13@users.noreply.github.com> Date: Sat, 16 Dec 2023 12:57:44 -0500 Subject: [PATCH 1/5] no special characters when creating organization Checks the organizations name for special chars using a regex --- backend/models/organization.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/backend/models/organization.js b/backend/models/organization.js index 5b1b651..48a528f 100644 --- a/backend/models/organization.js +++ b/backend/models/organization.js @@ -18,6 +18,16 @@ const Organization = { }; var slug = slugify(orgName, { lower: true }); + const validNameRegex = /^[a-zA-Z0-9]+$/; + + // Validate orgName against the regular expression + if (!validNameRegex.test(orgName)) { + return { + organization: null, + message: "Organization name contains invalid characters. Only alphanumeric characters are allowed.", + }; + } + const existingBySlug = await this.get({ slug }); if (!!existingBySlug) { const slugSeed = Math.floor(10000000 + Math.random() * 90000000); From 6ec72e42f199e912abff9ddcda3f89860245d515 Mon Sep 17 00:00:00 2001 From: timothycarambat Date: Tue, 19 Dec 2023 14:05:32 -0800 Subject: [PATCH 2/5] fix new orgs always broken on naming convention --- backend/models/organization.js | 18 +- backend/storage/settings.json | 834 ++++++++++++++------------------- 2 files changed, 349 insertions(+), 503 deletions(-) diff --git a/backend/models/organization.js b/backend/models/organization.js index 48a528f..f9ec969 100644 --- a/backend/models/organization.js +++ b/backend/models/organization.js @@ -16,27 +16,21 @@ const Organization = { organization: null, message: "No Organization name provided.", }; - var slug = slugify(orgName, { lower: true }); - const validNameRegex = /^[a-zA-Z0-9]+$/; - - // Validate orgName against the regular expression - if (!validNameRegex.test(orgName)) { - return { - organization: null, - message: "Organization name contains invalid characters. Only alphanumeric characters are allowed.", - }; - } + // If the new name contains bad characters + // replace them with spaces and continue creation. + const newOrgName = orgName.replace(/[:\.,<>@]/, " "); + var slug = slugify(newOrgName, { lower: true }); const existingBySlug = await this.get({ slug }); if (!!existingBySlug) { const slugSeed = Math.floor(10000000 + Math.random() * 90000000); - slug = slugify(`${orgName}-${slugSeed}`, { lower: true }); + slug = slugify(`${newOrgName}-${slugSeed}`, { lower: true }); } const organization = await prisma.organizations.create({ data: { - name: orgName, + name: newOrgName, slug, uuid: this.makeKey(), }, diff --git a/backend/storage/settings.json b/backend/storage/settings.json index afc8999..49c5de5 100644 --- a/backend/storage/settings.json +++ b/backend/storage/settings.json @@ -1,468 +1,4 @@ { - "_prisma_migrations": { - "slug": "_prisma_migrations", - "table": { - "name": "_prisma_migrations", - "pk": "id", - "verbose": "_prisma_migrations" - }, - "columns": [ - { - "name": "id", - "verbose": "id", - "control": { - "text": true - }, - "type": "varchar(36)", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "checksum", - "verbose": "checksum", - "control": { - "text": true - }, - "type": "varchar(64)", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "finished_at", - "verbose": "finished_at", - "control": { - "text": true - }, - "type": "timestamp", - "allowNull": true, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "migration_name", - "verbose": "migration_name", - "control": { - "text": true - }, - "type": "varchar(255)", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "logs", - "verbose": "logs", - "control": { - "text": true - }, - "type": "text", - "allowNull": true, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "rolled_back_at", - "verbose": "rolled_back_at", - "control": { - "text": true - }, - "type": "timestamp", - "allowNull": true, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "started_at", - "verbose": "started_at", - "control": { - "text": true - }, - "type": "timestamp", - "allowNull": false, - "defaultValue": "now()", - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "applied_steps_count", - "verbose": "applied_steps_count", - "control": { - "text": true - }, - "type": "integer", - "allowNull": false, - "defaultValue": "0", - "listview": { - "show": true - }, - "editview": { - "show": true - } - } - ], - "mainview": { - "show": true - }, - "listview": { - "order": {}, - "page": 25 - }, - "editview": { - "readonly": false - } - }, - "system_settings": { - "slug": "system_settings", - "table": { - "name": "system_settings", - "pk": "id", - "verbose": "system_settings" - }, - "columns": [ - { - "name": "id", - "verbose": "id", - "control": { - "text": true - }, - "type": "integer", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "label", - "verbose": "label", - "control": { - "text": true - }, - "type": "text", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "value", - "verbose": "value", - "control": { - "text": true - }, - "type": "text", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "createdAt", - "verbose": "createdAt", - "control": { - "text": true - }, - "type": "timestamp", - "allowNull": false, - "defaultValue": "CURRENT_TIMESTAMP", - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "lastUpdatedAt", - "verbose": "lastUpdatedAt", - "control": { - "text": true - }, - "type": "timestamp", - "allowNull": false, - "defaultValue": "CURRENT_TIMESTAMP", - "listview": { - "show": true - }, - "editview": { - "show": true - } - } - ], - "mainview": { - "show": true - }, - "listview": { - "order": {}, - "page": 25 - }, - "editview": { - "readonly": false - } - }, - "users": { - "slug": "users", - "table": { - "name": "users", - "pk": "id", - "verbose": "users" - }, - "columns": [ - { - "name": "id", - "verbose": "id", - "control": { - "text": true - }, - "type": "integer", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "email", - "verbose": "email", - "control": { - "text": true - }, - "type": "text", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "password", - "verbose": "password", - "control": { - "text": true - }, - "type": "text", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "role", - "verbose": "role", - "control": { - "text": true - }, - "type": "text", - "allowNull": false, - "defaultValue": "'default'::text", - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "createdAt", - "verbose": "createdAt", - "control": { - "text": true - }, - "type": "timestamp", - "allowNull": false, - "defaultValue": "CURRENT_TIMESTAMP", - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "lastUpdatedAt", - "verbose": "lastUpdatedAt", - "control": { - "text": true - }, - "type": "timestamp", - "allowNull": false, - "defaultValue": "CURRENT_TIMESTAMP", - "listview": { - "show": true - }, - "editview": { - "show": true - } - } - ], - "mainview": { - "show": true - }, - "listview": { - "order": {}, - "page": 25 - }, - "editview": { - "readonly": false - } - }, - "organization_users": { - "slug": "organization_users", - "table": { - "name": "organization_users", - "pk": "id", - "verbose": "organization_users" - }, - "columns": [ - { - "name": "id", - "verbose": "id", - "control": { - "text": true - }, - "type": "integer", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "user_id", - "verbose": "user_id", - "control": { - "text": true - }, - "type": "integer", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "organization_id", - "verbose": "organization_id", - "control": { - "text": true - }, - "type": "integer", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "createdAt", - "verbose": "createdAt", - "control": { - "text": true - }, - "type": "timestamp", - "allowNull": false, - "defaultValue": "CURRENT_TIMESTAMP", - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "lastUpdatedAt", - "verbose": "lastUpdatedAt", - "control": { - "text": true - }, - "type": "timestamp", - "allowNull": false, - "defaultValue": "CURRENT_TIMESTAMP", - "listview": { - "show": true - }, - "editview": { - "show": true - } - } - ], - "mainview": { - "show": true - }, - "listview": { - "order": {}, - "page": 25 - }, - "editview": { - "readonly": false - } - }, "organizations": { "slug": "organizations", "table": { @@ -795,6 +331,154 @@ "readonly": false } }, + "organization_workspaces": { + "slug": "organization_workspaces", + "table": { + "name": "organization_workspaces", + "pk": "id", + "verbose": "organization_workspaces" + }, + "columns": [ + { + "name": "id", + "verbose": "id", + "control": { + "text": true + }, + "type": "integer", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "name", + "verbose": "name", + "control": { + "text": true + }, + "type": "text", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "slug", + "verbose": "slug", + "control": { + "text": true + }, + "type": "text", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "uuid", + "verbose": "uuid", + "control": { + "text": true + }, + "type": "text", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "fname", + "verbose": "fname", + "control": { + "text": true + }, + "type": "text", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "organization_id", + "verbose": "organization_id", + "control": { + "text": true + }, + "type": "integer", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "createdAt", + "verbose": "createdAt", + "control": { + "text": true + }, + "type": "timestamp", + "allowNull": false, + "defaultValue": "CURRENT_TIMESTAMP", + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "lastUpdatedAt", + "verbose": "lastUpdatedAt", + "control": { + "text": true + }, + "type": "timestamp", + "allowNull": false, + "defaultValue": "CURRENT_TIMESTAMP", + "listview": { + "show": true + }, + "editview": { + "show": true + } + } + ], + "mainview": { + "show": true + }, + "listview": { + "order": {}, + "page": 25 + }, + "editview": { + "readonly": false + } + }, "workspace_documents": { "slug": "workspace_documents", "table": { @@ -927,6 +611,122 @@ "readonly": false } }, + "users": { + "slug": "users", + "table": { + "name": "users", + "pk": "id", + "verbose": "users" + }, + "columns": [ + { + "name": "id", + "verbose": "id", + "control": { + "text": true + }, + "type": "integer", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "email", + "verbose": "email", + "control": { + "text": true + }, + "type": "text", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "password", + "verbose": "password", + "control": { + "text": true + }, + "type": "text", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "role", + "verbose": "role", + "control": { + "text": true + }, + "type": "text", + "allowNull": false, + "defaultValue": "'default'::text", + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "createdAt", + "verbose": "createdAt", + "control": { + "text": true + }, + "type": "timestamp", + "allowNull": false, + "defaultValue": "CURRENT_TIMESTAMP", + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "lastUpdatedAt", + "verbose": "lastUpdatedAt", + "control": { + "text": true + }, + "type": "timestamp", + "allowNull": false, + "defaultValue": "CURRENT_TIMESTAMP", + "listview": { + "show": true + }, + "editview": { + "show": true + } + } + ], + "mainview": { + "show": true + }, + "listview": { + "order": {}, + "page": 25 + }, + "editview": { + "readonly": false + } + }, "document_vectors": { "slug": "document_vectors", "table": { @@ -1239,12 +1039,12 @@ "readonly": false } }, - "organization_workspaces": { - "slug": "organization_workspaces", + "system_settings": { + "slug": "system_settings", "table": { - "name": "organization_workspaces", + "name": "system_settings", "pk": "id", - "verbose": "organization_workspaces" + "verbose": "system_settings" }, "columns": [ { @@ -1264,8 +1064,8 @@ } }, { - "name": "name", - "verbose": "name", + "name": "label", + "verbose": "label", "control": { "text": true }, @@ -1280,8 +1080,8 @@ } }, { - "name": "slug", - "verbose": "slug", + "name": "value", + "verbose": "value", "control": { "text": true }, @@ -1296,12 +1096,80 @@ } }, { - "name": "uuid", - "verbose": "uuid", + "name": "createdAt", + "verbose": "createdAt", "control": { "text": true }, - "type": "text", + "type": "timestamp", + "allowNull": false, + "defaultValue": "CURRENT_TIMESTAMP", + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "lastUpdatedAt", + "verbose": "lastUpdatedAt", + "control": { + "text": true + }, + "type": "timestamp", + "allowNull": false, + "defaultValue": "CURRENT_TIMESTAMP", + "listview": { + "show": true + }, + "editview": { + "show": true + } + } + ], + "mainview": { + "show": true + }, + "listview": { + "order": {}, + "page": 25 + }, + "editview": { + "readonly": false + } + }, + "organization_users": { + "slug": "organization_users", + "table": { + "name": "organization_users", + "pk": "id", + "verbose": "organization_users" + }, + "columns": [ + { + "name": "id", + "verbose": "id", + "control": { + "text": true + }, + "type": "integer", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "user_id", + "verbose": "user_id", + "control": { + "text": true + }, + "type": "integer", "allowNull": false, "defaultValue": null, "listview": { @@ -1358,22 +1226,6 @@ "editview": { "show": true } - }, - { - "name": "fname", - "verbose": "fname", - "control": { - "text": true - }, - "type": "text", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } } ], "mainview": { From 27369b29229b8b282e72e5984ea2bc9ed69e0faf Mon Sep 17 00:00:00 2001 From: timothycarambat Date: Tue, 19 Dec 2023 14:09:06 -0800 Subject: [PATCH 3/5] fix: add global flag --- backend/models/organization.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/models/organization.js b/backend/models/organization.js index f9ec969..861d218 100644 --- a/backend/models/organization.js +++ b/backend/models/organization.js @@ -19,7 +19,7 @@ const Organization = { // If the new name contains bad characters // replace them with spaces and continue creation. - const newOrgName = orgName.replace(/[:\.,<>@]/, " "); + const newOrgName = orgName.replace(/[:.,<>@]/, " "); var slug = slugify(newOrgName, { lower: true }); const existingBySlug = await this.get({ slug }); From fbc23f6ad4082993411295d085b829ab0b9f1293 Mon Sep 17 00:00:00 2001 From: timothycarambat Date: Tue, 19 Dec 2023 14:09:50 -0800 Subject: [PATCH 4/5] fix: add global flag --- backend/models/organization.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/models/organization.js b/backend/models/organization.js index 861d218..2637d54 100644 --- a/backend/models/organization.js +++ b/backend/models/organization.js @@ -17,9 +17,9 @@ const Organization = { message: "No Organization name provided.", }; - // If the new name contains bad characters + // If the new name contains bad characters // replace them with spaces and continue creation. - const newOrgName = orgName.replace(/[:.,<>@]/, " "); + const newOrgName = orgName.replace(/[:\.,<>@]/g, ' '); var slug = slugify(newOrgName, { lower: true }); const existingBySlug = await this.get({ slug }); From f0ac186da72def039275ee30800db72bd3cc6729 Mon Sep 17 00:00:00 2001 From: timothycarambat Date: Thu, 21 Dec 2023 11:04:21 -0800 Subject: [PATCH 5/5] cleanup PRs --- backend/endpoints/v1/documents/index.js | 1 - backend/storage/settings.json | 512 +++++++++--------- frontend/src/components/Header/index.tsx | 122 +---- .../FragmentList/SearchView/index.tsx | 4 - .../pages/DocumentView/FragmentList/index.tsx | 1 - 5 files changed, 258 insertions(+), 382 deletions(-) diff --git a/backend/endpoints/v1/documents/index.js b/backend/endpoints/v1/documents/index.js index db4c56e..8ac7179 100644 --- a/backend/endpoints/v1/documents/index.js +++ b/backend/endpoints/v1/documents/index.js @@ -409,7 +409,6 @@ function documentEndpoints(app) { method, query ); - response.status(200).json({ fragments, error }); } catch (e) { console.log(e.message, e); diff --git a/backend/storage/settings.json b/backend/storage/settings.json index 98f127d..49c5de5 100644 --- a/backend/storage/settings.json +++ b/backend/storage/settings.json @@ -611,154 +611,6 @@ "readonly": false } }, - "document_vectors": { - "slug": "document_vectors", - "table": { - "name": "document_vectors", - "pk": "id", - "verbose": "document_vectors" - }, - "columns": [ - { - "name": "id", - "verbose": "id", - "control": { - "text": true - }, - "type": "integer", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "docId", - "verbose": "docId", - "control": { - "text": true - }, - "type": "text", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "vectorId", - "verbose": "vectorId", - "control": { - "text": true - }, - "type": "text", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "document_id", - "verbose": "document_id", - "control": { - "text": true - }, - "type": "integer", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "workspace_id", - "verbose": "workspace_id", - "control": { - "text": true - }, - "type": "integer", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "organization_id", - "verbose": "organization_id", - "control": { - "text": true - }, - "type": "integer", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "createdAt", - "verbose": "createdAt", - "control": { - "text": true - }, - "type": "timestamp", - "allowNull": false, - "defaultValue": "CURRENT_TIMESTAMP", - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "lastUpdatedAt", - "verbose": "lastUpdatedAt", - "control": { - "text": true - }, - "type": "timestamp", - "allowNull": false, - "defaultValue": "CURRENT_TIMESTAMP", - "listview": { - "show": true - }, - "editview": { - "show": true - } - } - ], - "mainview": { - "show": true - }, - "listview": { - "order": {}, - "page": 25 - }, - "editview": { - "readonly": false - } - }, "users": { "slug": "users", "table": { @@ -875,12 +727,12 @@ "readonly": false } }, - "system_settings": { - "slug": "system_settings", + "document_vectors": { + "slug": "document_vectors", "table": { - "name": "system_settings", + "name": "document_vectors", "pk": "id", - "verbose": "system_settings" + "verbose": "document_vectors" }, "columns": [ { @@ -900,8 +752,8 @@ } }, { - "name": "label", - "verbose": "label", + "name": "docId", + "verbose": "docId", "control": { "text": true }, @@ -916,8 +768,8 @@ } }, { - "name": "value", - "verbose": "value", + "name": "vectorId", + "verbose": "vectorId", "control": { "text": true }, @@ -931,6 +783,54 @@ "show": true } }, + { + "name": "document_id", + "verbose": "document_id", + "control": { + "text": true + }, + "type": "integer", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "workspace_id", + "verbose": "workspace_id", + "control": { + "text": true + }, + "type": "integer", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "organization_id", + "verbose": "organization_id", + "control": { + "text": true + }, + "type": "integer", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, { "name": "createdAt", "verbose": "createdAt", @@ -1139,6 +1039,206 @@ "readonly": false } }, + "system_settings": { + "slug": "system_settings", + "table": { + "name": "system_settings", + "pk": "id", + "verbose": "system_settings" + }, + "columns": [ + { + "name": "id", + "verbose": "id", + "control": { + "text": true + }, + "type": "integer", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "label", + "verbose": "label", + "control": { + "text": true + }, + "type": "text", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "value", + "verbose": "value", + "control": { + "text": true + }, + "type": "text", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "createdAt", + "verbose": "createdAt", + "control": { + "text": true + }, + "type": "timestamp", + "allowNull": false, + "defaultValue": "CURRENT_TIMESTAMP", + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "lastUpdatedAt", + "verbose": "lastUpdatedAt", + "control": { + "text": true + }, + "type": "timestamp", + "allowNull": false, + "defaultValue": "CURRENT_TIMESTAMP", + "listview": { + "show": true + }, + "editview": { + "show": true + } + } + ], + "mainview": { + "show": true + }, + "listview": { + "order": {}, + "page": 25 + }, + "editview": { + "readonly": false + } + }, + "organization_users": { + "slug": "organization_users", + "table": { + "name": "organization_users", + "pk": "id", + "verbose": "organization_users" + }, + "columns": [ + { + "name": "id", + "verbose": "id", + "control": { + "text": true + }, + "type": "integer", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "user_id", + "verbose": "user_id", + "control": { + "text": true + }, + "type": "integer", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "organization_id", + "verbose": "organization_id", + "control": { + "text": true + }, + "type": "integer", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "createdAt", + "verbose": "createdAt", + "control": { + "text": true + }, + "type": "timestamp", + "allowNull": false, + "defaultValue": "CURRENT_TIMESTAMP", + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "lastUpdatedAt", + "verbose": "lastUpdatedAt", + "control": { + "text": true + }, + "type": "timestamp", + "allowNull": false, + "defaultValue": "CURRENT_TIMESTAMP", + "listview": { + "show": true + }, + "editview": { + "show": true + } + } + ], + "mainview": { + "show": true + }, + "listview": { + "order": {}, + "page": 25 + }, + "editview": { + "readonly": false + } + }, "organization_notifications": { "slug": "organization_notifications", "table": { @@ -1303,106 +1403,6 @@ "readonly": false } }, - "organization_users": { - "slug": "organization_users", - "table": { - "name": "organization_users", - "pk": "id", - "verbose": "organization_users" - }, - "columns": [ - { - "name": "id", - "verbose": "id", - "control": { - "text": true - }, - "type": "integer", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "user_id", - "verbose": "user_id", - "control": { - "text": true - }, - "type": "integer", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "organization_id", - "verbose": "organization_id", - "control": { - "text": true - }, - "type": "integer", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "createdAt", - "verbose": "createdAt", - "control": { - "text": true - }, - "type": "timestamp", - "allowNull": false, - "defaultValue": "CURRENT_TIMESTAMP", - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "lastUpdatedAt", - "verbose": "lastUpdatedAt", - "control": { - "text": true - }, - "type": "timestamp", - "allowNull": false, - "defaultValue": "CURRENT_TIMESTAMP", - "listview": { - "show": true - }, - "editview": { - "show": true - } - } - ], - "mainview": { - "show": true - }, - "listview": { - "order": {}, - "page": 25 - }, - "editview": { - "readonly": false - } - }, "organization_rag_tests": { "slug": "organization_rag_tests", "table": { diff --git a/frontend/src/components/Header/index.tsx b/frontend/src/components/Header/index.tsx index 9c11d3c..494d37e 100644 --- a/frontend/src/components/Header/index.tsx +++ b/frontend/src/components/Header/index.tsx @@ -1,11 +1,4 @@ -import { Link } from 'react-router-dom'; -import Logo from '../../images/logo/logo-light.png'; -import { CheckCircle, Copy } from 'react-feather'; import { useEffect, useState } from 'react'; -import paths from '../../utils/paths'; -import { STORE_TOKEN, STORE_USER } from '../../utils/constants'; -import truncate from 'truncate'; -import Notifications from './Notifications'; export default function Header(props: { entity?: any | null; @@ -17,12 +10,7 @@ export default function Header(props: { }) { const [copied, setCopied] = useState(false); if (!props.entity) return null; - const { entity, property, nameProp, extendedItems = <> } = props; - - const handleCopy = () => { - window.navigator.clipboard.writeText(entity[property]); - setCopied(true); - }; + const { extendedItems = <> } = props; useEffect(() => { function manageCopy() { @@ -35,114 +23,8 @@ export default function Header(props: { }, [copied]); return ( - //
- //
- //
- // {/* */} - // - // {/* */} - - // - // Logo - // - //
- - //
- //
- //
- //

- // {truncate(entity[nameProp ?? 'name'], 20)} - //

- // - // {extendedItems} - //
- //
- // - // - //
- //
- //
- //
- //
-
- {/*
- Organization {'>'} Workspace 1 {'>'} Document 1 -
-
- - -
*/} - {extendedItems} -
+
{extendedItems}
); } diff --git a/frontend/src/pages/DocumentView/FragmentList/SearchView/index.tsx b/frontend/src/pages/DocumentView/FragmentList/SearchView/index.tsx index 0ba2635..7c4bfe4 100644 --- a/frontend/src/pages/DocumentView/FragmentList/SearchView/index.tsx +++ b/frontend/src/pages/DocumentView/FragmentList/SearchView/index.tsx @@ -38,14 +38,12 @@ export default function SearchView({ }) { const formEl = useRef(null); const [showSearchMethods, setShowSearchMethods] = useState(false); - const [sourceDoc, setSourceDoc] = useState(null); const clearSearch = (e: SyntheticEvent) => { e.preventDefault(); setSearchBy('exactText'); setSearching(false); setSearchMode(false); - setSourceDoc(null); (formEl.current as HTMLFormElement).reset(); }; const handleSearch = async (e: SyntheticEvent) => { @@ -69,8 +67,6 @@ export default function SearchView({ setSearchFragments([]); return; } - const metadataForIds = await Document.metadatas(document.id, vectorIds); - setSourceDoc(metadataForIds); setSearchFragments(matches); setSearching(false); }; diff --git a/frontend/src/pages/DocumentView/FragmentList/index.tsx b/frontend/src/pages/DocumentView/FragmentList/index.tsx index 5943e86..b244922 100644 --- a/frontend/src/pages/DocumentView/FragmentList/index.tsx +++ b/frontend/src/pages/DocumentView/FragmentList/index.tsx @@ -3,7 +3,6 @@ import PreLoader from '../../../components/Preloader'; import Document from '../../../models/document'; import truncate from 'truncate'; import pluralize from 'pluralize'; -import { useParams } from 'react-router-dom'; import DocumentListPagination from '../../../components/DocumentPaginator'; import SearchView from './SearchView'; import MetadataEditor from './MetadataEditor';