From 66afcdf3a3c6e0d717669728a92213c2c53592be Mon Sep 17 00:00:00 2001
From: Priyanka Terala <104053200+Terala-Priyanka@users.noreply.github.com>
Date: Mon, 30 Sep 2024 11:10:09 +0530
Subject: [PATCH] UICAL-285 - Disable 'Actions' menu on DCB Calendar. (#535)
* UICAL-285 - Disable 'Actions' menu on DCB Calendar.
* UICAL-285 - upgrade versions of upload-artifact actions in CI workflows
* UICAL-285 - refine
* fix few lint issues
* UICAL-285 - remove commented code
---
.github/workflows/build-npm-release.yml | 4 ++--
.github/workflows/build-npm.yml | 4 ++--
CHANGELOG.md | 4 ++++
src/test/data/Calendars.ts | 10 ++++++++++
src/views/panes/InfoPane.test.tsx | 25 +++++++++++++++++++++++++
src/views/panes/InfoPane.tsx | 5 +++++
6 files changed, 48 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/build-npm-release.yml b/.github/workflows/build-npm-release.yml
index 75d20a0a..d40064e8 100644
--- a/.github/workflows/build-npm-release.yml
+++ b/.github/workflows/build-npm-release.yml
@@ -151,7 +151,7 @@ jobs:
comment_title: Jest Unit Test Statistics
- name: Publish Jest coverage report
- uses: actions/upload-artifact@v2
+ uses: actions/upload-artifact@v4
if: always()
with:
name: jest-coverage-report
@@ -159,7 +159,7 @@ jobs:
retention-days: 30
- name: Publish yarn.lock
- uses: actions/upload-artifact@v2
+ uses: actions/upload-artifact@v4
if: failure()
with:
name: yarn.lock
diff --git a/.github/workflows/build-npm.yml b/.github/workflows/build-npm.yml
index afe48470..3a64b625 100644
--- a/.github/workflows/build-npm.yml
+++ b/.github/workflows/build-npm.yml
@@ -90,7 +90,7 @@ jobs:
comment_title: Jest Unit Test Statistics
- name: Publish Jest coverage report
- uses: actions/upload-artifact@v2
+ uses: actions/upload-artifact@v4
if: always()
with:
name: jest-coverage-report
@@ -98,7 +98,7 @@ jobs:
retention-days: 30
- name: Publish yarn.lock
- uses: actions/upload-artifact@v2
+ uses: actions/upload-artifact@v4
if: failure()
with:
name: yarn.lock
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a7c31adb..a623c924 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
# Change history for ui-calendar
+## In progress
+
+* Disable 'Actions' menu on DCB Calendar. Refs UICAL-285.
+
## [11.0.1] (https://github.com/folio-org/ui-calendar/tree/v11.0.1) (2024-05-08)
* Address empty fourth pane on open of 'Current calendar assignment'. Refs UICAL-283
diff --git a/src/test/data/Calendars.ts b/src/test/data/Calendars.ts
index b8e94e20..752c903d 100644
--- a/src/test/data/Calendars.ts
+++ b/src/test/data/Calendars.ts
@@ -227,3 +227,13 @@ export const SUMMER_SP_4_245: CalendarDTO = {
],
exceptions: []
};
+
+export const DCB: CalendarDTO = {
+ id: 'f3fde29e-59f7-47a6-8109-af6cb92acde5',
+ name: 'DCB Calendar',
+ assignments: ['9d1b77e8-f02e-4b7f-b296-3f2042ddac54'],
+ startDate: '2000-01-01',
+ endDate: '2000-04-30',
+ normalHours: [],
+ exceptions: []
+};
diff --git a/src/views/panes/InfoPane.test.tsx b/src/views/panes/InfoPane.test.tsx
index 34a9404f..dfd55765 100644
--- a/src/views/panes/InfoPane.test.tsx
+++ b/src/views/panes/InfoPane.test.tsx
@@ -285,6 +285,31 @@ describe('Calendar info pane', () => {
expect(screen.getByRole('button', { name: 'Delete' })).toBeInTheDocument();
});
+ it('should not render action buttons for DCB calendar', async () => {
+ const props = {
+ creationBasePath: '',
+ editBasePath: '',
+ calendar: Calendars.DCB,
+ onClose: jest.fn(),
+ dataRepository: new DataRepository(undefined, undefined, {
+ create: jest.fn(),
+ update: jest.fn(),
+ delete: jest.fn(),
+ dates: jest.fn(),
+ }),
+ };
+
+ render(
+ withEverything(
+
+
+ ,
+ ),
+ );
+
+ expect(screen.queryByRole('button', { name: 'Actions' })).toBeNull();
+ });
+
it.skip('handles delete', async () => {
const props = {
creationBasePath: '',
diff --git a/src/views/panes/InfoPane.tsx b/src/views/panes/InfoPane.tsx
index c7fde3ac..7b34e6c7 100644
--- a/src/views/panes/InfoPane.tsx
+++ b/src/views/panes/InfoPane.tsx
@@ -32,6 +32,8 @@ import { generateExceptionalOpeningRows } from '../../utils/InfoPaneUtils';
import ifPermissionOr from '../../utils/ifPermissionOr';
import css from './InfoPane.css';
+const DCB_CALENDAR = 'DCB Calendar';
+
export interface InfoPaneProps {
creationBasePath: string;
editBasePath: string;
@@ -120,6 +122,9 @@ export const InfoPane: FunctionComponent = (
onClose={props.onClose}
dismissible
actionMenu={({ onToggle }) => {
+ if (calendar.name === DCB_CALENDAR) {
+ return null;
+ }
return ifPermissionOr(
stripes,
[permissions.UPDATE, permissions.CREATE, permissions.DELETE],