Skip to content

Commit ad02cab

Browse files
authored
Merge branch 'v15/dev' into v15/feature/reworking-error-notifications
2 parents 1aa177f + 6df7ff4 commit ad02cab

File tree

5 files changed

+16
-64
lines changed

5 files changed

+16
-64
lines changed

src/Umbraco.Core/Configuration/Models/Validation/GlobalSettingsValidator.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,14 @@ private bool ValidateSmtpSetting(SmtpSettings? value, out string message) =>
3232

3333
private bool ValidateSqlWriteLockTimeOutSetting(TimeSpan configuredTimeOut, out string message)
3434
{
35-
// Only apply this setting if it's not excessively high or low
35+
// Only apply this setting if it's not excessively low
3636
const int minimumTimeOut = 100;
37-
const int maximumTimeOut = 20000;
3837

3938
// between 0.1 and 20 seconds
40-
if (configuredTimeOut.TotalMilliseconds < minimumTimeOut ||
41-
configuredTimeOut.TotalMilliseconds > maximumTimeOut)
39+
if (configuredTimeOut.TotalMilliseconds < minimumTimeOut)
4240
{
4341
message =
44-
$"The `{Constants.Configuration.ConfigGlobal}:{nameof(GlobalSettings.DistributedLockingWriteLockDefaultTimeout)}` setting is not between the minimum of {minimumTimeOut} ms and maximum of {maximumTimeOut} ms";
42+
$"The `{Constants.Configuration.ConfigGlobal}:{nameof(GlobalSettings.DistributedLockingWriteLockDefaultTimeout)}` should not be configured as less than {minimumTimeOut} ms";
4543
return false;
4644
}
4745

src/Umbraco.Web.UI.Client/src/packages/core/tree/default/default-tree.context.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -78,23 +78,6 @@ export class UmbDefaultTreeContext<
7878
// listen for page changes on the pagination manager
7979
this.pagination.addEventListener(UmbChangeEvent.TYPE, this.#onPageChange);
8080

81-
/* TODO: revisit. This is a temp solution to notify the parent it needs to reload its children
82-
there might be a better way to do this through a tree item parent context.
83-
It does not look like there is a way to have a "dynamic" parent context that will stop when a
84-
specific parent is reached (a tree item unique that matches the parentUnique of this item) */
85-
const hostElement = this.getHostElement();
86-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
87-
// @ts-ignore
88-
hostElement.addEventListener('temp-reload-tree-item-parent', (event: CustomEvent) => {
89-
const treeRoot = this.#treeRoot.getValue();
90-
const unique = treeRoot?.unique;
91-
92-
if (event.detail.unique === unique) {
93-
event.stopPropagation();
94-
this.loadTree();
95-
}
96-
});
97-
9881
// always load the tree root because we need the root entity to reload the entire tree
9982
this.#loadTreeRoot();
10083
}

src/Umbraco.Web.UI.Client/src/packages/core/tree/tree-item/tree-item-base/tree-item-context-base.ts

Lines changed: 12 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ export abstract class UmbTreeItemContextBase<
6868
#foldersOnly = new UmbBooleanState(false);
6969
readonly foldersOnly = this.#foldersOnly.asObservable();
7070

71-
treeContext?: UmbDefaultTreeContext<TreeItemType, TreeRootType>;
71+
public treeContext?: UmbDefaultTreeContext<TreeItemType, TreeRootType>;
72+
public parentTreeItemContext?: UmbTreeItemContext<TreeItemType>;
73+
7274
#sectionContext?: typeof UMB_SECTION_CONTEXT.TYPE;
7375
#sectionSidebarContext?: typeof UMB_SECTION_SIDEBAR_CONTEXT.TYPE;
7476
#actionEventContext?: typeof UMB_ACTION_EVENT_CONTEXT.TYPE;
@@ -87,24 +89,6 @@ export abstract class UmbTreeItemContextBase<
8789
// listen for page changes on the pagination manager
8890
this.pagination.addEventListener(UmbChangeEvent.TYPE, this.#onPageChange);
8991

90-
/* TODO: revisit. This is a temp solution to notify the parent it needs to reload its children
91-
there might be a better way to do this through a tree item parent context.
92-
It does not look like there is a way to have a "dynamic" parent context that will stop when a
93-
specific parent is reached (a tree item unique that matches the parentUnique of this item) */
94-
const hostElement = this.getHostElement();
95-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
96-
// @ts-ignore
97-
hostElement.addEventListener('temp-reload-tree-item-parent', (event: CustomEvent) => {
98-
const treeItem = this.getTreeItem();
99-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
100-
// @ts-ignore
101-
const unique = treeItem?.unique;
102-
if (event.detail.unique === unique) {
103-
event.stopPropagation();
104-
this.loadChildren();
105-
}
106-
});
107-
10892
window.addEventListener('navigationend', this.#debouncedCheckIsActive);
10993
}
11094

@@ -248,6 +232,10 @@ export abstract class UmbTreeItemContextBase<
248232
this.#observeFoldersOnly();
249233
});
250234

235+
this.consumeContext(UMB_TREE_ITEM_CONTEXT, (instance) => {
236+
this.parentTreeItemContext = instance;
237+
}).skipHost();
238+
251239
this.consumeContext(UMB_ACTION_EVENT_CONTEXT, (instance) => {
252240
this.#removeEventListeners();
253241
this.#actionEventContext = instance;
@@ -353,19 +341,11 @@ export abstract class UmbTreeItemContextBase<
353341
if (event.getUnique() !== this.unique) return;
354342
if (event.getEntityType() !== this.entityType) return;
355343

356-
/* TODO: revisit. This is a temp solution to notify the parent it needs to reload its children
357-
there might be a better way to do this through a tree item parent context.
358-
It does not look like there is a way to have a "dynamic" parent context that will stop when a
359-
specific parent is reached (a tree item unique that matches the parentUnique of this item) */
360-
const treeItem = this.getTreeItem();
361-
const parentUnique = treeItem?.parent.unique;
362-
363-
const customEvent = new CustomEvent('temp-reload-tree-item-parent', {
364-
detail: { unique: parentUnique },
365-
bubbles: true,
366-
composed: true,
367-
});
368-
this.getHostElement().dispatchEvent(customEvent);
344+
if (this.parentTreeItemContext) {
345+
this.parentTreeItemContext.loadChildren();
346+
} else {
347+
this.treeContext?.loadTree();
348+
}
369349
};
370350

371351
#onPageChange = (event: UmbChangeEvent) => {

src/Umbraco.Web.UI.Client/src/packages/core/tree/tree-item/tree-item-context.interface.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export interface UmbTreeItemContext<TreeItemType extends UmbTreeItemModel> exten
1717
hasActions: Observable<boolean>;
1818
path: Observable<string>;
1919
pagination: UmbPaginationManager;
20+
getTreeItem(): TreeItemType | undefined;
2021
setTreeItem(treeItem: TreeItemType | undefined): void;
2122
loadChildren(): void;
2223
toggleContextMenu(): void;

tests/Umbraco.Tests.UnitTests/Umbraco.Core/Configuration/Models/Validation/GlobalSettingsValidatorTests.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,6 @@ public void Returns_Fail_For_Configuration_With_Insufficient_SqlWriteLockTimeOut
3939
Assert.False(result.Succeeded);
4040
}
4141

42-
[Test]
43-
public void Returns_Fail_For_Configuration_With_Excessive_SqlWriteLockTimeOut()
44-
{
45-
var validator = new GlobalSettingsValidator();
46-
var options = new GlobalSettings { DistributedLockingWriteLockDefaultTimeout = TimeSpan.Parse("00:00:21") };
47-
48-
var result = validator.Validate("settings", options);
49-
Assert.False(result.Succeeded);
50-
}
51-
5242
[Test]
5343
public void Returns_Success_For_Configuration_With_Valid_SqlWriteLockTimeOut()
5444
{

0 commit comments

Comments
 (0)