forked from github/plane
fix: workspaces list not being fetched, display properties endpoint updated (#2493)
* fix: workspaces list not being fetched * style: truncate workspace name if length exceeds
This commit is contained in:
parent
fda0a6791f
commit
5f014d204c
@ -17,8 +17,6 @@ import { Avatar } from "components/ui";
|
|||||||
import { Loader } from "@plane/ui";
|
import { Loader } from "@plane/ui";
|
||||||
// icons
|
// icons
|
||||||
import { Check, LogOut, Plus, Settings, UserCircle2 } from "lucide-react";
|
import { Check, LogOut, Plus, Settings, UserCircle2 } from "lucide-react";
|
||||||
// helpers
|
|
||||||
import { truncateText } from "helpers/string.helper";
|
|
||||||
// types
|
// types
|
||||||
import { IWorkspace } from "types";
|
import { IWorkspace } from "types";
|
||||||
|
|
||||||
@ -104,15 +102,15 @@ export const WorkspaceSidebarDropdown = observer(() => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="inline-flex items-center gap-2 px-4 pt-4">
|
<div className="flex items-center gap-2 px-4 pt-4">
|
||||||
<Menu as="div" className="relative col-span-4 inline-block w-full text-left">
|
<Menu as="div" className="relative col-span-4 text-left flex-grow truncate">
|
||||||
<Menu.Button className="text-custom-sidebar-text-200 flex w-full items-center rounded-sm text-sm font-medium focus:outline-none">
|
<Menu.Button className="text-custom-sidebar-text-200 rounded-sm text-sm font-medium focus:outline-none w-full truncate">
|
||||||
<div
|
<div
|
||||||
className={`flex w-full items-center gap-x-2 rounded-sm bg-custom-sidebar-background-80 p-1 ${
|
className={`flex items-center gap-x-2 rounded-sm bg-custom-sidebar-background-80 p-1 truncate ${
|
||||||
themeStore.sidebarCollapsed ? "justify-center" : ""
|
themeStore.sidebarCollapsed ? "justify-center" : ""
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<div className="relative grid h-6 w-6 place-items-center rounded bg-gray-700 uppercase text-white">
|
<div className="relative grid h-6 w-6 place-items-center rounded bg-gray-700 uppercase text-white flex-shrink-0">
|
||||||
{activeWorkspace?.logo && activeWorkspace.logo !== "" ? (
|
{activeWorkspace?.logo && activeWorkspace.logo !== "" ? (
|
||||||
<img
|
<img
|
||||||
src={activeWorkspace.logo}
|
src={activeWorkspace.logo}
|
||||||
@ -125,8 +123,8 @@ export const WorkspaceSidebarDropdown = observer(() => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{!themeStore.sidebarCollapsed && (
|
{!themeStore.sidebarCollapsed && (
|
||||||
<h4 className="text-custom-text-100">
|
<h4 className="text-custom-text-100 truncate">
|
||||||
{activeWorkspace?.name ? truncateText(activeWorkspace.name, 14) : "Loading..."}
|
{activeWorkspace?.name ? activeWorkspace.name : "Loading..."}
|
||||||
</h4>
|
</h4>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@ -158,8 +156,8 @@ export const WorkspaceSidebarDropdown = observer(() => {
|
|||||||
onClick={() => handleWorkspaceNavigation(workspace)}
|
onClick={() => handleWorkspaceNavigation(workspace)}
|
||||||
className="flex w-full items-center justify-between gap-1 p-1 rounded-md text-sm text-custom-sidebar-text-100 hover:bg-custom-sidebar-background-80"
|
className="flex w-full items-center justify-between gap-1 p-1 rounded-md text-sm text-custom-sidebar-text-100 hover:bg-custom-sidebar-background-80"
|
||||||
>
|
>
|
||||||
<div className="flex items-center justify-start gap-2.5">
|
<div className="flex items-center justify-start gap-2.5 truncate">
|
||||||
<span className="relative flex h-6 w-6 items-center justify-center rounded bg-gray-700 p-2 text-xs uppercase text-white">
|
<span className="relative flex h-6 w-6 items-center justify-center rounded bg-gray-700 p-2 text-xs uppercase text-white flex-shrink-0">
|
||||||
{workspace?.logo && workspace.logo !== "" ? (
|
{workspace?.logo && workspace.logo !== "" ? (
|
||||||
<img
|
<img
|
||||||
src={workspace.logo}
|
src={workspace.logo}
|
||||||
@ -172,18 +170,18 @@ export const WorkspaceSidebarDropdown = observer(() => {
|
|||||||
</span>
|
</span>
|
||||||
|
|
||||||
<h5
|
<h5
|
||||||
className={`text-sm ${workspaceSlug === workspace.slug ? "" : "text-custom-text-200"}`}
|
className={`text-sm truncate ${
|
||||||
|
workspaceSlug === workspace.slug ? "" : "text-custom-text-200"
|
||||||
|
}`}
|
||||||
>
|
>
|
||||||
{truncateText(workspace.name, 18)}
|
{workspace.name}
|
||||||
</h5>
|
</h5>
|
||||||
</div>
|
</div>
|
||||||
<span className="p-1">
|
{workspace.id === activeWorkspace?.id && (
|
||||||
<Check
|
<span className="p-1 flex-shrink-0">
|
||||||
className={`h-3 w-3.5 text-custom-sidebar-text-100 ${
|
<Check className="h-3 w-3.5 text-custom-sidebar-text-100" />
|
||||||
workspace.id === activeWorkspace?.id ? "opacity-100" : "opacity-0"
|
</span>
|
||||||
}`}
|
)}
|
||||||
/>
|
|
||||||
</span>
|
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
|
@ -19,6 +19,8 @@ export const WorkspaceAuthWrapper: FC<IWorkspaceAuthWrapper> = observer((props)
|
|||||||
// router
|
// router
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { workspaceSlug } = router.query;
|
const { workspaceSlug } = router.query;
|
||||||
|
// fetching all workspaces
|
||||||
|
useSWR(`USER_WORKSPACES_LIST`, () => workspaceStore.fetchWorkspaces());
|
||||||
// fetching user workspace information
|
// fetching user workspace information
|
||||||
useSWR(
|
useSWR(
|
||||||
workspaceSlug ? `WORKSPACE_MEMBERS_ME_${workspaceSlug}` : null,
|
workspaceSlug ? `WORKSPACE_MEMBERS_ME_${workspaceSlug}` : null,
|
||||||
|
@ -153,12 +153,14 @@ export class IssueService extends APIService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async patchIssueDisplayProperties(
|
async updateIssueDisplayProperties(
|
||||||
workspaceSlug: string,
|
workspaceSlug: string,
|
||||||
projectId: string,
|
projectId: string,
|
||||||
data: IIssueDisplayProperties
|
data: IIssueDisplayProperties
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
return this.patch(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issue-display-properties/`, data)
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issue-display-properties/`, {
|
||||||
|
properties: data,
|
||||||
|
})
|
||||||
.then((response) => response?.data)
|
.then((response) => response?.data)
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
throw error?.response?.data;
|
throw error?.response?.data;
|
||||||
|
@ -217,7 +217,7 @@ export class IssueFilterStore implements IIssueFilterStore {
|
|||||||
this.userDisplayProperties = newProperties;
|
this.userDisplayProperties = newProperties;
|
||||||
});
|
});
|
||||||
|
|
||||||
await this.issueService.patchIssueDisplayProperties(workspaceSlug, projectId, newProperties);
|
await this.issueService.updateIssueDisplayProperties(workspaceSlug, projectId, newProperties);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.fetchUserProjectFilters(workspaceSlug, projectId);
|
this.fetchUserProjectFilters(workspaceSlug, projectId);
|
||||||
|
|
||||||
@ -225,7 +225,7 @@ export class IssueFilterStore implements IIssueFilterStore {
|
|||||||
this.error = error;
|
this.error = error;
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log("Failed to update user filters in issue filter store", error);
|
console.log("Failed to update user display properties in issue filter store", error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user