diff --git a/src/actions.js b/src/actions.js
index 060cbf5..b261a96 100644
--- a/src/actions.js
+++ b/src/actions.js
@@ -17,7 +17,6 @@ const TASK_GROUP_PROJECTION = () => [
'code',
'completionPolicy',
'taskexecutorSet { edges { node { user { id username lastName } } } }',
- 'taskAllowedSources',
];
const TASK_FULL_PROJECTION = () => [
@@ -65,7 +64,6 @@ export const formatTaskGroupGQL = (taskGroup) => {
${taskGroup?.id ? `id: "${taskGroup.id}"` : ''}
${taskGroup?.taskexecutorSet ? `userIds: ${executorsString}` : 'userIds: []'}
${taskGroup?.taskSources ? `taskSources: ${taskSourcesString}` : 'taskSources: []'}
- ${taskGroup?.taskAllowedSources ? `taskAllowedSources: ${taskSourcesString}` : 'taskAllowedSources: []'}
`;
};
@@ -124,7 +122,6 @@ export function fetchTaskGroup(modulesManager, variables) {
completionPolicy
jsonExt
taskexecutorSet { edges { node { user { id username lastName } } } },
- taskAllowedSources
}
}
}
diff --git a/src/components/TaskHeadPanel.js b/src/components/TaskHeadPanel.js
index ff0fc0b..b27618a 100644
--- a/src/components/TaskHeadPanel.js
+++ b/src/components/TaskHeadPanel.js
@@ -89,7 +89,6 @@ class TaskHeadPanel extends FormPanel {
readOnly={!rights.includes(TASK_UPDATE)
|| [TASK_STATUS.COMPLETED, TASK_STATUS.FAILED].includes(task.status)}
withNull
- source={task?.source}
value={task?.taskGroup}
onChange={(taskGroup) => this.updateAttribute('taskGroup', taskGroup)}
/>
diff --git a/src/components/groups-management/TaskGroupHeadPanel.js b/src/components/groups-management/TaskGroupHeadPanel.js
index 1f85f9a..c3ef633 100644
--- a/src/components/groups-management/TaskGroupHeadPanel.js
+++ b/src/components/groups-management/TaskGroupHeadPanel.js
@@ -11,8 +11,6 @@ import { withTheme, withStyles } from '@material-ui/core/styles';
import TaskExecutorsPicker from '../../pickers/TaskExecutorsPicker';
import GroupPolicyPicker from '../../pickers/GroupPolicyPicker';
import TaskSourcePicker from '../../pickers/TaskSourcePicker';
-import TaskSourceAllowedPicker from '../../pickers/TaskSourceAllowedPicker';
-import { TASK_GROUP_UPDATE, TASK_GROUP_CREATE } from '../../constants';
const styles = (theme) => ({
tableTitle: theme.table.title,
@@ -45,16 +43,9 @@ const renderHeadPanelTitle = (classes) => (
class TaskGroupHeadPanel extends FormPanel {
render() {
const {
- edited, classes, readOnly, rights,
+ edited, classes, readOnly,
} = this.props;
const taskGroup = { ...edited };
- const filterAllowedSources = (options) => {
- if (!taskGroup?.taskAllowedSources?.length) {
- return options;
- }
- const sourcesIds = taskGroup.taskAllowedSources.map((source) => source.id);
- return options.filter((option) => sourcesIds.includes(option.id));
- };
return (
<>
{renderHeadPanelTitle(classes)}
@@ -95,14 +86,6 @@ class TaskGroupHeadPanel extends FormPanel {
readOnly={readOnly}
value={taskGroup?.taskSources}
onChange={(sources) => this.updateAttribute('taskSources', sources)}
- filterOptions={filterAllowedSources}
- />
-
-
- this.updateAttribute('taskAllowedSources', allowedSources)}
/>
diff --git a/src/pickers/TaskGroupPicker.js b/src/pickers/TaskGroupPicker.js
index cb3850e..5b1f938 100644
--- a/src/pickers/TaskGroupPicker.js
+++ b/src/pickers/TaskGroupPicker.js
@@ -1,7 +1,10 @@
import React, { useState } from 'react';
import {
- useModulesManager, useTranslations, Autocomplete, useGraphqlQuery,
+ useModulesManager,
+ useTranslations,
+ Autocomplete,
+ useGraphqlQuery,
} from '@openimis/fe-core';
function TaskGroupPicker(props) {
@@ -13,7 +16,6 @@ function TaskGroupPicker(props) {
withPlaceholder,
value,
label,
- source = null,
filterOptions,
filterSelectedOptions,
placeholder,
@@ -33,7 +35,6 @@ function TaskGroupPicker(props) {
id
code
completionPolicy
- taskAllowedSources
}
}
}
@@ -44,16 +45,6 @@ function TaskGroupPicker(props) {
},
);
- const options = data?.taskGroup?.edges.map((edge) => edge.node) ?? [];
-
- const filteredOptionsWithAllowedSources = options.filter((option) => {
- const parsedResponse = JSON.parse(option.taskAllowedSources);
- const allowedSources = typeof parsedResponse === 'object' ? [parsedResponse] : parsedResponse;
- const usersAllowedSources = allowedSources.flatMap((source) => source.task_allowed_sources);
-
- return usersAllowedSources.includes(source);
- });
-
return (
edge.node) ?? []}
isLoading={isLoading}
value={value}
getOptionLabel={(option) => `${option.code}`}
diff --git a/src/pickers/TaskSourceAllowedPicker.js b/src/pickers/TaskSourceAllowedPicker.js
deleted file mode 100644
index 6fd7838..0000000
--- a/src/pickers/TaskSourceAllowedPicker.js
+++ /dev/null
@@ -1,35 +0,0 @@
-import React from 'react';
-import { Autocomplete, useTranslations, useModulesManager } from '@openimis/fe-core';
-import { TASK_CONTRIBUTION_KEY } from '../constants';
-
-function TaskSourceAllowedPicker({
- onChange, readOnly, required, withLabel, value,
-}) {
- const modulesManager = useModulesManager();
- const { formatMessage } = useTranslations('tasksManagement');
- const contributions = modulesManager.getContribs(TASK_CONTRIBUTION_KEY);
- const allowedSources = contributions.flatMap((contribution) => {
- const source = contribution.taskSource;
- return source ? source.map((item) => ({ id: item, name: item })) : [];
- });
-
- return (
- `${source.name}`}
- onChange={onChange}
- filterSelectedOptions
- onInputChange={() => {}}
- />
- );
-}
-
-export default TaskSourceAllowedPicker;
diff --git a/src/pickers/TaskSourcePicker.js b/src/pickers/TaskSourcePicker.js
index 3d94051..93ea99f 100644
--- a/src/pickers/TaskSourcePicker.js
+++ b/src/pickers/TaskSourcePicker.js
@@ -12,7 +12,6 @@ function TaskSourcePicker({
required,
withLabel,
value,
- filterOptions,
}) {
const modulesManager = useModulesManager();
const { formatMessage } = useTranslations('tasksManagement');
@@ -35,7 +34,7 @@ function TaskSourcePicker({
value={value}
getOptionLabel={(source) => `${source.name}`}
onChange={onChange}
- filterOptions={filterOptions}
+ filterSelectedOptions
onInputChange={() => {}}
/>
);
diff --git a/src/reducer.js b/src/reducer.js
index d81e26e..8be83b1 100644
--- a/src/reducer.js
+++ b/src/reducer.js
@@ -166,10 +166,6 @@ function reducer(
taskSources: taskGroup?.jsonExt
? JSON.parse(taskGroup.jsonExt).task_sources.map((source) => ({ id: source, name: source }))
: [],
- taskAllowedSources: taskGroup?.taskAllowedSources
- ? JSON.parse(taskGroup?.taskAllowedSources).task_allowed_sources.map(
- (source) => ({ id: source, name: source }),
- ) : [],
}))?.[0],
fetchingTaskGroup: false,
errorTaskGroup: formatGraphQLError(action.payload),
diff --git a/src/translations/en.json b/src/translations/en.json
index 2d39117..e4f352b 100644
--- a/src/translations/en.json
+++ b/src/translations/en.json
@@ -53,8 +53,6 @@
"tasksManagement.menu.taskExecutionerGroups": "Task Executioner Groups",
"tasksManagement.TaskSourcePicker.label": "Task Sources",
"tasksManagement.TaskSourcePicker.placeholder": "Search for task sources...",
- "tasksManagement.TaskSourceAllowedPicker.label": "Allowed Task Sources",
- "tasksManagement.TaskSourceAllowedPicker.placeholder": "Search for allowed task sources...",
"tasksManagement.entries.tasksManagementAllView": "All Tasks",
"tasksManagement.task.source.mutationLabel": "Resolving task",
"tasksManagement.task.source.IndividualService": "Individual Service",