diff --git a/src/Umbraco.Web.UI.Client/src/common/filters/umbCmsJoinArray.filter.js b/src/Umbraco.Web.UI.Client/src/common/filters/umbCmsJoinArray.filter.js index 870e49754105..05f83f96aa2e 100644 --- a/src/Umbraco.Web.UI.Client/src/common/filters/umbCmsJoinArray.filter.js +++ b/src/Umbraco.Web.UI.Client/src/common/filters/umbCmsJoinArray.filter.js @@ -4,17 +4,20 @@ * @namespace umbCmsJoinArray * * param {array} array of string or objects, if an object use the third argument to specify which prop to list. - * param {seperator} string containing the seperator to add between joined values. + * param {separator} string containing the separator to add between joined values. * param {prop} string used if joining an array of objects, set the name of properties to join. * * @description - * Join an array of string or an array of objects, with a costum seperator. - * + * Join an array of string or an array of objects, with a custom separator. + * If the array is null or empty, returns an empty string + * If the array is not actually an array (ie a string or number), returns the value of the array */ angular.module("umbraco.filters").filter('umbCmsJoinArray', function () { return function join(array, separator, prop) { - return (!Utilities.isUndefined(prop) ? array.map(function (item) { - return item[prop]; - }) : array).join(separator || ''); + if (typeof array !== 'object' || !array) { + return array || ''; + } + separator = separator || ''; + return (!Utilities.isUndefined(prop) ? array.map(item => item[prop]) : array).join(separator); }; }); diff --git a/src/Umbraco.Web.UI.Client/src/less/dashboards/examine-management.less b/src/Umbraco.Web.UI.Client/src/less/dashboards/examine-management.less index 7b842c40ad38..533760149fcc 100644 --- a/src/Umbraco.Web.UI.Client/src/less/dashboards/examine-management.less +++ b/src/Umbraco.Web.UI.Client/src/less/dashboards/examine-management.less @@ -13,8 +13,45 @@ } } + .umb-panel-group__details-status-content{ + width:50%; // this is to fix flexbox not making the content too wide + } + .umb-panel-group__details-status-action{ background-color:transparent; padding-left:0; } + + .result-table { + overflow-x:auto; + border:1px solid @tableBorder; + + > table { + margin-bottom:0; + border:0; + } + + th:first-child, + td:first-child { + position:sticky; + left:0; + background-color:@white; + border-right:1px solid @tableBorder; + border-left:0; + + + td, + + th { + border-left:0; + } + } + + th:last-child, + td:last-child { + position:sticky; + right:0; + background-color:@white; + border-left:1px solid @tableBorder; + } + } } + diff --git a/src/Umbraco.Web.UI.Client/src/less/utilities/_text-align.less b/src/Umbraco.Web.UI.Client/src/less/utilities/_text-align.less index beff81d80cba..070078fc19c2 100644 --- a/src/Umbraco.Web.UI.Client/src/less/utilities/_text-align.less +++ b/src/Umbraco.Web.UI.Client/src/less/utilities/_text-align.less @@ -2,6 +2,12 @@ TEXT ALIGN */ -.tl { text-align: left; } -.tr { text-align: right; } -.tc { text-align: center; } +.tl, +.table td.tl, +.table th.tl { text-align: left; } +.tr, +.table td.tr, +.table th.tr { text-align: right; } +.tc, +.table td.tc, +.table th.tc { text-align: center; } diff --git a/src/Umbraco.Web.UI.Client/src/views/dashboard/settings/examinemanagement.controller.js b/src/Umbraco.Web.UI.Client/src/views/dashboard/settings/examinemanagement.controller.js index 94e81afb8fcf..cff40baf4532 100644 --- a/src/Umbraco.Web.UI.Client/src/views/dashboard/settings/examinemanagement.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/dashboard/settings/examinemanagement.controller.js @@ -9,7 +9,9 @@ function ExamineManagementController($http, $q, $timeout, umbRequestHelper, loca vm.selectedIndex = null; vm.selectedSearcher = null; vm.searchResults = null; + vm.showSearchResultFields = []; + vm.showSelectFieldsDialog = showSelectFieldsDialog; vm.showSearchResultDialog = showSearchResultDialog; vm.showIndexInfo = showIndexInfo; vm.showSearcherInfo = showSearcherInfo; @@ -24,6 +26,35 @@ function ExamineManagementController($http, $q, $timeout, umbRequestHelper, loca vm.infoOverlay = null; + function showSelectFieldsDialog() { + if (vm.searchResults) { + + // build list of available fields + var availableFields = []; + vm.searchResults.results.map(r => Object.keys(r.values).map(key => { + if (availableFields.indexOf(key) == -1 && key != "__NodeId" && key != "nodeName") { + availableFields.push(key); + } + })); + + availableFields.sort(); + + editorService.open({ + title: "Fields", + availableFields: availableFields, + fieldIsSelected: function(key) { + return vm.showSearchResultFields.indexOf(key) > -1; + }, + toggleField: vm.toggleField, + size: "small", + view: "views/dashboard/settings/examinemanagementfields.html", + close: function () { + editorService.close(); + } + }); + } + } + function showSearchResultDialog(values) { if (vm.searchResults) { localizationService.localize("examineManagement_fieldValues").then(function (value) { @@ -40,6 +71,17 @@ function ExamineManagementController($http, $q, $timeout, umbRequestHelper, loca } } + vm.toggleField = function(key) { + if (vm.showSearchResultFields.indexOf(key) > -1) { + vm.showSearchResultFields = vm.showSearchResultFields.filter(field => field != key); + } + else { + vm.showSearchResultFields.push(key); + } + + vm.showSearchResultFields.sort(); + }; + function nextSearchResultPage(pageNumber) { search(vm.selectedIndex ? vm.selectedIndex : vm.selectedSearcher, null, pageNumber); } diff --git a/src/Umbraco.Web.UI.Client/src/views/dashboard/settings/examinemanagement.html b/src/Umbraco.Web.UI.Client/src/views/dashboard/settings/examinemanagement.html index 5960025cf6b5..abfd3e5b15d1 100644 --- a/src/Umbraco.Web.UI.Client/src/views/dashboard/settings/examinemanagement.html +++ b/src/Umbraco.Web.UI.Client/src/views/dashboard/settings/examinemanagement.html @@ -158,9 +158,9 @@ {{result.score}} {{result.id}} - {{result.values['nodeName'] | umbCmsJoinArray:', '}} - {{result.values['nodeName'] | umbCmsJoinArray:', '}} - + {{ ::result.values['nodeName'] | umbCmsJoinArray:', '}} + {{ ::result.values['nodeName'] | umbCmsJoinArray:', '}} + @@ -288,27 +288,52 @@

- - - - - - - - - - - - - - - - -
ScoreIdName
{{result.score}}{{result.id}} - {{result.values['nodeName'] | umbCmsJoinArray:', '}} - {{result.values['nodeName'] | umbCmsJoinArray:', '}} - -
+
+ + + + + + + + + + + + + + + + + + + +
IdName +
+ {{ field }} + +
+
+ + Score
{{result.id}} + + {{ ::result.values['nodeName'] | umbCmsJoinArray:', ' }} + + {{ ::result.values['nodeName'] | umbCmsJoinArray:', ' }} + + {{ ::result.values[field] | umbCmsJoinArray:', ' }} + + + + + {{ ::result.score | number:4 }} + +
+
+ + + + + + +
+ + + + + {{ field }} +
+
+
+
+ + + + + + +
+
diff --git a/src/Umbraco.Web.UI.Client/src/views/dashboard/settings/examinemanagementresults.html b/src/Umbraco.Web.UI.Client/src/views/dashboard/settings/examinemanagementresults.html index cd455a32ae16..ad888cfcf3fe 100644 --- a/src/Umbraco.Web.UI.Client/src/views/dashboard/settings/examinemanagementresults.html +++ b/src/Umbraco.Web.UI.Client/src/views/dashboard/settings/examinemanagementresults.html @@ -20,7 +20,7 @@ {{key}} - {{values | umbCmsJoinArray:', '}} + {{ ::values | umbCmsJoinArray:', '}} diff --git a/src/Umbraco.Web.UI.Client/test/unit/common/filters/umbCmsJoinArray.filter.spec.js b/src/Umbraco.Web.UI.Client/test/unit/common/filters/umbCmsJoinArray.filter.spec.js index 4a44b17bff5c..1c33a91b09a3 100644 --- a/src/Umbraco.Web.UI.Client/test/unit/common/filters/umbCmsJoinArray.filter.spec.js +++ b/src/Umbraco.Web.UI.Client/test/unit/common/filters/umbCmsJoinArray.filter.spec.js @@ -11,12 +11,9 @@ {input:[], separator:', ', prop:'param' , expectedResult: ''}, {input:[{param:'a'},{param:'b'},{param:'c'}], separator:', ', prop:null , expectedResult: ', , '}, {input:[{param:'a'},{param:'b'},{param:'c'}], separator:null, prop:'param' , expectedResult: 'abc'}, - ]; - - var testCasesWithExpectedError = [ - {input:'test', separator:', ', prop:'param'}, - {input:null, separator:', ', prop:'param'}, - {input:undefined, separator:', ', prop:'param'}, + {input:'test', separator:', ', prop:'param', expectedResult: 'test'}, + {input:null, separator:', ', prop:'param', expectedResult: ''}, + {input:undefined, separator:', ', prop:'param', expectedResult: ''}, ]; beforeEach(module('umbraco')); @@ -25,19 +22,11 @@ $umbCmsJoinArray = $filter('umbCmsJoinArray'); })); - testCases.forEach(function(test){ it('Blackbox tests with expected result=\''+test.expectedResult+'\'', function() { expect($umbCmsJoinArray(test.input, test.separator, test.prop)).toBe(test.expectedResult); }); }); - - testCasesWithExpectedError.forEach(function(test){ - it('Blackbox tests with expected error. Input=\''+test.input+'\'', function() { - expect(function() { $umbCmsJoinArray(test.input, test.separator, test.prop)}).toThrow(); - }); - }); - }); }());