From 58f14747a14ef87ed40d65eab1a17c49b1172fe8 Mon Sep 17 00:00:00 2001 From: Tsiry Sandratraina Date: Sat, 10 Aug 2024 14:49:02 +0000 Subject: [PATCH] feat(auth): handle redirections from fluentci.io feat(auth): handle redirections from fluentci.io fix localStorage fix localStorage fix localStorage fix localStorage fix localStorage fix localStorage fix localStorage fix localStorage feat(auth): handle redirections from fluentci.io feat(auth): handle redirections from fluentci.io --- webui/bun.lockb | Bin 730976 -> 730928 bytes webui/codegen.yml | 1 + webui/graphql.schema.json | 223 +++++++++++++++++++++++++ webui/src/Containers/Auth/Auth.tsx | 20 +++ webui/src/Containers/Home/Home.tsx | 26 +++ webui/src/GraphQL/Fragment.tsx | 23 +++ webui/src/GraphQL/Package/Mutation.tsx | 20 +++ webui/src/Hooks/GraphQL.tsx | 137 +++++++++++++++ 8 files changed, 450 insertions(+) create mode 100644 webui/src/GraphQL/Package/Mutation.tsx diff --git a/webui/bun.lockb b/webui/bun.lockb index 9f08e074fb394480dfd7bf004a37f6a3b0280e5f..4d37cffff0064231a09a1f9c2a496de88554c366 100755 GIT binary patch delta 4587 zcmXw*3s{!r8OJ{mK29F^z%wcb4?{sY%tT8j1TM++lSGr88Pn#x)RZh&twyYvCz!Ex zk6SI^TI4BGH2Y*_h+=qFuGFnfuf zGpT#dq`o*asJ7f+;SZ|t2UqxeRQN+G{Gt2(-b3#N^>oqA-dVnzp&n0=r#qNDH(hD7 zH#Ykla1SoO4U=w(g^*j=2=;c@AbFy06OSjnxyh%*f_B}RW}-z z4zo{eva2?WY?a&lZ`Nn`J+V|+3ye$86tS`7hsAPShgsxFN<*rVMZQ=%>~*oJFniz( zVz1aeF5?Im(^URlq`8s`#Kyz?V)u&O0V@=n?#j(#hTOA|@+0|+;aB-Y@@ZnT#3sQC z#0p)zS zE*G|1>>*cb77HciAx%QE$9z~UpFBt9C1Q3;bH#q>TFhdRq*GqX)so+u8@2_%$mdFuF)*ksC+gkzzMYRq{@rPo5Y?Hn*%!tv%c}P3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!JR$Y`P?Pb)> zV&`DC+vTQPyQ$x@Y0vsr?Dy0mFq<#mxe6?bzn8@x zP`KKE5ZenICiXwEeXtFBd#{V_hrObqU{8Zxdo@uBTTTuTtD!E2tsr;nV*Na|9F*wG z-CfdIE-Mht_Wb~ngS3k5h4IhxCK1J@+92xN<>5I<9j(jn=Ss{XL>6^O_0%?qd}@D- z`UthHP_cUI(_&$+)hq^aXlL;@ah|ELh8!+-m^u>ChSLz3y;<)NgJCwDhP#+^SVSV( zW;76k*sRCNQDR4_;iQP z%m&e97tn&mR7rmUrAkT_`ztJvQ?!Zk6R}Iw9}%{0ce!SfCh2dW2eH^iP8a)-`V4Q( zZt^r3qwB`kr|T`6;i}9cQ|@q9?_6B*T*cIwT_1)z<%wm?LkCCE~_K>s1 z{zYA;cQglP+ulZOXN&Ea@kUOcuN#C|K*8&)Q^ zMXV33Tx=`MeyT4lnT=_u{+;^z!GQ~ek2CIQxgH^)pWCp-$g&|I^yP3^4p-NWyjy({)Z<}+p@{;$94WmvjrZI@3 zT5ve^an9OyqXuRt6G?6Vm9zDx`l4X-IBC10gX)W>E}*uPx6w!P#PDIa#7^{(*a$H@ z(J5~Wj^yAWYBM=Zwk^Dgx{%s5o0}xhl8aquvZ&MR9*ylCU6*pvdtp#r_!r)Xy*_)G z?BUr+*aK7UD!%r9?%P7?h^@pXVzVo`>fIH*uCvQ(n@j5Sj;zb;^bVL7+>*i%vF5BT zN(rhfO6j?8U-0%ezQjtai*M`M);)N2d)IOK+KBd^L~vb1d#|~v!6#$8Mrey$6WjaH F{{a@P16Ke5 diff --git a/webui/codegen.yml b/webui/codegen.yml index 74af5a9..924e171 100644 --- a/webui/codegen.yml +++ b/webui/codegen.yml @@ -1,4 +1,5 @@ overwrite: true +#schema: "https://api.fluentci.io/graphql" #schema: "http://127.0.0.1:6076/graphql" schema: "http://127.0.0.1:8787/graphql" documents: "src/**/*.tsx" diff --git a/webui/graphql.schema.json b/webui/graphql.schema.json index dca04f0..cfaa7b6 100644 --- a/webui/graphql.schema.json +++ b/webui/graphql.schema.json @@ -458,6 +458,65 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "OBJECT", + "name": "Category", + "description": null, + "fields": [ + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "slug", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, { "kind": "SCALAR", "name": "Float", @@ -1085,6 +1144,39 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "starPackage", + "description": null, + "args": [ + { + "name": "id", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Package", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "unarchiveProject", "description": null, @@ -1143,6 +1235,39 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "unstarPackage", + "description": null, + "args": [ + { + "name": "id", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Package", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "updateProject", "description": null, @@ -1290,6 +1415,26 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "categories", + "description": null, + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Category", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "createdAt", "description": null, @@ -1957,6 +2102,39 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "countPackageStars", + "description": null, + "args": [ + { + "name": "id", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "countPackages", "description": null, @@ -2479,6 +2657,18 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "orderBy", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "skip", "description": null, @@ -2691,6 +2881,39 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "starredPackage", + "description": null, + "args": [ + { + "name": "id", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "versions", "description": null, diff --git a/webui/src/Containers/Auth/Auth.tsx b/webui/src/Containers/Auth/Auth.tsx index b7078a0..d4cde48 100644 --- a/webui/src/Containers/Auth/Auth.tsx +++ b/webui/src/Containers/Auth/Auth.tsx @@ -1,5 +1,7 @@ +import { useEffect } from "react"; import { SignIn } from "@clerk/clerk-react"; import styled from "@emotion/styled"; +import { useSearchParams } from "react-router-dom"; const Container = styled.div` display: flex; @@ -10,6 +12,24 @@ const Container = styled.div` `; export default function Auth() { + const [qs] = useSearchParams(); + const redirect = qs.get("redirect"); + const action = qs.get("action"); + const id = qs.get("id"); + + useEffect(() => { + if (redirect && action && id) { + localStorage.setItem( + "extra", + JSON.stringify({ + redirect, + action, + id, + }) + ); + } + }, [redirect, action, id]); + return ( diff --git a/webui/src/Containers/Home/Home.tsx b/webui/src/Containers/Home/Home.tsx index 4e60e06..c725f6e 100644 --- a/webui/src/Containers/Home/Home.tsx +++ b/webui/src/Containers/Home/Home.tsx @@ -6,6 +6,7 @@ import Loading from "./Loading"; import { useRecoilState } from "recoil"; import { HomeState } from "./HomeState"; import Navbar from "../../Components/Navbar"; +import { useStarPackageMutation } from "../../Hooks/GraphQL"; const Container = styled.div` height: calc(100vh - 30px); @@ -16,12 +17,37 @@ const Container = styled.div` const Home: FC = () => { const [{ loading }, setState] = useRecoilState(HomeState); + const [starPackage] = useStarPackageMutation(); const setLoading = (loading: boolean) => { setState({ loading }); }; useEffect(() => { + const extra = localStorage.getItem("extra"); + if (extra) { + const { id, redirect, action } = JSON.parse(extra); + console.log("extra", extra); + console.log({ id, redirect, action }); + switch (action) { + case "star": + starPackage({ + variables: { + id, + }, + }) + .then((res) => { + localStorage.removeItem("extra"); + console.log(res); + window.location.href = `https://fluentci.io${redirect}`; + }) + .catch((e) => console.error(e)); + break; + default: + break; + } + } + if (!location.host) { // eslint-disable-next-line @typescript-eslint/no-explicit-any (window as any).ipcRenderer.on( diff --git a/webui/src/GraphQL/Fragment.tsx b/webui/src/GraphQL/Fragment.tsx index d3ed8e5..dd88ae5 100644 --- a/webui/src/GraphQL/Fragment.tsx +++ b/webui/src/GraphQL/Fragment.tsx @@ -105,3 +105,26 @@ export const OrganizationFragment = gql` createdAt } `; + +export const PackageFragment = gql` + fragment PackageFragment on Package { + id + name + publisher + description + version + owner + downloads + repoName + logoUrl + githubUrl + license + createdAt + updatedAt + categories { + id + name + slug + } + } +`; diff --git a/webui/src/GraphQL/Package/Mutation.tsx b/webui/src/GraphQL/Package/Mutation.tsx new file mode 100644 index 0000000..b78ce8e --- /dev/null +++ b/webui/src/GraphQL/Package/Mutation.tsx @@ -0,0 +1,20 @@ +import { gql } from "@apollo/client"; +import { PackageFragment } from "../Fragment"; + +export const STAR_PACKAGE = gql` + mutation StarPackage($id: ID!) { + starPackage(id: $id) { + ...PackageFragment + } + } + ${PackageFragment} +`; + +export const UNSTAR_PACKAGE = gql` + mutation UnstarPackage($id: ID!) { + unstarPackage(id: $id) { + ...PackageFragment + } + } + ${PackageFragment} +`; diff --git a/webui/src/Hooks/GraphQL.tsx b/webui/src/Hooks/GraphQL.tsx index 66979ae..f297477 100644 --- a/webui/src/Hooks/GraphQL.tsx +++ b/webui/src/Hooks/GraphQL.tsx @@ -58,6 +58,13 @@ export type ActionInput = { useWasm: Scalars['Boolean']; }; +export type Category = { + __typename?: 'Category'; + id: Scalars['ID']; + name: Scalars['String']; + slug: Scalars['String']; +}; + /** A job is a task that is run in a project. */ export type Job = { __typename?: 'Job'; @@ -92,8 +99,10 @@ export type Mutation = { runJob: Job; runPipeline?: Maybe; saveActions?: Maybe>; + starPackage: Package; unarchiveProject?: Maybe; unlinkRepository?: Maybe; + unstarPackage: Package; updateProject?: Maybe; }; @@ -153,6 +162,11 @@ export type MutationSaveActionsArgs = { }; +export type MutationStarPackageArgs = { + id: Scalars['ID']; +}; + + export type MutationUnarchiveProjectArgs = { id: Scalars['ID']; }; @@ -163,6 +177,11 @@ export type MutationUnlinkRepositoryArgs = { }; +export type MutationUnstarPackageArgs = { + id: Scalars['ID']; +}; + + export type MutationUpdateProjectArgs = { description?: InputMaybe; id: Scalars['ID']; @@ -180,6 +199,7 @@ export type Organization = { export type Package = { __typename?: 'Package'; avatarUrl?: Maybe; + categories?: Maybe>; createdAt: Scalars['String']; defaultBranch?: Maybe; description: Scalars['String']; @@ -234,6 +254,7 @@ export type Query = { accessTokens: Array; account?: Maybe; actions?: Maybe>; + countPackageStars: Scalars['Int']; countPackages: Scalars['Int']; countProjects: Scalars['Int']; countRuns: Scalars['Int']; @@ -252,6 +273,7 @@ export type Query = { project?: Maybe; projects: Array; repositories: Array; + starredPackage: Scalars['Boolean']; versions: Array; }; @@ -266,6 +288,11 @@ export type QueryActionsArgs = { }; +export type QueryCountPackageStarsArgs = { + id: Scalars['ID']; +}; + + export type QueryCountPackagesArgs = { all?: InputMaybe; category?: InputMaybe; @@ -328,6 +355,7 @@ export type QueryPackagesArgs = { all?: InputMaybe; category?: InputMaybe; filter?: InputMaybe; + orderBy?: InputMaybe; skip?: InputMaybe; take?: InputMaybe; }; @@ -353,6 +381,11 @@ export type QueryRepositoriesArgs = { }; +export type QueryStarredPackageArgs = { + id: Scalars['ID']; +}; + + export type QueryVersionsArgs = { id: Scalars['String']; }; @@ -464,6 +497,8 @@ export type RepositoryFragmentFragment = { __typename?: 'Repository', id: string export type OrganizationFragmentFragment = { __typename?: 'Organization', id: string, name: string, createdAt: string }; +export type PackageFragmentFragment = { __typename?: 'Package', id: string, name: string, publisher?: string | null, description: string, version: string, owner: string, downloads: number, repoName?: string | null, logoUrl?: string | null, githubUrl?: string | null, license?: string | null, createdAt: string, updatedAt: string, categories?: Array<{ __typename?: 'Category', id: string, name: string, slug: string }> | null }; + export type RunJobMutationVariables = Exact<{ projectId?: InputMaybe; jobName?: InputMaybe; @@ -506,6 +541,20 @@ export type GetOrganizationsQueryVariables = Exact<{ export type GetOrganizationsQuery = { __typename?: 'Query', organizations: Array<{ __typename?: 'Organization', id: string, name: string, createdAt: string }> }; +export type StarPackageMutationVariables = Exact<{ + id: Scalars['ID']; +}>; + + +export type StarPackageMutation = { __typename?: 'Mutation', starPackage: { __typename?: 'Package', id: string, name: string, publisher?: string | null, description: string, version: string, owner: string, downloads: number, repoName?: string | null, logoUrl?: string | null, githubUrl?: string | null, license?: string | null, createdAt: string, updatedAt: string, categories?: Array<{ __typename?: 'Category', id: string, name: string, slug: string }> | null } }; + +export type UnstarPackageMutationVariables = Exact<{ + id: Scalars['ID']; +}>; + + +export type UnstarPackageMutation = { __typename?: 'Mutation', unstarPackage: { __typename?: 'Package', id: string, name: string, publisher?: string | null, description: string, version: string, owner: string, downloads: number, repoName?: string | null, logoUrl?: string | null, githubUrl?: string | null, license?: string | null, createdAt: string, updatedAt: string, categories?: Array<{ __typename?: 'Category', id: string, name: string, slug: string }> | null } }; + export type CreateProjectMutationVariables = Exact<{ [key: string]: never; }>; @@ -731,6 +780,28 @@ export const OrganizationFragmentFragmentDoc = gql` createdAt } `; +export const PackageFragmentFragmentDoc = gql` + fragment PackageFragment on Package { + id + name + publisher + description + version + owner + downloads + repoName + logoUrl + githubUrl + license + createdAt + updatedAt + categories { + id + name + slug + } +} + `; export const CreateAccessTokenDocument = gql` mutation CreateAccessToken($name: String!) { createAccessToken(name: $name) { @@ -1237,6 +1308,72 @@ export function useGetOrganizationsLazyQuery(baseOptions?: Apollo.LazyQueryHookO export type GetOrganizationsQueryHookResult = ReturnType; export type GetOrganizationsLazyQueryHookResult = ReturnType; export type GetOrganizationsQueryResult = Apollo.QueryResult; +export const StarPackageDocument = gql` + mutation StarPackage($id: ID!) { + starPackage(id: $id) { + ...PackageFragment + } +} + ${PackageFragmentFragmentDoc}`; +export type StarPackageMutationFn = Apollo.MutationFunction; + +/** + * __useStarPackageMutation__ + * + * To run a mutation, you first call `useStarPackageMutation` within a React component and pass it any options that fit your needs. + * When your component renders, `useStarPackageMutation` returns a tuple that includes: + * - A mutate function that you can call at any time to execute the mutation + * - An object with fields that represent the current status of the mutation's execution + * + * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; + * + * @example + * const [starPackageMutation, { data, loading, error }] = useStarPackageMutation({ + * variables: { + * id: // value for 'id' + * }, + * }); + */ +export function useStarPackageMutation(baseOptions?: Apollo.MutationHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useMutation(StarPackageDocument, options); + } +export type StarPackageMutationHookResult = ReturnType; +export type StarPackageMutationResult = Apollo.MutationResult; +export type StarPackageMutationOptions = Apollo.BaseMutationOptions; +export const UnstarPackageDocument = gql` + mutation UnstarPackage($id: ID!) { + unstarPackage(id: $id) { + ...PackageFragment + } +} + ${PackageFragmentFragmentDoc}`; +export type UnstarPackageMutationFn = Apollo.MutationFunction; + +/** + * __useUnstarPackageMutation__ + * + * To run a mutation, you first call `useUnstarPackageMutation` within a React component and pass it any options that fit your needs. + * When your component renders, `useUnstarPackageMutation` returns a tuple that includes: + * - A mutate function that you can call at any time to execute the mutation + * - An object with fields that represent the current status of the mutation's execution + * + * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; + * + * @example + * const [unstarPackageMutation, { data, loading, error }] = useUnstarPackageMutation({ + * variables: { + * id: // value for 'id' + * }, + * }); + */ +export function useUnstarPackageMutation(baseOptions?: Apollo.MutationHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useMutation(UnstarPackageDocument, options); + } +export type UnstarPackageMutationHookResult = ReturnType; +export type UnstarPackageMutationResult = Apollo.MutationResult; +export type UnstarPackageMutationOptions = Apollo.BaseMutationOptions; export const CreateProjectDocument = gql` mutation CreateProject { createProject {