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

UI improvement of "Request Access" #1228

Merged
merged 7 commits into from
May 16, 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
26 changes: 13 additions & 13 deletions frontend/src/modules/Catalog/components/GlossarySearchResultItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
Divider,
Grid,
IconButton,
Button,
Link,
Tooltip,
Typography
Expand Down Expand Up @@ -281,19 +282,18 @@ export const GlossarySearchResultItem = ({ hit }) => {
{isOpeningModal || isOpeningDashboardModal ? (
<CircularProgress size={20} />
) : (
<Tooltip title="Request Access">
<IconButton
color="primary"
edge="end"
onClick={() =>
hit.resourceKind === 'dashboard'
? handleRequestDashboardAccessModalOpen()
: handleRequestAccessModalOpen()
}
>
<LockOpen fontSize="small" />
</IconButton>
</Tooltip>
<Button
color="primary"
startIcon={<LockOpen fontSize="small" />}
onClick={() =>
hit.resourceKind === 'dashboard'
? handleRequestDashboardAccessModalOpen()
: handleRequestAccessModalOpen()
}
type="button"
>
Request Access
</Button>
)}
<RequestAccessModal
hit={hit}
Expand Down
116 changes: 78 additions & 38 deletions frontend/src/modules/S3_Datasets/views/DatasetView.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
ForumOutlined,
Info,
LocalOffer,
LockOpen,
ShareOutlined,
Upload,
ViewArrayOutlined
Expand Down Expand Up @@ -49,6 +50,7 @@ import {
DatasetUpload
} from '../components';
import { isFeatureEnabled } from 'utils';
import { RequestAccessModal } from '../../Catalog/components';

const DatasetView = () => {
const dispatch = useDispatch();
Expand Down Expand Up @@ -122,6 +124,16 @@ const DatasetView = () => {
[client]
);

const [isRequestAccessOpen, setIsRequestAccessOpen] = useState(false);
const [isOpeningModal, setIsOpeningModal] = useState(false);
const handleRequestAccessModalOpen = () => {
setIsOpeningModal(true);
setIsRequestAccessOpen(true);
};

const handleRequestAccessModalClose = () => {
setIsRequestAccessOpen(false);
};
const reloadVotes = async () => {
const response = await client.query(countUpVotes(params.uri, 'dataset'));
if (!response.errors && response.data.countUpVotes !== null) {
Expand Down Expand Up @@ -262,50 +274,78 @@ const DatasetView = () => {
</Link>
</Breadcrumbs>
</Grid>
{isAdmin && (
<Grid item>
<Box sx={{ m: -1 }}>
<UpVoteButton
upVoted={isUpVoted}
onClick={() => upVoteDataset(dataset.datasetUri)}
upVotes={upVotes}
/>
<Button
color="primary"
startIcon={<ForumOutlined fontSize="small" />}
sx={{ mt: 1, mr: 1 }}
onClick={() => setOpenFeed(true)}
type="button"
variant="outlined"
>
Chat
</Button>
{isFeatureEnabled('s3_datasets', 'aws_actions') && (
<DatasetAWSActions dataset={dataset} isAdmin={isAdmin} />
)}
<Button
color="primary"
component={RouterLink}
startIcon={<PencilAltIcon fontSize="small" />}
sx={{ mt: 1, mr: 1 }}
to={`/console/datasets/${dataset.datasetUri}/edit`}
variant="outlined"
>
Edit
</Button>

<Grid item>
<Box sx={{ m: -1 }}>
{isAdmin && (
<span>
<UpVoteButton
upVoted={isUpVoted}
onClick={() => upVoteDataset(dataset.datasetUri)}
upVotes={upVotes}
/>
<Button
color="primary"
startIcon={<ForumOutlined fontSize="small" />}
sx={{ mt: 1, mr: 1 }}
onClick={() => setOpenFeed(true)}
type="button"
variant="outlined"
>
Chat
</Button>
{isFeatureEnabled('s3_datasets', 'aws_actions') && (
<DatasetAWSActions dataset={dataset} isAdmin={isAdmin} />
)}
<Button
color="primary"
component={RouterLink}
startIcon={<PencilAltIcon fontSize="small" />}
sx={{ mt: 1, mr: 1 }}
to={`/console/datasets/${dataset.datasetUri}/edit`}
variant="outlined"
>
Edit
</Button>
<Button
color="primary"
startIcon={<FaTrash size={15} />}
sx={{ mt: 1 }}
onClick={handleDeleteObjectModalOpen}
type="button"
variant="outlined"
>
Delete
</Button>
</span>
)}
{isOpeningModal ? (
<CircularProgress size={20} />
) : (
<Button
color="primary"
startIcon={<FaTrash size={15} />}
sx={{ mt: 1 }}
onClick={handleDeleteObjectModalOpen}
startIcon={<LockOpen size={15} />}
onClick={handleRequestAccessModalOpen}
type="button"
sx={{ mt: 1, ml: 1 }}
variant="outlined"
>
Delete
Request Access
</Button>
</Box>
</Grid>
)}
)}
<RequestAccessModal
onApply={handleRequestAccessModalClose}
onClose={handleRequestAccessModalClose}
open={isRequestAccessOpen}
stopLoader={() => setIsOpeningModal(false)}
hit={{
_id: dataset.datasetUri,
resourceKind: 'dataset',
label: dataset.label
}}
/>
</Box>
</Grid>
</Grid>
<Box sx={{ mt: 3 }}>
<Tabs
Expand Down
Loading