fix(app/templates): show default url in settings [EE-6393] (#10706)

pull/10716/head
Chaim Lev-Ari 1 year ago committed by GitHub
parent 7a9436dad7
commit 3cf36b0e93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -4,30 +4,40 @@ import { FormControl } from '@@/form-components/FormControl';
import { FormSection } from '@@/form-components/FormSection'; import { FormSection } from '@@/form-components/FormSection';
import { Input } from '@@/form-components/Input'; import { Input } from '@@/form-components/Input';
// this value is taken from https://github.com/portainer/portainer/blob/develop/api/portainer.go#L1628
const DEFAULT_URL =
'https://raw.githubusercontent.com/portainer/templates/v3/templates.json';
export function TemplatesUrlSection() { export function TemplatesUrlSection() {
const [{ name }, { error }] = useField<string>('templatesUrl'); const [{ name }, { error }] = useField<string>('templatesUrl');
return ( return (
<FormSection title="App Templates"> <FormSection title="App Templates">
<div className="form-group"> <div className="form-group">
<span className="col-sm-12 text-muted small"> <div className="col-sm-12 text-muted small">
You can specify the URL to your own template definitions file here. <p>
See{' '} You can specify the URL to your own template definitions file here.
<a See{' '}
href="https://docs.portainer.io/advanced/app-templates/build" <a
target="_blank" href="https://docs.portainer.io/advanced/app-templates/build"
rel="noreferrer" target="_blank"
> rel="noreferrer"
Portainer documentation >
</a>{' '} Portainer documentation
for more details. </a>{' '}
</span> for more details.
</p>
<p>
The default value is <a href={DEFAULT_URL}>{DEFAULT_URL}</a>
</p>
</div>
</div> </div>
<FormControl label="URL" inputId="templates_url" errors={error}> <FormControl label="URL" inputId="templates_url" errors={error}>
<Field <Field
as={Input} as={Input}
id="templates_url" id="templates_url"
placeholder="https://myserver.mydomain/templates.json" placeholder={DEFAULT_URL}
data-cy="settings-templateUrl" data-cy="settings-templateUrl"
name={name} name={name}
/> />

Loading…
Cancel
Save