forked from github/plane
chore: update view button (#523)
This commit is contained in:
parent
7731ee5de4
commit
3d34741356
@ -118,18 +118,6 @@ export const IssuesView: React.FC<Props> = ({
|
|||||||
: null
|
: null
|
||||||
);
|
);
|
||||||
|
|
||||||
const { data: viewDetails } = useSWR(
|
|
||||||
workspaceSlug && projectId && viewId ? VIEW_DETAILS(viewId as string) : null,
|
|
||||||
workspaceSlug && projectId && viewId
|
|
||||||
? () =>
|
|
||||||
viewsService.getViewDetails(
|
|
||||||
workspaceSlug as string,
|
|
||||||
projectId as string,
|
|
||||||
viewId as string
|
|
||||||
)
|
|
||||||
: null
|
|
||||||
);
|
|
||||||
|
|
||||||
const handleDeleteIssue = useCallback(
|
const handleDeleteIssue = useCallback(
|
||||||
(issue: IIssue) => {
|
(issue: IIssue) => {
|
||||||
setDeleteIssueModal(true);
|
setDeleteIssueModal(true);
|
||||||
@ -405,8 +393,6 @@ export const IssuesView: React.FC<Props> = ({
|
|||||||
(key) => filters[key as keyof IIssueFilterOptions] === null
|
(key) => filters[key as keyof IIssueFilterOptions] === null
|
||||||
);
|
);
|
||||||
|
|
||||||
const isUpdatingView = JSON.stringify(filters) === JSON.stringify(viewDetails?.query_data);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<CreateUpdateViewModal
|
<CreateUpdateViewModal
|
||||||
@ -556,8 +542,7 @@ export const IssuesView: React.FC<Props> = ({
|
|||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{viewId
|
{Object.keys(filters).length > 0 && nullFilters.length !== Object.keys(filters).length && (
|
||||||
? isUpdatingView && (
|
|
||||||
<PrimaryButton
|
<PrimaryButton
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (viewId) {
|
if (viewId) {
|
||||||
@ -574,29 +559,8 @@ export const IssuesView: React.FC<Props> = ({
|
|||||||
}}
|
}}
|
||||||
className="flex items-center gap-2 text-sm"
|
className="flex items-center gap-2 text-sm"
|
||||||
>
|
>
|
||||||
Update view
|
{!viewId && <PlusIcon className="h-4 w-4" />}
|
||||||
</PrimaryButton>
|
{viewId ? "Update" : "Save"} view
|
||||||
)
|
|
||||||
: Object.keys(filters).length > 0 &&
|
|
||||||
nullFilters.length !== Object.keys(filters).length && (
|
|
||||||
<PrimaryButton
|
|
||||||
onClick={() => {
|
|
||||||
if (viewId) {
|
|
||||||
setFilters({}, true);
|
|
||||||
setToastAlert({
|
|
||||||
title: "View updated",
|
|
||||||
message: "Your view has been updated",
|
|
||||||
type: "success",
|
|
||||||
});
|
|
||||||
} else
|
|
||||||
setCreateViewModal({
|
|
||||||
query: filters,
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
className="flex items-center gap-2 text-sm"
|
|
||||||
>
|
|
||||||
<PlusIcon className="h-4 w-4" />
|
|
||||||
Save view
|
|
||||||
</PrimaryButton>
|
</PrimaryButton>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user