Skip to content

Commit 86f945d

Browse files
committed
add confirm
1 parent b6f4d27 commit 86f945d

File tree

7 files changed

+48
-11
lines changed

7 files changed

+48
-11
lines changed

samples/UmbracoV9/App_Plugins/Relewise.Dashboard/dashboard.controller.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,26 @@
1818
});
1919
}
2020

21+
vm.exportContentPermanentlyDelete = function () {
22+
const confirmed = confirm("Are you sure, you want to perform an full export and remove deleted content items?");
23+
if (!confirmed) {
24+
return;
25+
}
26+
27+
vm.exportLoading = true;
28+
vm.errorMessage = "";
29+
vm.success = "";
30+
relewiseDashboardResources.exportContentWithDelete().then(() => {
31+
vm.exportLoading = false;
32+
vm.success = "Content was successfully exported to Relewise";
33+
vm.errorMessage = "";
34+
}, () => {
35+
vm.exportLoading = false;
36+
vm.success = "";
37+
vm.errorMessage = "Unexpected error while exporting data happened";
38+
});
39+
}
40+
2141
function init() {
2242
relewiseDashboardResources.getConfiguration().then((response) => {
2343
if (response.status === 200) {

samples/UmbracoV9/App_Plugins/Relewise.Dashboard/dashboard.html

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,17 @@
22
<h2>Relewise</h2>
33
<umb-box>
44
<umb-box-content>
5-
65
<p>
76
Welcome to the Relewise dashboard - Here you can perform export functions get all your content exported into Relewise.<br />
87
It's also possible to see the settings for Relewise directly here.
98
</p>
10-
<div>
9+
<div class="button-box">
1110
<button class="btn btn-primary" ng-click="vm.exportContent()" ng-disabled="vm.exportLoading">
12-
Full content export
11+
Export content
12+
</button>
13+
14+
<button class="btn btn-danger" ng-click="vm.exportContentPermanentlyDelete()" ng-disabled="vm.exportLoading">
15+
Export content and remove old data
1316
</button>
1417
</div>
1518
<div class="error mt-10" ng-if="vm.errorMessage">{{vm.errorMessage}}</div>

samples/UmbracoV9/App_Plugins/Relewise.Dashboard/relewise.resources.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
exportContent: function () {
66
return $http.post("/umbraco/backoffice/Relewise/DashboardApi/ContentExport");
77
},
8+
exportContentWithDelete: function () {
9+
return $http.post("/umbraco/backoffice/Relewise/DashboardApi/ContentExport?permanentlyDelete=true");
10+
},
811
getConfiguration: function () {
912
return $http.get("/umbraco/backoffice/Relewise/DashboardApi/Configuration");
1013
}

samples/UmbracoV9/App_Plugins/Relewise.Dashboard/styles.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,8 @@ h5 {
2929
.pl-20 {
3030
padding-left: 20px;
3131
}
32+
33+
.button-box {
34+
display: flex;
35+
justify-content: space-between;
36+
}

src/Integrations.Umbraco/App_Plugins/Relewise.Dashboard/dashboard.controller.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
}
2020

2121
vm.exportContentPermanentlyDelete = function () {
22+
const confirmed = confirm("Are you sure, you want to perform an full export and remove deleted content items?");
23+
if (!confirmed) {
24+
return;
25+
}
26+
2227
vm.exportLoading = true;
2328
vm.errorMessage = "";
2429
vm.success = "";

src/Integrations.Umbraco/App_Plugins/Relewise.Dashboard/dashboard.html

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,18 @@
22
<h2>Relewise</h2>
33
<umb-box>
44
<umb-box-content>
5-
65
<p>
76
Welcome to the Relewise dashboard - Here you can perform export functions get all your content exported into Relewise.<br />
87
It's also possible to see the settings for Relewise directly here.
98
</p>
10-
<div>
9+
<div class="button-box">
1110
<button class="btn btn-primary" ng-click="vm.exportContent()" ng-disabled="vm.exportLoading">
1211
Export content
1312
</button>
1413

15-
<span class="pl-20">
16-
<button class="btn btn-danger" ng-click="vm.exportContentPermanentlyDelete()" ng-disabled="vm.exportLoading">
17-
Export content and remove old data
18-
</button>
19-
</span>
20-
14+
<button class="btn btn-danger" ng-click="vm.exportContentPermanentlyDelete()" ng-disabled="vm.exportLoading">
15+
Export content and remove old data
16+
</button>
2117
</div>
2218
<div class="error mt-10" ng-if="vm.errorMessage">{{vm.errorMessage}}</div>
2319
<div class="export-success mt-10" ng-if="vm.success">{{vm.success}}</div>

src/Integrations.Umbraco/App_Plugins/Relewise.Dashboard/styles.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,8 @@ h5 {
2929
.pl-20 {
3030
padding-left: 20px;
3131
}
32+
33+
.button-box {
34+
display: flex;
35+
justify-content: space-between;
36+
}

0 commit comments

Comments
 (0)