Commit 94585621 authored by Julien's avatar Julien

Merge pull request #1690 from bonitasoft/feat/home-order-by-last-update

Feat/home order by last update
parents c04e7f19 7c82903d
......@@ -34,7 +34,7 @@
</p>
<ul class="ArtifactList">
<li class="ArtifactList-item" ng-repeat="widget in widgets | filter:filters | orderBy:'name'">
<li class="ArtifactList-item" ng-repeat="widget in widgets | filter:filters | orderBy:'-lastUpdate'">
<div class="Artifact-info">
<a ui-sref="designer.widget({ widgetId: widget.id })" class="Artifact-link ">
<span title="{{ widget.name }}">
......
......@@ -185,6 +185,7 @@ angular.module('bonitasoft.designer.e2e', ['ngMockE2E'])
id: 'customAwesomeWidget',
name: 'awesomeWidget',
custom: true,
lastUpdate: 1447944407862,
template: '<div>My {{ properties.qualifier }} widget just {{ properties.verb }}!</div>',
properties: [
{
......@@ -216,12 +217,38 @@ angular.module('bonitasoft.designer.e2e', ['ngMockE2E'])
'active': true
}
]
},
{
id: 'customFavoriteWidget',
name: 'favoriteWidget',
custom: true,
lastUpdate: 1447891242960,
template: '<div>My {{ properties.qualifier }} widget just {{ properties.verb }}!</div>',
properties: [
{
label: 'Qualifier',
name: 'qualifier',
type: 'text',
defaultValue: 'awesome',
bond: 'expression'
},
{
label: 'Verb',
name: 'verb',
type: 'text',
defaultValue: 'rocks',
bond: 'expression'
}
],
assets: []
}
];
var personPage = {
id: 'person',
name: 'Person',
type: 'page',
lastUpdate: 1447944407862,
data: {
alreadyExistsData: { type: 'constant', value: 'aValue' },
jsonExample: { type: 'json', value: {} },
......@@ -478,6 +505,8 @@ angular.module('bonitasoft.designer.e2e', ['ngMockE2E'])
{
id: 'empty',
name: 'empty',
type: 'page',
lastUpdate: 1447891242960,
rows: [[]],
data: {}
}
......@@ -536,13 +565,7 @@ angular.module('bonitasoft.designer.e2e', ['ngMockE2E'])
// get all light representation
$httpBackend.whenGET('rest/widgets?view=light').respond(function() {
var response = widgets.map(function(elem) {
return {
id: elem.id,
name: elem.name,
custom: elem.custom
};
});
var response = widgets.map(({id, name, custom, lastUpdate}) => ({id, name, custom, lastUpdate}));
return [200, response, {}];
});
......@@ -578,12 +601,7 @@ angular.module('bonitasoft.designer.e2e', ['ngMockE2E'])
* ******************************************************************************************************/
// get all (light representation)
$httpBackend.whenGET('rest/pages').respond(function() {
var response = pages.map(function(page) {
return {
id: page.id,
name: page.name
};
});
var response = pages.map(({id, name, type, lastUpdate}) => ({id, name, type, lastUpdate}));
return [200, response, {}];
});
......
......@@ -2,15 +2,18 @@ var HomePage = require('../pages/home.page.js');
describe('home page', function() {
let ALL_PAGE_NAMES = ['Person', 'empty'];
let ALL_WIDGET_NAMES = ['awesomeWidget', 'favoriteWidget'];
var home;
beforeEach(function() {
home = HomePage.get();
});
it('should list pages and widgets', function() {
expect(home.getListedPageNames()).toEqual(['Person', 'empty']);
expect(home.getListedWidgetNames()).toEqual(['awesomeWidget']);
it('should list pages and widgets ordered by last update date descendant', function() {
expect(home.getListedPageNames()).toEqual(ALL_PAGE_NAMES);
expect(home.getListedWidgetNames()).toEqual(ALL_WIDGET_NAMES);
});
it('should navigate to a page', function() {
......@@ -181,7 +184,7 @@ describe('home page', function() {
expect(home.getListedWidgetNames()).toEqual(['awesomeWidget']);
home.search('');
expect(home.getListedPageNames()).toEqual(['Person', 'empty']);
expect(home.getListedWidgetNames()).toEqual(['awesomeWidget']);
expect(home.getListedPageNames()).toEqual(ALL_PAGE_NAMES);
expect(home.getListedWidgetNames()).toEqual(ALL_WIDGET_NAMES);
});
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment