Compare commits

...

4 commits

25 changed files with 2840 additions and 3425 deletions

35
.zed/settings.json Normal file
View file

@ -0,0 +1,35 @@
// Folder-specific settings
//
// For a full list of overridable settings, and general information on folder-specific settings,
// see the documentation: https://zed.dev/docs/configuring-zed#folder-specific-settings
{
"prettier": {
"allowed": false
},
"languages": {
"JavaScript": {
"formatter": {
"code_actions": {
"source.fixAll.eslint": true
}
},
"tab_size": 2
},
"TypeScript": {
"formatter": {
"code_actions": {
"source.fixAll.eslint": true
}
},
"tab_size": 2
},
"Vue.js": {
"formatter": {
"code_actions": {
"source.fixAll.eslint": true
}
},
"tab_size": 2
}
}
}

View file

@ -13,11 +13,13 @@ export default [
}, },
}, },
plugins: { vueParser }, plugins: { vueParser },
files: ['src/**/*.js', 'src/**/*.ts', 'src/**/*.vue'],
rules: { rules: {
'semi': [ 'semi': [
'error', 'error',
'always', 'always',
], ],
'object-curly-spacing': ['warn', 'always'],
'comma-dangle': [ 'comma-dangle': [
'error', 'error',
'always-multiline', 'always-multiline',

5549
client/pnpm-lock.yaml generated

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { apiCall } from "../../api"; import { apiCall } from '../../api';
import getPlugins from "../../plugins"; import getPlugins from '../../plugins';
const p = getPlugins(); const p = getPlugins();
let peers = $ref({}); let peers = $ref({});
@ -8,11 +8,11 @@ let loading = $ref(false);
let selection = $ref([] as number[]); let selection = $ref([] as number[]);
const columns = [ const columns = [
{ heading: "Name", path: "name" }, { heading: 'Name', path: 'name' },
{ heading: "Allowed IPs", path: "allowed_ips" }, { heading: 'Allowed IPs', path: 'allowed_ips' },
{ heading: "Endpoint", path: "endpoint" }, { heading: 'Endpoint', path: 'endpoint' },
{ heading: "Persistent Keepalive", path: "persistent_keepalive" }, { heading: 'Persistent Keepalive', path: 'persistent_keepalive' },
{ heading: "Comment", path: "comment" }, { heading: 'Comment', path: 'comment' },
]; ];
const displayData = $computed(() => { const displayData = $computed(() => {
@ -32,24 +32,24 @@ const displayData = $computed(() => {
async function load() { async function load() {
loading = true; loading = true;
let res = await apiCall("vpn.wireguard.peers.list", {}); let res = await apiCall('vpn.wireguard.peers.list', {});
if (res.Error === null) { if (res.Error === null) {
console.debug("peers", res.Data); console.debug('peers', res.Data);
peers = res.Data; peers = res.Data;
} else { } else {
console.debug("error", res); console.debug('error', res);
} }
loading = false; loading = false;
} }
async function deletePeer() { async function deletePeer() {
let res = await apiCall("vpn.wireguard.peers.delete", { let res = await apiCall('vpn.wireguard.peers.delete', {
name: displayData[selection[0]].name, name: displayData[selection[0]].name,
}); });
if (res.Error === null) { if (res.Error === null) {
console.debug("deleted peer"); console.debug('deleted peer');
} else { } else {
console.debug("error", res); console.debug('error', res);
} }
load(); load();
} }
@ -76,7 +76,9 @@ onMounted(async () => {
> >
<button @click="load">Refresh</button> <button @click="load">Refresh</button>
<router-link class="button" to="/vpn/wireguard.peers/edit" <router-link class="button" to="/vpn/wireguard.peers/edit"
>Create</router-link >
Create
</router-link
> >
<button :disabled="selection.length != 1" @click="editPeer"> <button :disabled="selection.length != 1" @click="editPeer">
Edit Edit

View file

@ -15,5 +15,10 @@ export function isNullish(value: any) {
return (value === null || value === undefined); return (value === null || value === undefined);
} }
export function variantOf(enumValue: any) {
if (typeof enumValue === 'string') return enumValue;
else return Object.entries(enumValue)[0][0];
}
export type Index = string | number | symbol; export type Index = string | number | symbol;
export type MaybeIndex = Index | null; export type MaybeIndex = Index | null;