diff --git a/frontend/src/pages/dashboard/[id].tsx b/frontend/src/pages/dashboard/[id].tsx index fd43616a3..c40d547a9 100644 --- a/frontend/src/pages/dashboard/[id].tsx +++ b/frontend/src/pages/dashboard/[id].tsx @@ -167,7 +167,7 @@ export default function Dashboard() { const [dropZoneData, setDropZoneData] = useState(); const [projectTags, setProjectTags] = useState([]); - const { hasUnsavedChanges, setHasUnsavedChanges } = useLeaveConfirm({initialValue: false}); + const { hasUnsavedChanges, setHasUnsavedChanges } = useLeaveConfirm({ initialValue: false }); const { t } = useTranslation(); const { createNotification } = useNotificationContext(); @@ -217,6 +217,9 @@ export default function Dashboard() { useEffect(() => { (async () => { + if (router.isReady && workspaceId === 'undefined') { + router.push('/noprojects'); + } try { const tempNumSnapshots = await getProjectSercetSnapshotsCount({ workspaceId @@ -314,7 +317,7 @@ export default function Dashboard() { valueOverride: undefined, comment: '', tags: [] - }, + } ]); }; @@ -750,11 +753,13 @@ export default function Dashboard() { }; const handleOnEnvironmentChange = (envName: string) => { - if(hasUnsavedChanges) { + if (hasUnsavedChanges) { if (!window.confirm(leaveConfirmDefaultMessage)) return; } - const selectedWorkspaceEnv = workspaceEnvs.find(({ name }: { name: string }) => envName === name) || { + const selectedWorkspaceEnv = workspaceEnvs.find( + ({ name }: { name: string }) => envName === name + ) || { name: 'unknown', slug: 'unknown', isWriteDenied: false, @@ -843,16 +848,18 @@ export default function Dashboard() {
- {!selectedEnv?.isReadDenied &&
{(data?.length !== 0 || hasUnsavedChanges) && !snapshotData && (
@@ -993,50 +1000,61 @@ export default function Dashboard() { className="mt-1 max-h-[calc(100vh-280px)] overflow-hidden overflow-y-scroll no-scrollbar no-scrollbar::-webkit-scrollbar border border-mineshaft-600 rounded-md" >
-
+
-
0
- Key - {!snapshotData && reorderRows(1)} - > - {sortMethod === 'alphabetical' ? : } - } +
+ 0 +
+ Key + {!snapshotData && ( + reorderRows(1)} + > + {sortMethod === 'alphabetical' ? ( + + ) : ( + + )} + + )}
-
-
Value
+
+
+ Value +
-
Comment
+
+ Comment +
-
Tags
+
+ Tags +
-
-
+
+
null} role="none" onClick={() => {}} className="invisible group-hover:visible" > - +
@@ -1044,10 +1062,16 @@ export default function Dashboard() {
{!snapshotData && data - ?.filter((row) => - row.key?.toUpperCase().includes(searchKeys.toUpperCase()) - || row.tags?.map(tag => tag.name).join(" ")?.toUpperCase().includes(searchKeys.toUpperCase()) - || row.comment?.toUpperCase().includes(searchKeys.toUpperCase())) + ?.filter( + (row) => + row.key?.toUpperCase().includes(searchKeys.toUpperCase()) || + row.tags + ?.map((tag) => tag.name) + .join(' ') + ?.toUpperCase() + .includes(searchKeys.toUpperCase()) || + row.comment?.toUpperCase().includes(searchKeys.toUpperCase()) + ) .filter((row) => !sharedToHide.includes(row.id)) // .filter((row) => row.value !== undefined) .map((keyPair) => ( @@ -1097,15 +1121,15 @@ export default function Dashboard() { tags={projectTags} /> ))} -
-
-
@@ -1152,8 +1176,7 @@ export default function Dashboard() { - row.id === sidebarSecretId && row.value !== undefined + (row: SecretDataProps) => row.id === sidebarSecretId && row.value !== undefined )} modifyKey={listenChangeKey} modifyValue={listenChangeValue} diff --git a/frontend/src/views/Settings/ProjectSettingsPage/ProjectSettingsPage.tsx b/frontend/src/views/Settings/ProjectSettingsPage/ProjectSettingsPage.tsx index f6fc92111..8c1a2ddd1 100644 --- a/frontend/src/views/Settings/ProjectSettingsPage/ProjectSettingsPage.tsx +++ b/frontend/src/views/Settings/ProjectSettingsPage/ProjectSettingsPage.tsx @@ -58,7 +58,7 @@ export const ProjectSettingsPage = () => { const renameWorkspace = useRenameWorkspace(); const toggleAutoCapitalization = useToggleAutoCapitalization(); - + const deleteWorkspace = useDeleteWorkspace(); // env crud operation const createWsEnv = useCreateWsEnvironment(); @@ -97,7 +97,7 @@ export const ProjectSettingsPage = () => { } }; - const onAutoCapitalizationToggle = async (state: boolean) => { + const onAutoCapitalizationToggle = async (state: boolean) => { try { await toggleAutoCapitalization.mutateAsync({ workspaceID, @@ -123,6 +123,9 @@ export const ProjectSettingsPage = () => { await deleteWorkspace.mutateAsync({ workspaceID }); // redirect user to first workspace user is part of const ws = workspaces.find(({ _id }) => _id !== workspaceID); + if (!ws) { + router.push('/noprojects'); + } router.push(`/dashboard/${ws?._id}`); createNotification({ text: 'Successfully deleted workspace', @@ -247,7 +250,7 @@ export const ProjectSettingsPage = () => { const res = await createWsTag.mutateAsync({ workspaceID, tagName: name, - tagSlug: name.replace(" ", "_") + tagSlug: name.replace(' ', '_') }); createNotification({ text: 'Successfully created a tag',