Skip to content

Commit

Permalink
Merge branch 'release-v1.0.5' into devdoc/ui
Browse files Browse the repository at this point in the history
  • Loading branch information
tulsiojha committed Jun 27, 2024
2 parents 82d4fb6 + c865039 commit eedc6f2
Show file tree
Hide file tree
Showing 22 changed files with 123 additions and 238 deletions.
8 changes: 4 additions & 4 deletions web/gql-queries-generator/doc/queries.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1924,10 +1924,6 @@ mutation consoleDeleteAccountMembership($accountName: String!, $memberId: ID!) {
accounts_removeAccountMembership(accountName: $accountName, memberId: $memberId)
}

mutation consoleVerifyInviteCode($invitationCode: String!) {
auth_verifyInviteCode(invitationCode: $invitationCode)
}

query consoleGetCredToken($username: String!) {
cr_getCredToken(username: $username)
}
Expand Down Expand Up @@ -6485,6 +6481,10 @@ mutation authVerifyEmail($token: String!) {
}
}

mutation authResendVerificationEmail {
auth_resendVerificationEmail
}

query authLoginPageInitUrls {
githubLoginUrl: oAuth_requestLogin(provider: "github")
gitlabLoginUrl: oAuth_requestLogin(provider: "gitlab")
Expand Down
30 changes: 15 additions & 15 deletions web/lib/app-setup/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,21 +197,21 @@ const Root = ({
}}
/>

<script
// @ts-ignore
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{
__html: `
try {
if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
document.querySelector('html').setAttribute('data-theme', 'dark')
} else {
document.querySelector('html').setAttribute('data-theme', 'light')
}
} catch (_) {}
`,
}}
/>
{/* <script */}
{/* // @ts-ignore */}
{/* // eslint-disable-next-line react/no-danger */}
{/* dangerouslySetInnerHTML={{ */}
{/* __html: ` */}
{/* try { */}
{/* if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) { */}
{/* document.querySelector('html').setAttribute('data-theme', 'dark') */}
{/* } else { */}
{/* document.querySelector('html').setAttribute('data-theme', 'light') */}
{/* } */}
{/* } catch (_) {} */}
{/* `, */}
{/* }} */}
{/* /> */}
</head>
<body className="antialiased">
<div
Expand Down
4 changes: 0 additions & 4 deletions web/lib/server/helpers/minimal-auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ export const minimalAuth = async (ctx: IExtRemixCtx) => {
return redirect(`${authBaseUrl}/verify-email`);
}

if (whoAmI.data && !whoAmI.data.approved) {
return redirect(`${consoleBaseUrl}/invite-code`);
}

ctx.authProps = (props: MapType) => {
return {
...props,
Expand Down
2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@jengaicons/react": "1.6.0",
"@mdx-js/react": "^2.3.0",
"@monaco-editor/react": "^4.6.0",
"@oshq/react-select": "^1.4.2",
"@oshq/react-select": "^1.4.4",
"@radix-ui/primitive": "^1.0.1",
"@radix-ui/react-alert-dialog": "1.0.4",
"@radix-ui/react-checkbox": "^1.0.4",
Expand Down
8 changes: 4 additions & 4 deletions web/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion web/src/apps/auth/components/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const Footer = () => {
<div className="hidden md:block lg:hidden">
<SocialMenu />
</div>
<ThemeSwitcher />
{/* <ThemeSwitcher /> */}
</div>
</div>
<div className="flex flex-col-reverse gap-4xl md:gap-0 md:flex-row md:items-center lg:justify-between">
Expand Down
13 changes: 1 addition & 12 deletions web/src/apps/auth/routes/_main+/cli-logged-in.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
import { Link } from '@remix-run/react';
import Container from '~/auth/components/container';
import { Button } from '~/components/atoms/button';
import { getCookie } from '~/root/lib/app-setup/cookies';
import withContext from '~/root/lib/app-setup/with-contxt';
import { IExtRemixCtx } from '~/root/lib/types/common';

const cliLoggedIn = () => {
return (
<Container
headerExtra={
<Button
variant="outline"
content="Sign in"
linkComponent={Link}
to="/login"
/>
}
>
<Container>
<div className="flex flex-col gap-6xl md:w-[500px] px-3xl py-5xl md:px-9xl">
<div className="flex flex-col gap-lg items-center text-center">
<div className="text-text-strong headingXl text-center">
Expand Down
8 changes: 4 additions & 4 deletions web/src/apps/auth/routes/_main+/verify-email.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useAPIClient } from '~/root/lib/client/hooks/api-provider';
import usePersistState from '~/root/lib/client/hooks/use-persist-state';
import { useEffect, useState } from 'react';
import { GQLServerHandler } from '~/auth/server/gql/saved-queries';
Expand All @@ -14,20 +13,21 @@ import { IRemixCtx } from '~/root/lib/types/common';
import { ArrowLeft } from '~/components/icons';
import { cn } from '~/components/utils';
import Container from '~/auth/components/container';
import { useAuthApi } from '~/auth/server/gql/api-provider';

const VerifyEmail = () => {
const { query, email } = useLoaderData();
const navigate = useNavigate();
const { token } = query;
const api = useAPIClient();
const api = useAuthApi();

const [rateLimiter, setRateLimiter] = usePersistState('rateLimiter', {});

useEffect(() => {
(async () => {
try {
if (!token) return;
const { _, errors } = await api.verifyEmail({
const { errors } = await api.verifyEmail({
token,
});
if (errors) {
Expand Down Expand Up @@ -68,7 +68,7 @@ const VerifyEmail = () => {

setSending(true);

const { errors } = await api.resendVerificationEmail({ email });
const { errors } = await api.resendVerificationEmail();

setSending(false);

Expand Down
15 changes: 15 additions & 0 deletions web/src/apps/auth/server/gql/saved-queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import {
AuthCheckOauthEnabledQueryVariables,
AuthSetRemoteAuthHeaderMutation,
AuthSetRemoteAuthHeaderMutationVariables,
AuthResendVerificationEmailMutation,
AuthResendVerificationEmailMutationVariables,
} from '~/root/src/generated/gql/server';
import { cliQueries } from './cli-queries';

Expand Down Expand Up @@ -138,6 +140,19 @@ export const GQLServerHandler = ({ headers, cookies }: IGQLServerProps) => {
}
),

resendVerificationEmail: executor(
gql`
mutation Mutation {
auth_resendVerificationEmail
}
`,
{
transformer: (data: AuthResendVerificationEmailMutation) =>
data.auth_resendVerificationEmail,
vars(_: AuthResendVerificationEmailMutationVariables) {},
}
),

loginPageInitUrls: executor(
gql`
query Query {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {
BackingServices,
// BackingServices,
CirclesFour,
GearSix,
// Plus,
Expand Down Expand Up @@ -103,16 +103,16 @@ const tabs = [
to: '/cs/configs',
value: '/cs',
},
{
label: (
<span className="flex flex-row items-center gap-lg">
<BackingServices size={tabIconSize} />
Managed resources
</span>
),
to: '/managed-resources',
value: '/managed-resources',
},
// {
// label: (
// <span className="flex flex-row items-center gap-lg">
// <BackingServices size={tabIconSize} />
// Managed resources
// </span>
// ),
// to: '/managed-resources',
// value: '/managed-resources',
// },
// {
// label: 'Jobs & Crons',
// to: '/jc/task',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Popup from '~/components/molecule/popup';
import { IDialog, IModifiedItem } from '~/console/components/types.d';
import { ConsoleApiType } from '~/console/server/gql/saved-queries';
import { parseName } from '~/console/server/r-utils/common';
import { constants } from '~/console/server/utils/constants';
import useForm from '~/lib/client/hooks/use-form';
import Yup from '~/lib/server/helpers/yup';
import { handleError } from '~/lib/utils/common';
Expand Down Expand Up @@ -75,6 +76,7 @@ const Handle = ({
validationSchema: Yup.object({
key: Yup.string()
.required()
.matches(constants.keyFormatRegex, 'Invalid key format')
.test('is-valid', 'Key already exists.', (value) => {
if (isUpdate) {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ const HandleConfig = ({ show, setShow }: IDialog) => {
name: Yup.string().required(),
}),
onSubmit: async (val) => {
if ( !environment) {
if (!environment) {
throw new Error('Project and Environment is required!.');
}
try {
const { errors: e } = await api.createConfig({
envName: environment,

config: {
metadata: {
name: val.name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ const ExposedRoute = () => {
// error={!!portError}
// message={portError}
disableWhileLoading
createLabel="Exposed Domains"
/>
</div>
);
Expand Down Expand Up @@ -219,6 +220,7 @@ export const ExposedPorts = () => {
error={!!portError}
message={portError}
disableWhileLoading
createLabel="Exposed ports"
/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Popup from '~/components/molecule/popup';
import { IDialog, IModifiedItem } from '~/console/components/types.d';
import { ConsoleApiType } from '~/console/server/gql/saved-queries';
import { parseName } from '~/console/server/r-utils/common';
import { constants } from '~/console/server/utils/constants';
import useForm from '~/lib/client/hooks/use-form';
import Yup from '~/lib/server/helpers/yup';
import { handleError } from '~/lib/utils/common';
Expand Down Expand Up @@ -72,6 +73,7 @@ const Handle = ({
validationSchema: Yup.object({
key: Yup.string()
.required()
.matches(constants.keyFormatRegex, 'Invalid key format')
.test('is-valid', 'Key already exists.', (value) => {
if (isUpdate) {
return true;
Expand Down
8 changes: 1 addition & 7 deletions web/src/apps/console/routes/_main+/_index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import { redirect } from '@remix-run/node';
import { GQLServerHandler } from '~/root/lib/server/gql/saved-queries';
import { IRemixCtx } from '~/root/lib/types/common';

export const loader = async (ctx: IRemixCtx) => {
const { data } = await GQLServerHandler(ctx.request).whoAmI();
if (data && !data.approved) {
return redirect(`/invite-code`);
}
export const loader = async () => {
return redirect('/teams');
};
22 changes: 11 additions & 11 deletions web/src/apps/console/routes/_main+/_layout/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import {
InfraAsCode,
GearSix,
Project,
BackingServices,
// BackingServices,
BellFill,
Sliders,
} from '~/console/components/icons';
Expand Down Expand Up @@ -86,16 +86,16 @@ const AccountTabs = () => {
to: '/environments',
value: '/environments',
},
{
label: (
<span className="flex flex-row items-center gap-lg">
<BackingServices size={iconSize} />
Managed Services
</span>
),
to: '/managed-services',
value: '/managed-services',
},
// {
// label: (
// <span className="flex flex-row items-center gap-lg">
// <BackingServices size={iconSize} />
// Managed Services
// </span>
// ),
// to: '/managed-services',
// value: '/managed-services',
// },
{
label: (
<span className="flex flex-row items-center gap-lg">
Expand Down
Loading

0 comments on commit eedc6f2

Please sign in to comment.