Skip to content

Commit

Permalink
Task/WP-66: Refactored some variables and props to include proptypes (#…
Browse files Browse the repository at this point in the history
…876)

* Refactored some variables and props to include proptypes

* fixed linting errors
  • Loading branch information
asimregmi authored Oct 9, 2023
1 parent a0ade92 commit b31a09d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ const DataFilesProjectMembers = ({
};

DataFilesProjectMembers.propTypes = {
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 @@ -27,7 +27,7 @@ const DataFilesAddButton = ({ readOnly }) => {
payload: { operation: 'upload', props: {} },
});
};
const err = useSelector((state) => state.files.error.FilesListing);
const hasError = useSelector((state) => state.files.error.FilesListing);
const { api, scheme } = useSelector(
(state) => state.files.params.FilesListing
);
Expand Down Expand Up @@ -60,7 +60,7 @@ const DataFilesAddButton = ({ readOnly }) => {

const disabled =
readOnly ||
err !== false ||
hasError !== false ||
api !== 'tapis' ||
(scheme !== 'private' && scheme !== 'projects');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,18 @@ const OPERATION_MAP = {
case 'upload':
case 'move':
case 'copy': {
const destPath = response.path.split('/').slice(0, -1).join('/');
const projectName = findProjectTitle(projectList, response.systemId);
const { path, systemId, source } = response;
const destPath = path.split('/').slice(0, -1).join('/');
const projectName = findProjectTitle(projectList, systemId);

let op = mappedOp;

if (mappedOp === 'copied') {
const srcSystem =
response.source.split('/')[0] === 'https:'
? response.source.split('/')[7]
: response.source.split('/')[2];
const destSystem = response.systemId;
source.split('/')[0] === 'https:'
? source.split('/')[7]
: source.split('/')[2];
const destSystem = systemId;
if (srcSystem !== destSystem) {
op = 'started copying';
}
Expand All @@ -62,7 +63,7 @@ const OPERATION_MAP = {
} else {
dest =
destPath === '/' || destPath === ''
? `${findSystemDisplayName(systemList, response.systemId)}/`
? `${findSystemDisplayName(systemList, systemId)}/`
: destPath;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { DropdownSelector } from '_common';
import styles from './DataFilesSystemSelector.module.scss';

const DataFilesSystemSelector = ({
systemId,

This comment has been minimized.

Copy link
@nathanfranklin

nathanfranklin Oct 9, 2023

Member

for renaming a property, we'll need to update the uses of DataFilesSystemSelector to reflect that change

systemAndHomeDirId,
section,
disabled,
operation,
Expand All @@ -17,11 +17,12 @@ const DataFilesSystemSelector = ({
(state) => state.systems.storage.configuration
);
const modalProps = useSelector((state) => state.files.modalProps[operation]);
const findSystem = (id) =>
const findSystem = (systemAndHomeDirPath) =>
systemList.find(
(system) => `${system.system}${system.homeDir || ''}` === id
(system) =>
`${system.system}${system.homeDir || ''}` === systemAndHomeDirPath
);
const [selectedSystem, setSelectedSystem] = useState(systemId);
const [selectedSystem, setSelectedSystem] = useState(systemAndHomeDirId);

const openSystem = useCallback(
(event) => {
Expand Down Expand Up @@ -69,7 +70,7 @@ const DataFilesSystemSelector = ({
};

useEffect(() => {
setSelectedSystem(systemId);
setSelectedSystem(systemAndHomeDirId);
}, []);

const dropdownSystems = systemList.filter(
Expand Down Expand Up @@ -111,7 +112,7 @@ const DataFilesSystemSelector = ({
};

DataFilesSystemSelector.propTypes = {
systemId: PropTypes.string,
systemAndHomeDirId: PropTypes.string,
section: PropTypes.string.isRequired,
disabled: PropTypes.bool,
operation: PropTypes.string.isRequired,
Expand All @@ -120,7 +121,7 @@ DataFilesSystemSelector.propTypes = {
};

DataFilesSystemSelector.defaultProps = {
systemId: '',
systemAndHomeDirId: '',
disabled: false,
showProjects: false,
excludedSystems: [],
Expand Down

0 comments on commit b31a09d

Please sign in to comment.