mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-05 23:26:38 +08:00
feat: add support for release channels in version upgrade and node agent updates
- Introduced ReleaseChannel type to manage stable and preview releases. - Updated DashboardTopbar to handle version upgrades based on selected release channel. - Enhanced node detail page to allow manual checks for agent updates on stable and preview channels. - Modified API endpoints to support fetching and upgrading based on release channels. - Updated UI components to reflect changes in version checking and upgrade processes. - Added tests for new functionality related to preview releases and agent updates.
This commit is contained in:
@@ -1,47 +1,63 @@
|
||||
import { apiRequest } from '@/lib/api/client';
|
||||
|
||||
import type {
|
||||
NodeBootstrapToken,
|
||||
NodeItem,
|
||||
NodeMutationPayload,
|
||||
} from '@/features/nodes/types';
|
||||
|
||||
export function getNodes() {
|
||||
return apiRequest<NodeItem[]>('/nodes/');
|
||||
}
|
||||
|
||||
export function createNode(payload: NodeMutationPayload) {
|
||||
return apiRequest<NodeItem>('/nodes/', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
}
|
||||
|
||||
export function updateNode(id: number, payload: NodeMutationPayload) {
|
||||
return apiRequest<NodeItem>(`/nodes/${id}`, {
|
||||
method: 'PUT',
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
}
|
||||
|
||||
export function deleteNode(id: number) {
|
||||
return apiRequest<void>(`/nodes/${id}`, {
|
||||
method: 'DELETE',
|
||||
});
|
||||
}
|
||||
|
||||
export function getNodeBootstrapToken() {
|
||||
return apiRequest<NodeBootstrapToken>('/nodes/bootstrap-token');
|
||||
}
|
||||
|
||||
export function rotateNodeBootstrapToken() {
|
||||
return apiRequest<NodeBootstrapToken>('/nodes/bootstrap-token/rotate', {
|
||||
method: 'POST',
|
||||
});
|
||||
}
|
||||
|
||||
export function requestNodeAgentUpdate(id: number) {
|
||||
return apiRequest<NodeItem>(`/nodes/${id}/agent-update`, {
|
||||
method: 'POST',
|
||||
});
|
||||
}
|
||||
import { apiRequest } from '@/lib/api/client';
|
||||
|
||||
import type {
|
||||
NodeAgentReleaseInfo,
|
||||
NodeAgentUpdatePayload,
|
||||
NodeBootstrapToken,
|
||||
NodeItem,
|
||||
NodeMutationPayload,
|
||||
} from '@/features/nodes/types';
|
||||
import type { ReleaseChannel } from '@/features/update/types';
|
||||
|
||||
export function getNodes() {
|
||||
return apiRequest<NodeItem[]>('/nodes/');
|
||||
}
|
||||
|
||||
export function createNode(payload: NodeMutationPayload) {
|
||||
return apiRequest<NodeItem>('/nodes/', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
}
|
||||
|
||||
export function updateNode(id: number, payload: NodeMutationPayload) {
|
||||
return apiRequest<NodeItem>(`/nodes/${id}`, {
|
||||
method: 'PUT',
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
}
|
||||
|
||||
export function deleteNode(id: number) {
|
||||
return apiRequest<void>(`/nodes/${id}`, {
|
||||
method: 'DELETE',
|
||||
});
|
||||
}
|
||||
|
||||
export function getNodeBootstrapToken() {
|
||||
return apiRequest<NodeBootstrapToken>('/nodes/bootstrap-token');
|
||||
}
|
||||
|
||||
export function rotateNodeBootstrapToken() {
|
||||
return apiRequest<NodeBootstrapToken>('/nodes/bootstrap-token/rotate', {
|
||||
method: 'POST',
|
||||
});
|
||||
}
|
||||
|
||||
export function getNodeAgentRelease(
|
||||
id: number,
|
||||
channel: ReleaseChannel = 'stable',
|
||||
) {
|
||||
return apiRequest<NodeAgentReleaseInfo>(
|
||||
`/nodes/${id}/agent-release?channel=${channel}`,
|
||||
);
|
||||
}
|
||||
|
||||
export function requestNodeAgentUpdate(
|
||||
id: number,
|
||||
payload?: NodeAgentUpdatePayload,
|
||||
) {
|
||||
return apiRequest<NodeItem>(`/nodes/${id}/agent-update`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(payload ?? {}),
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user