From 2d04917951abbaa4019ac467060485c98ed04e4b Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Date: Mon, 27 Nov 2023 17:15:11 +0530 Subject: [PATCH] chore: instance admins endpoint added and ui/ux improvement (#2895) * style: sidebar improvement * style: header height consistency * chore: layout consistency and general page improvement * chore: layout, email form and image form improvement * chore: instance admins endpoint intergrated and code refactor * chore: code refactor * chore: google client secret section removed --- web/components/instance/email-form.tsx | 65 ++++++++++++------- web/components/instance/general-form.tsx | 29 +++++---- .../instance/google-config-form.tsx | 31 --------- web/components/instance/image-config-form.tsx | 2 +- web/components/instance/sidebar-dropdown.tsx | 10 +-- web/components/instance/sidebar-menu.tsx | 10 +-- web/layouts/admin-layout/header.tsx | 2 +- web/layouts/admin-layout/layout.tsx | 2 +- web/pages/god-mode/ai.tsx | 2 +- web/pages/god-mode/authorization.tsx | 2 +- web/pages/god-mode/image.tsx | 2 +- web/pages/god-mode/index.tsx | 9 +-- web/pages/god-mode/{email.tsx => mail.tsx} | 8 +-- web/services/instance.service.ts | 35 ++++++---- web/store/instance/instance.store.ts | 23 ++++++- web/types/instance.d.ts | 17 +++-- 16 files changed, 140 insertions(+), 109 deletions(-) rename web/pages/god-mode/{email.tsx => mail.tsx} (87%) diff --git a/web/components/instance/email-form.tsx b/web/components/instance/email-form.tsx index 870512106..794592ba1 100644 --- a/web/components/instance/email-form.tsx +++ b/web/components/instance/email-form.tsx @@ -1,7 +1,8 @@ -import { FC } from "react"; +import { FC, useState } from "react"; import { Controller, useForm } from "react-hook-form"; // ui import { Button, Input, ToggleSwitch } from "@plane/ui"; +import { Eye, EyeOff } from "lucide-react"; // types import { IFormattedInstanceConfiguration } from "types/instance"; // hooks @@ -24,6 +25,7 @@ export interface EmailFormValues { export const InstanceEmailForm: FC = (props) => { const { config } = props; + const [showPassword, setShowPassword] = useState(false); // store const { instance: instanceStore } = useMobxStore(); // toast @@ -62,7 +64,7 @@ export const InstanceEmailForm: FC = (props) => { return ( <> -
+

Host

= (props) => { />
-
+

Username

= (props) => {

Password

- ( - +
+ ( + + )} + /> + {showPassword ? ( + + ) : ( + )} - /> +
-
-
+
+
Turn TLS {Boolean(parseInt(watch("EMAIL_USE_TLS"))) ? "off" : "on"} @@ -174,7 +193,7 @@ export const InstanceEmailForm: FC = (props) => {
-
+
Turn SSL {Boolean(parseInt(watch("EMAIL_USE_SSL"))) ? "off" : "on"} @@ -201,7 +220,7 @@ export const InstanceEmailForm: FC = (props) => {
-
+
diff --git a/web/components/instance/general-form.tsx b/web/components/instance/general-form.tsx index d8b533f73..9ee7c2f64 100644 --- a/web/components/instance/general-form.tsx +++ b/web/components/instance/general-form.tsx @@ -3,22 +3,23 @@ import { Controller, useForm } from "react-hook-form"; // ui import { Button, Input, ToggleSwitch } from "@plane/ui"; // types -import { IInstance } from "types/instance"; +import { IInstance, IInstanceAdmin } from "types/instance"; // hooks import useToast from "hooks/use-toast"; import { useMobxStore } from "lib/mobx/store-provider"; export interface IInstanceGeneralForm { instance: IInstance; + instanceAdmins: IInstanceAdmin[]; } export interface GeneralFormValues { instance_name: string; - // is_telemetry_enabled: boolean; + is_telemetry_enabled: boolean; } export const InstanceGeneralForm: FC = (props) => { - const { instance } = props; + const { instance, instanceAdmins } = props; // store const { instance: instanceStore } = useMobxStore(); // toast @@ -31,7 +32,7 @@ export const InstanceGeneralForm: FC = (props) => { } = useForm({ defaultValues: { instance_name: instance.instance_name, - // is_telemetry_enabled: instance.is_telemetry_enabled, + is_telemetry_enabled: instance.is_telemetry_enabled, }, }); @@ -52,7 +53,7 @@ export const InstanceGeneralForm: FC = (props) => { return ( <> -
+

Name of instance

= (props) => {
-

Admin Email

+

Admin email

-

Instance Id

+

Instance ID

= (props) => {
- {/*
+
Share anonymous usage instance
@@ -114,10 +115,10 @@ export const InstanceGeneralForm: FC = (props) => { render={({ field: { value, onChange } }) => } />
-
*/} +
-
diff --git a/web/components/instance/google-config-form.tsx b/web/components/instance/google-config-form.tsx index 5637b76fc..0e0f80316 100644 --- a/web/components/instance/google-config-form.tsx +++ b/web/components/instance/google-config-form.tsx @@ -89,37 +89,6 @@ export const InstanceGoogleConfigForm: FC = (props) =

-
-

Client Secret

- ( - - )} - /> -

- Your client secret should also be in your Google API Console.{" "} - - Learn more - -

-

Origin URL