Skip to content

Commit c8125a3

Browse files
authored
Merge pull request #6 from Relewise/feat/parse-token
Feat: improve exporting
2 parents c49cd78 + 86f945d commit c8125a3

File tree

17 files changed

+115
-28
lines changed

17 files changed

+115
-28
lines changed

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ jobs:
2525
- name: Push
2626
run: dotnet nuget push Relewise.Integrations.Umbraco.${VERSION}.nupkg --source https://api.nuget.org/v3/index.json --api-key ${NUGET_TOKEN}
2727
env:
28-
NUGET_TOKEN: ${{ secrets.NUGET_RELEWISE_UMBRACO_TOKEN }}
28+
NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }}

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+
}

samples/UmbracoV9/Startup.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Linq;
3+
using System.Threading;
34
using System.Threading.Tasks;
45
using Microsoft.AspNetCore.Builder;
56
using Microsoft.AspNetCore.Hosting;
@@ -111,7 +112,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
111112

112113
public class BlogMapper : IContentTypeMapping
113114
{
114-
public Task<ContentUpdate> Map(ContentMappingContext context)
115+
public Task<ContentUpdate> Map(ContentMappingContext context, CancellationToken token)
115116
{
116117
context.ContentUpdate.Content.Data["Title"] = context.PublishedContent.GetProperty("title").GetValue<string>(context.CulturesToPublish.First());
117118

src/Integrations.Umbraco/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) {

src/Integrations.Umbraco/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>

src/Integrations.Umbraco/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
}

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)