Skip to content

Commit

Permalink
fix: Extension page license support
Browse files Browse the repository at this point in the history
  • Loading branch information
dogukanoksuz committed Feb 22, 2024
1 parent a4c5173 commit 35fab11
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/components/settings/extension-actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu"

import { SelectServer } from "../selectbox/server-select"
import {
Dialog,
DialogContent,
Expand Down Expand Up @@ -130,14 +131,18 @@ function License({
const { toast } = useToast()
const [loading, setLoading] = useState(false)
const [data, setData] = useState<string>("")
const [server, setServer] = useState<string>("")
const { t } = useTranslation("settings")

const handleCreate = () => {
setLoading(true)

apiService
.getInstance()
.post(`/settings/extensions/${extension.id}/license`, { license: data })
.post(`/settings/extensions/${extension.id}/license`, {
license: data,
server_id: server,
})
.then(() => {
toast({
title: t("success"),
Expand Down Expand Up @@ -168,6 +173,12 @@ function License({
</DialogDescription>
</DialogHeader>

{extension.license_type === "golang_standard" && (
<SelectServer
defaultValue=""
onValueChange={(value) => setServer(value)}
/>
)}
<div className="mt-3 grid w-full items-center gap-1.5">
<Label htmlFor="license">
{t("extensions.actions.license.form.license")}
Expand Down
1 change: 1 addition & 0 deletions src/types/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export interface IExtension {
menus: IMenu[]
updated: number
licensed: boolean
license_type: "golang_standard" | "php"
}

export interface IExtensionSetting {
Expand Down

0 comments on commit 35fab11

Please sign in to comment.