fix(edge/stacks): fix ui issues [EE-5578] (#9070)

pull/9115/head
Chaim Lev-Ari 1 year ago committed by GitHub
parent 3d22cde096
commit 2cd5d55b00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -183,23 +183,31 @@ function InnerForm({
/> />
{values.deploymentType === DeploymentType.Compose && ( {values.deploymentType === DeploymentType.Compose && (
<> <>
<div className="form-group">
<div className="col-sm-12">
<SwitchField <SwitchField
checked={values.prePullImage} checked={values.prePullImage}
name="prePullImage" name="prePullImage"
label="Pre-pull images" label="Pre-pull images"
tooltip="When enabled, redeployment will be executed when image(s) is pulled successfully" tooltip="When enabled, redeployment will be executed when image(s) is pulled successfully"
label-Class="col-sm-3 col-lg-2" labelClass="col-sm-3 col-lg-2"
onChange={(value) => setFieldValue('prePullImage', value)} onChange={(value) => setFieldValue('prePullImage', value)}
/> />
</div>
</div>
<div className="form-group">
<div className="col-sm-12">
<SwitchField <SwitchField
checked={values.retryDeploy} checked={values.retryDeploy}
name="retryDeploy" name="retryDeploy"
label="Retry deployment" label="Retry deployment"
tooltip="When enabled, this will allow edge agent keep retrying deployment if failure occur" tooltip="When enabled, this will allow edge agent keep retrying deployment if failure occur"
label-Class="col-sm-3 col-lg-2" labelClass="col-sm-3 col-lg-2"
onChange={(value) => setFieldValue('retryDeploy', value)} onChange={(value) => setFieldValue('retryDeploy', value)}
/> />
</div>
</div>
</> </>
)} )}
</> </>

@ -1,4 +1,5 @@
import { useState, useEffect } from 'react'; import { useState, useEffect } from 'react';
import { RefreshCw } from 'lucide-react';
import { Registry } from '@/react/portainer/registries/types'; import { Registry } from '@/react/portainer/registries/types';
@ -75,17 +76,15 @@ export function PrivateRegistryFieldset({
{checked && ( {checked && (
<> <>
{method !== 'repository' && ( {method !== 'repository' && (
<>
<TextTip color="blue"> <TextTip color="blue">
If you make any changes to the image urls in your yaml, please If you make any changes to the image urls in your yaml, please
reload or select registry manually reload or select registry manually
</TextTip> </TextTip>
<Button onClick={reload}>Reload</Button>
</>
)} )}
{!errorMessage ? ( {!errorMessage ? (
<FormControl label="Registry" inputId="users-selector"> <FormControl label="Registry" inputId="users-selector">
<div className="flex">
<Select <Select
value={registries.filter( value={registries.filter(
(registry) => registry.Id === selected (registry) => registry.Id === selected
@ -94,7 +93,17 @@ export function PrivateRegistryFieldset({
getOptionLabel={(registry) => registry.Name} getOptionLabel={(registry) => registry.Name}
getOptionValue={(registry) => registry.Id.toString()} getOptionValue={(registry) => registry.Id.toString()}
onChange={(value) => onSelect(value?.Id)} onChange={(value) => onSelect(value?.Id)}
className="w-full"
/> />
{method !== 'repository' && (
<Button
onClick={reload}
title="Reload"
icon={RefreshCw}
color="light"
/>
)}
</div>
</FormControl> </FormControl>
) : ( ) : (
<FormError>{errorMessage}</FormError> <FormError>{errorMessage}</FormError>

@ -31,9 +31,13 @@ export async function createStackFromFileContent({
...payload ...payload
}: FileContentPayload) { }: FileContentPayload) {
try { try {
const { data } = await axios.post<EdgeStack>(buildUrl(), payload, { const { data } = await axios.post<EdgeStack>(
params: { method: 'string', dryrun: dryRun ? 'true' : 'false' }, buildUrl(undefined, 'create/string'),
}); payload,
{
params: { dryrun: dryRun ? 'true' : 'false' },
}
);
return data; return data;
} catch (e) { } catch (e) {
throw parseAxiosError(e as Error); throw parseAxiosError(e as Error);

Loading…
Cancel
Save