feat(access): instance network rules at the capture receiver; policies reload without a restart
This commit is contained in:
33 files changed
+1682
-814
No files matched your search
@@ -16,7 +16,7 @@ import {
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import { api } from "@/lib/api";
|
||||
|
||||
type Level = "org" | "workspace" | "object";
|
||||
type Level = "instance" | "org" | "workspace" | "object";
|
||||
|
||||
interface Policy {
|
||||
id: string;
|
||||
@@ -139,6 +139,7 @@ onMounted(load);
|
||||
<Select v-model="draft.level">
|
||||
<SelectTrigger class="w-40"><SelectValue /></SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="instance">instance</SelectItem>
|
||||
<SelectItem value="org">org</SelectItem>
|
||||
<SelectItem value="workspace">workspace</SelectItem>
|
||||
<SelectItem value="object">object</SelectItem>
|
||||
|
||||
@@ -45,6 +45,7 @@ const {
|
||||
requestUnsigned,
|
||||
requireSigning,
|
||||
approveUnsigned,
|
||||
refusals,
|
||||
} = useSources();
|
||||
|
||||
const customPath = ref("");
|
||||
@@ -137,7 +138,15 @@ function url(source: Source): string {
|
||||
<TableCell
|
||||
class="max-w-0 truncate font-mono text-fg-muted"
|
||||
:title="url(source)"
|
||||
>{{ source.path }}</TableCell
|
||||
>{{ source.path }}
|
||||
<div
|
||||
v-if="refusals[source.path]"
|
||||
class="text-xs font-sans text-destructive"
|
||||
:title="refusals[source.path].addrs.join(', ')"
|
||||
>
|
||||
{{ refusals[source.path].refused }} refused in 24h from
|
||||
{{ refusals[source.path].addrs.slice(0, 3).join(", ") }}
|
||||
</div></TableCell
|
||||
>
|
||||
<TableCell>
|
||||
<Badge :variant="signingKind(source.signing)">{{
|
||||
|
||||
@@ -12,6 +12,13 @@ export interface Source {
|
||||
created_at?: string;
|
||||
}
|
||||
|
||||
/** What the network rules refused on one source in the last day. */
|
||||
export interface SourceRefusals {
|
||||
refused: number;
|
||||
accepted: number;
|
||||
addrs: string[];
|
||||
}
|
||||
|
||||
export type SigningKind = "ok" | "info" | "warn" | "idle";
|
||||
|
||||
const LABELS: Record<string, string> = {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ref } from "vue";
|
||||
|
||||
import { api } from "@/lib/api";
|
||||
import type { Source } from "./source-signing";
|
||||
import type { Source, SourceRefusals } from "./source-signing";
|
||||
|
||||
/**
|
||||
* The sources list and its writes. A write that generates a secret keeps the
|
||||
@@ -13,6 +13,7 @@ export function useSources() {
|
||||
const sources = ref<Source[] | null>(null);
|
||||
const failure = ref<string | null>(null);
|
||||
const revealed = ref<Source | null>(null);
|
||||
const refusals = ref<Record<string, SourceRefusals>>({});
|
||||
const busy = ref(false);
|
||||
|
||||
function message(err: unknown): string {
|
||||
@@ -21,8 +22,12 @@ export function useSources() {
|
||||
|
||||
async function load(): Promise<void> {
|
||||
try {
|
||||
const res = await api.sources<{ sources?: Source[] }>();
|
||||
const res = await api.sources<{
|
||||
sources?: Source[];
|
||||
refusals?: Record<string, SourceRefusals>;
|
||||
}>();
|
||||
sources.value = res.sources || [];
|
||||
refusals.value = res.refusals || {};
|
||||
failure.value = null;
|
||||
} catch (err) {
|
||||
failure.value = message(err);
|
||||
@@ -47,6 +52,7 @@ export function useSources() {
|
||||
sources,
|
||||
failure,
|
||||
revealed,
|
||||
refusals,
|
||||
busy,
|
||||
load,
|
||||
create: (path: string) => run(() => api.sourceCreate<Source>(path.trim())),
|
||||
|
||||
Reference in new issue
Block a user