Some checks failed
CodeQL / Analyze (javascript) (push) Failing after 16s
CodeQL / Analyze (python) (push) Failing after 3s
i18n sync check / check:sync (push) Failing after 3s
React Doctor / react-doctor (push) Failing after 16s
Branch Build CE / Build-Push Admin Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge Admin Manifest (push) Has been cancelled
Branch Build CE / Build-Push Web Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge Web Manifest (push) Has been cancelled
Branch Build CE / Build-Push Space Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge Proxy Manifest (push) Has been cancelled
Branch Build CE / Merge Space Manifest (push) Has been cancelled
Branch Build CE / Prepare AIO Assets (push) Has been cancelled
Branch Build CE / Build Setup (push) Has been cancelled
Branch Build CE / Build-Push Live Collaboration Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge Live Collaboration Manifest (push) Has been cancelled
Branch Build CE / Build-Push API Server Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge API Server Manifest (push) Has been cancelled
Branch Build CE / Build-Push Proxy Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Build-Push AIO Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge AIO Manifest (push) Has been cancelled
Branch Build CE / Upload Build Assets (push) Has been cancelled
Branch Build CE / Build Release (push) Has been cancelled
67 lines
2.1 KiB
TypeScript
67 lines
2.1 KiB
TypeScript
/**
|
|
* Copyright (c) 2023-present Plane Software, Inc. and contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
* See the LICENSE file for details.
|
|
*/
|
|
|
|
import { observer } from "mobx-react";
|
|
import Link from "next/link";
|
|
// icons
|
|
import { SettingsOutline } from "@makeplane/propel/icons";
|
|
// plane internal packages
|
|
import { AnchorButton } from "@makeplane/propel/components/anchor-button";
|
|
import { Button } from "@makeplane/propel/components/button";
|
|
import { Switch } from "@makeplane/propel/components/switch";
|
|
import type { TInstanceAuthenticationMethodKeys } from "@plane/types";
|
|
// hooks
|
|
import { useInstance } from "@/hooks/store";
|
|
|
|
type Props = {
|
|
disabled: boolean;
|
|
updateConfig: (key: TInstanceAuthenticationMethodKeys, value: string) => void;
|
|
};
|
|
|
|
export const GitlabConfiguration = observer(function GitlabConfiguration(props: Props) {
|
|
const { disabled, updateConfig } = props;
|
|
// store
|
|
const { formattedConfig } = useInstance();
|
|
// derived values
|
|
const enableGitlabConfig = formattedConfig?.IS_GITLAB_ENABLED ?? "";
|
|
const isGitlabConfigured = !!formattedConfig?.GITLAB_CLIENT_ID && !!formattedConfig?.GITLAB_CLIENT_SECRET;
|
|
|
|
return (
|
|
<>
|
|
{isGitlabConfigured ? (
|
|
<div className="flex items-center gap-4">
|
|
<AnchorButton
|
|
variant="primary"
|
|
size="sm"
|
|
nativeButton={false}
|
|
render={<Link href="/authentication/gitlab" />}
|
|
label="Edit"
|
|
/>
|
|
<Switch
|
|
checked={Boolean(parseInt(enableGitlabConfig))}
|
|
onCheckedChange={() => {
|
|
const newEnableGitlabConfig = Boolean(parseInt(enableGitlabConfig)) === true ? "0" : "1";
|
|
updateConfig("IS_GITLAB_ENABLED", newEnableGitlabConfig);
|
|
}}
|
|
size="sm"
|
|
disabled={disabled}
|
|
/>
|
|
</div>
|
|
) : (
|
|
<Button
|
|
variant="secondary"
|
|
size="sm"
|
|
stretch="auto"
|
|
nativeButton={false}
|
|
render={<Link href="/authentication/gitlab" />}
|
|
icon={<SettingsOutline className="h-4 w-4 p-0.5 text-tertiary" />}
|
|
label="Configure"
|
|
/>
|
|
)}
|
|
</>
|
|
);
|
|
});
|