diff --git a/VERSION b/VERSION index bcce8b7..872d3b2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.1.103 +1.1.104 diff --git a/cmd/edgeguard-api/main.go b/cmd/edgeguard-api/main.go index e80df40..f908fc5 100644 --- a/cmd/edgeguard-api/main.go +++ b/cmd/edgeguard-api/main.go @@ -60,7 +60,7 @@ import ( usersvc "git.netcell-it.de/projekte/edgeguard-native/internal/services/users" ) -var version = "1.1.103" +var version = "1.1.104" func main() { addr := os.Getenv("EDGEGUARD_API_ADDR") diff --git a/cmd/edgeguard-ctl/main.go b/cmd/edgeguard-ctl/main.go index fec8c1a..ba5e0f9 100644 --- a/cmd/edgeguard-ctl/main.go +++ b/cmd/edgeguard-ctl/main.go @@ -11,7 +11,7 @@ import ( "git.netcell-it.de/projekte/edgeguard-native/internal/services/setup" ) -var version = "1.1.103" +var version = "1.1.104" const usage = `edgeguard-ctl — EdgeGuard CLI diff --git a/cmd/edgeguard-scheduler/main.go b/cmd/edgeguard-scheduler/main.go index c6b5d24..ad62666 100644 --- a/cmd/edgeguard-scheduler/main.go +++ b/cmd/edgeguard-scheduler/main.go @@ -35,7 +35,7 @@ import ( "git.netcell-it.de/projekte/edgeguard-native/internal/services/tlscerts" ) -var version = "1.1.103" +var version = "1.1.104" const ( // renewTickInterval — how often we re-evaluate expiring certs. diff --git a/management-ui/src/pages/ForwardProxy/index.tsx b/management-ui/src/pages/ForwardProxy/index.tsx index df848d9..842f822 100644 --- a/management-ui/src/pages/ForwardProxy/index.tsx +++ b/management-ui/src/pages/ForwardProxy/index.tsx @@ -1,9 +1,9 @@ -import { useState } from 'react' +import { useMemo, useState } from 'react' import { Alert, Button, Form, Input, InputNumber, Modal, Select, Space, Switch, Tag, Tooltip, Typography, message, } from 'antd' import type { ColumnsType } from 'antd/es/table' -import { CheckCircleOutlined, CloseCircleOutlined, CloudServerOutlined, PlusOutlined } from '@ant-design/icons' +import { ArrowDownOutlined, ArrowUpOutlined, CheckCircleOutlined, CloseCircleOutlined, CloudServerOutlined, PlusOutlined } from '@ant-design/icons' import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query' import { useTranslation } from 'react-i18next' @@ -97,6 +97,20 @@ export default function ForwardProxyPage() { onError: (e: Error) => message.error(e.message), }) + const sortedACLs = useMemo( + () => [...(data ?? [])].sort((a, b) => a.priority - b.priority), + [data], + ) + const swapACLs = useMutation({ + mutationFn: async ({ a, b }: { a: ACL; b: ACL }) => { + const stripMeta = ({ id: _id, created_at: _ca, updated_at: _ua, ...r }: ACL) => r + await apiClient.put(`/forward-proxy/acls/${a.id}`, { ...stripMeta(a), priority: b.priority }) + await apiClient.put(`/forward-proxy/acls/${b.id}`, { ...stripMeta(b), priority: a.priority }) + }, + onSuccess: () => { void qc.invalidateQueries({ queryKey: ['fwd-proxy', 'acls'] }) }, + onError: (e: Error) => message.error(e.message), + }) + const cols: ColumnsType = [ { title: t('fwd.priority'), dataIndex: 'priority', key: 'priority', width: 90 }, { title: t('fwd.name'), dataIndex: 'name', key: 'name', render: (s: string) => {s} }, @@ -120,6 +134,27 @@ export default function ForwardProxyPage() { /> ), }, + { + title: '', key: 'move', width: 64, + render: (_, row) => { + const idx = sortedACLs.findIndex(r => r.id === row.id) + const swapping = swapACLs.isPending + return ( + + +