From 4de70a34202e8848120e9f1a30de37551b64da26 Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Thu, 23 Jan 2025 11:20:48 -0700 Subject: [PATCH] restrict certain routes to admins --- .../{ => (permissions)}/attributes/page.tsx | 4 +-- .../ListDatasetGroupsComponent.tsx | 0 .../DatasetGroupAppSegments.tsx | 0 .../DatasetGroupBackButton.tsx | 0 .../DatasetGroupTitleAndDescription.tsx | 0 .../DatasetGroupDatasetSelectedPopup.tsx | 0 .../DatasetGroupDatasetsController.tsx | 0 .../DatasetGroupDatasetsListContainer.tsx | 0 .../[datasetGroupId]/datasets/page.tsx | 0 .../[datasetGroupId]/layout.tsx | 0 .../DatasetGroupDatasetGroupsController.tsx | 0 .../DatasetGroupDatasetSelectedPopup.tsx | 0 .../DatasetGroupDatasetsListContainer.tsx | 0 .../permission-groups/page.tsx | 0 .../users/DatasetGroupUsersController.tsx | 0 .../users/DatasetGroupUsersListContainer.tsx | 0 .../users/DatasetGroupUsersSelectedPopup.tsx | 0 .../[datasetGroupId]/users/page.tsx | 0 .../dataset-groups/page.tsx | 2 +- .../app/app/settings/(permissions)/layout.tsx | 17 +++++++++++ .../ListPermissionGroupsComponent.tsx | 0 .../PermissionAppSegments.tsx | 0 .../PermissionBackButton.tsx | 0 .../PermissionGroupTitleAndDescription.tsx | 0 ...PermissionGroupDatasetGroupsController.tsx | 0 .../PermissionGroupDatasetSelectedPopup.tsx | 0 .../PermissionGroupDatasetsListContainer.tsx | 0 .../dataset-groups/page.tsx | 0 .../PermissionGroupDatasetSelectedPopup.tsx | 0 .../PermissionGroupDatasetsController.tsx | 0 .../PermissionGroupDatasetsListContainer.tsx | 0 .../[permissionGroupId]/datasets/page.tsx | 0 .../[permissionGroupId]/layout.tsx | 0 .../users/PermissionGroupUsersController.tsx | 0 .../PermissionGroupUsersListContainer.tsx | 0 .../PermissionGroupUsersSelectedPopup.tsx | 0 .../[permissionGroupId]/users/page.tsx | 0 .../permission-groups/page.tsx | 2 +- .../users/ListUsersComponent.tsx | 2 +- .../users/UserListPopupContainer.tsx | 0 .../LayoutHeaderAndSegment.tsx | 0 .../_LayoutHeaderAndSegment/UserHeader.tsx | 0 .../_LayoutHeaderAndSegment/UserSegments.tsx | 0 .../UsersBackButton.tsx | 0 .../[userId]/_LayoutHeaderAndSegment/index.ts | 0 .../_overview/UserDatasetListContainer.tsx | 0 .../[userId]/_overview/UserDatasetSearch.tsx | 0 .../[userId]/_overview/UserDefaultAccess.tsx | 0 .../[userId]/_overview/UserLineageHeader.tsx | 0 .../_overview/UserOverviewController.tsx | 0 .../attributes/UserAttributesController.tsx | 0 .../UserAttributesListContainer.tsx | 0 .../UserAttributesSelectedPopup.tsx | 0 .../users/[userId]/attributes/page.tsx | 0 .../UserDatasetGroupListContainer.tsx | 0 .../UserDatasetGroupSelectedPopup.tsx | 0 .../UserDatasetGroupsController.tsx | 0 .../users/[userId]/dataset-groups/page.tsx | 0 .../datasets/UserDatasetsController.tsx | 0 .../datasets/UserDatasetsListContainer.tsx | 0 .../datasets/UserDatasetsSelectedPopup.tsx | 0 .../users/[userId]/datasets/page.tsx | 0 .../users/[userId]/layout.tsx | 0 .../users/[userId]/page.tsx | 0 .../UserPermissionGroupSelectedPopup.tsx | 0 .../UserPermissionGroupsController.tsx | 0 .../UserPermissionGroupsListContainer.tsx | 0 .../users/[userId]/permission-groups/page.tsx | 2 +- .../[userId]/teams/UserTeamsController.tsx | 0 .../[userId]/teams/UserTeamsListContainer.tsx | 0 .../[userId]/teams/UserTeamsSelectedPopup.tsx | 0 .../users/[userId]/teams/page.tsx | 0 .../{ => (permissions)}/users/config.ts | 0 .../{ => (permissions)}/users/page.tsx | 4 +-- .../(restricted-width)/api-keys/page.tsx | 2 +- .../(restricted-width)/billing/page.tsx | 19 ++++++++++-- .../[datasourceId]/FormItem.tsx | 0 .../[datasourceId]/WhiteListBlock.tsx | 0 .../[datasourceId]/_DatasourceForm.tsx | 0 .../[datasourceId]/_DatasourceFormContent.tsx | 0 .../[datasourceId]/_forms/BigQueryForm.tsx | 0 .../[datasourceId]/_forms/DataBricksForm.tsx | 0 .../[datasourceId]/_forms/FormWrapper.tsx | 0 .../[datasourceId]/_forms/MySqlForm.tsx | 0 .../[datasourceId]/_forms/PostgresForm.tsx | 0 .../[datasourceId]/_forms/RedshiftForm.tsx | 0 .../[datasourceId]/_forms/SnowflakeForm.tsx | 0 .../[datasourceId]/_forms/SqlServerForm.tsx | 0 .../[datasourceId]/page.tsx | 0 .../add/page.tsx | 4 +-- .../(admin-restricted-space)/layout.tsx | 16 ++++++++++ .../datasources/_DatasourceList.tsx | 17 +++++++---- .../datasources/_HeaderContainer.tsx | 5 +--- .../(restricted-width)/datasources/page.tsx | 3 +- .../(restricted-width)/embeds/page.tsx | 4 +-- .../(restricted-width)/general/page.tsx | 4 +-- .../(restricted-width)/integrations/page.tsx | 4 +-- .../(restricted-width)/notifications/page.tsx | 4 +-- .../(restricted-width)/permissions/page.tsx | 4 +-- .../(restricted-width)/preferences/page.tsx | 4 +-- .../(restricted-width)/profile/page.tsx | 4 +-- .../(restricted-width)/security/page.tsx | 4 +-- .../(restricted-width)/storage/page.tsx | 4 +-- .../SettingsEmptyState.tsx} | 30 +++++++++++-------- .../SettingsPageHeader.tsx} | 0 web/src/app/app/settings/_components/index.ts | 2 ++ web/src/server_context/user.ts | 2 +- 107 files changed, 111 insertions(+), 58 deletions(-) rename web/src/app/app/settings/{ => (permissions)}/attributes/page.tsx (65%) rename web/src/app/app/settings/{ => (permissions)}/dataset-groups/ListDatasetGroupsComponent.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/dataset-groups/[datasetGroupId]/DatasetGroupAppSegments.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/dataset-groups/[datasetGroupId]/DatasetGroupBackButton.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/dataset-groups/[datasetGroupId]/DatasetGroupTitleAndDescription.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/dataset-groups/[datasetGroupId]/datasets/DatasetGroupDatasetSelectedPopup.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/dataset-groups/[datasetGroupId]/datasets/DatasetGroupDatasetsController.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/dataset-groups/[datasetGroupId]/datasets/DatasetGroupDatasetsListContainer.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/dataset-groups/[datasetGroupId]/datasets/page.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/dataset-groups/[datasetGroupId]/layout.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/dataset-groups/[datasetGroupId]/permission-groups/DatasetGroupDatasetGroupsController.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/dataset-groups/[datasetGroupId]/permission-groups/DatasetGroupDatasetSelectedPopup.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/dataset-groups/[datasetGroupId]/permission-groups/DatasetGroupDatasetsListContainer.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/dataset-groups/[datasetGroupId]/permission-groups/page.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/dataset-groups/[datasetGroupId]/users/DatasetGroupUsersController.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/dataset-groups/[datasetGroupId]/users/DatasetGroupUsersListContainer.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/dataset-groups/[datasetGroupId]/users/DatasetGroupUsersSelectedPopup.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/dataset-groups/[datasetGroupId]/users/page.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/dataset-groups/page.tsx (96%) create mode 100644 web/src/app/app/settings/(permissions)/layout.tsx rename web/src/app/app/settings/{ => (permissions)}/permission-groups/ListPermissionGroupsComponent.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/permission-groups/[permissionGroupId]/PermissionAppSegments.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/permission-groups/[permissionGroupId]/PermissionBackButton.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/permission-groups/[permissionGroupId]/PermissionGroupTitleAndDescription.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/permission-groups/[permissionGroupId]/dataset-groups/PermissionGroupDatasetGroupsController.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/permission-groups/[permissionGroupId]/dataset-groups/PermissionGroupDatasetSelectedPopup.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/permission-groups/[permissionGroupId]/dataset-groups/PermissionGroupDatasetsListContainer.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/permission-groups/[permissionGroupId]/dataset-groups/page.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/permission-groups/[permissionGroupId]/datasets/PermissionGroupDatasetSelectedPopup.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/permission-groups/[permissionGroupId]/datasets/PermissionGroupDatasetsController.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/permission-groups/[permissionGroupId]/datasets/PermissionGroupDatasetsListContainer.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/permission-groups/[permissionGroupId]/datasets/page.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/permission-groups/[permissionGroupId]/layout.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/permission-groups/[permissionGroupId]/users/PermissionGroupUsersController.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/permission-groups/[permissionGroupId]/users/PermissionGroupUsersListContainer.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/permission-groups/[permissionGroupId]/users/PermissionGroupUsersSelectedPopup.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/permission-groups/[permissionGroupId]/users/page.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/permission-groups/page.tsx (96%) rename web/src/app/app/settings/{ => (permissions)}/users/ListUsersComponent.tsx (97%) rename web/src/app/app/settings/{ => (permissions)}/users/UserListPopupContainer.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/users/[userId]/_LayoutHeaderAndSegment/LayoutHeaderAndSegment.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/users/[userId]/_LayoutHeaderAndSegment/UserHeader.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/users/[userId]/_LayoutHeaderAndSegment/UserSegments.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/users/[userId]/_LayoutHeaderAndSegment/UsersBackButton.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/users/[userId]/_LayoutHeaderAndSegment/index.ts (100%) rename web/src/app/app/settings/{ => (permissions)}/users/[userId]/_overview/UserDatasetListContainer.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/users/[userId]/_overview/UserDatasetSearch.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/users/[userId]/_overview/UserDefaultAccess.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/users/[userId]/_overview/UserLineageHeader.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/users/[userId]/_overview/UserOverviewController.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/users/[userId]/attributes/UserAttributesController.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/users/[userId]/attributes/UserAttributesListContainer.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/users/[userId]/attributes/UserAttributesSelectedPopup.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/users/[userId]/attributes/page.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/users/[userId]/dataset-groups/UserDatasetGroupListContainer.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/users/[userId]/dataset-groups/UserDatasetGroupSelectedPopup.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/users/[userId]/dataset-groups/UserDatasetGroupsController.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/users/[userId]/dataset-groups/page.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/users/[userId]/datasets/UserDatasetsController.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/users/[userId]/datasets/UserDatasetsListContainer.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/users/[userId]/datasets/UserDatasetsSelectedPopup.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/users/[userId]/datasets/page.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/users/[userId]/layout.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/users/[userId]/page.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/users/[userId]/permission-groups/UserPermissionGroupSelectedPopup.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/users/[userId]/permission-groups/UserPermissionGroupsController.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/users/[userId]/permission-groups/UserPermissionGroupsListContainer.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/users/[userId]/permission-groups/page.tsx (97%) rename web/src/app/app/settings/{ => (permissions)}/users/[userId]/teams/UserTeamsController.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/users/[userId]/teams/UserTeamsListContainer.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/users/[userId]/teams/UserTeamsSelectedPopup.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/users/[userId]/teams/page.tsx (100%) rename web/src/app/app/settings/{ => (permissions)}/users/config.ts (100%) rename web/src/app/app/settings/{ => (permissions)}/users/page.tsx (89%) rename web/src/app/app/settings/(restricted-width)/datasources/{ => (admin-restricted-space)}/[datasourceId]/FormItem.tsx (100%) rename web/src/app/app/settings/(restricted-width)/datasources/{ => (admin-restricted-space)}/[datasourceId]/WhiteListBlock.tsx (100%) rename web/src/app/app/settings/(restricted-width)/datasources/{ => (admin-restricted-space)}/[datasourceId]/_DatasourceForm.tsx (100%) rename web/src/app/app/settings/(restricted-width)/datasources/{ => (admin-restricted-space)}/[datasourceId]/_DatasourceFormContent.tsx (100%) rename web/src/app/app/settings/(restricted-width)/datasources/{ => (admin-restricted-space)}/[datasourceId]/_forms/BigQueryForm.tsx (100%) rename web/src/app/app/settings/(restricted-width)/datasources/{ => (admin-restricted-space)}/[datasourceId]/_forms/DataBricksForm.tsx (100%) rename web/src/app/app/settings/(restricted-width)/datasources/{ => (admin-restricted-space)}/[datasourceId]/_forms/FormWrapper.tsx (100%) rename web/src/app/app/settings/(restricted-width)/datasources/{ => (admin-restricted-space)}/[datasourceId]/_forms/MySqlForm.tsx (100%) rename web/src/app/app/settings/(restricted-width)/datasources/{ => (admin-restricted-space)}/[datasourceId]/_forms/PostgresForm.tsx (100%) rename web/src/app/app/settings/(restricted-width)/datasources/{ => (admin-restricted-space)}/[datasourceId]/_forms/RedshiftForm.tsx (100%) rename web/src/app/app/settings/(restricted-width)/datasources/{ => (admin-restricted-space)}/[datasourceId]/_forms/SnowflakeForm.tsx (100%) rename web/src/app/app/settings/(restricted-width)/datasources/{ => (admin-restricted-space)}/[datasourceId]/_forms/SqlServerForm.tsx (100%) rename web/src/app/app/settings/(restricted-width)/datasources/{ => (admin-restricted-space)}/[datasourceId]/page.tsx (100%) rename web/src/app/app/settings/(restricted-width)/datasources/{ => (admin-restricted-space)}/add/page.tsx (96%) create mode 100644 web/src/app/app/settings/(restricted-width)/datasources/(admin-restricted-space)/layout.tsx rename web/src/app/app/settings/{_SettingsEmptyState.tsx => _components/SettingsEmptyState.tsx} (69%) rename web/src/app/app/settings/{_SettingsPageHeader.tsx => _components/SettingsPageHeader.tsx} (100%) create mode 100644 web/src/app/app/settings/_components/index.ts diff --git a/web/src/app/app/settings/attributes/page.tsx b/web/src/app/app/settings/(permissions)/attributes/page.tsx similarity index 65% rename from web/src/app/app/settings/attributes/page.tsx rename to web/src/app/app/settings/(permissions)/attributes/page.tsx index 3a8632f40..bdcfe87bb 100644 --- a/web/src/app/app/settings/attributes/page.tsx +++ b/web/src/app/app/settings/(permissions)/attributes/page.tsx @@ -1,8 +1,8 @@ 'use client'; import React from 'react'; -import { SettingsEmptyState } from '../_SettingsEmptyState'; -import { SettingsPageHeader } from '../_SettingsPageHeader'; +import { SettingsEmptyState } from '../../_components/SettingsEmptyState'; +import { SettingsPageHeader } from '../../_components/SettingsPageHeader'; export default function Page() { return ( diff --git a/web/src/app/app/settings/dataset-groups/ListDatasetGroupsComponent.tsx b/web/src/app/app/settings/(permissions)/dataset-groups/ListDatasetGroupsComponent.tsx similarity index 100% rename from web/src/app/app/settings/dataset-groups/ListDatasetGroupsComponent.tsx rename to web/src/app/app/settings/(permissions)/dataset-groups/ListDatasetGroupsComponent.tsx diff --git a/web/src/app/app/settings/dataset-groups/[datasetGroupId]/DatasetGroupAppSegments.tsx b/web/src/app/app/settings/(permissions)/dataset-groups/[datasetGroupId]/DatasetGroupAppSegments.tsx similarity index 100% rename from web/src/app/app/settings/dataset-groups/[datasetGroupId]/DatasetGroupAppSegments.tsx rename to web/src/app/app/settings/(permissions)/dataset-groups/[datasetGroupId]/DatasetGroupAppSegments.tsx diff --git a/web/src/app/app/settings/dataset-groups/[datasetGroupId]/DatasetGroupBackButton.tsx b/web/src/app/app/settings/(permissions)/dataset-groups/[datasetGroupId]/DatasetGroupBackButton.tsx similarity index 100% rename from web/src/app/app/settings/dataset-groups/[datasetGroupId]/DatasetGroupBackButton.tsx rename to web/src/app/app/settings/(permissions)/dataset-groups/[datasetGroupId]/DatasetGroupBackButton.tsx diff --git a/web/src/app/app/settings/dataset-groups/[datasetGroupId]/DatasetGroupTitleAndDescription.tsx b/web/src/app/app/settings/(permissions)/dataset-groups/[datasetGroupId]/DatasetGroupTitleAndDescription.tsx similarity index 100% rename from web/src/app/app/settings/dataset-groups/[datasetGroupId]/DatasetGroupTitleAndDescription.tsx rename to web/src/app/app/settings/(permissions)/dataset-groups/[datasetGroupId]/DatasetGroupTitleAndDescription.tsx diff --git a/web/src/app/app/settings/dataset-groups/[datasetGroupId]/datasets/DatasetGroupDatasetSelectedPopup.tsx b/web/src/app/app/settings/(permissions)/dataset-groups/[datasetGroupId]/datasets/DatasetGroupDatasetSelectedPopup.tsx similarity index 100% rename from web/src/app/app/settings/dataset-groups/[datasetGroupId]/datasets/DatasetGroupDatasetSelectedPopup.tsx rename to web/src/app/app/settings/(permissions)/dataset-groups/[datasetGroupId]/datasets/DatasetGroupDatasetSelectedPopup.tsx diff --git a/web/src/app/app/settings/dataset-groups/[datasetGroupId]/datasets/DatasetGroupDatasetsController.tsx b/web/src/app/app/settings/(permissions)/dataset-groups/[datasetGroupId]/datasets/DatasetGroupDatasetsController.tsx similarity index 100% rename from web/src/app/app/settings/dataset-groups/[datasetGroupId]/datasets/DatasetGroupDatasetsController.tsx rename to web/src/app/app/settings/(permissions)/dataset-groups/[datasetGroupId]/datasets/DatasetGroupDatasetsController.tsx diff --git a/web/src/app/app/settings/dataset-groups/[datasetGroupId]/datasets/DatasetGroupDatasetsListContainer.tsx b/web/src/app/app/settings/(permissions)/dataset-groups/[datasetGroupId]/datasets/DatasetGroupDatasetsListContainer.tsx similarity index 100% rename from web/src/app/app/settings/dataset-groups/[datasetGroupId]/datasets/DatasetGroupDatasetsListContainer.tsx rename to web/src/app/app/settings/(permissions)/dataset-groups/[datasetGroupId]/datasets/DatasetGroupDatasetsListContainer.tsx diff --git a/web/src/app/app/settings/dataset-groups/[datasetGroupId]/datasets/page.tsx b/web/src/app/app/settings/(permissions)/dataset-groups/[datasetGroupId]/datasets/page.tsx similarity index 100% rename from web/src/app/app/settings/dataset-groups/[datasetGroupId]/datasets/page.tsx rename to web/src/app/app/settings/(permissions)/dataset-groups/[datasetGroupId]/datasets/page.tsx diff --git a/web/src/app/app/settings/dataset-groups/[datasetGroupId]/layout.tsx b/web/src/app/app/settings/(permissions)/dataset-groups/[datasetGroupId]/layout.tsx similarity index 100% rename from web/src/app/app/settings/dataset-groups/[datasetGroupId]/layout.tsx rename to web/src/app/app/settings/(permissions)/dataset-groups/[datasetGroupId]/layout.tsx diff --git a/web/src/app/app/settings/dataset-groups/[datasetGroupId]/permission-groups/DatasetGroupDatasetGroupsController.tsx b/web/src/app/app/settings/(permissions)/dataset-groups/[datasetGroupId]/permission-groups/DatasetGroupDatasetGroupsController.tsx similarity index 100% rename from web/src/app/app/settings/dataset-groups/[datasetGroupId]/permission-groups/DatasetGroupDatasetGroupsController.tsx rename to web/src/app/app/settings/(permissions)/dataset-groups/[datasetGroupId]/permission-groups/DatasetGroupDatasetGroupsController.tsx diff --git a/web/src/app/app/settings/dataset-groups/[datasetGroupId]/permission-groups/DatasetGroupDatasetSelectedPopup.tsx b/web/src/app/app/settings/(permissions)/dataset-groups/[datasetGroupId]/permission-groups/DatasetGroupDatasetSelectedPopup.tsx similarity index 100% rename from web/src/app/app/settings/dataset-groups/[datasetGroupId]/permission-groups/DatasetGroupDatasetSelectedPopup.tsx rename to web/src/app/app/settings/(permissions)/dataset-groups/[datasetGroupId]/permission-groups/DatasetGroupDatasetSelectedPopup.tsx diff --git a/web/src/app/app/settings/dataset-groups/[datasetGroupId]/permission-groups/DatasetGroupDatasetsListContainer.tsx b/web/src/app/app/settings/(permissions)/dataset-groups/[datasetGroupId]/permission-groups/DatasetGroupDatasetsListContainer.tsx similarity index 100% rename from web/src/app/app/settings/dataset-groups/[datasetGroupId]/permission-groups/DatasetGroupDatasetsListContainer.tsx rename to web/src/app/app/settings/(permissions)/dataset-groups/[datasetGroupId]/permission-groups/DatasetGroupDatasetsListContainer.tsx diff --git a/web/src/app/app/settings/dataset-groups/[datasetGroupId]/permission-groups/page.tsx b/web/src/app/app/settings/(permissions)/dataset-groups/[datasetGroupId]/permission-groups/page.tsx similarity index 100% rename from web/src/app/app/settings/dataset-groups/[datasetGroupId]/permission-groups/page.tsx rename to web/src/app/app/settings/(permissions)/dataset-groups/[datasetGroupId]/permission-groups/page.tsx diff --git a/web/src/app/app/settings/dataset-groups/[datasetGroupId]/users/DatasetGroupUsersController.tsx b/web/src/app/app/settings/(permissions)/dataset-groups/[datasetGroupId]/users/DatasetGroupUsersController.tsx similarity index 100% rename from web/src/app/app/settings/dataset-groups/[datasetGroupId]/users/DatasetGroupUsersController.tsx rename to web/src/app/app/settings/(permissions)/dataset-groups/[datasetGroupId]/users/DatasetGroupUsersController.tsx diff --git a/web/src/app/app/settings/dataset-groups/[datasetGroupId]/users/DatasetGroupUsersListContainer.tsx b/web/src/app/app/settings/(permissions)/dataset-groups/[datasetGroupId]/users/DatasetGroupUsersListContainer.tsx similarity index 100% rename from web/src/app/app/settings/dataset-groups/[datasetGroupId]/users/DatasetGroupUsersListContainer.tsx rename to web/src/app/app/settings/(permissions)/dataset-groups/[datasetGroupId]/users/DatasetGroupUsersListContainer.tsx diff --git a/web/src/app/app/settings/dataset-groups/[datasetGroupId]/users/DatasetGroupUsersSelectedPopup.tsx b/web/src/app/app/settings/(permissions)/dataset-groups/[datasetGroupId]/users/DatasetGroupUsersSelectedPopup.tsx similarity index 100% rename from web/src/app/app/settings/dataset-groups/[datasetGroupId]/users/DatasetGroupUsersSelectedPopup.tsx rename to web/src/app/app/settings/(permissions)/dataset-groups/[datasetGroupId]/users/DatasetGroupUsersSelectedPopup.tsx diff --git a/web/src/app/app/settings/dataset-groups/[datasetGroupId]/users/page.tsx b/web/src/app/app/settings/(permissions)/dataset-groups/[datasetGroupId]/users/page.tsx similarity index 100% rename from web/src/app/app/settings/dataset-groups/[datasetGroupId]/users/page.tsx rename to web/src/app/app/settings/(permissions)/dataset-groups/[datasetGroupId]/users/page.tsx diff --git a/web/src/app/app/settings/dataset-groups/page.tsx b/web/src/app/app/settings/(permissions)/dataset-groups/page.tsx similarity index 96% rename from web/src/app/app/settings/dataset-groups/page.tsx rename to web/src/app/app/settings/(permissions)/dataset-groups/page.tsx index 89216ad53..079431c25 100644 --- a/web/src/app/app/settings/dataset-groups/page.tsx +++ b/web/src/app/app/settings/(permissions)/dataset-groups/page.tsx @@ -1,6 +1,6 @@ 'use client'; import React, { useState } from 'react'; -import { SettingsPageHeader } from '../_SettingsPageHeader'; +import { SettingsPageHeader } from '../../_components/SettingsPageHeader'; import { PermissionSearch, NewDatasetGroupModal } from '@appComponents/PermissionComponents'; import { useDebounceSearch } from '@/hooks/useDebounceSearch'; import { useListDatasetGroups } from '@/api/buster_rest'; diff --git a/web/src/app/app/settings/(permissions)/layout.tsx b/web/src/app/app/settings/(permissions)/layout.tsx new file mode 100644 index 000000000..98f76ee88 --- /dev/null +++ b/web/src/app/app/settings/(permissions)/layout.tsx @@ -0,0 +1,17 @@ +import { BusterRoutes, createBusterRoute } from '@/routes/busterRoutes'; +import { useCheckIfUserIsAdmin_server } from '@/server_context/user'; +import { redirect } from 'next/navigation'; + +export default async function Layout({ children }: { children: React.ReactNode }) { + const isAdmin = await useCheckIfUserIsAdmin_server(); + + if (!isAdmin) { + return redirect( + createBusterRoute({ + route: BusterRoutes.SETTINGS_GENERAL + }) + ); + } + + return <>{children}; +} diff --git a/web/src/app/app/settings/permission-groups/ListPermissionGroupsComponent.tsx b/web/src/app/app/settings/(permissions)/permission-groups/ListPermissionGroupsComponent.tsx similarity index 100% rename from web/src/app/app/settings/permission-groups/ListPermissionGroupsComponent.tsx rename to web/src/app/app/settings/(permissions)/permission-groups/ListPermissionGroupsComponent.tsx diff --git a/web/src/app/app/settings/permission-groups/[permissionGroupId]/PermissionAppSegments.tsx b/web/src/app/app/settings/(permissions)/permission-groups/[permissionGroupId]/PermissionAppSegments.tsx similarity index 100% rename from web/src/app/app/settings/permission-groups/[permissionGroupId]/PermissionAppSegments.tsx rename to web/src/app/app/settings/(permissions)/permission-groups/[permissionGroupId]/PermissionAppSegments.tsx diff --git a/web/src/app/app/settings/permission-groups/[permissionGroupId]/PermissionBackButton.tsx b/web/src/app/app/settings/(permissions)/permission-groups/[permissionGroupId]/PermissionBackButton.tsx similarity index 100% rename from web/src/app/app/settings/permission-groups/[permissionGroupId]/PermissionBackButton.tsx rename to web/src/app/app/settings/(permissions)/permission-groups/[permissionGroupId]/PermissionBackButton.tsx diff --git a/web/src/app/app/settings/permission-groups/[permissionGroupId]/PermissionGroupTitleAndDescription.tsx b/web/src/app/app/settings/(permissions)/permission-groups/[permissionGroupId]/PermissionGroupTitleAndDescription.tsx similarity index 100% rename from web/src/app/app/settings/permission-groups/[permissionGroupId]/PermissionGroupTitleAndDescription.tsx rename to web/src/app/app/settings/(permissions)/permission-groups/[permissionGroupId]/PermissionGroupTitleAndDescription.tsx diff --git a/web/src/app/app/settings/permission-groups/[permissionGroupId]/dataset-groups/PermissionGroupDatasetGroupsController.tsx b/web/src/app/app/settings/(permissions)/permission-groups/[permissionGroupId]/dataset-groups/PermissionGroupDatasetGroupsController.tsx similarity index 100% rename from web/src/app/app/settings/permission-groups/[permissionGroupId]/dataset-groups/PermissionGroupDatasetGroupsController.tsx rename to web/src/app/app/settings/(permissions)/permission-groups/[permissionGroupId]/dataset-groups/PermissionGroupDatasetGroupsController.tsx diff --git a/web/src/app/app/settings/permission-groups/[permissionGroupId]/dataset-groups/PermissionGroupDatasetSelectedPopup.tsx b/web/src/app/app/settings/(permissions)/permission-groups/[permissionGroupId]/dataset-groups/PermissionGroupDatasetSelectedPopup.tsx similarity index 100% rename from web/src/app/app/settings/permission-groups/[permissionGroupId]/dataset-groups/PermissionGroupDatasetSelectedPopup.tsx rename to web/src/app/app/settings/(permissions)/permission-groups/[permissionGroupId]/dataset-groups/PermissionGroupDatasetSelectedPopup.tsx diff --git a/web/src/app/app/settings/permission-groups/[permissionGroupId]/dataset-groups/PermissionGroupDatasetsListContainer.tsx b/web/src/app/app/settings/(permissions)/permission-groups/[permissionGroupId]/dataset-groups/PermissionGroupDatasetsListContainer.tsx similarity index 100% rename from web/src/app/app/settings/permission-groups/[permissionGroupId]/dataset-groups/PermissionGroupDatasetsListContainer.tsx rename to web/src/app/app/settings/(permissions)/permission-groups/[permissionGroupId]/dataset-groups/PermissionGroupDatasetsListContainer.tsx diff --git a/web/src/app/app/settings/permission-groups/[permissionGroupId]/dataset-groups/page.tsx b/web/src/app/app/settings/(permissions)/permission-groups/[permissionGroupId]/dataset-groups/page.tsx similarity index 100% rename from web/src/app/app/settings/permission-groups/[permissionGroupId]/dataset-groups/page.tsx rename to web/src/app/app/settings/(permissions)/permission-groups/[permissionGroupId]/dataset-groups/page.tsx diff --git a/web/src/app/app/settings/permission-groups/[permissionGroupId]/datasets/PermissionGroupDatasetSelectedPopup.tsx b/web/src/app/app/settings/(permissions)/permission-groups/[permissionGroupId]/datasets/PermissionGroupDatasetSelectedPopup.tsx similarity index 100% rename from web/src/app/app/settings/permission-groups/[permissionGroupId]/datasets/PermissionGroupDatasetSelectedPopup.tsx rename to web/src/app/app/settings/(permissions)/permission-groups/[permissionGroupId]/datasets/PermissionGroupDatasetSelectedPopup.tsx diff --git a/web/src/app/app/settings/permission-groups/[permissionGroupId]/datasets/PermissionGroupDatasetsController.tsx b/web/src/app/app/settings/(permissions)/permission-groups/[permissionGroupId]/datasets/PermissionGroupDatasetsController.tsx similarity index 100% rename from web/src/app/app/settings/permission-groups/[permissionGroupId]/datasets/PermissionGroupDatasetsController.tsx rename to web/src/app/app/settings/(permissions)/permission-groups/[permissionGroupId]/datasets/PermissionGroupDatasetsController.tsx diff --git a/web/src/app/app/settings/permission-groups/[permissionGroupId]/datasets/PermissionGroupDatasetsListContainer.tsx b/web/src/app/app/settings/(permissions)/permission-groups/[permissionGroupId]/datasets/PermissionGroupDatasetsListContainer.tsx similarity index 100% rename from web/src/app/app/settings/permission-groups/[permissionGroupId]/datasets/PermissionGroupDatasetsListContainer.tsx rename to web/src/app/app/settings/(permissions)/permission-groups/[permissionGroupId]/datasets/PermissionGroupDatasetsListContainer.tsx diff --git a/web/src/app/app/settings/permission-groups/[permissionGroupId]/datasets/page.tsx b/web/src/app/app/settings/(permissions)/permission-groups/[permissionGroupId]/datasets/page.tsx similarity index 100% rename from web/src/app/app/settings/permission-groups/[permissionGroupId]/datasets/page.tsx rename to web/src/app/app/settings/(permissions)/permission-groups/[permissionGroupId]/datasets/page.tsx diff --git a/web/src/app/app/settings/permission-groups/[permissionGroupId]/layout.tsx b/web/src/app/app/settings/(permissions)/permission-groups/[permissionGroupId]/layout.tsx similarity index 100% rename from web/src/app/app/settings/permission-groups/[permissionGroupId]/layout.tsx rename to web/src/app/app/settings/(permissions)/permission-groups/[permissionGroupId]/layout.tsx diff --git a/web/src/app/app/settings/permission-groups/[permissionGroupId]/users/PermissionGroupUsersController.tsx b/web/src/app/app/settings/(permissions)/permission-groups/[permissionGroupId]/users/PermissionGroupUsersController.tsx similarity index 100% rename from web/src/app/app/settings/permission-groups/[permissionGroupId]/users/PermissionGroupUsersController.tsx rename to web/src/app/app/settings/(permissions)/permission-groups/[permissionGroupId]/users/PermissionGroupUsersController.tsx diff --git a/web/src/app/app/settings/permission-groups/[permissionGroupId]/users/PermissionGroupUsersListContainer.tsx b/web/src/app/app/settings/(permissions)/permission-groups/[permissionGroupId]/users/PermissionGroupUsersListContainer.tsx similarity index 100% rename from web/src/app/app/settings/permission-groups/[permissionGroupId]/users/PermissionGroupUsersListContainer.tsx rename to web/src/app/app/settings/(permissions)/permission-groups/[permissionGroupId]/users/PermissionGroupUsersListContainer.tsx diff --git a/web/src/app/app/settings/permission-groups/[permissionGroupId]/users/PermissionGroupUsersSelectedPopup.tsx b/web/src/app/app/settings/(permissions)/permission-groups/[permissionGroupId]/users/PermissionGroupUsersSelectedPopup.tsx similarity index 100% rename from web/src/app/app/settings/permission-groups/[permissionGroupId]/users/PermissionGroupUsersSelectedPopup.tsx rename to web/src/app/app/settings/(permissions)/permission-groups/[permissionGroupId]/users/PermissionGroupUsersSelectedPopup.tsx diff --git a/web/src/app/app/settings/permission-groups/[permissionGroupId]/users/page.tsx b/web/src/app/app/settings/(permissions)/permission-groups/[permissionGroupId]/users/page.tsx similarity index 100% rename from web/src/app/app/settings/permission-groups/[permissionGroupId]/users/page.tsx rename to web/src/app/app/settings/(permissions)/permission-groups/[permissionGroupId]/users/page.tsx diff --git a/web/src/app/app/settings/permission-groups/page.tsx b/web/src/app/app/settings/(permissions)/permission-groups/page.tsx similarity index 96% rename from web/src/app/app/settings/permission-groups/page.tsx rename to web/src/app/app/settings/(permissions)/permission-groups/page.tsx index 95fdb2277..f4cfac6a8 100644 --- a/web/src/app/app/settings/permission-groups/page.tsx +++ b/web/src/app/app/settings/(permissions)/permission-groups/page.tsx @@ -1,6 +1,6 @@ 'use client'; import React, { useState } from 'react'; -import { SettingsPageHeader } from '../_SettingsPageHeader'; +import { SettingsPageHeader } from '../../_components/SettingsPageHeader'; import { PermissionSearch, NewPermissionGroupModal } from '@appComponents/PermissionComponents'; import { useDebounceSearch } from '@/hooks/useDebounceSearch'; import { useListAllPermissionGroups } from '@/api/buster_rest'; diff --git a/web/src/app/app/settings/users/ListUsersComponent.tsx b/web/src/app/app/settings/(permissions)/users/ListUsersComponent.tsx similarity index 97% rename from web/src/app/app/settings/users/ListUsersComponent.tsx rename to web/src/app/app/settings/(permissions)/users/ListUsersComponent.tsx index e17f1b84b..e5683ccc3 100644 --- a/web/src/app/app/settings/users/ListUsersComponent.tsx +++ b/web/src/app/app/settings/(permissions)/users/ListUsersComponent.tsx @@ -11,7 +11,7 @@ import React, { useMemo, useState } from 'react'; import { Text } from '@/components/text'; import { OrganizationUserRoleText } from './config'; import { BusterRoutes, createBusterRoute } from '@/routes'; -import { ListUserItem } from '../../_components/ListContent'; +import { ListUserItem } from '../../../_components/ListContent'; export const ListUsersComponent: React.FC<{ users: OrganizationUser[]; diff --git a/web/src/app/app/settings/users/UserListPopupContainer.tsx b/web/src/app/app/settings/(permissions)/users/UserListPopupContainer.tsx similarity index 100% rename from web/src/app/app/settings/users/UserListPopupContainer.tsx rename to web/src/app/app/settings/(permissions)/users/UserListPopupContainer.tsx diff --git a/web/src/app/app/settings/users/[userId]/_LayoutHeaderAndSegment/LayoutHeaderAndSegment.tsx b/web/src/app/app/settings/(permissions)/users/[userId]/_LayoutHeaderAndSegment/LayoutHeaderAndSegment.tsx similarity index 100% rename from web/src/app/app/settings/users/[userId]/_LayoutHeaderAndSegment/LayoutHeaderAndSegment.tsx rename to web/src/app/app/settings/(permissions)/users/[userId]/_LayoutHeaderAndSegment/LayoutHeaderAndSegment.tsx diff --git a/web/src/app/app/settings/users/[userId]/_LayoutHeaderAndSegment/UserHeader.tsx b/web/src/app/app/settings/(permissions)/users/[userId]/_LayoutHeaderAndSegment/UserHeader.tsx similarity index 100% rename from web/src/app/app/settings/users/[userId]/_LayoutHeaderAndSegment/UserHeader.tsx rename to web/src/app/app/settings/(permissions)/users/[userId]/_LayoutHeaderAndSegment/UserHeader.tsx diff --git a/web/src/app/app/settings/users/[userId]/_LayoutHeaderAndSegment/UserSegments.tsx b/web/src/app/app/settings/(permissions)/users/[userId]/_LayoutHeaderAndSegment/UserSegments.tsx similarity index 100% rename from web/src/app/app/settings/users/[userId]/_LayoutHeaderAndSegment/UserSegments.tsx rename to web/src/app/app/settings/(permissions)/users/[userId]/_LayoutHeaderAndSegment/UserSegments.tsx diff --git a/web/src/app/app/settings/users/[userId]/_LayoutHeaderAndSegment/UsersBackButton.tsx b/web/src/app/app/settings/(permissions)/users/[userId]/_LayoutHeaderAndSegment/UsersBackButton.tsx similarity index 100% rename from web/src/app/app/settings/users/[userId]/_LayoutHeaderAndSegment/UsersBackButton.tsx rename to web/src/app/app/settings/(permissions)/users/[userId]/_LayoutHeaderAndSegment/UsersBackButton.tsx diff --git a/web/src/app/app/settings/users/[userId]/_LayoutHeaderAndSegment/index.ts b/web/src/app/app/settings/(permissions)/users/[userId]/_LayoutHeaderAndSegment/index.ts similarity index 100% rename from web/src/app/app/settings/users/[userId]/_LayoutHeaderAndSegment/index.ts rename to web/src/app/app/settings/(permissions)/users/[userId]/_LayoutHeaderAndSegment/index.ts diff --git a/web/src/app/app/settings/users/[userId]/_overview/UserDatasetListContainer.tsx b/web/src/app/app/settings/(permissions)/users/[userId]/_overview/UserDatasetListContainer.tsx similarity index 100% rename from web/src/app/app/settings/users/[userId]/_overview/UserDatasetListContainer.tsx rename to web/src/app/app/settings/(permissions)/users/[userId]/_overview/UserDatasetListContainer.tsx diff --git a/web/src/app/app/settings/users/[userId]/_overview/UserDatasetSearch.tsx b/web/src/app/app/settings/(permissions)/users/[userId]/_overview/UserDatasetSearch.tsx similarity index 100% rename from web/src/app/app/settings/users/[userId]/_overview/UserDatasetSearch.tsx rename to web/src/app/app/settings/(permissions)/users/[userId]/_overview/UserDatasetSearch.tsx diff --git a/web/src/app/app/settings/users/[userId]/_overview/UserDefaultAccess.tsx b/web/src/app/app/settings/(permissions)/users/[userId]/_overview/UserDefaultAccess.tsx similarity index 100% rename from web/src/app/app/settings/users/[userId]/_overview/UserDefaultAccess.tsx rename to web/src/app/app/settings/(permissions)/users/[userId]/_overview/UserDefaultAccess.tsx diff --git a/web/src/app/app/settings/users/[userId]/_overview/UserLineageHeader.tsx b/web/src/app/app/settings/(permissions)/users/[userId]/_overview/UserLineageHeader.tsx similarity index 100% rename from web/src/app/app/settings/users/[userId]/_overview/UserLineageHeader.tsx rename to web/src/app/app/settings/(permissions)/users/[userId]/_overview/UserLineageHeader.tsx diff --git a/web/src/app/app/settings/users/[userId]/_overview/UserOverviewController.tsx b/web/src/app/app/settings/(permissions)/users/[userId]/_overview/UserOverviewController.tsx similarity index 100% rename from web/src/app/app/settings/users/[userId]/_overview/UserOverviewController.tsx rename to web/src/app/app/settings/(permissions)/users/[userId]/_overview/UserOverviewController.tsx diff --git a/web/src/app/app/settings/users/[userId]/attributes/UserAttributesController.tsx b/web/src/app/app/settings/(permissions)/users/[userId]/attributes/UserAttributesController.tsx similarity index 100% rename from web/src/app/app/settings/users/[userId]/attributes/UserAttributesController.tsx rename to web/src/app/app/settings/(permissions)/users/[userId]/attributes/UserAttributesController.tsx diff --git a/web/src/app/app/settings/users/[userId]/attributes/UserAttributesListContainer.tsx b/web/src/app/app/settings/(permissions)/users/[userId]/attributes/UserAttributesListContainer.tsx similarity index 100% rename from web/src/app/app/settings/users/[userId]/attributes/UserAttributesListContainer.tsx rename to web/src/app/app/settings/(permissions)/users/[userId]/attributes/UserAttributesListContainer.tsx diff --git a/web/src/app/app/settings/users/[userId]/attributes/UserAttributesSelectedPopup.tsx b/web/src/app/app/settings/(permissions)/users/[userId]/attributes/UserAttributesSelectedPopup.tsx similarity index 100% rename from web/src/app/app/settings/users/[userId]/attributes/UserAttributesSelectedPopup.tsx rename to web/src/app/app/settings/(permissions)/users/[userId]/attributes/UserAttributesSelectedPopup.tsx diff --git a/web/src/app/app/settings/users/[userId]/attributes/page.tsx b/web/src/app/app/settings/(permissions)/users/[userId]/attributes/page.tsx similarity index 100% rename from web/src/app/app/settings/users/[userId]/attributes/page.tsx rename to web/src/app/app/settings/(permissions)/users/[userId]/attributes/page.tsx diff --git a/web/src/app/app/settings/users/[userId]/dataset-groups/UserDatasetGroupListContainer.tsx b/web/src/app/app/settings/(permissions)/users/[userId]/dataset-groups/UserDatasetGroupListContainer.tsx similarity index 100% rename from web/src/app/app/settings/users/[userId]/dataset-groups/UserDatasetGroupListContainer.tsx rename to web/src/app/app/settings/(permissions)/users/[userId]/dataset-groups/UserDatasetGroupListContainer.tsx diff --git a/web/src/app/app/settings/users/[userId]/dataset-groups/UserDatasetGroupSelectedPopup.tsx b/web/src/app/app/settings/(permissions)/users/[userId]/dataset-groups/UserDatasetGroupSelectedPopup.tsx similarity index 100% rename from web/src/app/app/settings/users/[userId]/dataset-groups/UserDatasetGroupSelectedPopup.tsx rename to web/src/app/app/settings/(permissions)/users/[userId]/dataset-groups/UserDatasetGroupSelectedPopup.tsx diff --git a/web/src/app/app/settings/users/[userId]/dataset-groups/UserDatasetGroupsController.tsx b/web/src/app/app/settings/(permissions)/users/[userId]/dataset-groups/UserDatasetGroupsController.tsx similarity index 100% rename from web/src/app/app/settings/users/[userId]/dataset-groups/UserDatasetGroupsController.tsx rename to web/src/app/app/settings/(permissions)/users/[userId]/dataset-groups/UserDatasetGroupsController.tsx diff --git a/web/src/app/app/settings/users/[userId]/dataset-groups/page.tsx b/web/src/app/app/settings/(permissions)/users/[userId]/dataset-groups/page.tsx similarity index 100% rename from web/src/app/app/settings/users/[userId]/dataset-groups/page.tsx rename to web/src/app/app/settings/(permissions)/users/[userId]/dataset-groups/page.tsx diff --git a/web/src/app/app/settings/users/[userId]/datasets/UserDatasetsController.tsx b/web/src/app/app/settings/(permissions)/users/[userId]/datasets/UserDatasetsController.tsx similarity index 100% rename from web/src/app/app/settings/users/[userId]/datasets/UserDatasetsController.tsx rename to web/src/app/app/settings/(permissions)/users/[userId]/datasets/UserDatasetsController.tsx diff --git a/web/src/app/app/settings/users/[userId]/datasets/UserDatasetsListContainer.tsx b/web/src/app/app/settings/(permissions)/users/[userId]/datasets/UserDatasetsListContainer.tsx similarity index 100% rename from web/src/app/app/settings/users/[userId]/datasets/UserDatasetsListContainer.tsx rename to web/src/app/app/settings/(permissions)/users/[userId]/datasets/UserDatasetsListContainer.tsx diff --git a/web/src/app/app/settings/users/[userId]/datasets/UserDatasetsSelectedPopup.tsx b/web/src/app/app/settings/(permissions)/users/[userId]/datasets/UserDatasetsSelectedPopup.tsx similarity index 100% rename from web/src/app/app/settings/users/[userId]/datasets/UserDatasetsSelectedPopup.tsx rename to web/src/app/app/settings/(permissions)/users/[userId]/datasets/UserDatasetsSelectedPopup.tsx diff --git a/web/src/app/app/settings/users/[userId]/datasets/page.tsx b/web/src/app/app/settings/(permissions)/users/[userId]/datasets/page.tsx similarity index 100% rename from web/src/app/app/settings/users/[userId]/datasets/page.tsx rename to web/src/app/app/settings/(permissions)/users/[userId]/datasets/page.tsx diff --git a/web/src/app/app/settings/users/[userId]/layout.tsx b/web/src/app/app/settings/(permissions)/users/[userId]/layout.tsx similarity index 100% rename from web/src/app/app/settings/users/[userId]/layout.tsx rename to web/src/app/app/settings/(permissions)/users/[userId]/layout.tsx diff --git a/web/src/app/app/settings/users/[userId]/page.tsx b/web/src/app/app/settings/(permissions)/users/[userId]/page.tsx similarity index 100% rename from web/src/app/app/settings/users/[userId]/page.tsx rename to web/src/app/app/settings/(permissions)/users/[userId]/page.tsx diff --git a/web/src/app/app/settings/users/[userId]/permission-groups/UserPermissionGroupSelectedPopup.tsx b/web/src/app/app/settings/(permissions)/users/[userId]/permission-groups/UserPermissionGroupSelectedPopup.tsx similarity index 100% rename from web/src/app/app/settings/users/[userId]/permission-groups/UserPermissionGroupSelectedPopup.tsx rename to web/src/app/app/settings/(permissions)/users/[userId]/permission-groups/UserPermissionGroupSelectedPopup.tsx diff --git a/web/src/app/app/settings/users/[userId]/permission-groups/UserPermissionGroupsController.tsx b/web/src/app/app/settings/(permissions)/users/[userId]/permission-groups/UserPermissionGroupsController.tsx similarity index 100% rename from web/src/app/app/settings/users/[userId]/permission-groups/UserPermissionGroupsController.tsx rename to web/src/app/app/settings/(permissions)/users/[userId]/permission-groups/UserPermissionGroupsController.tsx diff --git a/web/src/app/app/settings/users/[userId]/permission-groups/UserPermissionGroupsListContainer.tsx b/web/src/app/app/settings/(permissions)/users/[userId]/permission-groups/UserPermissionGroupsListContainer.tsx similarity index 100% rename from web/src/app/app/settings/users/[userId]/permission-groups/UserPermissionGroupsListContainer.tsx rename to web/src/app/app/settings/(permissions)/users/[userId]/permission-groups/UserPermissionGroupsListContainer.tsx diff --git a/web/src/app/app/settings/users/[userId]/permission-groups/page.tsx b/web/src/app/app/settings/(permissions)/users/[userId]/permission-groups/page.tsx similarity index 97% rename from web/src/app/app/settings/users/[userId]/permission-groups/page.tsx rename to web/src/app/app/settings/(permissions)/users/[userId]/permission-groups/page.tsx index fe272da91..b3c2361c8 100644 --- a/web/src/app/app/settings/users/[userId]/permission-groups/page.tsx +++ b/web/src/app/app/settings/(permissions)/users/[userId]/permission-groups/page.tsx @@ -1,7 +1,7 @@ import { prefetchGetUserPermissionGroups } from '@/api/buster_rest/users'; import { HydrationBoundary, dehydrate } from '@tanstack/react-query'; import { UserPermissionGroupsController } from './UserPermissionGroupsController'; -import { useCheckIfUserIsAdmin_server } from '../../../../../../server_context/user'; +import { useCheckIfUserIsAdmin_server } from '../../../../../../../server_context/user'; import { redirect } from 'next/navigation'; import { BusterRoutes, createBusterRoute } from '@/routes'; diff --git a/web/src/app/app/settings/users/[userId]/teams/UserTeamsController.tsx b/web/src/app/app/settings/(permissions)/users/[userId]/teams/UserTeamsController.tsx similarity index 100% rename from web/src/app/app/settings/users/[userId]/teams/UserTeamsController.tsx rename to web/src/app/app/settings/(permissions)/users/[userId]/teams/UserTeamsController.tsx diff --git a/web/src/app/app/settings/users/[userId]/teams/UserTeamsListContainer.tsx b/web/src/app/app/settings/(permissions)/users/[userId]/teams/UserTeamsListContainer.tsx similarity index 100% rename from web/src/app/app/settings/users/[userId]/teams/UserTeamsListContainer.tsx rename to web/src/app/app/settings/(permissions)/users/[userId]/teams/UserTeamsListContainer.tsx diff --git a/web/src/app/app/settings/users/[userId]/teams/UserTeamsSelectedPopup.tsx b/web/src/app/app/settings/(permissions)/users/[userId]/teams/UserTeamsSelectedPopup.tsx similarity index 100% rename from web/src/app/app/settings/users/[userId]/teams/UserTeamsSelectedPopup.tsx rename to web/src/app/app/settings/(permissions)/users/[userId]/teams/UserTeamsSelectedPopup.tsx diff --git a/web/src/app/app/settings/users/[userId]/teams/page.tsx b/web/src/app/app/settings/(permissions)/users/[userId]/teams/page.tsx similarity index 100% rename from web/src/app/app/settings/users/[userId]/teams/page.tsx rename to web/src/app/app/settings/(permissions)/users/[userId]/teams/page.tsx diff --git a/web/src/app/app/settings/users/config.ts b/web/src/app/app/settings/(permissions)/users/config.ts similarity index 100% rename from web/src/app/app/settings/users/config.ts rename to web/src/app/app/settings/(permissions)/users/config.ts diff --git a/web/src/app/app/settings/users/page.tsx b/web/src/app/app/settings/(permissions)/users/page.tsx similarity index 89% rename from web/src/app/app/settings/users/page.tsx rename to web/src/app/app/settings/(permissions)/users/page.tsx index 7417f0d74..bdb2c3da7 100644 --- a/web/src/app/app/settings/users/page.tsx +++ b/web/src/app/app/settings/(permissions)/users/page.tsx @@ -1,12 +1,12 @@ 'use client'; import React from 'react'; -import { SettingsPageHeader } from '../_SettingsPageHeader'; +import { SettingsPageHeader } from '../../_components/SettingsPageHeader'; import { useDebounceSearch } from '@/hooks/useDebounceSearch'; import { useGetOrganizationUsers } from '@/api/buster_rest'; import { useUserConfigContextSelector } from '@/context/Users'; import { ListUsersComponent } from './ListUsersComponent'; -import { PermissionSearch } from '../../_components/PermissionComponents'; +import { PermissionSearch } from '../../../_components/PermissionComponents'; export default function Page() { const userOrganization = useUserConfigContextSelector((x) => x.userOrganizations); diff --git a/web/src/app/app/settings/(restricted-width)/api-keys/page.tsx b/web/src/app/app/settings/(restricted-width)/api-keys/page.tsx index 7ab8d4346..0ec442262 100644 --- a/web/src/app/app/settings/(restricted-width)/api-keys/page.tsx +++ b/web/src/app/app/settings/(restricted-width)/api-keys/page.tsx @@ -1,5 +1,5 @@ import { useCheckIfUserIsAdmin_server } from '../../../../../server_context/user'; -import { SettingsPageHeader } from '../../_SettingsPageHeader'; +import { SettingsPageHeader } from '../../_components/SettingsPageHeader'; import { ApiKeysController } from './ApiKeysController'; import { createBusterRoute, BusterRoutes } from '@/routes'; import { redirect } from 'next/navigation'; diff --git a/web/src/app/app/settings/(restricted-width)/billing/page.tsx b/web/src/app/app/settings/(restricted-width)/billing/page.tsx index a5fda1971..895092e59 100644 --- a/web/src/app/app/settings/(restricted-width)/billing/page.tsx +++ b/web/src/app/app/settings/(restricted-width)/billing/page.tsx @@ -1,7 +1,20 @@ -import { SettingsEmptyState } from '../../_SettingsEmptyState'; -import { SettingsPageHeader } from '../../_SettingsPageHeader'; +import { SettingsEmptyState } from '../../_components/SettingsEmptyState'; +import { SettingsPageHeader } from '../../_components/SettingsPageHeader'; +import { redirect } from 'next/navigation'; +import { BusterRoutes, createBusterRoute } from '@/routes/busterRoutes'; +import { useCheckIfUserIsAdmin_server } from '@/server_context/user'; + +export default async function Page() { + const isAdmin = await useCheckIfUserIsAdmin_server(); + + if (!isAdmin) { + return redirect( + createBusterRoute({ + route: BusterRoutes.SETTINGS_GENERAL + }) + ); + } -export default function Page() { return (
diff --git a/web/src/app/app/settings/(restricted-width)/datasources/[datasourceId]/FormItem.tsx b/web/src/app/app/settings/(restricted-width)/datasources/(admin-restricted-space)/[datasourceId]/FormItem.tsx similarity index 100% rename from web/src/app/app/settings/(restricted-width)/datasources/[datasourceId]/FormItem.tsx rename to web/src/app/app/settings/(restricted-width)/datasources/(admin-restricted-space)/[datasourceId]/FormItem.tsx diff --git a/web/src/app/app/settings/(restricted-width)/datasources/[datasourceId]/WhiteListBlock.tsx b/web/src/app/app/settings/(restricted-width)/datasources/(admin-restricted-space)/[datasourceId]/WhiteListBlock.tsx similarity index 100% rename from web/src/app/app/settings/(restricted-width)/datasources/[datasourceId]/WhiteListBlock.tsx rename to web/src/app/app/settings/(restricted-width)/datasources/(admin-restricted-space)/[datasourceId]/WhiteListBlock.tsx diff --git a/web/src/app/app/settings/(restricted-width)/datasources/[datasourceId]/_DatasourceForm.tsx b/web/src/app/app/settings/(restricted-width)/datasources/(admin-restricted-space)/[datasourceId]/_DatasourceForm.tsx similarity index 100% rename from web/src/app/app/settings/(restricted-width)/datasources/[datasourceId]/_DatasourceForm.tsx rename to web/src/app/app/settings/(restricted-width)/datasources/(admin-restricted-space)/[datasourceId]/_DatasourceForm.tsx diff --git a/web/src/app/app/settings/(restricted-width)/datasources/[datasourceId]/_DatasourceFormContent.tsx b/web/src/app/app/settings/(restricted-width)/datasources/(admin-restricted-space)/[datasourceId]/_DatasourceFormContent.tsx similarity index 100% rename from web/src/app/app/settings/(restricted-width)/datasources/[datasourceId]/_DatasourceFormContent.tsx rename to web/src/app/app/settings/(restricted-width)/datasources/(admin-restricted-space)/[datasourceId]/_DatasourceFormContent.tsx diff --git a/web/src/app/app/settings/(restricted-width)/datasources/[datasourceId]/_forms/BigQueryForm.tsx b/web/src/app/app/settings/(restricted-width)/datasources/(admin-restricted-space)/[datasourceId]/_forms/BigQueryForm.tsx similarity index 100% rename from web/src/app/app/settings/(restricted-width)/datasources/[datasourceId]/_forms/BigQueryForm.tsx rename to web/src/app/app/settings/(restricted-width)/datasources/(admin-restricted-space)/[datasourceId]/_forms/BigQueryForm.tsx diff --git a/web/src/app/app/settings/(restricted-width)/datasources/[datasourceId]/_forms/DataBricksForm.tsx b/web/src/app/app/settings/(restricted-width)/datasources/(admin-restricted-space)/[datasourceId]/_forms/DataBricksForm.tsx similarity index 100% rename from web/src/app/app/settings/(restricted-width)/datasources/[datasourceId]/_forms/DataBricksForm.tsx rename to web/src/app/app/settings/(restricted-width)/datasources/(admin-restricted-space)/[datasourceId]/_forms/DataBricksForm.tsx diff --git a/web/src/app/app/settings/(restricted-width)/datasources/[datasourceId]/_forms/FormWrapper.tsx b/web/src/app/app/settings/(restricted-width)/datasources/(admin-restricted-space)/[datasourceId]/_forms/FormWrapper.tsx similarity index 100% rename from web/src/app/app/settings/(restricted-width)/datasources/[datasourceId]/_forms/FormWrapper.tsx rename to web/src/app/app/settings/(restricted-width)/datasources/(admin-restricted-space)/[datasourceId]/_forms/FormWrapper.tsx diff --git a/web/src/app/app/settings/(restricted-width)/datasources/[datasourceId]/_forms/MySqlForm.tsx b/web/src/app/app/settings/(restricted-width)/datasources/(admin-restricted-space)/[datasourceId]/_forms/MySqlForm.tsx similarity index 100% rename from web/src/app/app/settings/(restricted-width)/datasources/[datasourceId]/_forms/MySqlForm.tsx rename to web/src/app/app/settings/(restricted-width)/datasources/(admin-restricted-space)/[datasourceId]/_forms/MySqlForm.tsx diff --git a/web/src/app/app/settings/(restricted-width)/datasources/[datasourceId]/_forms/PostgresForm.tsx b/web/src/app/app/settings/(restricted-width)/datasources/(admin-restricted-space)/[datasourceId]/_forms/PostgresForm.tsx similarity index 100% rename from web/src/app/app/settings/(restricted-width)/datasources/[datasourceId]/_forms/PostgresForm.tsx rename to web/src/app/app/settings/(restricted-width)/datasources/(admin-restricted-space)/[datasourceId]/_forms/PostgresForm.tsx diff --git a/web/src/app/app/settings/(restricted-width)/datasources/[datasourceId]/_forms/RedshiftForm.tsx b/web/src/app/app/settings/(restricted-width)/datasources/(admin-restricted-space)/[datasourceId]/_forms/RedshiftForm.tsx similarity index 100% rename from web/src/app/app/settings/(restricted-width)/datasources/[datasourceId]/_forms/RedshiftForm.tsx rename to web/src/app/app/settings/(restricted-width)/datasources/(admin-restricted-space)/[datasourceId]/_forms/RedshiftForm.tsx diff --git a/web/src/app/app/settings/(restricted-width)/datasources/[datasourceId]/_forms/SnowflakeForm.tsx b/web/src/app/app/settings/(restricted-width)/datasources/(admin-restricted-space)/[datasourceId]/_forms/SnowflakeForm.tsx similarity index 100% rename from web/src/app/app/settings/(restricted-width)/datasources/[datasourceId]/_forms/SnowflakeForm.tsx rename to web/src/app/app/settings/(restricted-width)/datasources/(admin-restricted-space)/[datasourceId]/_forms/SnowflakeForm.tsx diff --git a/web/src/app/app/settings/(restricted-width)/datasources/[datasourceId]/_forms/SqlServerForm.tsx b/web/src/app/app/settings/(restricted-width)/datasources/(admin-restricted-space)/[datasourceId]/_forms/SqlServerForm.tsx similarity index 100% rename from web/src/app/app/settings/(restricted-width)/datasources/[datasourceId]/_forms/SqlServerForm.tsx rename to web/src/app/app/settings/(restricted-width)/datasources/(admin-restricted-space)/[datasourceId]/_forms/SqlServerForm.tsx diff --git a/web/src/app/app/settings/(restricted-width)/datasources/[datasourceId]/page.tsx b/web/src/app/app/settings/(restricted-width)/datasources/(admin-restricted-space)/[datasourceId]/page.tsx similarity index 100% rename from web/src/app/app/settings/(restricted-width)/datasources/[datasourceId]/page.tsx rename to web/src/app/app/settings/(restricted-width)/datasources/(admin-restricted-space)/[datasourceId]/page.tsx diff --git a/web/src/app/app/settings/(restricted-width)/datasources/add/page.tsx b/web/src/app/app/settings/(restricted-width)/datasources/(admin-restricted-space)/add/page.tsx similarity index 96% rename from web/src/app/app/settings/(restricted-width)/datasources/add/page.tsx rename to web/src/app/app/settings/(restricted-width)/datasources/(admin-restricted-space)/add/page.tsx index 79dbaf26a..124108ef0 100644 --- a/web/src/app/app/settings/(restricted-width)/datasources/add/page.tsx +++ b/web/src/app/app/settings/(restricted-width)/datasources/(admin-restricted-space)/add/page.tsx @@ -2,8 +2,8 @@ import React from 'react'; import { BusterRoutes, createBusterRoute } from '@/routes'; -import { HeaderContainer } from '../_HeaderContainer'; -import { useContext, useState } from 'react'; +import { HeaderContainer } from '../../_HeaderContainer'; +import { useState } from 'react'; import { DatabaseNames, DataSourceTypes, SUPPORTED_DATASOURCES } from '@/api/buster_rest'; import { AppDataSourceIcon } from '@/components/icons/AppDataSourceIcons'; diff --git a/web/src/app/app/settings/(restricted-width)/datasources/(admin-restricted-space)/layout.tsx b/web/src/app/app/settings/(restricted-width)/datasources/(admin-restricted-space)/layout.tsx new file mode 100644 index 000000000..a230dabd0 --- /dev/null +++ b/web/src/app/app/settings/(restricted-width)/datasources/(admin-restricted-space)/layout.tsx @@ -0,0 +1,16 @@ +import { BusterRoutes, createBusterRoute } from '@/routes/busterRoutes'; +import { useCheckIfUserIsAdmin_server } from '@/server_context/user'; +import { redirect } from 'next/navigation'; + +export default function Layout({ children }: { children: React.ReactNode }) { + const isAdmin = useCheckIfUserIsAdmin_server(); + + if (!isAdmin) { + return redirect( + createBusterRoute({ + route: BusterRoutes.SETTINGS_DATASOURCES + }) + ); + } + return <>{children}; +} diff --git a/web/src/app/app/settings/(restricted-width)/datasources/_DatasourceList.tsx b/web/src/app/app/settings/(restricted-width)/datasources/_DatasourceList.tsx index 528ee86cb..3b100d7ef 100644 --- a/web/src/app/app/settings/(restricted-width)/datasources/_DatasourceList.tsx +++ b/web/src/app/app/settings/(restricted-width)/datasources/_DatasourceList.tsx @@ -13,10 +13,12 @@ import Link from 'next/link'; import { BusterRoutes, createBusterRoute } from '@/routes'; import { useMount } from 'ahooks'; import { Text } from '@/components'; -import { SettingsEmptyState } from '../../_SettingsEmptyState'; +import { SettingsEmptyState } from '../../_components/SettingsEmptyState'; import { useAppLayoutContextSelector } from '@/context/BusterAppLayout'; +import { useUserConfigContextSelector } from '@/context/Users'; export const DatasourceList: React.FC = () => { + const isAdmin = useUserConfigContextSelector((state) => state.isAdmin); const dataSourcesList = useDataSourceContextSelector((state) => state.dataSourcesList); const loadingDatasources = useDataSourceContextSelector((state) => state.loadingDatasources); const initDataSourceList = useDataSourceContextSelector((state) => state.initDataSourceList); @@ -29,7 +31,7 @@ export const DatasourceList: React.FC = () => { return (
- + {loadingDatasources ? ( @@ -37,6 +39,7 @@ export const DatasourceList: React.FC = () => { ) : ( { ); }; -const AddSourceHeader: React.FC<{}> = () => { +const AddSourceHeader: React.FC<{ isAdmin: boolean }> = ({ isAdmin }) => { return (
Your data sources @@ -60,9 +63,11 @@ const AddSourceHeader: React.FC<{}> = () => { href={createBusterRoute({ route: BusterRoutes.SETTINGS_DATASOURCES_ADD })}> - + {isAdmin && ( + + )}
); diff --git a/web/src/app/app/settings/(restricted-width)/datasources/_HeaderContainer.tsx b/web/src/app/app/settings/(restricted-width)/datasources/_HeaderContainer.tsx index fc75f0658..f84367b54 100644 --- a/web/src/app/app/settings/(restricted-width)/datasources/_HeaderContainer.tsx +++ b/web/src/app/app/settings/(restricted-width)/datasources/_HeaderContainer.tsx @@ -1,11 +1,8 @@ 'use client'; -import { AppMaterialIcons, BackButton } from '@/components'; +import { BackButton } from '@/components'; import React from 'react'; - import { createStyles } from 'antd-style'; -import Link from 'next/link'; -import { Text } from '@/components'; const useStyles = createStyles(({ css, token }) => ({ icon: { diff --git a/web/src/app/app/settings/(restricted-width)/datasources/page.tsx b/web/src/app/app/settings/(restricted-width)/datasources/page.tsx index f26b206a8..901e0825d 100644 --- a/web/src/app/app/settings/(restricted-width)/datasources/page.tsx +++ b/web/src/app/app/settings/(restricted-width)/datasources/page.tsx @@ -1,7 +1,6 @@ import React from 'react'; -import { Divider } from 'antd'; import { DatasourceList } from './_DatasourceList'; -import { SettingsPageHeader } from '../../_SettingsPageHeader'; +import { SettingsPageHeader } from '../../_components/SettingsPageHeader'; export default function Page() { return ( diff --git a/web/src/app/app/settings/(restricted-width)/embeds/page.tsx b/web/src/app/app/settings/(restricted-width)/embeds/page.tsx index 6ae143096..f1052764f 100644 --- a/web/src/app/app/settings/(restricted-width)/embeds/page.tsx +++ b/web/src/app/app/settings/(restricted-width)/embeds/page.tsx @@ -1,5 +1,5 @@ -import { SettingsEmptyState } from '../../_SettingsEmptyState'; -import { SettingsPageHeader } from '../../_SettingsPageHeader'; +import { SettingsEmptyState } from '../../_components/SettingsEmptyState'; +import { SettingsPageHeader } from '../../_components/SettingsPageHeader'; export default function Page() { return ( diff --git a/web/src/app/app/settings/(restricted-width)/general/page.tsx b/web/src/app/app/settings/(restricted-width)/general/page.tsx index 17abd695a..ffa1d7d3d 100644 --- a/web/src/app/app/settings/(restricted-width)/general/page.tsx +++ b/web/src/app/app/settings/(restricted-width)/general/page.tsx @@ -1,5 +1,5 @@ -import { SettingsEmptyState } from '../../_SettingsEmptyState'; -import { SettingsPageHeader } from '../../_SettingsPageHeader'; +import { SettingsEmptyState } from '../../_components/SettingsEmptyState'; +import { SettingsPageHeader } from '../../_components/SettingsPageHeader'; export default function Page() { return ( diff --git a/web/src/app/app/settings/(restricted-width)/integrations/page.tsx b/web/src/app/app/settings/(restricted-width)/integrations/page.tsx index afd7be589..d7f66bcff 100644 --- a/web/src/app/app/settings/(restricted-width)/integrations/page.tsx +++ b/web/src/app/app/settings/(restricted-width)/integrations/page.tsx @@ -1,5 +1,5 @@ -import { SettingsEmptyState } from '../../_SettingsEmptyState'; -import { SettingsPageHeader } from '../../_SettingsPageHeader'; +import { SettingsEmptyState } from '../../_components/SettingsEmptyState'; +import { SettingsPageHeader } from '../../_components/SettingsPageHeader'; export default function Page() { return ( diff --git a/web/src/app/app/settings/(restricted-width)/notifications/page.tsx b/web/src/app/app/settings/(restricted-width)/notifications/page.tsx index 53380cc88..71ebdb688 100644 --- a/web/src/app/app/settings/(restricted-width)/notifications/page.tsx +++ b/web/src/app/app/settings/(restricted-width)/notifications/page.tsx @@ -1,5 +1,5 @@ -import { SettingsEmptyState } from '../../_SettingsEmptyState'; -import { SettingsPageHeader } from '../../_SettingsPageHeader'; +import { SettingsEmptyState } from '../../_components/SettingsEmptyState'; +import { SettingsPageHeader } from '../../_components/SettingsPageHeader'; export default function Page() { return ( diff --git a/web/src/app/app/settings/(restricted-width)/permissions/page.tsx b/web/src/app/app/settings/(restricted-width)/permissions/page.tsx index fb1b8c3aa..07e7dca1a 100644 --- a/web/src/app/app/settings/(restricted-width)/permissions/page.tsx +++ b/web/src/app/app/settings/(restricted-width)/permissions/page.tsx @@ -1,5 +1,5 @@ -import { SettingsEmptyState } from '../../_SettingsEmptyState'; -import { SettingsPageHeader } from '../../_SettingsPageHeader'; +import { SettingsEmptyState } from '../../_components/SettingsEmptyState'; +import { SettingsPageHeader } from '../../_components/SettingsPageHeader'; export default function Page() { return ( diff --git a/web/src/app/app/settings/(restricted-width)/preferences/page.tsx b/web/src/app/app/settings/(restricted-width)/preferences/page.tsx index 453312580..10d243043 100644 --- a/web/src/app/app/settings/(restricted-width)/preferences/page.tsx +++ b/web/src/app/app/settings/(restricted-width)/preferences/page.tsx @@ -1,5 +1,5 @@ -import { SettingsEmptyState } from '../../_SettingsEmptyState'; -import { SettingsPageHeader } from '../../_SettingsPageHeader'; +import { SettingsEmptyState } from '../../_components/SettingsEmptyState'; +import { SettingsPageHeader } from '../../_components/SettingsPageHeader'; export default function Page() { return ( diff --git a/web/src/app/app/settings/(restricted-width)/profile/page.tsx b/web/src/app/app/settings/(restricted-width)/profile/page.tsx index d18112182..9c33e296c 100644 --- a/web/src/app/app/settings/(restricted-width)/profile/page.tsx +++ b/web/src/app/app/settings/(restricted-width)/profile/page.tsx @@ -1,6 +1,6 @@ import React from 'react'; -import { SettingsPageHeader } from '../../_SettingsPageHeader'; -import { SettingsEmptyState } from '../../_SettingsEmptyState'; +import { SettingsPageHeader } from '../../_components/SettingsPageHeader'; +import { SettingsEmptyState } from '../../_components/SettingsEmptyState'; export default function LogsPage() { return ( diff --git a/web/src/app/app/settings/(restricted-width)/security/page.tsx b/web/src/app/app/settings/(restricted-width)/security/page.tsx index 274bb1042..43b3684a6 100644 --- a/web/src/app/app/settings/(restricted-width)/security/page.tsx +++ b/web/src/app/app/settings/(restricted-width)/security/page.tsx @@ -1,8 +1,8 @@ 'use client'; import React from 'react'; -import { SettingsEmptyState } from '../../_SettingsEmptyState'; -import { SettingsPageHeader } from '../../_SettingsPageHeader'; +import { SettingsEmptyState } from '../../_components/SettingsEmptyState'; +import { SettingsPageHeader } from '../../_components/SettingsPageHeader'; export default function Page() { return ( diff --git a/web/src/app/app/settings/(restricted-width)/storage/page.tsx b/web/src/app/app/settings/(restricted-width)/storage/page.tsx index b8a41d2e9..0c4616afd 100644 --- a/web/src/app/app/settings/(restricted-width)/storage/page.tsx +++ b/web/src/app/app/settings/(restricted-width)/storage/page.tsx @@ -1,5 +1,5 @@ -import { SettingsEmptyState } from '../../_SettingsEmptyState'; -import { SettingsPageHeader } from '../../_SettingsPageHeader'; +import { SettingsEmptyState } from '../../_components/SettingsEmptyState'; +import { SettingsPageHeader } from '../../_components/SettingsPageHeader'; export default function Page() { return ( diff --git a/web/src/app/app/settings/_SettingsEmptyState.tsx b/web/src/app/app/settings/_components/SettingsEmptyState.tsx similarity index 69% rename from web/src/app/app/settings/_SettingsEmptyState.tsx rename to web/src/app/app/settings/_components/SettingsEmptyState.tsx index c32903fc6..9ef678653 100644 --- a/web/src/app/app/settings/_SettingsEmptyState.tsx +++ b/web/src/app/app/settings/_components/SettingsEmptyState.tsx @@ -12,12 +12,14 @@ export const SettingsEmptyState: React.FC<{ buttonText?: string; buttonAction?: () => void; buttonIcon?: React.ReactNode; + showButton?: boolean; }> = ({ title = 'This page is coming soon.', description = `This page isn’t built yet, but one day it will be.`, buttonAction, buttonText = 'Request support', - buttonIcon = + buttonIcon = , + showButton = true }) => { const { openInfoMessage } = useBusterNotifications(); @@ -32,18 +34,20 @@ export const SettingsEmptyState: React.FC<{ {description}
- + {showButton && ( + + )}
); diff --git a/web/src/app/app/settings/_SettingsPageHeader.tsx b/web/src/app/app/settings/_components/SettingsPageHeader.tsx similarity index 100% rename from web/src/app/app/settings/_SettingsPageHeader.tsx rename to web/src/app/app/settings/_components/SettingsPageHeader.tsx diff --git a/web/src/app/app/settings/_components/index.ts b/web/src/app/app/settings/_components/index.ts new file mode 100644 index 000000000..6268f43bc --- /dev/null +++ b/web/src/app/app/settings/_components/index.ts @@ -0,0 +1,2 @@ +export * from './SettingsPageHeader'; +export * from './SettingsEmptyState'; diff --git a/web/src/server_context/user.ts b/web/src/server_context/user.ts index 83d032194..734c39f15 100644 --- a/web/src/server_context/user.ts +++ b/web/src/server_context/user.ts @@ -2,7 +2,7 @@ import { getMyUserInfo } from '@/api/buster_rest/users/requests'; import { useSupabaseServerContext } from '@/context/Supabase/useSupabaseContext'; import { checkIfUserIsAdmin } from '@/context/Users/helpers'; -export const useCheckIfUserIsAdmin_server = async () => { +export const useCheckIfUserIsAdmin_server = async (): Promise => { const supabaseContext = await useSupabaseServerContext(); const userInfo = await getMyUserInfo({ jwtToken: supabaseContext.accessToken }); const isAdmin = checkIfUserIsAdmin(userInfo);