) =>
replace(index, {
...policy,
write:
@@ -553,9 +540,7 @@ const ResourceDetailsAccessPolicyTab : React.FC <{
)) &&
policy.actions.map(
(
-// @ts-expect-error TS(7006): Parameter 'customAction' implicitly has an 'any' t... Remove this comment to see the full error message
customAction,
-// @ts-expect-error TS(7006): Parameter 'actionKey' implicitly has an 'any' type... Remove this comment to see the full error message
actionKey
) => (
diff --git a/src/slices/eventDetailsSlice.ts b/src/slices/eventDetailsSlice.ts
index bdde6074a4..26728167b4 100644
--- a/src/slices/eventDetailsSlice.ts
+++ b/src/slices/eventDetailsSlice.ts
@@ -31,6 +31,7 @@ import { Statistics, fetchStatistics, fetchStatisticsValueUpdate } from './stati
import { Ace, TransformedAcl, TransformedAcls } from './aclDetailsSlice';
type MetadataField = {
+ collection?: { [key: string]: unknown }[], // different for e.g. languages and presenters
id: string,
label: string, // translation key
readOnly: boolean,
@@ -39,6 +40,12 @@ type MetadataField = {
value: string,
}
+export type MetadataCatalog = {
+ title: string, // translation key
+ flavor: string,
+ fields: MetadataField[] | undefined,
+}
+
interface Assets {
id: string,
mimetype: string,
@@ -67,7 +74,7 @@ type CommentAuthor = {
type Workflow = {
scheduling: boolean,
entries: {
- id: number,
+ id: string,
status: string, //translation key
submitted: string, //date
submitter: string,
@@ -162,16 +169,8 @@ type EventDetailsState = {
statusStatisticsValue: 'uninitialized' | 'loading' | 'succeeded' | 'failed',
errorStatisticsValue: SerializedError | null,
eventId: string,
- metadata: {
- title: string, // translation key
- flavor: string,
- fields: MetadataField[] | undefined
- },
- extendedMetadata: {
- title: string, // not (necessarily) translation key
- flavor: string,
- fields: MetadataField[] | undefined
- }[],
+ metadata: MetadataCatalog,
+ extendedMetadata: MetadataCatalog[],
assets: {
attachments: number,
catalogs: number,
@@ -234,12 +233,7 @@ type EventDetailsState = {
assetPublicationDetails: AssetDetails & {
channel: string,
},
- policies: {
- actions: string[],
- read: boolean,
- role: string,
- write: boolean,
- }[],
+ policies: TransformedAcl[],
comments: {
author: CommentAuthor,
creationDate: string,
@@ -1296,7 +1290,7 @@ export const performWorkflowAction = createAsyncThunk('eventDetails/performWorkf
eventId: string,
workflowId: string,
action: string,
- close: () => void,
+ close?: () => void,
}, { dispatch }) => {
const { eventId, workflowId, action, close} = params;
let headers = {
@@ -1327,7 +1321,7 @@ export const performWorkflowAction = createAsyncThunk('eventDetails/performWorkf
context: NOTIFICATION_CONTEXT
})
);
- close();
+ close && close();
})
.catch((response) => {
dispatch(
@@ -1345,7 +1339,7 @@ export const performWorkflowAction = createAsyncThunk('eventDetails/performWorkf
export const deleteWorkflow = createAsyncThunk('eventDetails/deleteWorkflow', async (params: {
eventId: string,
- workflowId: number
+ workflowId: string
}, { dispatch, getState }) => {
const { eventId, workflowId } = params;
@@ -1505,11 +1499,7 @@ export const updateMetadata = createAsyncThunk('eventDetails/updateMetadata', as
export const updateExtendedMetadata = createAsyncThunk('eventDetails/updateExtendedMetadata', async (params: {
eventId: string,
values: { [key: string]: any },
- catalog: {
- flavor: string,
- title: string,
- fields: { [key: string]: any }[]
- }
+ catalog: MetadataCatalog
}, { dispatch, getState }) => {
const { eventId, values, catalog } = params;
@@ -1617,7 +1607,7 @@ export const updateAssets = createAsyncThunk('eventDetails/updateAssets', async
export const saveAccessPolicies = createAsyncThunk('eventDetails/saveAccessPolicies', async (params: {
eventId: string,
- policies: { [key: string]: TransformedAcl }
+ policies: { acl: { ace: Ace[] } }
}, { dispatch }) => {
const { eventId, policies } = params;
const headers = getHttpHeaders();
diff --git a/src/slices/seriesDetailsSlice.ts b/src/slices/seriesDetailsSlice.ts
index a12c28a78c..a028d883f9 100644
--- a/src/slices/seriesDetailsSlice.ts
+++ b/src/slices/seriesDetailsSlice.ts
@@ -18,25 +18,11 @@ import { NOTIFICATION_CONTEXT } from "../configs/modalConfig";
import { RootState } from '../store';
import { Statistics, fetchStatistics, fetchStatisticsValueUpdate } from './statisticsSlice';
import { Ace, TransformedAcl, TransformedAcls } from './aclDetailsSlice';
+import { MetadataCatalog } from './eventDetailsSlice';
/**
* This file contains redux reducer for actions affecting the state of a series
*/
-type MetadataCatalog = {
- title: string,
- flavor: string,
- fields: {
- collection?: {}[], // different for e.g. languages and presenters
- id: string,
- label: string,
- readOnly: boolean,
- required: boolean,
- translatable?: boolean,
- type: string,
- value: string | string[],
- }[]
-}
-
type Feed = {
link: string,
type: string,
diff --git a/src/utils/resourceUtils.ts b/src/utils/resourceUtils.ts
index d16c350986..3c29f4f437 100644
--- a/src/utils/resourceUtils.ts
+++ b/src/utils/resourceUtils.ts
@@ -1,3 +1,4 @@
+import { Ace } from './../slices/aclDetailsSlice';
import { getFilters, getTextFilter } from "../selectors/tableFilterSelectors";
import {
getPageLimit,
@@ -397,10 +398,13 @@ export const getMetadataCollectionFieldName = (metadataField, field) => {
};
// Prepare rules of access policies for post of new events or series
-// @ts-expect-error TS(7006): Parameter 'policies' implicitly has an 'any' type.
-export const prepareAccessPolicyRulesForPost = (policies) => {
+export const prepareAccessPolicyRulesForPost = (policies: TransformedAcl[]) => {
// access policies for post request
- let access = {
+ let access : {
+ acl : {
+ ace: Ace[]
+ }
+ } = {
acl: {
ace: [],
},
@@ -410,7 +414,6 @@ export const prepareAccessPolicyRulesForPost = (policies) => {
for (let i = 0; policies.length > i; i++) {
if (policies[i].read) {
access.acl.ace = access.acl.ace.concat({
-// @ts-expect-error TS(2769): No overload matches this call.
action: "read",
allow: policies[i].read,
role: policies[i].role,
@@ -418,7 +421,6 @@ export const prepareAccessPolicyRulesForPost = (policies) => {
}
if (policies[i].write) {
access.acl.ace = access.acl.ace.concat({
-// @ts-expect-error TS(2769): No overload matches this call.
action: "write",
allow: policies[i].write,
role: policies[i].role,
@@ -427,7 +429,6 @@ export const prepareAccessPolicyRulesForPost = (policies) => {
if (policies[i].actions.length > 0) {
for (let j = 0; policies[i].actions.length > j; j++) {
access.acl.ace = access.acl.ace.concat({
-// @ts-expect-error TS(2769): No overload matches this call.
action: policies[i].actions[j],
allow: true,
role: policies[i].role,