mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 15:59:41 +02:00
feat(edge/jobs): migrate create view to react [EE-2221] (#11867)
This commit is contained in:
parent
94c91035a7
commit
02fbdfec36
27 changed files with 777 additions and 163 deletions
|
@ -0,0 +1,31 @@
|
|||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
import { EdgeGroup } from '@/react/edge/edge-groups/types';
|
||||
import { EnvironmentId } from '@/react/portainer/environments/types';
|
||||
|
||||
import { EdgeJob } from '../../types';
|
||||
import { buildUrl } from '../build-url';
|
||||
|
||||
/**
|
||||
* Payload for creating an EdgeJob from a string
|
||||
*/
|
||||
export interface FileContentPayload {
|
||||
name: string;
|
||||
cronExpression: string;
|
||||
recurring: boolean;
|
||||
|
||||
edgeGroups: Array<EdgeGroup['Id']>;
|
||||
endpoints: Array<EnvironmentId>;
|
||||
fileContent: string;
|
||||
}
|
||||
|
||||
export async function createJobFromFileContent(payload: FileContentPayload) {
|
||||
try {
|
||||
const { data } = await axios.post<EdgeJob>(
|
||||
buildUrl({ action: 'create/string' }),
|
||||
payload
|
||||
);
|
||||
return data;
|
||||
} catch (e) {
|
||||
throw parseAxiosError(e as Error);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue