Skip to content

Commit 08ee4f7

Browse files
Merge pull request #97 from aquality-automation/feature/create_number_column_type
Feature/create number column type
2 parents 07f371e + 106d630 commit 08ee4f7

File tree

15 files changed

+64
-32
lines changed

15 files changed

+64
-32
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
Features:
66
- Test Run List: Add posibility to filter by Inactive Milestone -> [View Issue](https://github.com/aquality-automation/aquality-tracking/issues/73)
7+
8+
Bugfixes:
9+
- Test Runs: Fix Filter for No Resolution Column -> [View Issue](https://github.com/aquality-automation/aquality-tracking/issues/22)
710

811
## 0.3.7 (2020-03-02)
912

e2e/pages/login.po/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { browser } from 'protractor';
22
import { elements, baseUrl, names } from './constants';
33
import { BasePage } from '../base.po';
44
import { projectList } from '../project/list.po';
5+
import { logger } from '../../utils/log.util';
56

67
class LogIn extends BasePage {
78
constructor() {
@@ -25,8 +26,10 @@ class LogIn extends BasePage {
2526

2627
async logInAs(userName: string, password: string) {
2728
if (await this.menuBar.isLogged()) {
29+
logger.info('Going to log out, before logging in with another user account.');
2830
await this.menuBar.clickLogOut();
2931
}
32+
await expect(await this.isOpened()).toBe(true, 'Was not logged out!');
3033
await this.setUserName(userName);
3134
await this.setPassword(password);
3235
await this.clickLogIn();

e2e/specs/milestone/milestoneView.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ describe('Milestone:', () => {
7373
milestones.version1 = await projectHelper.editorAPI.createMilestone(milestones.version1);
7474
milestones.version2 = await projectHelper.editorAPI.createMilestone(milestones.version2);
7575
milestones.version3 = await projectHelper.editorAPI.createMilestone(milestones.version3);
76-
await projectHelper.editorAPI.createSuite({ name: suites.base });
76+
return projectHelper.editorAPI.createSuite({ name: suites.base });
7777
});
7878

7979
afterAll(async () => {

protractor.conf.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ exports.config = {
4343
}, 'image/png')();
4444
done();
4545
})
46+
47+
browser.manage().logs().get('browser').then(function(browserLog) {
48+
allure.createAttachment('log', function () {
49+
return require('util').inspect(browserLog)
50+
}, 'text/plain')();
51+
done();
52+
});
4653
});
4754
}
4855
};

protractor.headless.conf.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ exports.config = {
5050
}, 'image/png')();
5151
done();
5252
})
53+
54+
browser.manage().logs().get('browser').then(function(browserLog) {
55+
allure.createAttachment('log', function () {
56+
return require('util').inspect(browserLog)
57+
}, 'text/plain')();
58+
done();
59+
});
5360
});
5461
}
5562
};

src/app/elements/table/table.filter.component.html

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@
4343
[sorter]="getDefaultSorter(col)"
4444
(sorted)="sort($event)" class="{{col.property}}" [ngClass]="{
4545
'fit': col.type === 'checkbox' || col.property === 'action',
46-
'percent':col.type === 'percent'
46+
'percent':col.type === 'percent' || col.type === 'number'
4747
}">
4848
<fa-icon class="icon up sorter" [icon]="icons.faArrowUp" style="display: none"></fa-icon>
4949
<fa-icon class="icon down sorter" [icon]="icons.faArrowDown" style="display: none"></fa-icon>
5050

51-
<div *ngIf="!col.headerlink && col.type !== 'selector'" class="pull-left">{{col?.name}}</div>
51+
<div *ngIf="!col.headerlink && col.type !== 'selector'" class="pull-left">{{col?.name}}{{col?.type === 'percent' ? ', %' : ''}}</div>
5252
<a *ngIf="col.headerlink" class="pull-left" oncontextmenu="return false;"
53-
(contextmenu)="openlink(col.headerlink)" title="Right click to open">{{col?.name}}</a>
53+
(contextmenu)="openlink(col.headerlink)" title="Right click to open">{{col?.name}}{{col?.type === 'percent' ? ', %' : ''}}</a>
5454
<input *ngIf="col.type === 'selector'" name="select_all" type="checkbox"
5555
[title]="selectAll ? 'Deselect All' : 'Select All'" [ngModel]="selectAll"
5656
(ngModelChange)="toggleSelectAll($event)" />
@@ -102,17 +102,17 @@
102102
(modelChange)="handleLookupFilterChange(col.lookup.objectWithId ? col.lookup.objectWithId : col.lookup.entity, [$event])">
103103
</lookup-autocomplete>
104104

105-
<div *ngIf="col.type === 'percent' && col.filter"
105+
<div *ngIf="(col.type === 'percent' || col.type === 'number') && col.filter"
106106
[ngClass]="{ 'has-error': isRangeInvalid(col) }">
107107
<input placeholder="from" class="inline form-control input-sm ft-range-selector"
108-
(keyup)="rangeKeyUp($event)"
108+
(keyup)="rangeKeyUp($event, col)"
109109
(ngModelChange)="handleRangeFilterChange(col, $event, 'from')"
110-
[ngModel]="rangeFilterData(col.property, 'from')" type="number" min="0" max="100"
110+
[ngModel]="rangeFilterData(col.property, 'from')" type="number" min="0" [max]="col.type === 'percent' ? 100 : undefined"
111111
oninput="this.value = this.value.replace(/[^0-9]/g, '');">
112112
<input placeholder="to" class="inline form-control input-sm ft-range-selector"
113113
(ngModelChange)="handleRangeFilterChange(col, $event, 'to')"
114-
[ngModel]="rangeFilterData(col.property, 'to')" type="number" min="0" max="100"
115-
(keyup)="rangeKeyUp($event)" oninput="this.value = this.value.replace(/[^0-9]/g, '');">
114+
[ngModel]="rangeFilterData(col.property, 'to')" type="number" min="0" [max]="col.type === 'percent' ? 100 : undefined"
115+
(keyup)="rangeKeyUp($event, col)" oninput="this.value = this.value.replace(/[^0-9]/g, '');">
116116
<fa-icon class="icon" [icon]="icons.faTimes" (click)="removeRangeFilter(col.property)">
117117
</fa-icon>
118118
</div>
@@ -366,7 +366,7 @@
366366
(blur)="sendUpdate(entity)" />
367367

368368
<div
369-
*ngIf="(col.type === 'text' || col.type=='email' || col.type=='percent' || col.type=='textarea') && (!col.editable || entity.constantRow || notEditableByProperty(entity, col)) && !col.link">
369+
*ngIf="(col.type === 'text' || col.type=='email' || col.type=='percent' || col.type=='number' || col.type=='textarea') && (!col.editable || entity.constantRow || notEditableByProperty(entity, col)) && !col.link">
370370
{{transformationsService.getPropertyValue(entity, col.property)}}</div>
371371
<attachment-inline *ngIf="col.type === 'file'" [name]="col.property + rowNum"
372372
[model]="transformationsService.getPropertyValue(entity, col.property)"

src/app/elements/table/table.filter.component.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -274,14 +274,14 @@ export class TableFilterComponent implements OnInit, AfterViewInit, OnDestroy, O
274274
handleRangeFilterChange(col: any, value: string, type: string) {
275275
const newFilter: Filter = this.filterHelper.getOrCreateFilter(col.property, this.appliedFilters);
276276
let ranges: any[] = [];
277-
ranges = newFilter.range ? newFilter.range.split(',') : [0, 100];
277+
ranges = newFilter.range ? newFilter.range.split(',') : [0, undefined];
278278

279279
switch (type) {
280280
case 'from':
281-
ranges[0] = this.fixIvalidRange(value);
281+
ranges[0] = this.fixIvalidRange(value, col);
282282
break;
283283
case 'to':
284-
ranges[1] = this.fixIvalidRange(value);
284+
ranges[1] = this.fixIvalidRange(value, col);
285285
break;
286286
}
287287

@@ -318,9 +318,11 @@ export class TableFilterComponent implements OnInit, AfterViewInit, OnDestroy, O
318318
this.filterChange(newFilter);
319319
}
320320

321-
fixIvalidRange(range: string | number) {
321+
fixIvalidRange(range: string | number, col: TFColumn) {
322322
range = +range < 0 ? 0 : range;
323-
range = +range > 100 ? 100 : range;
323+
if (col.type === TFColumnType.percent) {
324+
range = +range > 100 ? 100 : range;
325+
}
324326
return range;
325327
}
326328

@@ -568,8 +570,8 @@ export class TableFilterComponent implements OnInit, AfterViewInit, OnDestroy, O
568570
this.sort(this.defaultSortBy);
569571
}
570572

571-
rangeKeyUp($event) {
572-
$event.target.value = this.fixIvalidRange($event.target.value);
573+
rangeKeyUp($event, column: TFColumn) {
574+
$event.target.value = this.fixIvalidRange($event.target.value, column);
573575
}
574576

575577
removeRangeFilter(property) {
@@ -646,9 +648,9 @@ export class TableFilterComponent implements OnInit, AfterViewInit, OnDestroy, O
646648
rowClicked(entity: any, col: any, $event: any) {
647649
const el: HTMLElement = $event.target;
648650
const canClick = (!col.editable || this.notEditableByProperty(entity, col) || el.classList.contains('ft-cell'))
649-
&& col.type !== 'link'
650-
&& col.type !== 'long-text'
651-
&& !col.link;
651+
&& col.type !== 'link'
652+
&& col.type !== 'long-text'
653+
&& !col.link;
652654
if (canClick) {
653655
this.rowClick.emit(entity);
654656
}

src/app/elements/table/tfColumn.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export enum TFColumnType {
7272
email = 'email',
7373
multiselect = 'multiselect',
7474
percent = 'percent',
75+
number = 'number',
7576
password = 'password',
7677
checkbox = 'checkbox',
7778
autocomplete = 'lookup-autocomplete',

src/app/pages/audit/audit-list/audit.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export class AuditComponent implements OnInit {
102102
class: 'fit'
103103
},
104104
{
105-
name: 'Last Audit Result, %',
105+
name: 'Last Audit Result',
106106
property: 'result',
107107
filter: true,
108108
sorting: true,

src/app/pages/audit/audit-project-list/audit.project.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ export class AuditProjectComponent implements OnInit {
6464
{ name: 'Progress Finished', property: 'progress_finished', sorting: true, type: TFColumnType.date },
6565
{ name: 'Submitted', property: 'submitted', sorting: true, type: TFColumnType.date },
6666
{
67-
name: 'Result, %',
67+
name: 'Result',
6868
property: 'result',
6969
sorting: true,
70-
type: TFColumnType.text
70+
type: TFColumnType.percent
7171
},
7272
{
7373
name: 'Auditors',

0 commit comments

Comments
 (0)