Skip to content

Commit

Permalink
UICAL-285 - Disable 'Actions' menu on DCB Calendar. (#535)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Terala-Priyanka authored Sep 30, 2024
1 parent eb8122a commit 66afcdf
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-npm-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,15 @@ 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
path: ${{ env.JEST_COVERAGE_REPORT_DIR }}
retention-days: 30

- name: Publish yarn.lock
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
if: failure()
with:
name: yarn.lock
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,15 @@ 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
path: ${{ env.JEST_COVERAGE_REPORT_DIR }}
retention-days: 30

- name: Publish yarn.lock
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
if: failure()
with:
name: yarn.lock
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 10 additions & 0 deletions src/test/data/Calendars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: []
};
25 changes: 25 additions & 0 deletions src/views/panes/InfoPane.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(
<Paneset>
<InfoPane {...props} />
</Paneset>,
),
);

expect(screen.queryByRole('button', { name: 'Actions' })).toBeNull();
});

it.skip('handles delete', async () => {
const props = {
creationBasePath: '',
Expand Down
5 changes: 5 additions & 0 deletions src/views/panes/InfoPane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -120,6 +122,9 @@ export const InfoPane: FunctionComponent<InfoPaneProps> = (
onClose={props.onClose}
dismissible
actionMenu={({ onToggle }) => {
if (calendar.name === DCB_CALENDAR) {
return null;
}
return ifPermissionOr(
stripes,
[permissions.UPDATE, permissions.CREATE, permissions.DELETE],
Expand Down

0 comments on commit 66afcdf

Please sign in to comment.