diff --git a/gql-queries-generator/doc/queries.graphql b/gql-queries-generator/doc/queries.graphql index e5c22a7d8..3a6e3e594 100644 --- a/gql-queries-generator/doc/queries.graphql +++ b/gql-queries-generator/doc/queries.graphql @@ -4482,6 +4482,13 @@ query consoleGetRegistryImage($image: String!) { } } +query consoleGetRegistryImageUrl($image: String!, $meta: Map!) { + core_getRegistryImageURL(image: $image, meta: $meta) { + scriptUrl + url + } +} + query consoleListRegistryImages($pq: CursorPaginationIn) { core_listRegistryImages(pq: $pq) { edges { diff --git a/lib/types/common.ts b/lib/types/common.ts index 626caf76f..ca63a8046 100644 --- a/lib/types/common.ts +++ b/lib/types/common.ts @@ -2,7 +2,7 @@ import { ReactNode } from 'react'; export type NonNullableString = string & NonNullable; -export type MapType = { +export type MapType = { [key: string]: T | MapType; }; diff --git a/src/apps/auth/routes/_main+/oauth2.callback.$provider.tsx b/src/apps/auth/routes/_main+/oauth2.callback.$provider.tsx index 99ce1f56a..10baae536 100644 --- a/src/apps/auth/routes/_main+/oauth2.callback.$provider.tsx +++ b/src/apps/auth/routes/_main+/oauth2.callback.$provider.tsx @@ -1,7 +1,8 @@ -import { useLoaderData, useNavigate, useSearchParams } from '@remix-run/react'; +import { useLoaderData, useNavigate } from '@remix-run/react'; import { useAuthApi } from '~/auth/server/gql/api-provider'; import { BrandLogo } from '~/components/branding/brand-logo'; import { toast } from '~/components/molecule/toast'; +import { getCookie } from '~/root/lib/app-setup/cookies'; import useDebounce from '~/root/lib/client/hooks/use-debounce'; import getQueries from '~/root/lib/server/helpers/get-queries'; import { IRemixCtx } from '~/root/lib/types/common'; @@ -11,10 +12,9 @@ export const decodeState = (str: string) => Buffer.from(str, 'base64url').toString('utf8'); const CallBack = () => { - const { query, state, provider, setupAction } = useLoaderData(); + const { query, state, provider, setupAction, callbackUrl } = useLoaderData(); const api = useAuthApi(); const navigate = useNavigate(); - const [searchParams, _setSearchParams] = useSearchParams(); useDebounce( () => { @@ -71,9 +71,9 @@ const CallBack = () => { navigate('/'); } else { toast.success('Login Successfull'); - const callback = searchParams.get('callback'); - if (callback) { - window.location.href = callback; + if (callbackUrl) { + getCookie().remove('callback_url'); + window.location.href = callbackUrl; return; } navigate('/'); @@ -98,6 +98,8 @@ const CallBack = () => { export const loader = async (ctx: IRemixCtx) => { const { provider } = ctx.params; + const callbackUrl = getCookie(ctx).get('callback_url'); + const queries = getQueries(ctx); const { state, @@ -115,6 +117,7 @@ export const loader = async (ctx: IRemixCtx) => { query: queries, state: queryData?.state || state, provider, + callbackUrl, }; }; diff --git a/src/apps/auth/routes/_providers+/login.tsx b/src/apps/auth/routes/_providers+/login.tsx index 0644f86b3..957771c1e 100644 --- a/src/apps/auth/routes/_providers+/login.tsx +++ b/src/apps/auth/routes/_providers+/login.tsx @@ -6,12 +6,14 @@ import { GoogleLogo, } from '@jengaicons/react'; import { Link, useOutletContext, useSearchParams } from '@remix-run/react'; +import { useEffect } from 'react'; import { useAuthApi } from '~/auth/server/gql/api-provider'; import { Button } from '~/components/atoms/button'; import { PasswordInput, TextInput } from '~/components/atoms/input'; import { ArrowLeft, ArrowRight } from '~/components/icons'; import { toast } from '~/components/molecule/toast'; import { cn } from '~/components/utils'; +import { getCookie } from '~/root/lib/app-setup/cookies'; import { useReload } from '~/root/lib/client/helpers/reloader'; import useForm from '~/root/lib/client/hooks/use-form'; import Yup from '~/root/lib/server/helpers/yup'; @@ -117,17 +119,13 @@ const Login = () => { ? `/login?mode=email&callback=${callback}` : `/login?mode=email`; - const githubLoginHref = callback - ? `${githubLoginUrl}&callback=${callback}` - : githubLoginUrl; - - const gitlabLoginHref = callback - ? `${gitlabLoginUrl}&callback=${callback}` - : gitlabLoginUrl; - - const googleLoginHref = callback - ? `${googleLoginUrl}&callback=${callback}` - : googleLoginUrl; + useEffect(() => { + if (callback) { + getCookie().set('callback_url', callback, { + expires: new Date(Date.now() + 1000 * 60), + }); + } + }, [callback]); return ( { Continue with GitHub } prefix={} - // to={githubLoginUrl} - to={githubLoginHref} + to={githubLoginUrl} disabled={!githubLoginUrl} block linkComponent={Link} @@ -174,8 +171,7 @@ const Login = () => { Continue with GitLab } prefix={} - // to={gitlabLoginUrl} - to={gitlabLoginHref} + to={gitlabLoginUrl} disabled={!gitlabLoginUrl} block linkComponent={Link} @@ -187,8 +183,7 @@ const Login = () => { Continue with Google } prefix={} - // to={googleLoginUrl} - to={googleLoginHref} + to={googleLoginUrl} disabled={!googleLoginUrl} block linkComponent={Link} diff --git a/src/apps/console/routes/_main+/$account+/env+/$environment+/new-app/app-detail.tsx b/src/apps/console/routes/_main+/$account+/env+/$environment+/new-app/app-detail.tsx index ddf7365f9..602448c8a 100644 --- a/src/apps/console/routes/_main+/$account+/env+/$environment+/new-app/app-detail.tsx +++ b/src/apps/console/routes/_main+/$account+/env+/$environment+/new-app/app-detail.tsx @@ -58,12 +58,22 @@ const ExtraButton = ({ ); }; -const AppSelectItem = ({ label, value }: { label: string; value: string }) => { +const AppSelectItem = ({ + label, + value, + registry, + repository, +}: { + label: string; + value: string; + registry: string; + repository: string; +}) => { return (
{label}
-
{value}
+
{`${registry}/${repository}`}
); @@ -106,6 +116,8 @@ const AppDetail = () => { ), })); @@ -336,6 +348,7 @@ const AppDetail = () => { error={!!errors.imageUrl} message={errors.imageUrl} loading={imageLoaded} + createLabel="Select" /> {/* {values.imageMode === 'default' && ( diff --git a/src/apps/console/routes/_main+/$account+/settings+/images/handle-image-discovery.tsx b/src/apps/console/routes/_main+/$account+/settings+/images/handle-image-discovery.tsx new file mode 100644 index 000000000..62992487d --- /dev/null +++ b/src/apps/console/routes/_main+/$account+/settings+/images/handle-image-discovery.tsx @@ -0,0 +1,66 @@ +import { useParams } from '@remix-run/react'; +import { Button } from '~/components/atoms/button'; +import Popup from '~/components/molecule/popup'; +import CodeView from '~/console/components/code-view'; +import { LoadingPlaceHolder } from '~/console/components/loading'; +import { useConsoleApi } from '~/console/server/gql/api-provider'; +import { ensureAccountClientSide } from '~/console/server/utils/auth-utils'; +import useCustomSwr from '~/root/lib/client/hooks/use-custom-swr'; + +export const RegistryImageInstruction = ({ + show, + onClose, +}: { + show: boolean; + onClose: () => void; +}) => { + const params = useParams(); + ensureAccountClientSide(params); + const api = useConsoleApi(); + + const { data, isLoading, error } = useCustomSwr( + 'registry-image-instructions', + async () => { + return api.getRegistryImageUrl({ + image: '', + meta: {}, + }); + } + ); + + return ( + + Instructions to add image on registry + +
+ {error && ( + + Error while fetching instructions + + )} + {isLoading ? ( + + ) : ( + data && ( +
+ + Please follow below instruction for further steps + + + + {/* {data.url} */} +
+ ) + )} + +
+ +