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

task/WP-65-DropdownViewFullPath #866

Merged
merged 24 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
11f5121
task/WP-65-DropdownViewFullPath
Sep 29, 2023
d566301
task/WP-65-DropdownViewFullPath-v2
Oct 2, 2023
ad75f18
task/WP-65-DropdownViewFullPath-v3
Oct 2, 2023
123a766
task/WP-65-DropdownViewFullPath-v4
Oct 2, 2023
2d446c1
task/WP-65-DropdownViewFullPath-v5
Oct 2, 2023
3c0ca4a
Merge branch 'main' into task/WP-65-DropdownViewFullPath
rstijerina Oct 3, 2023
c531d37
task/WP-65-DropdownViewFullPathv6
Oct 3, 2023
f9605ac
Merge branch 'task/WP-65-DropdownViewFullPath' of github.com:TACC/Cor…
Oct 3, 2023
1fb6ab8
Merge branch 'main' into task/WP-65-DropdownViewFullPath
wesleyboar Oct 4, 2023
d20f4cb
task/WP-65-DropdownViewFullPath-v7
Oct 4, 2023
a72b22c
task/WP-65-DropdownViewFullPath - dropdown-menu css component (#875)
wesleyboar Oct 4, 2023
41b0f80
task/WP-65-DropdownViewFullPath-v8
Oct 5, 2023
00f4c5c
task/WP-65-DropdownViewFullPath-v9
Oct 5, 2023
8d3b8ab
task/WP-65-DropdownViewFullPath-v10
Oct 5, 2023
e4b6329
Merge branch 'main' into task/WP-65-DropdownViewFullPath
tjgrafft Oct 10, 2023
00a1ce0
task/WP-65-DropdownViewFullPath-v11
Oct 10, 2023
488f169
task/WP-65-DropdownViewFullPath-v12
Oct 10, 2023
78e0cc4
Merge branch 'main' into task/WP-65-DropdownViewFullPath
tjgrafft Oct 20, 2023
2ea3b0f
task/WP-65-DropdownViewFullPath-v13
Oct 24, 2023
c41e082
task/WP-65-DropdownViewFullPath-v14
Oct 24, 2023
0f002c1
task/WP-65-DropdownViewFullPath-v15
Oct 25, 2023
1e5d30c
Merge branch 'main' into task/WP-65-DropdownViewFullPath
rstijerina Oct 27, 2023
d72ae52
Update client/src/components/DataFiles/DataFilesModals/DataFilesShowP…
chandra-tacc Oct 27, 2023
d01917f
prettier fix
chandra-tacc Oct 27, 2023
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from 'react';
import PropTypes from 'prop-types';
import DataFilesBreadcrumbs from '../DataFilesBreadcrumbs/DataFilesBreadcrumbs.jsx';
import BreadcrumbsDropdown from '../DataFilesDropdown/DataFilesDropdown.jsx';
import styles from './CombinedBreadcrumbs.module.scss';

const CombinedBreadcrumbs = (props) => {
return (
<div className={styles['combined-breadcrumbs']}>
<BreadcrumbsDropdown {...props} />
<DataFilesBreadcrumbs {...props} />
</div>
);
};

CombinedBreadcrumbs.propTypes = {
api: PropTypes.string.isRequired,
scheme: PropTypes.string.isRequired,
system: PropTypes.string.isRequired,
path: PropTypes.string.isRequired,
section: PropTypes.string.isRequired,
isPublic: PropTypes.bool,
className: PropTypes.string,
};

CombinedBreadcrumbs.defaultProps = {
isPublic: false,
className: '',
};

export default CombinedBreadcrumbs;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.combined-breadcrumbs {
display: flex;
align-items: center;
gap: 1rem;
}
4 changes: 2 additions & 2 deletions client/src/components/DataFiles/DataFiles.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { useFileListing, useSystems } from 'hooks/datafiles';
import DataFilesToolbar from './DataFilesToolbar/DataFilesToolbar';
import DataFilesListing from './DataFilesListing/DataFilesListing';
import DataFilesSidebar from './DataFilesSidebar/DataFilesSidebar';
import DataFilesBreadcrumbs from './DataFilesBreadcrumbs/DataFilesBreadcrumbs';
import CombinedBreadcrumbs from './CombinedBreadcrumbs/CombinedBreadcrumbs';
import DataFilesModals from './DataFilesModals/DataFilesModals';
import DataFilesProjectsList from './DataFilesProjectsList/DataFilesProjectsList';
import DataFilesProjectFileListing from './DataFilesProjectFileListing/DataFilesProjectFileListing';
Expand Down Expand Up @@ -138,7 +138,7 @@ const DataFiles = () => {
listingParams.system === noPHISystem ? 'UNPROTECTED' : 'DATA'
}
header={
<DataFilesBreadcrumbs
<CombinedBreadcrumbs
api={listingParams.api}
scheme={listingParams.scheme}
system={listingParams.system}
Expand Down
wesleyboar marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import React from 'react';
import { useState } from 'react';
import { useDispatch } from 'react-redux';
import { Button } from '_common';
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';
import { v4 as uuidv4 } from 'uuid';
import './DataFilesBreadcrumbs.scss';
import '../DataFilesModals/DataFilesShowPathModal.jsx';
import {
useSystemDisplayName,
useFileListing,
useModal,
useSystems,
} from 'hooks/datafiles';
import truncateMiddle from 'utils/truncateMiddle';

const BreadcrumbLink = ({
api,
Expand All @@ -35,7 +40,7 @@ const BreadcrumbLink = ({
case 'FilesListing':
return (
<Link
className="breadcrumb-link"
className="breadcrumb-link truncate"
to={`${basePath}/${api}/${scheme}/${system}${path}/`}
>
{children}
Expand All @@ -46,7 +51,7 @@ const BreadcrumbLink = ({
return (
<span>
<a
className="breadcrumb-link"
className="breadcrumb-link truncate"
href={`/workbench/data/${api}/${scheme}/${system}${path}/`}
onClick={onClick}
>
Expand Down Expand Up @@ -120,6 +125,22 @@ const DataFilesBreadcrumbs = ({
const paths = [];
const pathComps = [];

const dispatch = useDispatch();

const fileData = {
system: system,
path: path,
};

const openFullPathModal = (e) => {
e.stopPropagation();
e.preventDefault();
dispatch({
type: 'DATA_FILES_TOGGLE_MODAL',
payload: { operation: 'showpath', props: { file: fileData } },
});
};
rstijerina marked this conversation as resolved.
Show resolved Hide resolved

const { fetchSelectedSystem } = useSystems();

const selectedSystem = fetchSelectedSystem({ scheme, system, path });
Expand Down Expand Up @@ -155,52 +176,29 @@ const DataFilesBreadcrumbs = ({
}
}, '');

const fullPath = paths.slice(-1);
const currentDirectory = pathComps.slice(-1);

return (
<div className={`breadcrumbs ${className}`}>
{scheme === 'projects' && (
<>
<RootProjectsLink
api={api}
section={section}
operation={operation}
label="Shared Workspaces"
/>{' '}
{system && `/ `}
</>
Comment on lines -159 to -169
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously we had the "Shared Workspaces" root in the breadcrumb path. Do we want to include that with this feature as well?
Screenshot 2023-10-18 at 12 16 08 PM

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SharedProjects What do you think of this? I'll fix the folder icon alignment, but do you like this idea for Shared Workspaces?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

<div className="breadcrumb-container">
<div className={`breadcrumbs ${className}`}>
{currentDirectory.length === 0 ? (
<span className="system-name">
{truncateMiddle(systemName || 'Shared Workspaces', 30)}
</span>
) : (
currentDirectory.map((pathComp, i) => {
if (i === fullPath.length - 1) {
return <span key={uuidv4()}>{truncateMiddle(pathComp, 30)}</span>;
}
})
)}
</div>
{systemName && api === 'tapis' && (
<Button type="link" onClick={openFullPathModal}>
View Full Path
</Button>
)}
<BreadcrumbLink
api={api}
scheme={scheme}
system={system}
path={startingPath}
section={section}
isPublic={isPublic}
>
<>{systemName}</>
</BreadcrumbLink>
{pathComps.map((pathComp, i) => {
if (i < paths.length - 2) {
return ' /... ';
}
if (i === paths.length - 1) {
return <span key={uuidv4()}> / {pathComp}</span>;
}
return (
<React.Fragment key={uuidv4()}>
{' '}
/{' '}
<BreadcrumbLink
api={api}
scheme={scheme}
system={system}
path={paths[i]}
section={section}
>
<>{pathComp}</>
</BreadcrumbLink>
</React.Fragment>
);
})}
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
@import '../../../styles/tools/mixins.scss';
@import '../../../styles/components/dropdown-menu.css';

.breadcrumbs {
/* ... */
@include truncate-with-ellipsis;
margin-right: 2em;
display: flex;
align-items: center;
}
.breadcrumb-link,
.breadcrumb-link:hover {
Expand Down Expand Up @@ -34,3 +37,74 @@
max-width: 700px;
}
}

#path-button-wrapper {
padding-left: var(--horizontal-buffer);
}

/* Nested to prevent styles from affecting CMS header dropdown */
/* HACK: Using ID to increase specificity (until source of problem is fixed) */
/* HELP: Why does DataFilesSidebar not need such specificity? */
/* .go-to-button-dropdown { */
#go-to-button-dropdown {
/* To fix menu not showing */
/* HELP: Why does DataFilesSidebar not need this fix? */
.dropdown-menu {
opacity: 1 !important;
pointer-events: auto !important;
}
/* To restyle */
.dropdown-menu {
margin-top: 38px;
}
.dropdown-menu::before,
.dropdown-menu::after {
left: 23px;
margin-left: 0;
}
.dropdown-menu::after {
top: -9px;
}

.dropdown-item {
display: inline-block;
}
}

.breadcrumb-container {
display: flex;
align-items: center;
}

.truncate {
display: inline-block;
max-width: 600px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
padding-left: 20px;
}

#go-to-button-dropdown .complex-dropdown-item-root,
.complex-dropdown-item-project {
display: flex !important;
}

#go-to-button-dropdown .link-hover:hover {
text-decoration: none;
}

.multiline-menu-item-wrapper {
display: inline-block;
padding-left: 5px;
line-height: 1.1em;
small {
display: block;
color: var(--global-color-primary--x-dark);
}
}

.breadcrumbs .vertical-align-separator {
margin-right: 2px;
margin-left: 10px;
}
Loading