Show published in tracked references
This commit is contained in:
committed by
Michael Latouche
parent
f7e73fbff5
commit
2d2d8df82e
@@ -1,4 +1,4 @@
|
||||
using System.Runtime.Serialization;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Umbraco.Cms.Core.Models;
|
||||
|
||||
@@ -20,6 +20,9 @@ public class RelationItem
|
||||
[DataMember(Name = "udi")]
|
||||
public Udi? NodeUdi => NodeType == Constants.UdiEntityType.Unknown ? null : Udi.Create(NodeType, NodeKey);
|
||||
|
||||
[DataMember(Name = "published")]
|
||||
public bool? NodePublished { get; set; }
|
||||
|
||||
[DataMember(Name = "icon")]
|
||||
public string? ContentTypeIcon { get; set; }
|
||||
|
||||
|
||||
@@ -447,6 +447,9 @@ internal class RelationItemDto
|
||||
[Column(Name = "nodeName")]
|
||||
public string? ChildNodeName { get; set; }
|
||||
|
||||
[Column(Name = "nodePublished")]
|
||||
public bool? ChildNodePublished { get; set; }
|
||||
|
||||
[Column(Name = "nodeObjectType")]
|
||||
public Guid ChildNodeObjectType { get; set; }
|
||||
|
||||
|
||||
@@ -26,11 +26,14 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement
|
||||
bool filterMustBeIsDependency, out long totalRecords)
|
||||
{
|
||||
Sql<ISqlContext> innerUnionSql = GetInnerUnionSql();
|
||||
var sql = _scopeAccessor.AmbientScope?.Database.SqlContext.Sql().SelectDistinct(
|
||||
|
||||
var sql = _scopeAccessor.AmbientScope?.Database.SqlContext.Sql()
|
||||
.SelectDistinct(
|
||||
"[x].[id] as nodeId",
|
||||
"[n].[uniqueId] as nodeKey",
|
||||
"[n].[text] as nodeName",
|
||||
"[n].[nodeObjectType] as nodeObjectType",
|
||||
"[d].[published] as nodePublished",
|
||||
"[ct].[icon] as contentTypeIcon",
|
||||
"[ct].[alias] as contentTypeAlias",
|
||||
"[ctn].[text] as contentTypeName",
|
||||
@@ -41,14 +44,27 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement
|
||||
.From<NodeDto>("n")
|
||||
.InnerJoinNested(innerUnionSql, "x")
|
||||
.On<NodeDto, UnionHelperDto>((n, x) => n.NodeId == x.Id, "n", "x")
|
||||
.LeftJoin<ContentDto>("c").On<NodeDto, ContentDto>((left, right) => left.NodeId == right.NodeId,
|
||||
.LeftJoin<ContentDto>("c")
|
||||
.On<NodeDto, ContentDto>(
|
||||
(left, right) => left.NodeId == right.NodeId,
|
||||
aliasLeft: "n",
|
||||
aliasRight: "c")
|
||||
.LeftJoin<ContentTypeDto>("ct")
|
||||
.On<ContentDto, ContentTypeDto>((left, right) => left.ContentTypeId == right.NodeId, aliasLeft: "c",
|
||||
.On<ContentDto, ContentTypeDto>(
|
||||
(left, right) => left.ContentTypeId == right.NodeId,
|
||||
aliasLeft: "c",
|
||||
aliasRight: "ct")
|
||||
.LeftJoin<NodeDto>("ctn").On<ContentTypeDto, NodeDto>((left, right) => left.NodeId == right.NodeId,
|
||||
aliasLeft: "ct", aliasRight: "ctn");
|
||||
.LeftJoin<NodeDto>("ctn")
|
||||
.On<ContentTypeDto, NodeDto>(
|
||||
(left, right) => left.NodeId == right.NodeId,
|
||||
aliasLeft: "ct",
|
||||
aliasRight: "ctn")
|
||||
.LeftJoin<DocumentDto>("d")
|
||||
.On<NodeDto, DocumentDto>(
|
||||
(left, right) => left.NodeId == right.NodeId,
|
||||
aliasLeft: "n",
|
||||
aliasRight: "d");
|
||||
|
||||
if (ids.Any())
|
||||
{
|
||||
sql = sql?.Where<NodeDto>(x => ids.Contains(x.NodeId), "n");
|
||||
@@ -78,25 +94,25 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement
|
||||
var innerUnionSqlChild = _scopeAccessor.AmbientScope.Database.SqlContext.Sql().Select(
|
||||
"[cr].childId as id", "[cr].parentId as otherId", "[rt].[alias]", "[rt].[name]",
|
||||
"[rt].[isDependency]", "[rt].[dual]")
|
||||
.From<RelationDto>("cr").InnerJoin<RelationTypeDto>("rt")
|
||||
.From<RelationDto>("cr")
|
||||
.InnerJoin<RelationTypeDto>("rt")
|
||||
.On<RelationDto, RelationTypeDto>((cr, rt) => rt.Dual == false && rt.Id == cr.RelationType, "cr", "rt");
|
||||
|
||||
var innerUnionSqlDualParent = _scopeAccessor.AmbientScope.Database.SqlContext.Sql().Select(
|
||||
"[dpr].parentId as id", "[dpr].childId as otherId", "[dprt].[alias]", "[dprt].[name]",
|
||||
"[dprt].[isDependency]", "[dprt].[dual]")
|
||||
.From<RelationDto>("dpr").InnerJoin<RelationTypeDto>("dprt")
|
||||
.On<RelationDto, RelationTypeDto>((dpr, dprt) => dprt.Dual == true && dprt.Id == dpr.RelationType,
|
||||
"dpr",
|
||||
"dprt");
|
||||
.From<RelationDto>("dpr")
|
||||
.InnerJoin<RelationTypeDto>("dprt")
|
||||
.On<RelationDto, RelationTypeDto>(
|
||||
(dpr, dprt) => dprt.Dual == true && dprt.Id == dpr.RelationType, "dpr", "dprt");
|
||||
|
||||
var innerUnionSql3 = _scopeAccessor.AmbientScope.Database.SqlContext.Sql().Select(
|
||||
"[dcr].childId as id", "[dcr].parentId as otherId", "[dcrt].[alias]", "[dcrt].[name]",
|
||||
"[dcrt].[isDependency]", "[dcrt].[dual]")
|
||||
.From<RelationDto>("dcr").InnerJoin<RelationTypeDto>("dcrt")
|
||||
.On<RelationDto, RelationTypeDto>((dcr, dcrt) => dcrt.Dual == true && dcrt.Id == dcr.RelationType,
|
||||
"dcr",
|
||||
"dcrt");
|
||||
|
||||
.From<RelationDto>("dcr")
|
||||
.InnerJoin<RelationTypeDto>("dcrt")
|
||||
.On<RelationDto, RelationTypeDto>(
|
||||
(dcr, dcrt) => dcrt.Dual == true && dcrt.Id == dcr.RelationType, "dcr", "dcrt");
|
||||
|
||||
var innerUnionSql = innerUnionSqlChild.Union(innerUnionSqlDualParent).Union(innerUnionSql3);
|
||||
|
||||
@@ -124,11 +140,13 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement
|
||||
.WhereLike<NodeDto>(x => x.Path, subsubQuery);
|
||||
|
||||
Sql<ISqlContext> innerUnionSql = GetInnerUnionSql();
|
||||
|
||||
var sql = _scopeAccessor.AmbientScope?.Database.SqlContext.Sql().SelectDistinct(
|
||||
"[x].[id] as nodeId",
|
||||
"[n].[uniqueId] as nodeKey",
|
||||
"[n].[text] as nodeName",
|
||||
"[n].[nodeObjectType] as nodeObjectType",
|
||||
"[d].[published] as nodePublished",
|
||||
"[ct].[icon] as contentTypeIcon",
|
||||
"[ct].[alias] as contentTypeAlias",
|
||||
"[ctn].[text] as contentTypeName",
|
||||
@@ -139,16 +157,28 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement
|
||||
.From<NodeDto>("n")
|
||||
.InnerJoinNested(innerUnionSql, "x")
|
||||
.On<NodeDto, UnionHelperDto>((n, x) => n.NodeId == x.Id, "n", "x")
|
||||
.LeftJoin<ContentDto>("c").On<NodeDto, ContentDto>((left, right) => left.NodeId == right.NodeId,
|
||||
.LeftJoin<ContentDto>("c")
|
||||
.On<NodeDto, ContentDto>(
|
||||
(left, right) => left.NodeId == right.NodeId,
|
||||
aliasLeft: "n",
|
||||
aliasRight: "c")
|
||||
.LeftJoin<ContentTypeDto>("ct")
|
||||
.On<ContentDto, ContentTypeDto>((left, right) => left.ContentTypeId == right.NodeId, aliasLeft: "c",
|
||||
.On<ContentDto, ContentTypeDto>(
|
||||
(left, right) => left.ContentTypeId == right.NodeId,
|
||||
aliasLeft: "c",
|
||||
aliasRight: "ct")
|
||||
.LeftJoin<NodeDto>("ctn").On<ContentTypeDto, NodeDto>((left, right) => left.NodeId == right.NodeId,
|
||||
aliasLeft: "ct", aliasRight: "ctn");
|
||||
sql = sql?.WhereIn((System.Linq.Expressions.Expression<Func<NodeDto, object?>>)(x => x.NodeId), subQuery,
|
||||
"n");
|
||||
.LeftJoin<NodeDto>("ctn")
|
||||
.On<ContentTypeDto, NodeDto>(
|
||||
(left, right) => left.NodeId == right.NodeId,
|
||||
aliasLeft: "ct",
|
||||
aliasRight: "ctn")
|
||||
.LeftJoin<DocumentDto>("d")
|
||||
.On<NodeDto, DocumentDto>(
|
||||
(left, right) => left.NodeId == right.NodeId,
|
||||
aliasLeft: "n",
|
||||
aliasRight: "d");
|
||||
|
||||
sql = sql?.WhereIn((System.Linq.Expressions.Expression<Func<NodeDto, object?>>)(x => x.NodeId), subQuery, "n");
|
||||
|
||||
if (filterMustBeIsDependency)
|
||||
{
|
||||
@@ -178,6 +208,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement
|
||||
"[n].[uniqueId] as nodeKey",
|
||||
"[n].[text] as nodeName",
|
||||
"[n].[nodeObjectType] as nodeObjectType",
|
||||
"[d].[published] as nodePublished",
|
||||
"[ct].[icon] as contentTypeIcon",
|
||||
"[ct].[alias] as contentTypeAlias",
|
||||
"[ctn].[text] as contentTypeName",
|
||||
@@ -188,14 +219,26 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement
|
||||
.From<NodeDto>("n")
|
||||
.InnerJoinNested(innerUnionSql, "x")
|
||||
.On<NodeDto, UnionHelperDto>((n, x) => n.NodeId == x.OtherId, "n", "x")
|
||||
.LeftJoin<ContentDto>("c").On<NodeDto, ContentDto>((left, right) => left.NodeId == right.NodeId,
|
||||
.LeftJoin<ContentDto>("c")
|
||||
.On<NodeDto, ContentDto>(
|
||||
(left, right) => left.NodeId == right.NodeId,
|
||||
aliasLeft: "n",
|
||||
aliasRight: "c")
|
||||
.LeftJoin<ContentTypeDto>("ct")
|
||||
.On<ContentDto, ContentTypeDto>((left, right) => left.ContentTypeId == right.NodeId, aliasLeft: "c",
|
||||
.On<ContentDto, ContentTypeDto>(
|
||||
(left, right) => left.ContentTypeId == right.NodeId,
|
||||
aliasLeft: "c",
|
||||
aliasRight: "ct")
|
||||
.LeftJoin<NodeDto>("ctn").On<ContentTypeDto, NodeDto>((left, right) => left.NodeId == right.NodeId,
|
||||
aliasLeft: "ct", aliasRight: "ctn")
|
||||
.LeftJoin<NodeDto>("ctn")
|
||||
.On<ContentTypeDto, NodeDto>(
|
||||
(left, right) => left.NodeId == right.NodeId,
|
||||
aliasLeft: "ct",
|
||||
aliasRight: "ctn")
|
||||
.LeftJoin<DocumentDto>("d")
|
||||
.On<NodeDto, DocumentDto>(
|
||||
(left, right) => left.NodeId == right.NodeId,
|
||||
aliasLeft: "n",
|
||||
aliasRight: "d")
|
||||
.Where<UnionHelperDto>(x => x.Id == id, "x");
|
||||
|
||||
if (filterMustBeIsDependency)
|
||||
@@ -400,6 +443,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement
|
||||
NodeKey = dto.ChildNodeKey,
|
||||
NodeType = ObjectTypes.GetUdiType(dto.ChildNodeObjectType),
|
||||
NodeName = dto.ChildNodeName,
|
||||
NodePublished = dto.ChildNodePublished,
|
||||
RelationTypeName = dto.RelationTypeName,
|
||||
RelationTypeIsBidirectional = dto.RelationTypeIsBidirectional,
|
||||
RelationTypeIsDependency = dto.RelationTypeIsDependency,
|
||||
|
||||
@@ -92,6 +92,7 @@
|
||||
totalPages: "<",
|
||||
headline: "<",
|
||||
items: "<",
|
||||
showPublished: "<?",
|
||||
showType: "<?",
|
||||
showTypeName: "<?",
|
||||
showRelationTypeName: "<?",
|
||||
|
||||
@@ -8,15 +8,24 @@
|
||||
<div class="umb-table-row">
|
||||
<div class="umb-table-cell"></div>
|
||||
<div class="umb-table-cell umb-table__name not-fixed"><localize key="general_nodeName">Node Name</localize></div>
|
||||
<div ng-if="vm.showPublished" class="umb-table-cell"><localize key="general_status">Status</localize></div>
|
||||
<div ng-if="vm.showTypeName" class="umb-table-cell"><localize key="general_typeName">Type Name</localize></div>
|
||||
<div ng-if="vm.showType" class="umb-table-cell"><localize key="general_type">Type</localize></div>
|
||||
<div ng-if="vm.showRelationTypeName" class="umb-table-cell"><localize key="relationType_relation">Relation</localize></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="umb-table-body">
|
||||
<div class="umb-table-row" ng-repeat="reference in vm.items">
|
||||
<div class="umb-table-row"
|
||||
ng-repeat="reference in vm.items"
|
||||
ng-class="{ '-light':!reference.published }">
|
||||
<div class="umb-table-cell"><umb-icon icon="{{reference.icon}}" class="umb-table-body__icon"></umb-icon></div>
|
||||
<div class="umb-table-cell umb-table__name"><a ng-href="{{vm.getUrl(reference.udi, reference.id)}}" ng-click="vm.referenceAnchorClicked($event, reference)">{{::reference.name}}</a></div>
|
||||
<div ng-if="vm.showPublished" class="umb-table-cell">
|
||||
<div ng-if="reference.published !== null">
|
||||
<span ng-if="reference.published" title="@content_published" localize="title"><localize key="content_published">Published</localize></span>
|
||||
<span ng-if="!reference.published" title="@content_unpublished" localize="title"><localize key="content_unpublished">Unpublished</localize></span>
|
||||
</div>
|
||||
</div>
|
||||
<div ng-if="vm.showTypeName" class="umb-table-cell"><span title="{{::reference.contentTypeName}}">{{::reference.contentTypeName}}</span></div>
|
||||
<div ng-if="vm.showType" class="umb-table-cell"><span title="{{::reference.type}}">{{::reference.type}}</span></div>
|
||||
<div ng-if="vm.showRelationTypeName" class="umb-table-cell"><span title="{{::reference.relationTypeName}}">{{::reference.relationTypeName}}</span></div>
|
||||
|
||||
@@ -13,24 +13,27 @@
|
||||
|
||||
<!-- Combined list -->
|
||||
<div ng-if="vm.hasReferences">
|
||||
<umb-tracked-references-table items="vm.references.items"
|
||||
total-pages="vm.references.totalPages"
|
||||
page-number="vm.references.pageNumber"
|
||||
headline="vm.referencesTitle"
|
||||
on-page-changed="vm.changeReferencesPageNumber(pageNumber)"
|
||||
show-type-name="true"
|
||||
show-type="!vm.compact"
|
||||
show-relation-type-name="!vm.compact"
|
||||
type-label-key="content_documentType">
|
||||
<umb-tracked-references-table
|
||||
items="vm.references.items"
|
||||
total-pages="vm.references.totalPages"
|
||||
page-number="vm.references.pageNumber"
|
||||
headline="vm.referencesTitle"
|
||||
on-page-changed="vm.changeReferencesPageNumber(pageNumber)"
|
||||
show-published="!vm.compact"
|
||||
show-type-name="true"
|
||||
show-type="!vm.compact"
|
||||
show-relation-type-name="!vm.compact"
|
||||
type-label-key="content_documentType">
|
||||
</umb-tracked-references-table>
|
||||
</div>
|
||||
|
||||
<div ng-if="vm.hasReferencesInDescendants">
|
||||
<umb-tracked-references-table items="vm.referencedDescendants.items"
|
||||
total-pages="vm.referencedDescendants.totalPages"
|
||||
page-number="vm.referencedDescendants.pageNumber"
|
||||
headline="vm.referencedDescendantsTitle"
|
||||
on-page-changed="vm.changeDescendantsPageNumber(pageNumber)">
|
||||
<umb-tracked-references-table
|
||||
items="vm.referencedDescendants.items"
|
||||
total-pages="vm.referencedDescendants.totalPages"
|
||||
page-number="vm.referencedDescendants.pageNumber"
|
||||
headline="vm.referencedDescendantsTitle"
|
||||
on-page-changed="vm.changeDescendantsPageNumber(pageNumber)">
|
||||
</umb-tracked-references-table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -14,7 +14,14 @@
|
||||
<localize key="defaultdialogs_confirmdelete">Are you sure you want to delete</localize> <strong>{{currentNode.name}}</strong>?
|
||||
</p>
|
||||
|
||||
<umb-tracked-references id="currentNode.id" on-loading-complete="checkingReferencesComplete()" hide-no-result="true" compact="true" show-descendants="true" hide-none-dependencies="true" on-warning="onReferencesWarning()"></umb-tracked-references>
|
||||
<umb-tracked-references
|
||||
id="currentNode.id"
|
||||
show-descendants="true"
|
||||
hide-no-result="true" compact="true"
|
||||
hide-none-dependencies="true"
|
||||
on-loading-complete="checkingReferencesComplete()"
|
||||
on-warning="onReferencesWarning()">
|
||||
</umb-tracked-references>
|
||||
|
||||
<div class="abstract umb-alert umb-alert--warning" ng-if="warningText">
|
||||
{{warningText}}
|
||||
|
||||
Reference in New Issue
Block a user