[WEB-1404] chore: admin app improvements (#4580)

* [WEB-1404] fix: redirection to web app and issue with telemetry checkbox in setup form.

* chore: add scrollbar in admin app.

* chore: fix `workspaces_exist` logic in instance api.
This commit is contained in:
Prateek Shourya 2024-05-24 16:59:49 +05:30 committed by GitHub
parent 7a47ce9d1d
commit 724f227842
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 86 additions and 40 deletions

View File

@ -64,8 +64,8 @@ const InstanceGithubAuthenticationPage = observer(() => {
return ( return (
<> <>
<PageHeader title="Authentication - God Mode" /> <PageHeader title="Authentication - God Mode" />
<div className="relative container mx-auto w-full h-full p-8 py-4 space-y-6 flex flex-col"> <div className="relative container mx-auto w-full h-full p-4 py-4 space-y-6 flex flex-col">
<div className="border-b border-custom-border-100 pb-3 space-y-1 flex-shrink-0"> <div className="border-b border-custom-border-100 mx-4 py-4 space-y-1 flex-shrink-0">
<AuthenticationMethodCard <AuthenticationMethodCard
name="Github" name="Github"
description="Allow members to login or sign up to plane with their Github accounts." description="Allow members to login or sign up to plane with their Github accounts."
@ -93,7 +93,7 @@ const InstanceGithubAuthenticationPage = observer(() => {
withBorder={false} withBorder={false}
/> />
</div> </div>
<div className="flex-grow overflow-hidden overflow-y-auto"> <div className="flex-grow overflow-hidden overflow-y-scroll vertical-scrollbar scrollbar-md p-4">
{formattedConfig ? ( {formattedConfig ? (
<InstanceGithubConfigForm config={formattedConfig} /> <InstanceGithubConfigForm config={formattedConfig} />
) : ( ) : (

View File

@ -58,8 +58,8 @@ const InstanceGoogleAuthenticationPage = observer(() => {
return ( return (
<> <>
<PageHeader title="Authentication - God Mode" /> <PageHeader title="Authentication - God Mode" />
<div className="relative container mx-auto w-full h-full p-8 py-4 space-y-6 flex flex-col"> <div className="relative container mx-auto w-full h-full p-4 py-4 space-y-6 flex flex-col">
<div className="border-b border-custom-border-100 pb-3 space-y-1 flex-shrink-0"> <div className="border-b border-custom-border-100 mx-4 py-4 space-y-1 flex-shrink-0">
<AuthenticationMethodCard <AuthenticationMethodCard
name="Google" name="Google"
description="Allow members to login or sign up to plane with their Google description="Allow members to login or sign up to plane with their Google
@ -81,7 +81,7 @@ const InstanceGoogleAuthenticationPage = observer(() => {
withBorder={false} withBorder={false}
/> />
</div> </div>
<div className="flex-grow overflow-hidden overflow-y-auto"> <div className="flex-grow overflow-hidden overflow-y-scroll vertical-scrollbar scrollbar-md p-4">
{formattedConfig ? ( {formattedConfig ? (
<InstanceGoogleConfigForm config={formattedConfig} /> <InstanceGoogleConfigForm config={formattedConfig} />
) : ( ) : (

View File

@ -332,42 +332,90 @@ body {
} }
/* scrollbar style */ /* scrollbar style */
::-webkit-scrollbar { @-moz-document url-prefix() {
display: none; * {
scrollbar-width: none;
}
.vertical-scrollbar,
.horizontal-scrollbar {
scrollbar-width: initial;
scrollbar-color: rgba(96, 100, 108, 0.1) transparent;
}
.vertical-scrollbar:hover,
.horizontal-scrollbar:hover {
scrollbar-color: rgba(96, 100, 108, 0.25) transparent;
}
.vertical-scrollbar:active,
.horizontal-scrollbar:active {
scrollbar-color: rgba(96, 100, 108, 0.7) transparent;
}
} }
.horizontal-scroll-enable { .vertical-scrollbar {
overflow-x: scroll; overflow-y: auto;
} }
.horizontal-scrollbar {
.horizontal-scroll-enable::-webkit-scrollbar { overflow-x: auto;
}
.vertical-scrollbar::-webkit-scrollbar,
.horizontal-scrollbar::-webkit-scrollbar {
display: block; display: block;
height: 7px; }
width: 0; .vertical-scrollbar::-webkit-scrollbar-track,
.horizontal-scrollbar::-webkit-scrollbar-track {
background-color: transparent;
border-radius: 9999px;
}
.vertical-scrollbar::-webkit-scrollbar-thumb,
.horizontal-scrollbar::-webkit-scrollbar-thumb {
background-clip: padding-box;
background-color: rgba(96, 100, 108, 0.1);
border-radius: 9999px;
}
.vertical-scrollbar:hover::-webkit-scrollbar-thumb,
.horizontal-scrollbar:hover::-webkit-scrollbar-thumb {
background-color: rgba(96, 100, 108, 0.25);
}
.vertical-scrollbar::-webkit-scrollbar-thumb:hover,
.horizontal-scrollbar::-webkit-scrollbar-thumb:hover {
background-color: rgba(96, 100, 108, 0.5);
}
.vertical-scrollbar::-webkit-scrollbar-thumb:active,
.horizontal-scrollbar::-webkit-scrollbar-thumb:active {
background-color: rgba(96, 100, 108, 0.7);
}
.vertical-scrollbar::-webkit-scrollbar-corner,
.horizontal-scrollbar::-webkit-scrollbar-corner {
background-color: transparent;
}
.vertical-scrollbar-margin-top-md::-webkit-scrollbar-track {
margin-top: 44px;
} }
.horizontal-scroll-enable::-webkit-scrollbar-track { /* scrollbar sm size */
height: 7px; .scrollbar-sm::-webkit-scrollbar {
background-color: rgba(var(--color-background-100)); height: 12px;
width: 12px;
} }
.scrollbar-sm::-webkit-scrollbar-thumb {
.horizontal-scroll-enable::-webkit-scrollbar-thumb { border: 3px solid rgba(0, 0, 0, 0);
border-radius: 5px;
background-color: rgba(var(--color-scrollbar));
} }
/* scrollbar md size */
.vertical-scroll-enable::-webkit-scrollbar { .scrollbar-md::-webkit-scrollbar {
display: block; height: 14px;
width: 5px; width: 14px;
} }
.scrollbar-md::-webkit-scrollbar-thumb {
.vertical-scroll-enable::-webkit-scrollbar-track { border: 3px solid rgba(0, 0, 0, 0);
width: 5px;
} }
/* scrollbar lg size */
.vertical-scroll-enable::-webkit-scrollbar-thumb { .scrollbar-lg::-webkit-scrollbar {
border-radius: 5px; height: 16px;
background-color: rgba(var(--color-background-90)); width: 16px;
}
.scrollbar-lg::-webkit-scrollbar-thumb {
border: 4px solid rgba(0, 0, 0, 0);
} }
/* end scrollbar style */ /* end scrollbar style */

View File

@ -38,7 +38,7 @@ export const HelpSection: FC = observer(() => {
// refs // refs
const helpOptionsRef = useRef<HTMLDivElement | null>(null); const helpOptionsRef = useRef<HTMLDivElement | null>(null);
const redirectionLink = encodeURI(WEB_BASE_URL + "/create-workspace"); const redirectionLink = encodeURI(WEB_BASE_URL + "/");
return ( return (
<div <div

View File

@ -56,7 +56,7 @@ export const SidebarMenu = observer(() => {
}; };
return ( return (
<div className="flex h-full w-full flex-col gap-2.5 overflow-y-auto px-4 py-4"> <div className="flex h-full w-full flex-col gap-2.5 overflow-y-scroll vertical-scrollbar scrollbar-sm px-4 py-4">
{INSTANCE_ADMIN_LINKS.map((item, index) => { {INSTANCE_ADMIN_LINKS.map((item, index) => {
const isActive = item.href === pathName || pathName.includes(item.href); const isActive = item.href === pathName || pathName.includes(item.href);
return ( return (

View File

@ -158,6 +158,7 @@ export const InstanceSetupForm: FC = (props) => {
onError={() => setIsSubmitting(false)} onError={() => setIsSubmitting(false)}
> >
<input type="hidden" name="csrfmiddlewaretoken" value={csrfToken} /> <input type="hidden" name="csrfmiddlewaretoken" value={csrfToken} />
<input type="hidden" name="is_telemetry_enabled" value={formData.is_telemetry_enabled ? "True" : "False"} />
<div className="flex flex-col sm:flex-row items-center gap-4"> <div className="flex flex-col sm:flex-row items-center gap-4">
<div className="w-full space-y-1"> <div className="w-full space-y-1">
@ -319,8 +320,6 @@ export const InstanceSetupForm: FC = (props) => {
<div> <div>
<Checkbox <Checkbox
id="is_telemetry_enabled" id="is_telemetry_enabled"
name="is_telemetry_enabled"
value={formData.is_telemetry_enabled ? "True" : "False"}
onChange={() => handleFormChange("is_telemetry_enabled", !formData.is_telemetry_enabled)} onChange={() => handleFormChange("is_telemetry_enabled", !formData.is_telemetry_enabled)}
checked={formData.is_telemetry_enabled} checked={formData.is_telemetry_enabled}
/> />

View File

@ -7,9 +7,9 @@ import { useTheme as nextUseTheme } from "next-themes";
// ui // ui
import { Button, getButtonStyling } from "@plane/ui"; import { Button, getButtonStyling } from "@plane/ui";
// helpers // helpers
import { resolveGeneralTheme } from "helpers/common.helper"; import { WEB_BASE_URL, resolveGeneralTheme } from "helpers/common.helper";
// hooks // hooks
import { useInstance, useTheme } from "@/hooks/store"; import { useTheme } from "@/hooks/store";
// icons // icons
import TakeoffIconLight from "/public/logos/takeoff-icon-light.svg"; import TakeoffIconLight from "/public/logos/takeoff-icon-light.svg";
import TakeoffIconDark from "/public/logos/takeoff-icon-dark.svg"; import TakeoffIconDark from "/public/logos/takeoff-icon-dark.svg";
@ -17,11 +17,10 @@ import TakeoffIconDark from "/public/logos/takeoff-icon-dark.svg";
export const NewUserPopup: React.FC = observer(() => { export const NewUserPopup: React.FC = observer(() => {
// hooks // hooks
const { isNewUserPopup, toggleNewUserPopup } = useTheme(); const { isNewUserPopup, toggleNewUserPopup } = useTheme();
const { config } = useInstance();
// theme // theme
const { resolvedTheme } = nextUseTheme(); const { resolvedTheme } = nextUseTheme();
const redirectionLink = `${config?.app_base_url ? `${config?.app_base_url}/create-workspace` : `/god-mode/`}`; const redirectionLink = encodeURI(WEB_BASE_URL + "/create-workspace");
if (!isNewUserPopup) return <></>; if (!isNewUserPopup) return <></>;
return ( return (

View File

@ -148,7 +148,7 @@ class InstanceEndpoint(BaseAPIView):
data["app_base_url"] = settings.APP_BASE_URL data["app_base_url"] = settings.APP_BASE_URL
instance_data = serializer.data instance_data = serializer.data
instance_data["workspaces_exist"] = Workspace.objects.count() > 1 instance_data["workspaces_exist"] = Workspace.objects.count() >= 1
response_data = {"config": data, "instance": instance_data} response_data = {"config": data, "instance": instance_data}
return Response(response_data, status=status.HTTP_200_OK) return Response(response_data, status=status.HTTP_200_OK)