Merge branch 'test' into dev
gitea/salix/dev This commit looks good Details

This commit is contained in:
Gerard 2019-03-08 13:12:33 +01:00
commit 9d85094ccd
6 changed files with 78 additions and 25 deletions

View File

@ -7,7 +7,7 @@ describe('Item Create botanical path', () => {
beforeAll(() => { beforeAll(() => {
nightmare nightmare
.loginAndModule('buyer', 'item') .loginAndModule('buyer', 'item')
.accessToSearchResult('Object5 Weapon 50') .accessToSearchResult('Object5 Weapon 50 hasVisible:false')
.accessToSection('item.card.botanical'); .accessToSection('item.card.botanical');
}); });

View File

@ -95,7 +95,7 @@ describe('Item Create/Clone path', () => {
it(`should search for the item Infinity Gauntlet`, async() => { it(`should search for the item Infinity Gauntlet`, async() => {
const result = await nightmare const result = await nightmare
.write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet') .write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet hasVisible:false')
.waitToClick(selectors.itemsIndex.searchButton) .waitToClick(selectors.itemsIndex.searchButton)
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1) .waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
.countElement(selectors.itemsIndex.searchResult); .countElement(selectors.itemsIndex.searchResult);
@ -117,7 +117,7 @@ describe('Item Create/Clone path', () => {
it('should search for the item Infinity Gauntlet and find two', async() => { it('should search for the item Infinity Gauntlet and find two', async() => {
const result = await nightmare const result = await nightmare
.waitToClick(selectors.itemTags.goToItemIndexButton) .waitToClick(selectors.itemTags.goToItemIndexButton)
.write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet') .write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet hasVisible:false')
.waitToClick(selectors.itemsIndex.searchButton) .waitToClick(selectors.itemsIndex.searchButton)
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 2) .waitForNumberOfElements(selectors.itemsIndex.searchResult, 2)
.countElement(selectors.itemsIndex.searchResult); .countElement(selectors.itemsIndex.searchResult);

View File

@ -13,9 +13,6 @@ class Controller {
id: false, id: false,
actions: false actions: false
}; };
if (!$stateParams.q)
this.filter = {hasVisible: true, isActive: true};
} }
stopEvent(event) { stopEvent(event) {
@ -24,6 +21,9 @@ class Controller {
} }
onSearch(params) { onSearch(params) {
if (params && params.hasVisible === undefined && params.isActive === undefined)
Object.assign(params, {hasVisible: true, isActive: true});
if (params) if (params)
this.$.model.applyFilter(null, params); this.$.model.applyFilter(null, params);
else else

View File

@ -9,18 +9,6 @@
vn-focus> vn-focus>
</vn-textfield> </vn-textfield>
</vn-horizontal> </vn-horizontal>
<vn-horizontal>
<vn-textfield
vn-one
label="Id"
model="filter.id">
</vn-textfield>
<vn-textfield
vn-one
label="Name"
model="filter.name">
</vn-textfield>
</vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-autocomplete <vn-autocomplete
vn-one vn-one
@ -41,11 +29,6 @@
</vn-autocomplete> </vn-autocomplete>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-textfield
vn-one
label="Description"
model="filter.description">
</vn-textfield>
<vn-autocomplete <vn-autocomplete
vn-one vn-one
disabled="false" disabled="false"
@ -113,6 +96,47 @@
ng-click="filter.tags.push({})"> ng-click="filter.tags.push({})">
</vn-icon-button> </vn-icon-button>
</vn-horizontal> </vn-horizontal>
<vn-horizontal margin-medium-v>
<span
ng-click="$ctrl.initializeMoreFields()"
vn-one translate
class="unselectable"
tabindex="-1"
ng-class="{link: !filter.moreFields || !filter.moreFields.length}">
More fields
</span>
</vn-horizontal>
<vn-horizontal ng-repeat="field in filter.moreFields">
<vn-autocomplete
vn-one
field="field.field"
data="$ctrl.moreFields"
value-field="field"
show-field="field"
label="Field"
on-change="field.value = null">
</vn-autocomplete>
<vn-textfield
vn-two
label="Value"
model="field.value">
</vn-textfield>
<vn-icon-button
vn-none
vn-tooltip="Remove field"
icon="delete"
ng-click="filter.moreFields.splice($index, 1)"
tabindex="-1">
</vn-icon-button>
</vn-horizontal>
<vn-horizontal ng-show="filter.moreFields && filter.moreFields.length">
<vn-icon-button
vn-bind="+"
vn-tooltip="Add field"
icon="add_circle"
ng-click="filter.moreFields.push({})">
</vn-icon-button>
</vn-horizontal>
<vn-horizontal margin-large-top> <vn-horizontal margin-large-top>
<vn-submit label="Search"></vn-submit> <vn-submit label="Search"></vn-submit>
</vn-horizontal> </vn-horizontal>

View File

@ -2,6 +2,21 @@ import ngModule from '../module';
import SearchPanel from 'core/components/searchbar/search-panel'; import SearchPanel from 'core/components/searchbar/search-panel';
class Controller extends SearchPanel { class Controller extends SearchPanel {
constructor($scope) {
super();
this.$ = $scope;
this.moreFields = [
{field: 'id'},
{field: 'description'},
{field: 'name'}
];
}
initializeMoreFields() {
if (!this.$.filter.moreFields || !this.$.filter.moreFields.length)
this.$.filter.moreFields = [{}];
}
set filter(value) { set filter(value) {
if (!value) if (!value)
value = {}; value = {};
@ -20,7 +35,14 @@ class Controller extends SearchPanel {
} }
get filter() { get filter() {
return this.$.filter; if (this.$.filter.moreFields) {
this.$.filter.moreFields.forEach(element => {
this.$.filter[element.field] = element.value;
});
}
let filter = Object.assign({}, this.$.filter);
delete filter.moreFields;
return filter;
} }
getSourceTable(selection) { getSourceTable(selection) {
@ -36,6 +58,8 @@ class Controller extends SearchPanel {
} }
} }
Controller.$inject = ['$scope'];
ngModule.component('vnItemSearchPanel', { ngModule.component('vnItemSearchPanel', {
template: require('./index.html'), template: require('./index.html'),
controller: Controller controller: Controller

View File

@ -1,3 +1,8 @@
Ink: Tinta Ink: Tinta
Origin: Origen Origin: Origen
Producer: Productor Producer: Productor.
With visible: Con visible
Field: Campo
More fields: Mas campos
Add field: Añadir campo
Remove field: Quitar campo