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

Add Unarchive button to a dashboard #4697

Merged
merged 1 commit into from
Jul 3, 2022
Merged

Add Unarchive button to a dashboard #4697

merged 1 commit into from
Jul 3, 2022

Conversation

arikfr
Copy link
Member

@arikfr arikfr commented Mar 1, 2020

What type of PR is this? (check all applicable)

  • Feature

Description

Follow up to #4669, added an "Unarchive" button to an archived dashboard.

Related Tickets & Documents

redashlabs/product#47
closes #982

Mobile & Desktop Screenshots/Recordings (if there are UI changes)

Screen-Recording-2020-03-01-at-2


const unarchiveDashboard = () => {
recordEvent("unarchive", "dashboard", dashboard.id);
updateDashboard({ is_archived: false }, false);
Copy link
Member Author

Choose a reason for hiding this comment

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

@gabrieldutra I've noticed for some of the update operations we don't send dashboard version information. When I did try sending version here, it had out of date version. It seems like we're hiding some flawed logic by avoiding sending the version with all updates. For example here: after unarchiving a dashboard you can no longer edit it.

We should address this in a separate PR, but wanted to point out to start the discussion in case I overlooked something.

Copy link
Member

Choose a reason for hiding this comment

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

The archive function is the only one that doesn't send dashboard version information, no? Anyway, I think I know what's going on, the update function is set to only update the changed keys from the dashboard object. Since the archive method doesn't send the version information, it keeps the outdated version.

In case you want to make it work for this PR (or lmk if you want me to push a commit), it should be a matter of changing this line to pick(updatedDashboard, [...keys(data), "version"]:

setDashboard(currentDashboard => extend({}, currentDashboard, pick(updatedDashboard, keys(data))))

@susodapop
Copy link
Contributor

@arikfr When I click the Unarchive button in deploy preview it issues the right ajax request. But it seems the dashboard is still archived.

Is this because the preview backend hasn't merged #4669?

@gabrieldutra
Copy link
Member

Is this because the preview backend hasn't merged #4669?

Most likely the backend hasn't been updated yet 😅, it's working in my local environment anyway :)

client/app/pages/dashboards/DashboardPage.jsx Outdated Show resolved Hide resolved

const unarchiveDashboard = () => {
recordEvent("unarchive", "dashboard", dashboard.id);
updateDashboard({ is_archived: false }, false);
Copy link
Member

Choose a reason for hiding this comment

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

The archive function is the only one that doesn't send dashboard version information, no? Anyway, I think I know what's going on, the update function is set to only update the changed keys from the dashboard object. Since the archive method doesn't send the version information, it keeps the outdated version.

In case you want to make it work for this PR (or lmk if you want me to push a commit), it should be a matter of changing this line to pick(updatedDashboard, [...keys(data), "version"]:

setDashboard(currentDashboard => extend({}, currentDashboard, pick(updatedDashboard, keys(data))))

@amirashakernady
Copy link

i need to know when the Un-archive button ready to be released ?

@susodapop
Copy link
Contributor

Thanks for pinging this @amirashakernady . I'll prioritise this one for this month.

@susodapop susodapop self-assigned this May 12, 2022
@amirashakernady
Copy link

Thanks a million @susodapop

@susodapop
Copy link
Contributor

I've rebased off the latest master.

@susodapop susodapop merged commit e2bad61 into master Jul 3, 2022
@susodapop susodapop deleted the unpublish-control branch July 3, 2022 18:14
AkaashK pushed a commit to tharzeez/redash that referenced this pull request Jul 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add an "unarchive" button on archived dashboards
4 participants