Skip to content

Commit 71b0a71

Browse files
Got product attribute / product attribute preset deployments working
1 parent dc53613 commit 71b0a71

File tree

6 files changed

+43
-45
lines changed

6 files changed

+43
-45
lines changed

Directory.Packages.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
<ItemGroup>
1313
<PackageVersion Include="Umbraco.Commerce.Cms.Startup" Version="[16.0.0-rc1, 16.999.999)" />
1414
<PackageVersion Include="Umbraco.Commerce.Persistence.Sqlite" Version="[16.0.0-rc1, 16.999.999)" />
15-
<PackageVersion Include="Umbraco.Deploy.Infrastructure" Version="[16.0.0-rc2, 16.999.999)" />
15+
<PackageVersion Include="Umbraco.Deploy.Infrastructure" Version="[16.0.0-rc3, 16.999.999)" />
1616
</ItemGroup>
1717
</Project>

src/Umbraco.Commerce.Deploy/Composing/UmbracoCommerceDeployComponent.cs

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -59,31 +59,11 @@ private void InitializeIntegratedEntities()
5959
new DeployRegisteredEntityTypeDetailOptions
6060
{
6161
SupportsQueueForTransfer = true,
62-
//SupportsQueueForTransferOfDescendents = true,
62+
// SupportsQueueForTransferOfDescendents = false,
6363
SupportsRestore = true,
6464
PermittedToRestore = true,
6565
SupportsPartialRestore = true,
6666
SupportsImportExport = true,
67-
},
68-
(string id, bool descendants, IServiceProvider provider, out UdiRange? range) =>
69-
{
70-
// Root folder
71-
if (int.TryParse(id, out var numericId) && numericId == Cms.Constants.Trees.Stores.Ids[Cms.Constants.Trees.Stores.NodeType.ProductAttributes])
72-
{
73-
range = new UdiRange(Udi.Create(UmbracoCommerceConstants.UdiEntityType.ProductAttribute), Constants.DeploySelector.DescendantsOfThis);
74-
return true;
75-
}
76-
77-
// Single entity
78-
if (Guid.TryParse(id, out Guid guidId))
79-
{
80-
range = new UdiRange(Udi.Create(UmbracoCommerceConstants.UdiEntityType.ProductAttribute, guidId));
81-
return true;
82-
}
83-
84-
// Out of range
85-
range = null;
86-
return false;
8767
});
8868

8969
transferEntityService.RegisterTransferEntityType(
@@ -96,26 +76,6 @@ private void InitializeIntegratedEntities()
9676
PermittedToRestore = true,
9777
SupportsPartialRestore = true,
9878
SupportsImportExport = true,
99-
},
100-
(string id, bool descendants, IServiceProvider provider, out UdiRange? range) =>
101-
{
102-
// Root folder
103-
if (int.TryParse(id, out var numericId) && numericId == Cms.Constants.Trees.Stores.Ids[Cms.Constants.Trees.Stores.NodeType.ProductAttributePresets])
104-
{
105-
range = new UdiRange(Udi.Create(UmbracoCommerceConstants.UdiEntityType.ProductAttributePreset), Constants.DeploySelector.DescendantsOfThis);
106-
return true;
107-
}
108-
109-
// Single entity
110-
if (Guid.TryParse(id, out Guid guidId))
111-
{
112-
range = new UdiRange(Udi.Create(UmbracoCommerceConstants.UdiEntityType.ProductAttributePreset, guidId));
113-
return true;
114-
}
115-
116-
// Out of range
117-
range = null;
118-
return false;
11979
});
12080
}
12181

src/Umbraco.Commerce.Deploy/Connectors/ServiceConnectors/UmbracoCommerceEntityServiceConnectorBase.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,15 @@ public override async Task<NamedUdiRange> GetRangeAsync(
9191
throw new ArgumentException("Invalid identifier.", nameof(sid));
9292
}
9393

94+
// See if the sid is a Store ID, if so, it's a root UDI
95+
StoreReadOnly? store = await _umbracoCommerceApi.GetStoreAsync(result);
96+
if (store != null)
97+
{
98+
EnsureOpenSelector(selector);
99+
return new NamedUdiRange(Udi.Create(UdiEntityType), OpenUdiName, selector);
100+
}
101+
102+
// If it's not a store ID, then is must be an entity ID
94103
TEntity? entity = await GetEntityAsync(result, cancellationToken).ConfigureAwait(false);
95104

96105
if (entity == null)

src/Umbraco.Commerce.Deploy/Connectors/ServiceConnectors/UmbracoCommerceProductAttributePresetServiceConnector.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class UmbracoCommerceProductAttributePresetServiceConnector : UmbracoComm
2828
"descendants"
2929
};
3030

31-
protected override string OpenUdiName => "All global:: Product Attribute Presets";
31+
protected override string OpenUdiName => "All Umbraco Commerce Product Attribute Presets";
3232

3333
public override string UdiEntityType => UmbracoCommerceConstants.UdiEntityType.ProductAttributePreset;
3434

src/Umbraco.Commerce.Deploy/wwwroot/umbraco-commerce-deploy.js

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
export const onInit = async (host, extensionRegistry) => {
22
extensionRegistry.registerMany([
3+
{
4+
type: 'localization',
5+
alias: 'Uc.Deploy.Localization.En',
6+
weight: -100,
7+
name: 'English',
8+
meta: {
9+
culture: 'en',
10+
localizations: {
11+
// Entity types
12+
deploy_entityTypes: {
13+
"uc:product-attribute": "Umbraco Commerce Product Attribute",
14+
"uc:product-attributes": "Umbraco Commerce Product Attributes",
15+
"uc:product-attribute-preset": "Umbraco Commerce Product Attribute Preset",
16+
"uc:product-attribute-presets": "Umbraco Commerce Product Attribute Presets"
17+
}
18+
}
19+
},
20+
},
321
{
422
type: "deployEntityActionRegistrar",
523
actionAlias: "Deploy.EntityAction.Queue",
@@ -11,6 +29,17 @@ export const onInit = async (host, extensionRegistry) => {
1129
"uc:product-attribute-preset",
1230
"uc:product-attribute-presets"
1331
],
14-
}
32+
},
33+
{
34+
type: "deployEntityTypeMapping",
35+
alias: "Uc.Deploy.EntityTypeMapping",
36+
name: "Umbraco Commerce Deploy Entity Type Mapping",
37+
entityTypes: {
38+
"uc:product-attribute": "umbraco-commerce-product-attribute",
39+
"uc:product-attributes": "umbraco-commerce-product-attribute",
40+
"uc:product-attribute-preset": "umbraco-commerce-product-attribute-preset",
41+
"uc:product-attribute-presets": "umbraco-commerce-product-attribute-preset"
42+
},
43+
},
1544
]);
1645
};

src/Umbraco.Commerce.Deploy/wwwroot/umbraco-package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "Umbraco.Commerce.Deploy",
33
"name": "Umbraco Commerce Deploy",
4-
"version": "16.0.0--rc1.preview.5.g222ad58",
4+
"version": "16.0.0--rc1.preview.6.gdc53613",
55
"allowTelemetry": true,
66
"extensions": [
77
{

0 commit comments

Comments
 (0)