mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
fix: workspace project ids computed (#3417)
This commit is contained in:
parent
577118ca02
commit
4baf2a2f09
@ -23,6 +23,8 @@ export const OAuthOptions: React.FC<Props> = observer((props) => {
|
|||||||
const {
|
const {
|
||||||
config: { envConfig },
|
config: { envConfig },
|
||||||
} = useApplication();
|
} = useApplication();
|
||||||
|
// derived values
|
||||||
|
const areBothOAuthEnabled = envConfig?.google_client_id && envConfig?.github_client_id;
|
||||||
|
|
||||||
const handleGoogleSignIn = async ({ clientId, credential }: any) => {
|
const handleGoogleSignIn = async ({ clientId, credential }: any) => {
|
||||||
try {
|
try {
|
||||||
@ -73,7 +75,7 @@ export const OAuthOptions: React.FC<Props> = observer((props) => {
|
|||||||
<p className="mx-3 flex-shrink-0 text-center text-sm text-onboarding-text-400">Or continue with</p>
|
<p className="mx-3 flex-shrink-0 text-center text-sm text-onboarding-text-400">Or continue with</p>
|
||||||
<hr className="w-full border-onboarding-border-100" />
|
<hr className="w-full border-onboarding-border-100" />
|
||||||
</div>
|
</div>
|
||||||
<div className="mx-auto mt-7 grid grid-cols-2 gap-4 overflow-hidden sm:w-96">
|
<div className={`mx-auto mt-7 grid gap-4 overflow-hidden sm:w-96 ${areBothOAuthEnabled ? "grid-cols-2" : ""}`}>
|
||||||
{envConfig?.google_client_id && (
|
{envConfig?.google_client_id && (
|
||||||
<div className="h-[42px] flex items-center !overflow-hidden">
|
<div className="h-[42px] flex items-center !overflow-hidden">
|
||||||
<GoogleSignInButton clientId={envConfig?.google_client_id} handleSignIn={handleGoogleSignIn} type={type} />
|
<GoogleSignInButton clientId={envConfig?.google_client_id} handleSignIn={handleGoogleSignIn} type={type} />
|
||||||
|
@ -92,24 +92,26 @@ export class ProjectStore implements IProjectStore {
|
|||||||
* Returns searched projects based on search query
|
* Returns searched projects based on search query
|
||||||
*/
|
*/
|
||||||
get searchedProjects() {
|
get searchedProjects() {
|
||||||
if (!this.rootStore.app.router.workspaceSlug) return [];
|
const workspaceDetails = this.rootStore.workspaceRoot.currentWorkspace;
|
||||||
const projectIds = Object.keys(this.projectMap);
|
if (!workspaceDetails) return [];
|
||||||
return this.searchQuery === ""
|
const workspaceProjects = Object.values(this.projectMap).filter(
|
||||||
? projectIds
|
(p) =>
|
||||||
: projectIds?.filter((projectId) => {
|
p.workspace === workspaceDetails.id &&
|
||||||
this.projectMap[projectId].name.toLowerCase().includes(this.searchQuery.toLowerCase()) ||
|
(p.name.toLowerCase().includes(this.searchQuery.toLowerCase()) ||
|
||||||
this.projectMap[projectId].identifier.toLowerCase().includes(this.searchQuery.toLowerCase());
|
p.identifier.toLowerCase().includes(this.searchQuery.toLowerCase()))
|
||||||
});
|
);
|
||||||
|
return workspaceProjects.map((p) => p.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns project IDs belong to the current workspace
|
* Returns project IDs belong to the current workspace
|
||||||
*/
|
*/
|
||||||
get workspaceProjectIds() {
|
get workspaceProjectIds() {
|
||||||
if (!this.rootStore.app.router.workspaceSlug) return null;
|
const workspaceDetails = this.rootStore.workspaceRoot.currentWorkspace;
|
||||||
const projectIds = Object.keys(this.projectMap);
|
if (!workspaceDetails) return null;
|
||||||
if (!projectIds) return null;
|
const workspaceProjects = Object.values(this.projectMap).filter((p) => p.workspace === workspaceDetails.id);
|
||||||
return projectIds;
|
const projectIds = workspaceProjects.map((p) => p.id);
|
||||||
|
return projectIds ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user