Skip to content

Commit

Permalink
Merge branch 'task/WP-725' of github.com:TACC/Core-Portal into task/W…
Browse files Browse the repository at this point in the history
…P-725
  • Loading branch information
Jeff McMillen authored and Jeff McMillen committed Dec 9, 2024
2 parents a917b86 + 1a0813d commit 0db1cfa
Show file tree
Hide file tree
Showing 29 changed files with 852 additions and 211 deletions.
30 changes: 29 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,32 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [3.10.1]

### Fixed

- WP-778: Fix infinite loop for state update in useEffect (#1019)
- Quick: CSS regression fixes- testing session (#1018)

## [3.10.0]

### Added

- deps/react-18: Update React to v18 (#979)
- WP-50: Fix sizing of buttons "as-link" (#986)
- WP-509: Handle file/folder download feature with large number of files (#981)
- WP-520: AppTray should use versionEnabled for list of apps instead of enabled (#991)
- WP-24: Disabling Google Drive Integration (#988)
- WP-730: Refactor useRename to use react-query (#993)
- WP-728: Mutation hook: Copy file (#1000)
- WP-78: V3 Shared Workspaces Tests (#987)

### Fixed

- WP-419 Public Data Header Left Margin (#1003)
- WP-765: Fix job status button to show background (#1015)


## [3.9.0]

### Fixed
Expand Down Expand Up @@ -1115,7 +1141,9 @@ 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.9.0...HEAD
[unreleased]: https://github.com/TACC/Core-Portal/compare/v3.10.1...HEAD
[3.10.1]: https://github.com/TACC/Core-Portal/releases/tag/v3.10.1
[3.10.0]: https://github.com/TACC/Core-Portal/releases/tag/v3.10.0
[3.9.0]: https://github.com/TACC/Core-Portal/releases/tag/v3.9.0
[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
Expand Down
8 changes: 3 additions & 5 deletions client/src/components/Applications/AppForm/AppForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ const HandleDependentFieldChanges = ({ app, formStateUpdateHandler }) => {
const { values, setValues } = useFormikContext();
React.useEffect(() => {
if (previousValues) {
let valueUpdated = false;
let updatedValues = { ...values };

// Set the current allocation
Expand All @@ -171,24 +170,23 @@ const HandleDependentFieldChanges = ({ app, formStateUpdateHandler }) => {
updatedValues,
formStateUpdateHandler
);
valueUpdated = true;
}
if (previousValues.execSystemId !== values.execSystemId) {
updatedValues = execSystemChangeHandler(
app,
values,
formStateUpdateHandler
);
valueUpdated = true;
}

if (
previousValues.execSystemLogicalQueue !== values.execSystemLogicalQueue
) {
updatedValues = updateValuesForQueue(app, values);
valueUpdated = true;
}
if (valueUpdated) setValues(updatedValues);
if (JSON.stringify(updatedValues) !== JSON.stringify(values)) {
setValues(updatedValues);
}
}
setPreviousValues(values);
}, [app, values, setValues, formStateUpdateHandler]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,3 +324,102 @@ describe('DataFilesListing - Section Name Determination', () => {
).toBeInTheDocument();
});
});
describe('DataFilesListing - showViewPath', () => {
afterEach(() => {
vi.restoreAllMocks();
});
it('renders the "Path" column when showViewPath is true', () => {
const testfile = {
system: 'test.system',
path: '/path/to/file',
name: 'testfile',
format: 'file',
length: 4096,
lastModified: '2019-06-17T15:49:53-05:00',
_links: { self: { href: 'href.test' } },
};
const history = createMemoryHistory();
history.push('/workbench/data/tapis/private/test.system/');
const store = mockStore({
...initialMockState,
files: {
...initialMockState.files,
listing: { FilesListing: [testfile] },
},
workbench: {
config: {
viewPath: true,
},
},
});
// Spy on useMemo to capture the cells array
const useMemoSpy = vi
.spyOn(React, 'useMemo')
.mockImplementation((fn) => fn());
const { getByText } = renderComponent(
<DataFilesListing
api="tapis"
scheme="private"
system="test.system"
resultCount={4}
path="/"
/>,
store,
history
);
// Path cell is added
expect(getByText('Path')).toBeDefined();
// Check the length of the cells array
const cellsArray = useMemoSpy.mock.results.find((result) =>
Array.isArray(result.value)
).value;
expect(cellsArray.length).toBe(6);
});
it('does not render the "Path" column when showViewPath is false', () => {
const testfile = {
system: 'test.system',
path: '/path/to/file',
name: 'testfile',
format: 'file',
length: 4096,
lastModified: '2019-06-17T15:49:53-05:00',
_links: { self: { href: 'href.test' } },
};
const history = createMemoryHistory();
history.push('/workbench/data/tapis/private/test.system/');
const store = mockStore({
...initialMockState,
files: {
...initialMockState.files,
listing: { FilesListing: [testfile] },
},
workbench: {
config: {
viewPath: false,
},
},
});
// Spy on useMemo to capture the cells array
const useMemoSpy = vi
.spyOn(React, 'useMemo')
.mockImplementation((fn) => fn());
const { queryByText } = renderComponent(
<DataFilesListing
api="tapis"
scheme="private"
system="test.system"
resultCount={4}
path="/"
/>,
store,
history
);
// Path should not exist as a new cell
expect(queryByText('Path')).toBeNull();
// Check the length of the cells array
const cellsArray = useMemoSpy.mock.results.find((result) =>
Array.isArray(result.value)
).value;
expect(cellsArray.length).toBe(5);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,7 @@ describe('DataFilesCopyModal', () => {
const submitButton = getByText('Create Folder');
fireEvent.click(submitButton);
});

expect(store.getActions()).toEqual([
{
type: 'DATA_FILES_MKDIR',
payload: {
api: 'tapis',
scheme: 'private',
system: 'test.system',
path: '/',
dirname: 'abc123',
reloadCallback: expect.any(Function),
},
},
]);
// TODO: New test needed for react redux call for mkdir
});

it('Error message on invalid input', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
}

.member-search {
margin-bottom: 1em;
font-size: 12px !important;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe('DataFilesSidebar', () => {
).toEqual(
'/workbench/data/tapis/private/longhorn.home.username/home/username/'
);
expect(queryByText(/My Data \(Work\)/)).toBeNull();
expect(queryByText(/My Data \(Work\)/)).toBeDefined();
});

it('disables creating new shared workspaces in read only shared workspaces', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe('DataFilesSystemSelector', () => {
store,
history
);
expect(queryByText(/My Data \(Work\)/)).toBeNull();
expect(queryByText(/My Data \(Work\)/)).toBeDefined();
expect(queryByText(/My Data \(Frontera\)/)).toBeDefined();
expect(queryByText(/My Data \(Longhorn\)/)).toBeDefined();
expect(queryByText(/Google Drive/)).toBeDefined();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/* TODOv3 update this fixture https://jira.tacc.utexas.edu/browse/WP-68*/

// Updated fixture changes from endpoint https://cep.test/api/datafiles/systems/list/
// Removed from configuration: hidden, keyservice
// Removed from storage and defintions array: errorMessage, loading
const systemsFixture = {
storage: {
configuration: [
Expand All @@ -9,10 +11,8 @@ const systemsFixture = {
scheme: 'private',
api: 'tapis',
icon: null,
hidden: true,
homeDir: '/home/username',
default: true,
keyservice: true,
},
{
name: 'My Data (Frontera)',
Expand Down Expand Up @@ -65,13 +65,30 @@ const systemsFixture = {
integration: 'portal.apps.googledrive_integration',
},
],
error: false,
errorMessage: null,
loading: false,
/*
* The following needs to be mirrored for the storage and definitions
These are included in the datafiles reducers but pass tests without these
This means that tests need to be more comprehensive to catch this or removed
Definitions that use variables other than list are used in:
- DataFilesTable.jsx:45 for error
state.systems.definitions.* is not called for anything else other than error
These would need to be removed then
- errorMessage
- loading
*/

//error: false,
//errorMessage: null,
//loading: false,
defaultHost: 'frontera.tacc.utexas.edu',
defaultSystem: 'frontera',
},
// This definitions is required for the tests, some can be removed. Referencing datafiles.reducers.js
definitions: {
// For DataFilesTable and DataFilesShowPathModal it requires the id from this list
list: [
{
id: 'frontera.home.username',
Expand All @@ -90,9 +107,9 @@ const systemsFixture = {
effectiveUserId: 'username',
},
],
error: false,
errorMessage: null,
loading: false,
error: false, // Commenting this out results in an error
//errorMessage: null,
//loading: false,
},
};

Expand Down
3 changes: 2 additions & 1 deletion client/src/components/DataFiles/tests/DataFiles.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe('DataFiles', () => {
//);
expect(getAllByText(/My Data \(Frontera\)/)).toBeDefined();
expect(getByText(/My Data \(Longhorn\)/)).toBeDefined();
expect(queryByText(/My Data \(Work\)/)).toBeNull();
expect(queryByText(/My Data \(Work\)/)).toBeDefined(); // Changed to defined, hidden attribute removed and would be defined by default
});

it('should not render Data Files with no systems', () => {
Expand All @@ -62,6 +62,7 @@ describe('DataFiles', () => {
},
},
systems: {
// TODO: Remove rest of unused variables
storage: {
configuration: [
{
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Jobs/JobsStatus/JobsStatus.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function JobsStatus({ status, fancy, jobUuid }) {
return (
<div className={styles.root}>
{fancy && color ? (
<Badge clasName={`badge-${color}`} color={null}>
<Badge className={`badge-${color}`} color={null}>
{userStatus}
</Badge>
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,33 @@ describe('Third Party Apps', () => {
expect(getByText('Google Drive')).toBeDefined();
expect(getByText('Disconnect')).toBeDefined();
});
it('Shows potential 3rd party connections other than Google Drive', () => {
const testStore = mockStore({
profile: {
...dummyState,
data: {
...dummyState.data,
integrations: [
{
label: '3rd Party Service',
description: '3rd Party Service description',
activated: true,
},
],
},
},
});
const { getByText, queryByText } = render(
<Provider store={testStore}>
<Integrations />
</Provider>
);
expect(getByText(/3rd Party Apps/)).toBeInTheDocument();
// Check that Google Drive is not rendered
expect(queryByText('Google Drive')).toBeNull();
// Check that other integrations are rendered
expect(getByText('3rd Party Service')).toBeInTheDocument();
});
});

describe('License Cell', () => {
Expand Down
1 change: 1 addition & 0 deletions client/src/components/PublicData/PublicData.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ const PublicDataListing = ({ canDownload, downloadCallback }) => {
disabled={!canDownload}
/>
}
contentLayoutName="oneColumn"
>
<SectionTableWrapper className={styles.content} manualContent>
<DataFilesListing
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/PublicData/PublicData.module.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
.content {
/* As a flex child */
flex-grow: 1;

/* WARNING: Mimicked on: History, Allocation, DataFiles, DataFilesProjectsList, DataFilesProjectFileListing, PublicData */
padding-top: 1.75rem; /* ~28px (22.5px * design * 1.2 design-to-app ratio) */
/* There is no sidebar, so there is no need for space to the left */
/* FAQ: Public pages, like `PublicData` and `SiteSearch`, have no sidebar */
/* padding-left: 1.5em; /* ~24px (20px * design * 1.2 design-to-app ratio) */
}

1 change: 1 addition & 0 deletions client/src/components/_common/Form/FormField.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ const FormField = ({

<InputGroup>
<Button
size="middle"
type="secondary"
onClick={() => setOpenTapisFileModal(true)}
>
Expand Down
Loading

0 comments on commit 0db1cfa

Please sign in to comment.