+
diff --git a/client/app/pages/dashboards/dashboard.js b/client/app/pages/dashboards/dashboard.js
index 236b6c3dba..45952d8bc6 100644
--- a/client/app/pages/dashboards/dashboard.js
+++ b/client/app/pages/dashboards/dashboard.js
@@ -196,6 +196,23 @@ function DashboardCtrl(
AlertDialog.open(title, message, confirm).then(archive);
};
+ this.unArchiveDashboard = () => {
+ Events.record('unarchive', 'dashboard', this.dashboard.id);
+ Dashboard.unarchive(
+ {
+ slug: this.dashboard.id,
+ is_archived: false,
+ },
+ () => {
+ this.loadDashboard();
+ toastr.success('Dashboard unarchived');
+ },
+ () => {
+ toastr.error('Dashboard could not be unarchived.');
+ },
+ );
+ };
+
this.showManagePermissionsModal = () => {
$uibModal.open({
component: 'permissionsEditor',
diff --git a/client/app/services/dashboard.js b/client/app/services/dashboard.js
index 04e5f74ad7..8439227fe7 100644
--- a/client/app/services/dashboard.js
+++ b/client/app/services/dashboard.js
@@ -50,6 +50,11 @@ function Dashboard($resource, $http, currentUser, Widget, dashboardGridOptions)
url: 'api/dashboards/recent',
transformResponse: transform,
},
+ unarchive: {
+ method: 'POST',
+ transformResponse: transform,
+ url: 'api/dashboards/:slug/unarchive',
+ },
});
resource.prototype.canEdit = function canEdit() {
diff --git a/redash/handlers/api.py b/redash/handlers/api.py
index f555246657..d0b375c31d 100644
--- a/redash/handlers/api.py
+++ b/redash/handlers/api.py
@@ -46,7 +46,9 @@ def json_representation(data, code, headers=None):
api.add_org_resource(DashboardListResource, '/api/dashboards', endpoint='dashboards')
api.add_org_resource(RecentDashboardsResource, '/api/dashboards/recent', endpoint='recent_dashboards')
-api.add_org_resource(DashboardResource, '/api/dashboards/
', endpoint='dashboard')
+api.add_org_resource(DashboardResource, '/api/dashboards/',
+ '/api/dashboards//unarchive',
+ endpoint='dashboard')
api.add_org_resource(PublicDashboardResource, '/api/dashboards/public/', endpoint='public_dashboard')
api.add_org_resource(DashboardShareResource, '/api/dashboards//share', endpoint='dashboard_share')
diff --git a/redash/handlers/dashboards.py b/redash/handlers/dashboards.py
index 21564e05ee..8c2e06d919 100644
--- a/redash/handlers/dashboards.py
+++ b/redash/handlers/dashboards.py
@@ -129,7 +129,8 @@ def post(self, dashboard_slug):
require_object_modify_permission(dashboard, self.current_user)
updates = project(dashboard_properties, ('name', 'layout', 'version',
- 'is_draft', 'dashboard_filters_enabled'))
+ 'is_draft', 'dashboard_filters_enabled',
+ 'is_archived'))
# SQLAlchemy handles the case where a concurrent transaction beats us
# to the update. But we still have to make sure that we're not starting