{/* dropdown for policy.role */}
|
{!transactions.readOnly ? (
0
- ? formatAclRolesForDropdown(rolesFilteredbyPolicies)
- : []
- }
+ options={dropdownOptions}
required={true}
creatable={true}
handleChange={element => {
if (element) {
const matchingRole = roles.find(role => role.name === element.value);
- formik.setFieldValue(`policies.${index}.role`, element.value);
- formik.setFieldValue(
- `policies.${index}.user`,
- matchingRole ? matchingRole.user : undefined,
- );
+ arrayHelpers.replace(formik.values.policies.findIndex(p => p === policy), {
+ ...policy,
+ role: element.value,
+ user: matchingRole ? matchingRole.user : undefined,
+ });
}
}}
placeholder={
@@ -601,7 +603,10 @@ export const AccessPolicyTable = ({
: "false"
}`}
onChange={(read: React.ChangeEvent) =>
- formik.setFieldValue(`policies.${index}.read`, read.target.checked)
+ arrayHelpers.replace(formik.values.policies.findIndex(p => p === policy), {
+ ...policy,
+ read: read.target.checked,
+ })
}
/>
|
@@ -625,7 +630,11 @@ export const AccessPolicyTable = ({
: "false"
}`}
onChange={(write: React.ChangeEvent) =>
- formik.setFieldValue(`policies.${index}.write`, write.target.checked)
+ arrayHelpers.replace(formik.values.policies.findIndex(p => p === policy), {
+ ...policy,
+ write:
+ write.target.checked,
+ })
}
/>
diff --git a/src/i18n/i18n.ts b/src/i18n/i18n.ts
index 0c6af4e310..4a8b19122e 100644
--- a/src/i18n/i18n.ts
+++ b/src/i18n/i18n.ts
@@ -1,4 +1,4 @@
-import i18n from "i18next";
+import i18n, { FormatterModule } from "i18next";
import { initReactI18next } from "react-i18next";
import HttpBackend, { HttpBackendOptions } from "i18next-http-backend";
@@ -23,7 +23,7 @@ import trTRTrans from "./org/opencastproject/adminui/languages/lang-tr_TR.json";
import zhCNTrans from "./org/opencastproject/adminui/languages/lang-zh_CN.json";
import zhTWTrans from "./org/opencastproject/adminui/languages/lang-zh_TW.json";
import { getCurrentLanguageInformation } from "../utils/utils";
-import { format } from "date-fns/format";
+import { format as dateFnsFormat } from "date-fns/format";
// Assignment of language code to translation file
// !!! If translation file of a new language is added, please add assignment here, too !!!
@@ -47,11 +47,29 @@ const resources = {
"zh-TW": { translation: zhTWTrans },
} as const;
+const myFormatter: FormatterModule = {
+ type: "formatter",
+ init(_services, _i18nextOptions) {},
+ format(value, format, lng, _options) {
+ if (value instanceof Date && format && lng) {
+ return dateFnsFormat(value, format, {
+ locale: getCurrentLanguageInformation(lng)?.dateLocale,
+ });
+ }
+
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
+ return value;
+ },
+ add(_name, _fc) { },
+ addCached(_name, _fc) { },
+};
+
// Configuration of i18next
i18n
.use(HttpBackend)
.use(LanguageDetector)
.use(initReactI18next)
+ .use(myFormatter)
.init({
resources,
fallbackLng: "en-US",
@@ -59,17 +77,9 @@ i18n
interpolation: {
escapeValue: false,
- format: function (value, formatStr, lng) {
- if (value instanceof Date && formatStr && lng) {
- return format(value, formatStr, {
- locale: getCurrentLanguageInformation(lng)?.dateLocale,
- });
- }
-
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
- return value;
- },
+ alwaysFormat: true,
},
+
react: {
useSuspense: false,
},
diff --git a/src/i18n/org/opencastproject/adminui/languages/lang-en_US.json b/src/i18n/org/opencastproject/adminui/languages/lang-en_US.json
index f2ca294350..1f7d046eef 100644
--- a/src/i18n/org/opencastproject/adminui/languages/lang-en_US.json
+++ b/src/i18n/org/opencastproject/adminui/languages/lang-en_US.json
@@ -1974,6 +1974,11 @@
},
"WRITE_ACCESS": {
"LABEL": "Write Access"
+ },
+ "NEEDS_CUTTING": {
+ "LABEL": "Needs cutting",
+ "YES": "Yes",
+ "NO": "No"
}
},
"JOBS": {
diff --git a/src/utils/aclUtils.ts b/src/utils/aclUtils.ts
index eb39e86fe5..9aab0406fe 100644
--- a/src/utils/aclUtils.ts
+++ b/src/utils/aclUtils.ts
@@ -102,6 +102,5 @@ export const handleTemplateChange = async