Skip to content

Commit

Permalink
Merge branch 'main' into task/WP-78--v3-shared-workspaces-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jalowe13 authored Oct 18, 2024
2 parents 15e2709 + 287b339 commit c266f16
Show file tree
Hide file tree
Showing 14 changed files with 178 additions and 33 deletions.
64 changes: 62 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,60 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [3.8.2]

### Added

- WP-371: Use set-facl job for workspace ACLs (#967, #968)

### Fixed

- WP-573: User unable to login when group checks fail (#962)

## [3.8.1]

### Fixed

- Cron indexer should use home dir as root instead of '/' (#963)
- WP-677: Dynamic exec system bug fixes - validation and allocation list (#964)

## [3.8.0]

### Added
WP-594: Setup internal docs with login access (#959)
WP-80: Implement dynamic execution system selection (#921)
WP-190: Handle concurrency with Tapis OAuth Token Refresh (#932)

### Fixed

- WP-585: TAS API: Country of Residence is no longer available.(#955)
- WP-553: Search index cron tab fixes (#948)

## [3.7.0]

### Fixed

- WP-549: Handle validation for FORK job type (#946)
- WP-551: use only strings for app arguments (#948)

## [3.6.1]

### Fixed

- Add Stampede3 to allocation list and system monitor list (#943)
- WP-547: case insensitive email in GET tickets (#944)

## [3.6.0]

### Fixed

- Fix and enable shared workspaces unit test (#927)
- WP-305: Do not encode sourceUrl field for tapis jobs (#929)
- WP-409: Set members to superuser via TAS (#931)
- Quick: update node to LTS (20.x), GH actions, and resolve security alerts (#940)
- Quick: update poetry to 1.8.2 (#941)
- Quick: add untracked migrations (#939)

## [3.5.0]

### Added
Expand Down Expand Up @@ -1042,8 +1096,14 @@ WP-306: Fix target path regression (#871)
## [1.0.0] - 2020-02-28
v1.0.0 Production release as of Feb 28, 2020.

[unreleased]: https://github.com/TACC/Core-Portal/compare/v3.5.0...HEAD
[3.5.0]: https://github.com/TACC/Core-Portal/compare/v3.5.0
[unreleased]: https://github.com/TACC/Core-Portal/compare/v3.8.2...HEAD
[3.8.2]: https://github.com/TACC/Core-Portal/releases/tag/v3.8.2
[3.8.1]: https://github.com/TACC/Core-Portal/releases/tag/v3.8.1
[3.8.0]: https://github.com/TACC/Core-Portal/releases/tag/v3.8.0
[3.7.0]: https://github.com/TACC/Core-Portal/releases/tag/v3.7.0
[3.6.1]: https://github.com/TACC/Core-Portal/releases/tag/v3.6.1
[3.6.0]: https://github.com/TACC/Core-Portal/releases/tag/v3.6.0
[3.5.0]: https://github.com/TACC/Core-Portal/releases/tag/v3.5.0
[3.4.3]: https://github.com/TACC/Core-Portal/releases/tag/v3.4.3
[3.4.2]: https://github.com/TACC/Core-Portal/releases/tag/v3.4.2
[3.4.1]: https://github.com/TACC/Core-Portal/releases/tag/v3.4.1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import { useDispatch } from 'react-redux';
import { useHistory, useLocation } from 'react-router-dom';
import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
import { Button } from '_common';
Expand All @@ -20,6 +21,7 @@ const DataFilesRenameModal = () => {

const toggle = () => toggleModal({ operation: 'rename', props: {} });

const dispatch = useDispatch();
const history = useHistory();
const location = useLocation();
const reloadPage = (name, newPath) => {
Expand All @@ -41,7 +43,7 @@ const DataFilesRenameModal = () => {
});

const onClosed = () => {
setStatus(null);
dispatch({ type: 'DATA_FILES_MODAL_CLOSE' });
};

const rename = ({ newName }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const DataFilesProjectFileListing = ({ system, path }) => {
</>
) : null}
<Button type="link" onClick={onManage}>
{readOnlyTeam ? 'View' : 'Manage'} Team
{`${readOnlyTeam ? 'View' : 'Manage'} Team`}
</Button>
</div>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ const DataFilesProjectMembers = ({
};

DataFilesProjectMembers.propTypes = {
projectId: PropTypes.string.isRequired,
projectId: PropTypes.string,
members: PropTypes.arrayOf(
PropTypes.shape({
username: PropTypes.string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export const IntegrationCell = ({ cell: { value } }) => {
) : (
<div>
<Button type="link" onClick={toggle}>
Setup {label}
{'Setup ' + label}
</Button>
</div>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ const dummyState = {
label: 'Google Drive',
description: 'test description',
activated: false,
disconnect: 'https://disconnect.com',
connect: 'https://google.com',
},
],
passwordLastChanged: '6/1/2020',
Expand Down Expand Up @@ -138,6 +140,8 @@ describe('Third Party Apps', () => {
label: 'Google Drive',
description: 'test description',
activated: true,
disconnect: 'https://disconnect.com',
connect: 'https://google.com',
},
],
},
Expand Down
25 changes: 20 additions & 5 deletions client/src/components/Tickets/TicketCreateForm.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ describe('TicketCreateForm', () => {
workbench,
});

const { getAllByText } = renderComponent(<TicketCreateForm />, store);
const { getAllByText } = renderComponent(
<TicketCreateForm provideDashBoardLinkOnSuccess={true} />,
store
);
expect(getAllByText(/Explain your steps/)).toBeDefined();
});

Expand All @@ -39,7 +42,10 @@ describe('TicketCreateForm', () => {
});

const { getAllByText, getByDisplayValue } = renderComponent(
<TicketCreateForm authenticatedUser={exampleAuthenticatedUser} />,
<TicketCreateForm
authenticatedUser={exampleAuthenticatedUser}
provideDashBoardLinkOnSuccess={true}
/>,
store
);
expect(getByDisplayValue(/Max/)).toBeInTheDocument();
Expand All @@ -58,7 +64,10 @@ describe('TicketCreateForm', () => {
});

const { getByTestId } = renderComponent(
<TicketCreateForm authenticatedUser={exampleAuthenticatedUser} />,
<TicketCreateForm
authenticatedUser={exampleAuthenticatedUser}
provideDashBoardLinkOnSuccess={true}
/>,
store
);
expect(getByTestId('loading-spinner'));
Expand All @@ -75,7 +84,10 @@ describe('TicketCreateForm', () => {
});

const { getByText } = renderComponent(
<TicketCreateForm authenticatedUser={exampleAuthenticatedUser} />,
<TicketCreateForm
authenticatedUser={exampleAuthenticatedUser}
provideDashBoardLinkOnSuccess={true}
/>,
store
);
expect(getByText(/1234/)).toBeDefined();
Expand All @@ -92,7 +104,10 @@ describe('TicketCreateForm', () => {
});

const { getByText } = renderComponent(
<TicketCreateForm authenticatedUser={exampleAuthenticatedUser} />,
<TicketCreateForm
authenticatedUser={exampleAuthenticatedUser}
provideDashBoardLinkOnSuccess={true}
/>,
store
);
expect(getByText(/Mock error/)).toBeDefined();
Expand Down
6 changes: 6 additions & 0 deletions client/src/components/Tickets/TicketModal.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const initialMockState = {
replying: false,
replyingError: false,
replyingErrorMessage: '',
attachments: [],
};

const ticketAttachmentSettings = {
Expand All @@ -41,6 +42,8 @@ const exampleTicketHistory = [
IsCreator: true,
Creator: 'Max Munstermann',
Created: 'Fri Mar 22 09:17:27 2019',
Attachments: [[1315069, 'untitled (0b)']],
Ticket: '1',
},
{
id: '2',
Expand All @@ -49,6 +52,8 @@ const exampleTicketHistory = [
IsCreator: false,
Creator: 'Ad Min',
Created: 'Fri Mar 23 10:17:00 2019',
Attachments: [[1315069, 'untitled (0b)']],
Ticket: '2',
},
];
const exampleTicketHistoryCard = [
Expand All @@ -63,6 +68,7 @@ const exampleTicketHistoryCard = [
[1315070, 'untitled (50b)'],
[1315071, 'Screen Shot 2021-09-27 at 12.45.03 PM.png (46.2k)'],
],
Ticket: '2077239',
},
];
function renderTicketsModelComponent(store) {
Expand Down
11 changes: 7 additions & 4 deletions client/src/components/_common/Searchbar/Searchbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,13 @@ const Searchbar = ({
)}
{((hasQuery && !siteSearch) ||
(filterType && filterType !== allFilterTypesValue && filterTypes)) && (
<Button attr="reset" type="link" onClick={onClear}>
<span data-testid="clear-button">
Back to All {dataType ? dataType : 'Results'}
</span>
<Button
attr="reset"
type="link"
onClick={onClear}
dataTestid="clear-button"
>
{`Back to All ${dataType ? dataType : 'Results'}`}
</Button>
)}
</form>
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/_common/Searchbar/Searchbar.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ describe('Searchbar', () => {

const element = getByTestId('clear-button');

expect(element.innerHTML).toBe('Back to All Files');
expect(element.textContent).toBe('Back to All Files');
});

it('shows correct label when no dataType is sent', async () => {
Expand Down Expand Up @@ -203,7 +203,7 @@ describe('Searchbar', () => {

const element = getByTestId('clear-button');

expect(element.innerHTML).toBe('Back to All Results');
expect(element.textContent).toBe('Back to All Results');
});

it('has expected elements', () => {
Expand Down
3 changes: 1 addition & 2 deletions client/src/hooks/datafiles/mutations/useRename.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ import { useSelector, useDispatch, shallowEqual } from 'react-redux';
function useRename() {
const dispatch = useDispatch();
const status = useSelector(
(state) => state.files.operationStatus.move,
(state) => state.files.operationStatus.rename,
shallowEqual
);

const setStatus = (newStatus) => {
dispatch({
type: 'DATA_FILES_SET_OPERATION_STATUS',
Expand Down
33 changes: 22 additions & 11 deletions client/src/hooks/datafiles/useFileListing.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,41 @@
import { useCallback } from 'react';
import { useSelector, useDispatch, shallowEqual } from 'react-redux';
import { useLocation } from 'react-router-dom';
import { useRename } from './mutations';
import { parse } from 'query-string';

function useFileListing(section = 'FilesListing') {
const dispatch = useDispatch();
const { query_string: queryString, filter } = parse(useLocation().search);

const { status: renameStatus } = useRename();
const { data, loading, error, params, loadingScroll, reachedEnd } =
useSelector(
(state) => ({
data: state?.files?.listing?.[section]?.map((file) => ({
...file,
disabled:
useSelector((state) => {
// Pinpoints currently selected file once before map iteration
const selectedFiles = state.files.selected?.FilesListing || [];
const selectedFileIndex =
selectedFiles.length === 1 ? selectedFiles[0] : -1;
// Conditional logic for returning a RUNNING status
const isRenameRunning = renameStatus === 'RUNNING';
return {
data: state?.files?.listing?.[section]?.map((file, index) => {
const isTrashRunning =
!!state.files.operationStatus.trash &&
state.files.operationStatus.trash[file.system + file.path] ===
'RUNNING',
})),
'RUNNING';
return {
...file,
disabled:
isTrashRunning ||
(isRenameRunning && index === selectedFileIndex),
};
}),
loading: state?.files?.loading?.[section],
loadingScroll: state?.files?.loadingScroll?.[section],
error: state?.files?.error?.[section],
params: state?.files?.params?.[section],
reachedEnd: state?.files?.reachedEnd?.[section],
}),
shallowEqual
);
};
}, shallowEqual);

const fetchListing = useCallback(
({ api, scheme, system, path, limit }) => {
Expand Down
45 changes: 45 additions & 0 deletions client/src/redux/sagas/systems.sagas.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { expectSaga } from 'redux-saga-test-plan';
import { pushSystemKeys } from 'redux-saga/effects';
import { fetchUtil } from 'utils/fetchUtil';
import { vi } from 'vitest';

// Mocks the cross-fetch
vi.mock('cross-fetch');

// Test the pushSystemKeys function
describe('pushSystemKeys', () => {
it('updates system data'),
() => {
// Create a mock form for the fetchUtil call
const mockForm = {
password: 'mockPassword',
token: 'mockToken',
hostname: 'mockHostname',
};
expectSaga(pushSystemKeys, {})
// Sends the call to update the systems modal
.put({
type: 'SYSTEMS_MODAL_UPDATE',
payload: {
operation: 'pushKeys',
props: { submitting: true },
},
})
// Sends the form information to the API url indicated
.call(fetchUtil, {
url: `/api/accounts/systems/${action.payload.systemId}/keys/`,
body: JSON.stringify({ mockForm, action: 'push' }),
method: 'PUT',
})
// Toggles the modal state when successful
.put({
type: 'SYSTEMS_TOGGLE_MODAL',
payload: {
operation: 'pushKeys',
props: {},
},
});
// Check for action.payload.onSuccess
expect(action.payload).toBe(onSuccess);
};
});
Loading

0 comments on commit c266f16

Please sign in to comment.