improve runtime environment variable modal usability
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2026-07-14 15:08:32 +09:00
parent 47dc9730e1
commit 45d05ba9fb
10 changed files with 591 additions and 5498 deletions
+75
View File
@@ -0,0 +1,75 @@
import { apiRequest } from '../../lib/api';
export type PlatformDevice = {
id: string;
accountEmail: string;
hostname: string;
tailscaleHostname: string;
sshUser?: string | null;
workspaceRoot?: string | null;
usageType: string;
os?: string | null;
arch?: string | null;
distro?: string | null;
installedAt: string;
lastProvisionedAt: string;
status: string;
};
export type PlatformSshKey = {
id: string;
accountEmail: string;
label?: string | null;
publicKeyHash: string;
keyType?: string | null;
lastProvisionedAt: string;
};
export type PlatformRegistrationUser = {
id: string;
name?: string | null;
email: string;
};
export type DeviceAuthorization = {
id: string;
userCode: string;
status: string;
authUserId?: string | null;
accountEmail?: string | null;
authUserName?: string | null;
expiresAt: string;
createdAt: string;
};
export async function loadPlatformDevices() {
const response = await apiRequest<{ devices?: PlatformDevice[] }>('/agents/devices');
return response.devices ?? [];
}
export async function loadPlatformSshKeys() {
const response = await apiRequest<{ sshKeys?: PlatformSshKey[] }>('/agents/ssh-keys');
return response.sshKeys ?? [];
}
export async function searchPlatformRegistrationUsers(keyword: string) {
const response = await apiRequest<{ users?: PlatformRegistrationUser[] }>(`/agents/registration-users?keyword=${encodeURIComponent(keyword)}`);
return response.users ?? [];
}
export async function loadDeviceAuthorizations() {
const response = await apiRequest<{ authorizations?: DeviceAuthorization[] }>('/agents/device-authorizations');
return response.authorizations ?? [];
}
export async function createDeviceAuthorization(userId: string) {
const response = await apiRequest<{ authorization: DeviceAuthorization }>('/agents/device-authorizations', {
method: 'POST',
body: JSON.stringify({ userId }),
});
return response.authorization;
}
export async function cancelDeviceAuthorization(id: string) {
return apiRequest<{ ok: boolean }>(`/agents/device-authorizations/${id}/cancel`, { method: 'POST' });
}