Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,16 @@

const mergedSettings = settings.flat();

// check if there is alias duplicates:
const aliasSet = new Set<string>();
for (const setting of mergedSettings) {
if (aliasSet.has(setting.alias)) {
console.error(`There is a duplicate alias "${setting.alias}" in the Property Editor configuration.`);
continue;
}
aliasSet.add(setting.alias);
}

Check warning on line 268 in src/Umbraco.Web.UI.Client/src/packages/data-type/workspace/data-type-workspace.context.ts

View check run for this annotation

CodeScene Delta Analysis / CodeScene Code Health Review (release/17.4.1)

❌ New issue: Bumpy Road Ahead

UmbDataTypeWorkspaceContext.mergeConfigProperties has 2 blocks with nested conditional logic. Any nesting of 2 or deeper is considered. Threshold is 2 blocks per function. The Bumpy Road code smell is a function that contains multiple chunks of nested conditional logic. The deeper the nesting and the more bumps, the lower the code health.
if (mergedSettings) {
this.#properties.setValue(mergedSettings);

Expand Down Expand Up @@ -294,17 +304,16 @@
const values: Array<UmbDataTypePropertyValueModel> = [];

// We want to keep the existing data, if it is not in the default data, and if it is in the default data, then we want to keep the default data.
for (const defaultDataItem of this.#properties.getValue()) {
for (const property of this.#properties.getValue()) {
// We are matching on the alias, as we assume that the alias is unique for the data type.
// TODO: Consider if we should also match on the editorAlias just to be on the safe side [JOV]
const existingData = data.values?.find((x) => x.alias === defaultDataItem.alias);
const existingData = data.values?.find((x) => x.alias === property.alias);
if (existingData) {
values.push(existingData);
continue;
}

// If the data is not in the existing data, then we want to add the default data if it exists.
const existingDefaultData = this.#settingsDefaultData.find((x) => x.alias === defaultDataItem.alias);
const existingDefaultData = this.#settingsDefaultData.find((x) => x.alias === property.alias);
if (existingDefaultData) {
values.push(existingDefaultData);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ export const manifest: ManifestPropertyEditorSchema = {
{
alias: 'minimumRange',
label: 'Minimum range',
description: '',
description:
'Minimum difference between the low and high values when range is enabled. Set to 0 to allow equal values.',
propertyEditorUiAlias: 'Umb.PropertyEditorUi.Decimal',
config: [{ alias: 'step', value: '0.00001' }],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,6 @@ export const manifests: Array<UmbExtensionManifest> = [
propertyEditorUiAlias: 'Umb.PropertyEditorUi.Decimal',
config: [{ alias: 'step', value: '0.00001' }],
},
{
alias: 'minimumRange',
label: 'Minimum range',
description:
'Minimum difference between the low and high values when range is enabled. Set to 0 to allow equal values.',
propertyEditorUiAlias: 'Umb.PropertyEditorUi.Decimal',
config: [{ alias: 'step', value: '0.00001' }],
},
],
defaultData: [
{
Expand All @@ -70,10 +62,6 @@ export const manifests: Array<UmbExtensionManifest> = [
alias: 'step',
value: 1.0,
},
{
alias: 'minimumRange',
value: 0.0,
},
],
},
},
Expand Down
Loading