Skip to content

Commit 5a144b1

Browse files
committed
Save content type name configuration instead of alias.
1 parent 731942d commit 5a144b1

File tree

8 files changed

+15
-20
lines changed

8 files changed

+15
-20
lines changed

src/Umbraco.Cms.Integrations.Automation.Zapier/App_Plugins/UmbracoCms.Integrations/Automation/Zapier/dashboard.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<input id="inWebHookUrl" type="text" ng-model="vm.webHookUrl" class="w-20 mb0" placeholder="WebHook URL" />
77
<select id="selContentTypes" ng-model="vm.selectedContentType" class="mb0">
88
<option value="">Please select a content type</option>
9-
<option ng-repeat="item in vm.contentTypes" value="{{ item.alias }}">{{ item.name }}</option>
9+
<option ng-repeat="item in vm.contentTypes" value="{{ item.name }}">{{ item.name }}</option>
1010
</select>
1111
<umb-button action="vm.onAdd()"
1212
type="button"
@@ -23,7 +23,7 @@
2323
</div>
2424
<div class="umb-table-cell">
2525
<a class="umb-table-head__link" href="#" prevent-default>
26-
<span>Content Type Alias</span>
26+
<span>Content Type Name</span>
2727
</a>
2828
</div>
2929
<div class="umb-table-cell">
@@ -41,7 +41,7 @@
4141
ng-repeat="row in vm.contentConfigs track by $index">
4242
<div class="umb-table-cell"></div>
4343
<div class="umb-table-cell">
44-
<span ng-bind="row.contentTypeAlias"></span>
44+
<span ng-bind="row.contentTypeName"></span>
4545
</div>
4646
<div class="umb-table-cell">
4747
<span ng-bind="row.webHookUrl"></span>

src/Umbraco.Cms.Integrations.Automation.Zapier/App_Plugins/UmbracoCms.Integrations/Automation/Zapier/js/zapier.controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
umbracoCmsIntegrationsAutomationZapierResource.addConfig(vm.webHookUrl, vm.selectedContentType).then(function (r) {
2323

24-
getContentTypes(vm.selectedContentType);
24+
getContentTypes();
2525

2626
getContentConfigs();
2727

src/Umbraco.Cms.Integrations.Automation.Zapier/App_Plugins/UmbracoCms.Integrations/Automation/Zapier/js/zapier.resource.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
$http.get(`${apiEndpoint}/GetContentTypes`),
1010
"Failed to get resource");
1111
},
12-
addConfig: function (webHookUrl, contentTypeAlias) {
12+
addConfig: function (webHookUrl, contentTypeName) {
1313
return umbRequestHelper.resourcePromise(
14-
$http.post(`${apiEndpoint}/Add`, { contentTypeAlias: contentTypeAlias, webHookUrl: webHookUrl }), "Failed to get resource");
14+
$http.post(`${apiEndpoint}/Add`, { contentTypeName: contentTypeName, webHookUrl: webHookUrl }), "Failed to get resource");
1515
},
1616
getAllConfigs: function () {
1717
return umbRequestHelper.resourcePromise(

src/Umbraco.Cms.Integrations.Automation.Zapier/Controllers/ZapConfigController.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,13 @@ public IEnumerable<ContentTypeDto> GetContentTypes()
3333

3434
var contentTypes = contentTypeService.GetAll();
3535

36-
var configEntities = _zapConfigService.GetAll().Select(p => p.ContentTypeAlias);
36+
var configEntities = _zapConfigService.GetAll().Select(p => p.ContentTypeName);
3737

3838
return contentTypes
39-
.Where(p => !configEntities.Contains(p.Alias))
39+
.Where(p => !configEntities.Contains(p.Name))
4040
.OrderBy(p => p.Name)
4141
.Select(p => new ContentTypeDto
4242
{
43-
Alias = p.Alias,
4443
Name = p.Name
4544
});
4645
}
@@ -52,7 +51,7 @@ public string Add([FromBody] ContentConfigDto dto)
5251
if (!string.IsNullOrEmpty(result)) return result;
5352

5453
var t = Task.Run(async () => await _zapierService.TriggerAsync(dto.WebHookUrl,
55-
new Dictionary<string, string> {{Constants.Content.Name, dto.ContentTypeAlias}}));
54+
new Dictionary<string, string> {{Constants.Content.Name, dto.ContentTypeName}}));
5655

5756
result = t.Result;
5857

src/Umbraco.Cms.Integrations.Automation.Zapier/Migrations/ZapContentConfigTable.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ public class ZapContentConfig
3535
[Column("Id")]
3636
public int Id { get; set; }
3737

38-
[Column("ContentTypeAlias")]
39-
public string ContentTypeAlias { get; set; }
38+
[Column("ContentTypeName")]
39+
public string ContentTypeName { get; set; }
4040

4141
[Column("WebHookUrl")]
4242
public string WebHookUrl { get; set; }

src/Umbraco.Cms.Integrations.Automation.Zapier/Models/Dtos/ContentConfigDto.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@ public ContentConfigDto(string webHookUrl)
1414
[JsonProperty("id")]
1515
public int Id { get; set; }
1616

17-
[JsonProperty("contentTypeAlias")]
18-
public string ContentTypeAlias { get; set; }
17+
[JsonProperty("contentTypeName")]
18+
public string ContentTypeName { get; set; }
1919

2020
[JsonProperty("webHookUrl")]
2121
public string WebHookUrl { get; set; }
2222

23-
2423
[JsonProperty("showDeletePrompt")]
2524
public bool ShowDeletePrompt { get; set; }
2625
}

src/Umbraco.Cms.Integrations.Automation.Zapier/Models/Dtos/ContentTypeDto.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ namespace Umbraco.Cms.Integrations.Automation.Zapier.Models.Dtos
55
public class ContentTypeDto
66
{
77

8-
[JsonProperty("alias")]
9-
public string Alias { get; set; }
10-
118
[JsonProperty("name")]
129
public string Name { get; set; }
1310
}

src/Umbraco.Cms.Integrations.Automation.Zapier/Services/ZapConfigService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public IEnumerable<ContentConfigDto> GetAll()
3131
return data.Select(p => new ContentConfigDto
3232
{
3333
Id = p.Id,
34-
ContentTypeAlias = p.ContentTypeAlias,
34+
ContentTypeName = p.ContentTypeName,
3535
WebHookUrl = p.WebHookUrl
3636
});
3737
}
@@ -45,7 +45,7 @@ public string Add(ContentConfigDto contentConfigDto)
4545
{
4646
var zapContentConfig = new ZapContentConfigTable.ZapContentConfig
4747
{
48-
ContentTypeAlias = contentConfigDto.ContentTypeAlias,
48+
ContentTypeName = contentConfigDto.ContentTypeName,
4949
WebHookUrl = contentConfigDto.WebHookUrl
5050
};
5151

0 commit comments

Comments
 (0)