[MM-54835] Convert LocalizedInput of 'custom_url_schemes_setting.tsx' to regular input component (#24854)
Этот коммит содержится в:
@@ -1,121 +1,465 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`components/AdminConsole/CustomUrlSchemeSetting initial state with multiple items 1`] = `
|
exports[`components/AdminConsole/CustomUrlSchemeSetting initial state with multiple items 1`] = `
|
||||||
|
<CustomURLSchemesSetting
|
||||||
|
disabled={false}
|
||||||
|
id="MySetting"
|
||||||
|
intl={
|
||||||
|
Object {
|
||||||
|
"$t": [Function],
|
||||||
|
"defaultFormats": Object {},
|
||||||
|
"defaultLocale": "en",
|
||||||
|
"defaultRichTextElements": undefined,
|
||||||
|
"fallbackOnEmptyString": true,
|
||||||
|
"formatDate": [Function],
|
||||||
|
"formatDateTimeRange": [Function],
|
||||||
|
"formatDateToParts": [Function],
|
||||||
|
"formatDisplayName": [Function],
|
||||||
|
"formatList": [Function],
|
||||||
|
"formatListToParts": [Function],
|
||||||
|
"formatMessage": [Function],
|
||||||
|
"formatNumber": [Function],
|
||||||
|
"formatNumberToParts": [Function],
|
||||||
|
"formatPlural": [Function],
|
||||||
|
"formatRelativeTime": [Function],
|
||||||
|
"formatTime": [Function],
|
||||||
|
"formatTimeToParts": [Function],
|
||||||
|
"formats": Object {},
|
||||||
|
"formatters": Object {
|
||||||
|
"getDateTimeFormat": [Function],
|
||||||
|
"getDisplayNames": [Function],
|
||||||
|
"getListFormat": [Function],
|
||||||
|
"getMessageFormat": [Function],
|
||||||
|
"getNumberFormat": [Function],
|
||||||
|
"getPluralRules": [Function],
|
||||||
|
"getRelativeTimeFormat": [Function],
|
||||||
|
},
|
||||||
|
"locale": "en",
|
||||||
|
"messages": Object {},
|
||||||
|
"onError": [Function],
|
||||||
|
"onWarn": [Function],
|
||||||
|
"textComponent": "span",
|
||||||
|
"timeZone": "Etc/UTC",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onChange={[MockFunction]}
|
||||||
|
setByEnv={false}
|
||||||
|
value={
|
||||||
|
Array [
|
||||||
|
"git",
|
||||||
|
"smtp",
|
||||||
|
"steam",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
>
|
||||||
<Settings
|
<Settings
|
||||||
helpText="Allows message text to link if it begins with any of the comma-separated URL schemes listed. By default, the following schemes will create links: \\"http\\", \\"https\\", \\"ftp\\", \\"tel\\", and \\"mailto\\"."
|
helpText="Allows message text to link if it begins with any of the comma-separated URL schemes listed. By default, the following schemes will create links: \\"http\\", \\"https\\", \\"ftp\\", \\"tel\\", and \\"mailto\\"."
|
||||||
inputId="MySetting"
|
inputId="MySetting"
|
||||||
label="Custom URL Schemes:"
|
label="Custom URL Schemes:"
|
||||||
setByEnv={false}
|
setByEnv={false}
|
||||||
>
|
>
|
||||||
<LocalizedInput
|
<div
|
||||||
|
className="form-group"
|
||||||
|
data-testid="MySetting"
|
||||||
|
>
|
||||||
|
<label
|
||||||
|
className="control-label col-sm-4"
|
||||||
|
htmlFor="MySetting"
|
||||||
|
>
|
||||||
|
Custom URL Schemes:
|
||||||
|
</label>
|
||||||
|
<div
|
||||||
|
className="col-sm-8"
|
||||||
|
>
|
||||||
|
<input
|
||||||
className="form-control"
|
className="form-control"
|
||||||
disabled={false}
|
disabled={false}
|
||||||
id="MySetting"
|
id="MySetting"
|
||||||
onChange={[Function]}
|
onChange={[Function]}
|
||||||
placeholder={
|
placeholder="E.g.: \\"git,smtp\\""
|
||||||
Object {
|
|
||||||
"defaultMessage": "E.g.: \\"git,smtp\\"",
|
|
||||||
"id": "admin.customization.customUrlSchemesPlaceholder",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
type="text"
|
type="text"
|
||||||
value="git,smtp,steam"
|
value="git,smtp,steam"
|
||||||
/>
|
/>
|
||||||
|
<div
|
||||||
|
className="help-text"
|
||||||
|
data-testid="MySettinghelp-text"
|
||||||
|
>
|
||||||
|
Allows message text to link if it begins with any of the comma-separated URL schemes listed. By default, the following schemes will create links: "http", "https", "ftp", "tel", and "mailto".
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</Settings>
|
</Settings>
|
||||||
|
</CustomURLSchemesSetting>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`components/AdminConsole/CustomUrlSchemeSetting initial state with no items 1`] = `
|
exports[`components/AdminConsole/CustomUrlSchemeSetting initial state with no items 1`] = `
|
||||||
|
<CustomURLSchemesSetting
|
||||||
|
disabled={false}
|
||||||
|
id="MySetting"
|
||||||
|
intl={
|
||||||
|
Object {
|
||||||
|
"$t": [Function],
|
||||||
|
"defaultFormats": Object {},
|
||||||
|
"defaultLocale": "en",
|
||||||
|
"defaultRichTextElements": undefined,
|
||||||
|
"fallbackOnEmptyString": true,
|
||||||
|
"formatDate": [Function],
|
||||||
|
"formatDateTimeRange": [Function],
|
||||||
|
"formatDateToParts": [Function],
|
||||||
|
"formatDisplayName": [Function],
|
||||||
|
"formatList": [Function],
|
||||||
|
"formatListToParts": [Function],
|
||||||
|
"formatMessage": [Function],
|
||||||
|
"formatNumber": [Function],
|
||||||
|
"formatNumberToParts": [Function],
|
||||||
|
"formatPlural": [Function],
|
||||||
|
"formatRelativeTime": [Function],
|
||||||
|
"formatTime": [Function],
|
||||||
|
"formatTimeToParts": [Function],
|
||||||
|
"formats": Object {},
|
||||||
|
"formatters": Object {
|
||||||
|
"getDateTimeFormat": [Function],
|
||||||
|
"getDisplayNames": [Function],
|
||||||
|
"getListFormat": [Function],
|
||||||
|
"getMessageFormat": [Function],
|
||||||
|
"getNumberFormat": [Function],
|
||||||
|
"getPluralRules": [Function],
|
||||||
|
"getRelativeTimeFormat": [Function],
|
||||||
|
},
|
||||||
|
"locale": "en",
|
||||||
|
"messages": Object {},
|
||||||
|
"onError": [Function],
|
||||||
|
"onWarn": [Function],
|
||||||
|
"textComponent": "span",
|
||||||
|
"timeZone": "Etc/UTC",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onChange={[MockFunction]}
|
||||||
|
setByEnv={false}
|
||||||
|
value={Array []}
|
||||||
|
>
|
||||||
<Settings
|
<Settings
|
||||||
helpText="Allows message text to link if it begins with any of the comma-separated URL schemes listed. By default, the following schemes will create links: \\"http\\", \\"https\\", \\"ftp\\", \\"tel\\", and \\"mailto\\"."
|
helpText="Allows message text to link if it begins with any of the comma-separated URL schemes listed. By default, the following schemes will create links: \\"http\\", \\"https\\", \\"ftp\\", \\"tel\\", and \\"mailto\\"."
|
||||||
inputId="MySetting"
|
inputId="MySetting"
|
||||||
label="Custom URL Schemes:"
|
label="Custom URL Schemes:"
|
||||||
setByEnv={false}
|
setByEnv={false}
|
||||||
>
|
>
|
||||||
<LocalizedInput
|
<div
|
||||||
|
className="form-group"
|
||||||
|
data-testid="MySetting"
|
||||||
|
>
|
||||||
|
<label
|
||||||
|
className="control-label col-sm-4"
|
||||||
|
htmlFor="MySetting"
|
||||||
|
>
|
||||||
|
Custom URL Schemes:
|
||||||
|
</label>
|
||||||
|
<div
|
||||||
|
className="col-sm-8"
|
||||||
|
>
|
||||||
|
<input
|
||||||
className="form-control"
|
className="form-control"
|
||||||
disabled={false}
|
disabled={false}
|
||||||
id="MySetting"
|
id="MySetting"
|
||||||
onChange={[Function]}
|
onChange={[Function]}
|
||||||
placeholder={
|
placeholder="E.g.: \\"git,smtp\\""
|
||||||
Object {
|
|
||||||
"defaultMessage": "E.g.: \\"git,smtp\\"",
|
|
||||||
"id": "admin.customization.customUrlSchemesPlaceholder",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
type="text"
|
type="text"
|
||||||
value=""
|
value=""
|
||||||
/>
|
/>
|
||||||
|
<div
|
||||||
|
className="help-text"
|
||||||
|
data-testid="MySettinghelp-text"
|
||||||
|
>
|
||||||
|
Allows message text to link if it begins with any of the comma-separated URL schemes listed. By default, the following schemes will create links: "http", "https", "ftp", "tel", and "mailto".
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</Settings>
|
</Settings>
|
||||||
|
</CustomURLSchemesSetting>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`components/AdminConsole/CustomUrlSchemeSetting initial state with one item 1`] = `
|
exports[`components/AdminConsole/CustomUrlSchemeSetting initial state with one item 1`] = `
|
||||||
|
<CustomURLSchemesSetting
|
||||||
|
disabled={false}
|
||||||
|
id="MySetting"
|
||||||
|
intl={
|
||||||
|
Object {
|
||||||
|
"$t": [Function],
|
||||||
|
"defaultFormats": Object {},
|
||||||
|
"defaultLocale": "en",
|
||||||
|
"defaultRichTextElements": undefined,
|
||||||
|
"fallbackOnEmptyString": true,
|
||||||
|
"formatDate": [Function],
|
||||||
|
"formatDateTimeRange": [Function],
|
||||||
|
"formatDateToParts": [Function],
|
||||||
|
"formatDisplayName": [Function],
|
||||||
|
"formatList": [Function],
|
||||||
|
"formatListToParts": [Function],
|
||||||
|
"formatMessage": [Function],
|
||||||
|
"formatNumber": [Function],
|
||||||
|
"formatNumberToParts": [Function],
|
||||||
|
"formatPlural": [Function],
|
||||||
|
"formatRelativeTime": [Function],
|
||||||
|
"formatTime": [Function],
|
||||||
|
"formatTimeToParts": [Function],
|
||||||
|
"formats": Object {},
|
||||||
|
"formatters": Object {
|
||||||
|
"getDateTimeFormat": [Function],
|
||||||
|
"getDisplayNames": [Function],
|
||||||
|
"getListFormat": [Function],
|
||||||
|
"getMessageFormat": [Function],
|
||||||
|
"getNumberFormat": [Function],
|
||||||
|
"getPluralRules": [Function],
|
||||||
|
"getRelativeTimeFormat": [Function],
|
||||||
|
},
|
||||||
|
"locale": "en",
|
||||||
|
"messages": Object {},
|
||||||
|
"onError": [Function],
|
||||||
|
"onWarn": [Function],
|
||||||
|
"textComponent": "span",
|
||||||
|
"timeZone": "Etc/UTC",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onChange={[MockFunction]}
|
||||||
|
setByEnv={false}
|
||||||
|
value={
|
||||||
|
Array [
|
||||||
|
"git",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
>
|
||||||
<Settings
|
<Settings
|
||||||
helpText="Allows message text to link if it begins with any of the comma-separated URL schemes listed. By default, the following schemes will create links: \\"http\\", \\"https\\", \\"ftp\\", \\"tel\\", and \\"mailto\\"."
|
helpText="Allows message text to link if it begins with any of the comma-separated URL schemes listed. By default, the following schemes will create links: \\"http\\", \\"https\\", \\"ftp\\", \\"tel\\", and \\"mailto\\"."
|
||||||
inputId="MySetting"
|
inputId="MySetting"
|
||||||
label="Custom URL Schemes:"
|
label="Custom URL Schemes:"
|
||||||
setByEnv={false}
|
setByEnv={false}
|
||||||
>
|
>
|
||||||
<LocalizedInput
|
<div
|
||||||
|
className="form-group"
|
||||||
|
data-testid="MySetting"
|
||||||
|
>
|
||||||
|
<label
|
||||||
|
className="control-label col-sm-4"
|
||||||
|
htmlFor="MySetting"
|
||||||
|
>
|
||||||
|
Custom URL Schemes:
|
||||||
|
</label>
|
||||||
|
<div
|
||||||
|
className="col-sm-8"
|
||||||
|
>
|
||||||
|
<input
|
||||||
className="form-control"
|
className="form-control"
|
||||||
disabled={false}
|
disabled={false}
|
||||||
id="MySetting"
|
id="MySetting"
|
||||||
onChange={[Function]}
|
onChange={[Function]}
|
||||||
placeholder={
|
placeholder="E.g.: \\"git,smtp\\""
|
||||||
Object {
|
|
||||||
"defaultMessage": "E.g.: \\"git,smtp\\"",
|
|
||||||
"id": "admin.customization.customUrlSchemesPlaceholder",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
type="text"
|
type="text"
|
||||||
value="git"
|
value="git"
|
||||||
/>
|
/>
|
||||||
|
<div
|
||||||
|
className="help-text"
|
||||||
|
data-testid="MySettinghelp-text"
|
||||||
|
>
|
||||||
|
Allows message text to link if it begins with any of the comma-separated URL schemes listed. By default, the following schemes will create links: "http", "https", "ftp", "tel", and "mailto".
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</Settings>
|
</Settings>
|
||||||
|
</CustomURLSchemesSetting>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`components/AdminConsole/CustomUrlSchemeSetting renders properly when disabled 1`] = `
|
exports[`components/AdminConsole/CustomUrlSchemeSetting renders properly when disabled 1`] = `
|
||||||
|
<CustomURLSchemesSetting
|
||||||
|
disabled={true}
|
||||||
|
id="MySetting"
|
||||||
|
intl={
|
||||||
|
Object {
|
||||||
|
"$t": [Function],
|
||||||
|
"defaultFormats": Object {},
|
||||||
|
"defaultLocale": "en",
|
||||||
|
"defaultRichTextElements": undefined,
|
||||||
|
"fallbackOnEmptyString": true,
|
||||||
|
"formatDate": [Function],
|
||||||
|
"formatDateTimeRange": [Function],
|
||||||
|
"formatDateToParts": [Function],
|
||||||
|
"formatDisplayName": [Function],
|
||||||
|
"formatList": [Function],
|
||||||
|
"formatListToParts": [Function],
|
||||||
|
"formatMessage": [Function],
|
||||||
|
"formatNumber": [Function],
|
||||||
|
"formatNumberToParts": [Function],
|
||||||
|
"formatPlural": [Function],
|
||||||
|
"formatRelativeTime": [Function],
|
||||||
|
"formatTime": [Function],
|
||||||
|
"formatTimeToParts": [Function],
|
||||||
|
"formats": Object {},
|
||||||
|
"formatters": Object {
|
||||||
|
"getDateTimeFormat": [Function],
|
||||||
|
"getDisplayNames": [Function],
|
||||||
|
"getListFormat": [Function],
|
||||||
|
"getMessageFormat": [Function],
|
||||||
|
"getNumberFormat": [Function],
|
||||||
|
"getPluralRules": [Function],
|
||||||
|
"getRelativeTimeFormat": [Function],
|
||||||
|
},
|
||||||
|
"locale": "en",
|
||||||
|
"messages": Object {},
|
||||||
|
"onError": [Function],
|
||||||
|
"onWarn": [Function],
|
||||||
|
"textComponent": "span",
|
||||||
|
"timeZone": "Etc/UTC",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onChange={[MockFunction]}
|
||||||
|
setByEnv={false}
|
||||||
|
value={
|
||||||
|
Array [
|
||||||
|
"git",
|
||||||
|
"smtp",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
>
|
||||||
<Settings
|
<Settings
|
||||||
helpText="Allows message text to link if it begins with any of the comma-separated URL schemes listed. By default, the following schemes will create links: \\"http\\", \\"https\\", \\"ftp\\", \\"tel\\", and \\"mailto\\"."
|
helpText="Allows message text to link if it begins with any of the comma-separated URL schemes listed. By default, the following schemes will create links: \\"http\\", \\"https\\", \\"ftp\\", \\"tel\\", and \\"mailto\\"."
|
||||||
inputId="MySetting"
|
inputId="MySetting"
|
||||||
label="Custom URL Schemes:"
|
label="Custom URL Schemes:"
|
||||||
setByEnv={false}
|
setByEnv={false}
|
||||||
>
|
>
|
||||||
<LocalizedInput
|
<div
|
||||||
|
className="form-group"
|
||||||
|
data-testid="MySetting"
|
||||||
|
>
|
||||||
|
<label
|
||||||
|
className="control-label col-sm-4"
|
||||||
|
htmlFor="MySetting"
|
||||||
|
>
|
||||||
|
Custom URL Schemes:
|
||||||
|
</label>
|
||||||
|
<div
|
||||||
|
className="col-sm-8"
|
||||||
|
>
|
||||||
|
<input
|
||||||
className="form-control"
|
className="form-control"
|
||||||
disabled={true}
|
disabled={true}
|
||||||
id="MySetting"
|
id="MySetting"
|
||||||
onChange={[Function]}
|
onChange={[Function]}
|
||||||
placeholder={
|
placeholder="E.g.: \\"git,smtp\\""
|
||||||
Object {
|
|
||||||
"defaultMessage": "E.g.: \\"git,smtp\\"",
|
|
||||||
"id": "admin.customization.customUrlSchemesPlaceholder",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
type="text"
|
type="text"
|
||||||
value="git,smtp"
|
value="git,smtp"
|
||||||
/>
|
/>
|
||||||
|
<div
|
||||||
|
className="help-text"
|
||||||
|
data-testid="MySettinghelp-text"
|
||||||
|
>
|
||||||
|
Allows message text to link if it begins with any of the comma-separated URL schemes listed. By default, the following schemes will create links: "http", "https", "ftp", "tel", and "mailto".
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</Settings>
|
</Settings>
|
||||||
|
</CustomURLSchemesSetting>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`components/AdminConsole/CustomUrlSchemeSetting renders properly when set by environment variable 1`] = `
|
exports[`components/AdminConsole/CustomUrlSchemeSetting renders properly when set by environment variable 1`] = `
|
||||||
|
<CustomURLSchemesSetting
|
||||||
|
disabled={false}
|
||||||
|
id="MySetting"
|
||||||
|
intl={
|
||||||
|
Object {
|
||||||
|
"$t": [Function],
|
||||||
|
"defaultFormats": Object {},
|
||||||
|
"defaultLocale": "en",
|
||||||
|
"defaultRichTextElements": undefined,
|
||||||
|
"fallbackOnEmptyString": true,
|
||||||
|
"formatDate": [Function],
|
||||||
|
"formatDateTimeRange": [Function],
|
||||||
|
"formatDateToParts": [Function],
|
||||||
|
"formatDisplayName": [Function],
|
||||||
|
"formatList": [Function],
|
||||||
|
"formatListToParts": [Function],
|
||||||
|
"formatMessage": [Function],
|
||||||
|
"formatNumber": [Function],
|
||||||
|
"formatNumberToParts": [Function],
|
||||||
|
"formatPlural": [Function],
|
||||||
|
"formatRelativeTime": [Function],
|
||||||
|
"formatTime": [Function],
|
||||||
|
"formatTimeToParts": [Function],
|
||||||
|
"formats": Object {},
|
||||||
|
"formatters": Object {
|
||||||
|
"getDateTimeFormat": [Function],
|
||||||
|
"getDisplayNames": [Function],
|
||||||
|
"getListFormat": [Function],
|
||||||
|
"getMessageFormat": [Function],
|
||||||
|
"getNumberFormat": [Function],
|
||||||
|
"getPluralRules": [Function],
|
||||||
|
"getRelativeTimeFormat": [Function],
|
||||||
|
},
|
||||||
|
"locale": "en",
|
||||||
|
"messages": Object {},
|
||||||
|
"onError": [Function],
|
||||||
|
"onWarn": [Function],
|
||||||
|
"textComponent": "span",
|
||||||
|
"timeZone": "Etc/UTC",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onChange={[MockFunction]}
|
||||||
|
setByEnv={true}
|
||||||
|
value={
|
||||||
|
Array [
|
||||||
|
"git",
|
||||||
|
"smtp",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
>
|
||||||
<Settings
|
<Settings
|
||||||
helpText="Allows message text to link if it begins with any of the comma-separated URL schemes listed. By default, the following schemes will create links: \\"http\\", \\"https\\", \\"ftp\\", \\"tel\\", and \\"mailto\\"."
|
helpText="Allows message text to link if it begins with any of the comma-separated URL schemes listed. By default, the following schemes will create links: \\"http\\", \\"https\\", \\"ftp\\", \\"tel\\", and \\"mailto\\"."
|
||||||
inputId="MySetting"
|
inputId="MySetting"
|
||||||
label="Custom URL Schemes:"
|
label="Custom URL Schemes:"
|
||||||
setByEnv={true}
|
setByEnv={true}
|
||||||
>
|
>
|
||||||
<LocalizedInput
|
<div
|
||||||
|
className="form-group"
|
||||||
|
data-testid="MySetting"
|
||||||
|
>
|
||||||
|
<label
|
||||||
|
className="control-label col-sm-4"
|
||||||
|
htmlFor="MySetting"
|
||||||
|
>
|
||||||
|
Custom URL Schemes:
|
||||||
|
</label>
|
||||||
|
<div
|
||||||
|
className="col-sm-8"
|
||||||
|
>
|
||||||
|
<input
|
||||||
className="form-control"
|
className="form-control"
|
||||||
disabled={true}
|
disabled={true}
|
||||||
id="MySetting"
|
id="MySetting"
|
||||||
onChange={[Function]}
|
onChange={[Function]}
|
||||||
placeholder={
|
placeholder="E.g.: \\"git,smtp\\""
|
||||||
Object {
|
|
||||||
"defaultMessage": "E.g.: \\"git,smtp\\"",
|
|
||||||
"id": "admin.customization.customUrlSchemesPlaceholder",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
type="text"
|
type="text"
|
||||||
value="git,smtp"
|
value="git,smtp"
|
||||||
/>
|
/>
|
||||||
|
<div
|
||||||
|
className="help-text"
|
||||||
|
data-testid="MySettinghelp-text"
|
||||||
|
>
|
||||||
|
Allows message text to link if it begins with any of the comma-separated URL schemes listed. By default, the following schemes will create links: "http", "https", "ftp", "tel", and "mailto".
|
||||||
|
</div>
|
||||||
|
<SetByEnv>
|
||||||
|
<div
|
||||||
|
className="alert alert-warning"
|
||||||
|
>
|
||||||
|
<FormattedMessage
|
||||||
|
defaultMessage="This setting has been set through an environment variable. It cannot be changed through the System Console."
|
||||||
|
id="admin.set_by_env"
|
||||||
|
>
|
||||||
|
<span>
|
||||||
|
This setting has been set through an environment variable. It cannot be changed through the System Console.
|
||||||
|
</span>
|
||||||
|
</FormattedMessage>
|
||||||
|
</div>
|
||||||
|
</SetByEnv>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</Settings>
|
</Settings>
|
||||||
|
</CustomURLSchemesSetting>
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
import {shallow} from 'enzyme';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import CustomURLSchemesSetting from 'components/admin_console/custom_url_schemes_setting';
|
import CustomURLSchemesSetting from 'components/admin_console/custom_url_schemes_setting';
|
||||||
import LocalizedInput from 'components/localized_input/localized_input';
|
|
||||||
|
import {mountWithIntl} from 'tests/helpers/intl-test-helper';
|
||||||
|
|
||||||
describe('components/AdminConsole/CustomUrlSchemeSetting', () => {
|
describe('components/AdminConsole/CustomUrlSchemeSetting', () => {
|
||||||
const baseProps = {
|
const baseProps = {
|
||||||
@@ -23,7 +23,7 @@ describe('components/AdminConsole/CustomUrlSchemeSetting', () => {
|
|||||||
value: [],
|
value: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
const wrapper = shallow(
|
const wrapper = mountWithIntl(
|
||||||
<CustomURLSchemesSetting {...props}/>,
|
<CustomURLSchemesSetting {...props}/>,
|
||||||
);
|
);
|
||||||
expect(wrapper).toMatchSnapshot();
|
expect(wrapper).toMatchSnapshot();
|
||||||
@@ -37,7 +37,7 @@ describe('components/AdminConsole/CustomUrlSchemeSetting', () => {
|
|||||||
value: ['git'],
|
value: ['git'],
|
||||||
};
|
};
|
||||||
|
|
||||||
const wrapper = shallow(
|
const wrapper = mountWithIntl(
|
||||||
<CustomURLSchemesSetting {...props}/>,
|
<CustomURLSchemesSetting {...props}/>,
|
||||||
);
|
);
|
||||||
expect(wrapper).toMatchSnapshot();
|
expect(wrapper).toMatchSnapshot();
|
||||||
@@ -51,7 +51,7 @@ describe('components/AdminConsole/CustomUrlSchemeSetting', () => {
|
|||||||
value: ['git', 'smtp', 'steam'],
|
value: ['git', 'smtp', 'steam'],
|
||||||
};
|
};
|
||||||
|
|
||||||
const wrapper = shallow(
|
const wrapper = mountWithIntl(
|
||||||
<CustomURLSchemesSetting {...props}/>,
|
<CustomURLSchemesSetting {...props}/>,
|
||||||
);
|
);
|
||||||
expect(wrapper).toMatchSnapshot();
|
expect(wrapper).toMatchSnapshot();
|
||||||
@@ -67,11 +67,11 @@ describe('components/AdminConsole/CustomUrlSchemeSetting', () => {
|
|||||||
onChange: jest.fn(),
|
onChange: jest.fn(),
|
||||||
};
|
};
|
||||||
|
|
||||||
const wrapper = shallow(
|
const wrapper = mountWithIntl(
|
||||||
<CustomURLSchemesSetting {...props}/>,
|
<CustomURLSchemesSetting {...props}/>,
|
||||||
);
|
);
|
||||||
|
|
||||||
wrapper.find(LocalizedInput).simulate('change', {target: {value: ''}});
|
wrapper.find('input').simulate('change', {target: {value: ''}});
|
||||||
|
|
||||||
expect(props.onChange).toBeCalledWith(baseProps.id, []);
|
expect(props.onChange).toBeCalledWith(baseProps.id, []);
|
||||||
});
|
});
|
||||||
@@ -82,11 +82,11 @@ describe('components/AdminConsole/CustomUrlSchemeSetting', () => {
|
|||||||
onChange: jest.fn(),
|
onChange: jest.fn(),
|
||||||
};
|
};
|
||||||
|
|
||||||
const wrapper = shallow(
|
const wrapper = mountWithIntl(
|
||||||
<CustomURLSchemesSetting {...props}/>,
|
<CustomURLSchemesSetting {...props}/>,
|
||||||
);
|
);
|
||||||
|
|
||||||
wrapper.find(LocalizedInput).simulate('change', {target: {value: ' steam '}});
|
wrapper.find('input').simulate('change', {target: {value: ' steam '}});
|
||||||
|
|
||||||
expect(props.onChange).toBeCalledWith(baseProps.id, ['steam']);
|
expect(props.onChange).toBeCalledWith(baseProps.id, ['steam']);
|
||||||
});
|
});
|
||||||
@@ -97,11 +97,11 @@ describe('components/AdminConsole/CustomUrlSchemeSetting', () => {
|
|||||||
onChange: jest.fn(),
|
onChange: jest.fn(),
|
||||||
};
|
};
|
||||||
|
|
||||||
const wrapper = shallow(
|
const wrapper = mountWithIntl(
|
||||||
<CustomURLSchemesSetting {...props}/>,
|
<CustomURLSchemesSetting {...props}/>,
|
||||||
);
|
);
|
||||||
|
|
||||||
wrapper.find(LocalizedInput).simulate('change', {target: {value: 'steam, git'}});
|
wrapper.find('input').simulate('change', {target: {value: 'steam, git'}});
|
||||||
|
|
||||||
expect(props.onChange).toBeCalledWith(baseProps.id, ['steam', 'git']);
|
expect(props.onChange).toBeCalledWith(baseProps.id, ['steam', 'git']);
|
||||||
});
|
});
|
||||||
@@ -112,11 +112,11 @@ describe('components/AdminConsole/CustomUrlSchemeSetting', () => {
|
|||||||
onChange: jest.fn(),
|
onChange: jest.fn(),
|
||||||
};
|
};
|
||||||
|
|
||||||
const wrapper = shallow(
|
const wrapper = mountWithIntl(
|
||||||
<CustomURLSchemesSetting {...props}/>,
|
<CustomURLSchemesSetting {...props}/>,
|
||||||
);
|
);
|
||||||
|
|
||||||
wrapper.find(LocalizedInput).simulate('change', {target: {value: 'ts3server, smtp, ms-excel'}});
|
wrapper.find('input').simulate('change', {target: {value: 'ts3server, smtp, ms-excel'}});
|
||||||
|
|
||||||
expect(props.onChange).toBeCalledWith(baseProps.id, ['ts3server', 'smtp', 'ms-excel']);
|
expect(props.onChange).toBeCalledWith(baseProps.id, ['ts3server', 'smtp', 'ms-excel']);
|
||||||
});
|
});
|
||||||
@@ -127,11 +127,11 @@ describe('components/AdminConsole/CustomUrlSchemeSetting', () => {
|
|||||||
onChange: jest.fn(),
|
onChange: jest.fn(),
|
||||||
};
|
};
|
||||||
|
|
||||||
const wrapper = shallow(
|
const wrapper = mountWithIntl(
|
||||||
<CustomURLSchemesSetting {...props}/>,
|
<CustomURLSchemesSetting {...props}/>,
|
||||||
);
|
);
|
||||||
|
|
||||||
wrapper.find(LocalizedInput).simulate('change', {target: {value: ',,,,,chrome,,,,ms-excel,,'}});
|
wrapper.find('input').simulate('change', {target: {value: ',,,,,chrome,,,,ms-excel,,'}});
|
||||||
|
|
||||||
expect(props.onChange).toBeCalledWith(baseProps.id, ['chrome', 'ms-excel']);
|
expect(props.onChange).toBeCalledWith(baseProps.id, ['chrome', 'ms-excel']);
|
||||||
});
|
});
|
||||||
@@ -143,7 +143,7 @@ describe('components/AdminConsole/CustomUrlSchemeSetting', () => {
|
|||||||
disabled: true,
|
disabled: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
const wrapper = shallow(
|
const wrapper = mountWithIntl(
|
||||||
<CustomURLSchemesSetting {...props}/>,
|
<CustomURLSchemesSetting {...props}/>,
|
||||||
);
|
);
|
||||||
expect(wrapper).toMatchSnapshot();
|
expect(wrapper).toMatchSnapshot();
|
||||||
@@ -155,7 +155,7 @@ describe('components/AdminConsole/CustomUrlSchemeSetting', () => {
|
|||||||
setByEnv: true,
|
setByEnv: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
const wrapper = shallow(
|
const wrapper = mountWithIntl(
|
||||||
<CustomURLSchemesSetting {...props}/>,
|
<CustomURLSchemesSetting {...props}/>,
|
||||||
);
|
);
|
||||||
expect(wrapper).toMatchSnapshot();
|
expect(wrapper).toMatchSnapshot();
|
||||||
|
|||||||
@@ -1,14 +1,9 @@
|
|||||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, {PureComponent} from 'react';
|
import React, {PureComponent} from 'react';
|
||||||
import type {ChangeEvent} from 'react';
|
import type {ChangeEvent} from 'react';
|
||||||
|
import {injectIntl, type IntlShape} from 'react-intl';
|
||||||
import LocalizedInput from 'components/localized_input/localized_input';
|
|
||||||
|
|
||||||
import {t} from 'utils/i18n';
|
|
||||||
import * as Utils from 'utils/utils';
|
|
||||||
|
|
||||||
import Setting from './setting';
|
import Setting from './setting';
|
||||||
|
|
||||||
@@ -18,24 +13,15 @@ type Props = {
|
|||||||
onChange: (id: string, valueAsArray: string[]) => void;
|
onChange: (id: string, valueAsArray: string[]) => void;
|
||||||
disabled: boolean;
|
disabled: boolean;
|
||||||
setByEnv: boolean;
|
setByEnv: boolean;
|
||||||
|
intl: IntlShape;
|
||||||
}
|
}
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
value: string;
|
value: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class CustomURLSchemesSetting extends
|
class CustomURLSchemesSetting extends
|
||||||
PureComponent<Props, State> {
|
PureComponent<Props, State> {
|
||||||
static get propTypes() {
|
|
||||||
return {
|
|
||||||
id: PropTypes.string.isRequired,
|
|
||||||
value: PropTypes.array.isRequired,
|
|
||||||
onChange: PropTypes.func.isRequired,
|
|
||||||
disabled: PropTypes.bool,
|
|
||||||
setByEnv: PropTypes.bool.isRequired,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(props: Props) {
|
constructor(props: Props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
@@ -63,24 +49,24 @@ export default class CustomURLSchemesSetting extends
|
|||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const label = Utils.localizeMessage('admin.customization.customUrlSchemes', 'Custom URL Schemes:');
|
|
||||||
const helpText = Utils.localizeMessage(
|
|
||||||
'admin.customization.customUrlSchemesDesc',
|
|
||||||
'Allows message text to link if it begins with any of the comma-separated URL schemes listed. By default, the following schemes will create links: "http", "https", "ftp", "tel", and "mailto".',
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Setting
|
<Setting
|
||||||
label={label}
|
label={this.props.intl.formatMessage({
|
||||||
helpText={helpText}
|
id: 'admin.customization.customUrlSchemes',
|
||||||
|
defaultMessage: 'Custom URL Schemes:',
|
||||||
|
})}
|
||||||
|
helpText={this.props.intl.formatMessage({
|
||||||
|
id: 'admin.customization.customUrlSchemesDesc',
|
||||||
|
defaultMessage: 'Allows message text to link if it begins with any of the comma-separated URL schemes listed. By default, the following schemes will create links: "http", "https", "ftp", "tel", and "mailto".',
|
||||||
|
})}
|
||||||
inputId={this.props.id}
|
inputId={this.props.id}
|
||||||
setByEnv={this.props.setByEnv}
|
setByEnv={this.props.setByEnv}
|
||||||
>
|
>
|
||||||
<LocalizedInput
|
<input
|
||||||
id={this.props.id}
|
id={this.props.id}
|
||||||
className='form-control'
|
className='form-control'
|
||||||
type='text'
|
type='text'
|
||||||
placeholder={{id: t('admin.customization.customUrlSchemesPlaceholder'), defaultMessage: 'E.g.: "git,smtp"'}}
|
placeholder={this.props.intl.formatMessage({id: 'admin.customization.customUrlSchemesPlaceholder', defaultMessage: 'E.g.: "git,smtp"'})}
|
||||||
value={this.state.value}
|
value={this.state.value}
|
||||||
onChange={this.handleChange}
|
onChange={this.handleChange}
|
||||||
disabled={this.props.disabled || this.props.setByEnv}
|
disabled={this.props.disabled || this.props.setByEnv}
|
||||||
@@ -89,3 +75,5 @@ export default class CustomURLSchemesSetting extends
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default injectIntl(CustomURLSchemesSetting);
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user