Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CM-231: Added Admin main menu contribution #5

Merged
merged 1 commit into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ export const TASK_GROUP_CREATE = 191002;
export const TASK_GROUP_UPDATE = 191003;
export const TASK_GROUP_DELETE = 191004;

export const RIGHT_TASK_EXECUTIONER_GROUPS = 190001;

export const TASKS_PREVIEW_CONTRIBUTION_KEY = 'tasksManagement.taskPreview';

export const BENEFIT_PLAN_TASK_PREVIEW_TABLE_VALUE = 'BenefitPlanTaskPreviewTable';
Expand Down
21 changes: 21 additions & 0 deletions src/contributions/AdminMainMenuContributions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from 'react';

import {
People,
} from '@material-ui/icons';

import { FormattedMessage } from '@openimis/fe-core';
import {
RIGHT_TASK_EXECUTIONER_GROUPS,
} from '../constants';

function getAdminMainMenuContributions() {
return [{
text: <FormattedMessage module="tasksManagement" id="menu.taskExecutionerGroups" />,
icon: <People />,
route: '/tasks/groups',
filter: (rights) => rights.includes(RIGHT_TASK_EXECUTIONER_GROUPS),
}];
}

export default getAdminMainMenuContributions;
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import TaskGroupPage from './pages/TaskGroupPage';
import TaskStatusPicker from './pickers/TaskStatusPicker';
import TaskPreviewCell from './components/TaskPreviewCell';
import TaskGroupPicker from './pickers/TaskGroupPicker';
import getAdminMainMenuContributions from './contributions/AdminMainMenuContributions';

const ROUTE_TASKS_MANAGEMENT = 'tasks';
const ROUTE_TASK_MANAGEMENT = 'tasks/task';
Expand All @@ -23,6 +24,7 @@ const DEFAULT_CONFIG = {
translations: [{ key: 'en', messages: messages_en }],
reducers: [{ key: 'tasksManagement', reducer }],
'core.MainMenu': [TasksMainMenu],
'admin.MainMenu': [...getAdminMainMenuContributions()],
'core.Router': [
{ path: ROUTE_TASKS_MANAGEMENT, component: TasksManagementPage },
{ path: `${ROUTE_TASK_MANAGEMENT}/:task_uuid?`, component: TaskDetailsPage },
Expand Down
3 changes: 2 additions & 1 deletion src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@
"tasksManagement.task.resolve.mutationLabel": "Resolving task",
"tasksManagement.task.resolve.confirm.title": "Resolve task",
"tasksManagement.task.resolve.confirm.approve.message": "Are you sure you want to approve this task?",
"tasksManagement.task.resolve.confirm.fail.message": "Are you sure you want to fail this task?"
"tasksManagement.task.resolve.confirm.fail.message": "Are you sure you want to fail this task?",
"tasksManagement.menu.taskExecutionerGroups": "Task Executioner Groups"
}