Skip to content

Commit

Permalink
fix: Some issues
Browse files Browse the repository at this point in the history
  • Loading branch information
dogukanoksuz committed Aug 9, 2023
1 parent 92cc8d3 commit 89db708
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 9 deletions.
27 changes: 19 additions & 8 deletions src/components/navigation/sidebar-selected.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ export default function SidebarSelected() {
})
}

const elementIsActive = (server: IServer): boolean => {
return !server.is_online || !server.can_run_command
}

return (
<>
{selectedLoading ? (
Expand Down Expand Up @@ -129,32 +133,36 @@ export default function SidebarSelected() {
<ServerItem
link={`/servers/${selected}`}
exact={true}
disabled={!selectedData.is_online}
disabled={elementIsActive(selectedData)}
>
<TrendingUp className="mr-2 h-4 w-4" />
Sistem Durumu
</ServerItem>
<ServerItem link={`/servers/${selected}/extensions`} exact={true}>
<ServerItem
link={`/servers/${selected}/extensions`}
exact={true}
disabled={!selectedData.is_online}
>
<ToyBrick className="mr-2 h-4 w-4" />
Eklentiler
</ServerItem>
<ServerItem
link={`/servers/${selected}/services`}
disabled={!selectedData.is_online}
disabled={elementIsActive(selectedData)}
>
<ServerCog className="mr-2 h-4 w-4" />
Servisler
</ServerItem>
<ServerItem
link={`/servers/${selected}/packages`}
disabled={!selectedData.is_online}
disabled={elementIsActive(selectedData)}
>
<PackageOpen className="mr-2 h-4 w-4" />
Paketler
</ServerItem>
<ServerItem
link={`/servers/${selected}/updates`}
disabled={!selectedData.is_online}
disabled={elementIsActive(selectedData)}
>
<PackageSearch className="mr-2 h-4 w-4" />
Güncellemeler
Expand All @@ -178,20 +186,23 @@ export default function SidebarSelected() {
exact: true,
},
]}
disabled={!selectedData.is_online}
disabled={elementIsActive(selectedData)}
>
<Users className="mr-2 h-4 w-4" />
Kullanıcı İşlemleri
</DropdownServerItem>
</div>
<ServerItem
link={`/servers/${selected}/open_ports`}
disabled={!selectedData.is_online}
disabled={elementIsActive(selectedData)}
>
<Network className="mr-2 h-4 w-4" />
Açık Portlar
</ServerItem>
<ServerItem link={`/servers/${selected}/access_logs`}>
<ServerItem
link={`/servers/${selected}/access_logs`}
disabled={!selectedData.is_online}
>
<FileClock className="mr-2 h-4 w-4" />
Erişim Kayıtları
</ServerItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,28 @@ function ExtensionSettings({
)
}

if (input.type === "number") {
return (
<div className="space-y-1">
<Label htmlFor={input.variable}>
{input.name}{" "}
{input.required && <span className="text-red-500">*</span>}
</Label>
<Input
name={input.variable}
type={input.type}
id={input.variable}
key={input.variable}
value={values[input.variable]}
onChange={(e) =>
setValues({ ...values, [input.variable]: e.target.value })
}
required={input.required}
/>
</div>
)
}

if (input.type === "password") {
return (
<div className="space-y-1">
Expand Down
7 changes: 6 additions & 1 deletion src/types/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ export interface IExtensionSetting {
}
}

type IExtensionVariableTypes = "text" | "password" | "server" | "extension"
type IExtensionVariableTypes =
| "text"
| "password"
| "server"
| "extension"
| "number"

export interface IExtensionVariable {
variable: string
Expand Down
1 change: 1 addition & 0 deletions src/types/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface IServer {
extension_count: number
extensions: IExtension[]
is_favorite: boolean
can_run_command: boolean
}

export interface IMenu {
Expand Down

0 comments on commit 89db708

Please sign in to comment.