Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function missingFn(language: string, id: string) {
return id;
}
const catalogs: Catalogs = { es: catalog };
const setupResult: I18n = setupI18n({ catalogs, language: 'es' });
const setupResultLocales: I18n = setupI18n({ locales: ['en-UK', 'ar-AS'] });
const setupResultMissingText: I18n = setupI18n({ missing: 'missing' });
const setupResultMissingFn: I18n = setupI18n({ missing: missingFn });
const setupResultCombined: I18n = setupI18n({ catalogs, language: 'de', locales: ['en-UK', 'ar-AS'], missing: missingFn });
const formattedDate: string = date('en', { timeZone: 'UTC' })(new Date());
const formattedNumber: string = number('en', { style: 'currency', currency: 'EUR' })(1234.56);
const mark: string = i18nMark('mark');
map(uiMetadata => {
const displayVersion = semver.coerce(uiMetadata.serverBuild);
const title = this._i18n._(i18nMark("New UI Available"));
const description = this._i18n._(
i18nMark(
"DC/OS UI has been updated to {version}. Reload the UI for the updated version."
),
{
version: displayVersion
}
);
const primaryActionText = this._i18n._(i18nMark("Reload"));
return new ToastNotification(title, {
appearance: ToastAppearance.Success,
callback: this.updateAvailableCallback,
description,
primaryActionText
});
}),
map(() => {
const title = this._i18n._(i18nMark("UI Rollback Failure"));
const description = this._i18n._(
i18nMark("The UI rollback has failed due to an error.")
);
const primaryActionText = this._i18n._(i18nMark("Try Again"));
return new ToastNotification(title, {
appearance: ToastAppearance.Danger,
callback: this.rollbackFailedCallback,
description,
primaryActionText
});
}),
filter(
map(() => {
const title = this._i18n._(i18nMark("UI Rollback Failure"));
const description = this._i18n._(
i18nMark("The UI rollback has failed due to an error.")
);
const primaryActionText = this._i18n._(i18nMark("Try Again"));
return new ToastNotification(title, {
appearance: ToastAppearance.Danger,
callback: this.rollbackFailedCallback,
description,
primaryActionText
});
}),
filter(
map(uiMetadata => {
const displayVersion = semver.coerce(uiMetadata.serverBuild);
const title = this._i18n._(i18nMark("New UI Available"));
const description = this._i18n._(
i18nMark(
"DC/OS UI has been updated to {version}. Reload the UI for the updated version."
),
{
version: displayVersion
}
);
const primaryActionText = this._i18n._(i18nMark("Reload"));
return new ToastNotification(title, {
appearance: ToastAppearance.Success,
callback: this.updateAvailableCallback,
description,
primaryActionText
});
}),
filter(
map(uiMetadata => {
const displayVersion = semver.coerce(uiMetadata.serverBuild);
const title = this._i18n._(i18nMark("New UI Available"));
const description = this._i18n._(
i18nMark(
"DC/OS UI has been updated to {version}. Reload the UI for the updated version."
),
{
version: displayVersion
}
);
const primaryActionText = this._i18n._(i18nMark("Reload"));
return new ToastNotification(title, {
appearance: ToastAppearance.Success,
callback: this.updateAvailableCallback,
description,
primaryActionText
});
}),
filter(
map(() => {
const title = this._i18n._(i18nMark("UI Rollback Failure"));
const description = this._i18n._(
i18nMark("The UI rollback has failed due to an error.")
);
const primaryActionText = this._i18n._(i18nMark("Try Again"));
return new ToastNotification(title, {
appearance: ToastAppearance.Danger,
callback: this.rollbackFailedCallback,
description,
primaryActionText
});
}),
filter(
export default (props: GroupModalHeaderProps) => {
const { i18n, mode, onClose, onSave } = props;
const cancelLabel = i18n._(i18nMark("Cancel"));
let saveLabel;
switch (mode) {
case "create":
saveLabel = i18n._(i18nMark("Create"));
break;
case "edit":
saveLabel = i18n._(i18nMark("Update"));
break;
case "force":
saveLabel = i18n._(i18nMark("Force Update"));
break;
}
return (
map(uiAction => {
let notification: ToastNotification;
const title = this._i18n._(i18nMark("UI Upgrade Failure"));
const description = this._i18n._(
i18nMark("The UI upgrade has failed due to an error.")
);
const primaryActionText = this._i18n._(i18nMark("Try Again"));
if (uiAction.value.data !== undefined) {
const upgradeVersion: string = uiAction.value.data;
const tryAgainCallback = (
callbackType: ToastCallbackType,
toastNotification: ToastNotification
) => {
this.updateFailedCallback(
callbackType,
toastNotification,
upgradeVersion
);
};
export default (props: GroupModalHeaderProps) => {
const { i18n, mode, onClose, onSave } = props;
const cancelLabel = i18n._(i18nMark("Cancel"));
let saveLabel;
switch (mode) {
case "create":
saveLabel = i18n._(i18nMark("Create"));
break;
case "edit":
saveLabel = i18n._(i18nMark("Update"));
break;
case "force":
saveLabel = i18n._(i18nMark("Force Update"));
break;
}
return (