Skip to content

Commit

Permalink
Merge pull request #234 from kloudlite/update/ui-changes
Browse files Browse the repository at this point in the history
Update/UI changes
  • Loading branch information
tulsiojha authored Jun 27, 2024
2 parents 3e571ef + ce70028 commit 680d8c7
Show file tree
Hide file tree
Showing 29 changed files with 172 additions and 223 deletions.
8 changes: 4 additions & 4 deletions 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
4 changes: 0 additions & 4 deletions 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 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 pnpm-lock.yaml

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

8 changes: 4 additions & 4 deletions 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 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 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 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
91 changes: 0 additions & 91 deletions src/apps/console/routes/invite-code.tsx

This file was deleted.

15 changes: 0 additions & 15 deletions src/apps/console/server/gql/queries/access-queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import {
ConsoleRejectInvitationMutationVariables,
ConsoleDeleteAccountMembershipMutation,
ConsoleDeleteAccountMembershipMutationVariables,
ConsoleVerifyInviteCodeMutation,
ConsoleVerifyInviteCodeMutationVariables,
} from '~/root/src/generated/gql/server';

export type IInvites = NN<
Expand Down Expand Up @@ -210,17 +208,4 @@ export const accessQueries = (executor: IExecutor) => ({
vars(_: ConsoleDeleteAccountMembershipMutationVariables) {},
}
),

verifyInviteCode: executor(
gql`
mutation Auth_verifyInviteCode($invitationCode: String!) {
auth_verifyInviteCode(invitationCode: $invitationCode)
}
`,
{
transformer: (data: ConsoleVerifyInviteCodeMutation) =>
data.auth_verifyInviteCode,
vars(_: ConsoleVerifyInviteCodeMutationVariables) {},
}
),
});
Loading

0 comments on commit 680d8c7

Please sign in to comment.