Skip to content

Commit

Permalink
PT-14394: AngularJS error when user open GenericExport (#83)
Browse files Browse the repository at this point in the history
fix: Error Expected array but received when user open Generic Export blade.
  • Loading branch information
OlegoO committed Nov 14, 2023
1 parent 9f46136 commit a78adfc
Show file tree
Hide file tree
Showing 4 changed files with 181 additions and 153 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<span class="list-descr" ng-if="data.localizedGroupName">{{data.localizedGroupName}}</span>
<span class="list-descr" ng-if="data.localizedDescription">{{data.localizedDescription}}</span>
</li>
<li class="list-item" ng-repeat="data in blade.currentEntities | orderBy: 'localizedName' track by data.groupName" ng-class="{'__selected': data.groupName === selectedNodeId}" ng-click='selectNode(data)' ng-if="!blade.searchText">
<li class="list-item" ng-repeat="data in blade.currentEntities | toArray | orderBy: 'localizedName' track by data.groupName" ng-class="{'__selected': data.groupName === selectedNodeId}" ng-click='selectNode(data)' ng-if="!blade.searchText">
<span class="list-t">{{data.localizedName}}</span>
<span class="list-descr" ng-if="data.localizedDescription">{{data.localizedDescription}}</span>
</li>
Expand Down
2 changes: 1 addition & 1 deletion src/VirtoCommerce.ExportModule.Web/Scripts/export.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if (AppDependencies !== undefined) {
AppDependencies.push(moduleName);
}

angular.module(moduleName, ['ui.grid.cellNav', 'ui.grid.edit', 'ui.grid.validate'])
angular.module(moduleName, ['ui.grid.cellNav', 'ui.grid.edit', 'ui.grid.validate', 'angular-toArrayFilter'])
.config(['$stateProvider', function ($stateProvider) {
$stateProvider.state('workspace.exportModule', {
url: '/generic-export',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
angular.module('angular-toArrayFilter', [])
.filter('toArray', function () {
return function (obj, addKey) {
if (!angular.isObject(obj)) return obj;
if (addKey === false) {
return Object.keys(obj).map(function (key) {
return obj[key];
});
} else {
return Object.keys(obj).map(function (key) {
var value = obj[key];
return angular.isObject(value) ?
Object.defineProperty(value, '$key', { enumerable: false, value: key }) :
{ $key: key, $value: value };
});
}
};
});
Loading

0 comments on commit a78adfc

Please sign in to comment.