mirror of
https://github.com/portainer/portainer.git
synced 2025-07-21 06:19:41 +02:00
feat(edge/templates): introduce edge specific settings [EE-6276] (#10609)
This commit is contained in:
parent
68950fbb24
commit
e43d076269
42 changed files with 885 additions and 319 deletions
|
@ -0,0 +1,47 @@
|
|||
import axios, {
|
||||
json2formData,
|
||||
parseAxiosError,
|
||||
} from '@/portainer/services/axios';
|
||||
import { RegistryId } from '@/react/portainer/registries/types';
|
||||
import { Pair } from '@/react/portainer/settings/types';
|
||||
import { EdgeGroup } from '@/react/edge/edge-groups/types';
|
||||
|
||||
import { DeploymentType, EdgeStack, StaggerConfig } from '../../types';
|
||||
import { buildUrl } from '../buildUrl';
|
||||
|
||||
/**
|
||||
* Payload to create an EdgeStack from a git repository
|
||||
*/
|
||||
export type FileUploadPayload = {
|
||||
Name: string;
|
||||
file: File;
|
||||
EdgeGroups: Array<EdgeGroup['Id']>;
|
||||
DeploymentType: DeploymentType;
|
||||
Registries?: Array<RegistryId>;
|
||||
/** * Uses the manifest's namespaces instead of the default one */
|
||||
UseManifestNamespaces?: boolean;
|
||||
PrePullImage?: boolean;
|
||||
RetryDeploy?: boolean;
|
||||
/** List of environment variables */
|
||||
EnvVars?: Array<Pair>;
|
||||
/** Configuration for stagger updates */
|
||||
StaggerConfig?: StaggerConfig;
|
||||
Webhook?: string;
|
||||
};
|
||||
|
||||
export async function createStackFromFile(payload: FileUploadPayload) {
|
||||
try {
|
||||
const { data } = await axios.post<EdgeStack>(
|
||||
buildUrl(undefined, 'create/file'),
|
||||
json2formData(payload),
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
},
|
||||
}
|
||||
);
|
||||
return data;
|
||||
} catch (e) {
|
||||
throw parseAxiosError(e as Error);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue