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

UICAL-285 - Disable 'Actions' menu on DCB Calendar. #535

Merged
merged 5 commits into from
Sep 30, 2024
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
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
Loading