This is an automated email from the ASF dual-hosted git repository.
zehnder pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
The following commit(s) were added to refs/heads/dev by this push:
new 383427c [hotfix] Fix grouping in data explorer
383427c is described below
commit 383427c96e1a2d3cd535f33e82a0fc4c48fb65f2
Author: Philipp Zehnder <[email protected]>
AuthorDate: Mon Oct 18 22:48:11 2021 +0200
[hotfix] Fix grouping in data explorer
---
ui/cypress/support/utils/AdapterUtils.ts | 1 -
ui/cypress/support/utils/DataLakeUtils.ts | 1 +
ui/cypress/tests/adapter/fileStream.ts | 1 -
.../tests/datalake/widgetDataConfiguration.ts | 53 ++++++++++++++--------
.../group-selection-panel.component.html | 8 +++-
.../group-selection-panel.component.ts | 5 ++
.../widgets/table/table-widget.component.html | 6 ++-
7 files changed, 50 insertions(+), 25 deletions(-)
diff --git a/ui/cypress/support/utils/AdapterUtils.ts
b/ui/cypress/support/utils/AdapterUtils.ts
index 82c90ed..9321a46 100644
--- a/ui/cypress/support/utils/AdapterUtils.ts
+++ b/ui/cypress/support/utils/AdapterUtils.ts
@@ -134,7 +134,6 @@ export class AdapterUtils {
}
private static markPropertyAsDimension(propertyName: string) {
- console.log('property-scope-' + propertyName);
cy.dataCy('property-scope-' + propertyName)
.click()
.get('.mat-option-text')
diff --git a/ui/cypress/support/utils/DataLakeUtils.ts
b/ui/cypress/support/utils/DataLakeUtils.ts
index a054666..adbc57d 100644
--- a/ui/cypress/support/utils/DataLakeUtils.ts
+++ b/ui/cypress/support/utils/DataLakeUtils.ts
@@ -31,6 +31,7 @@ export class DataLakeUtils {
.create('File_Set')
.setName(name)
.setTimestampProperty('timestamp')
+ .addDimensionProperty('randomtext')
.setFormat('csv')
.addFormatInput('input', 'delimiter', ';')
.addFormatInput('checkbox', 'header', 'check');
diff --git a/ui/cypress/tests/adapter/fileStream.ts
b/ui/cypress/tests/adapter/fileStream.ts
index 34084cf..2c84ae3 100644
--- a/ui/cypress/tests/adapter/fileStream.ts
+++ b/ui/cypress/tests/adapter/fileStream.ts
@@ -31,7 +31,6 @@ describe('Test File Stream Adapter', () => {
.create('File_Stream')
.setName('File Stream Adapter Test')
.setTimestampProperty('timestamp')
- .addDimensionProperty('randomtext')
.addProtocolInput('input', 'speed', '1')
.addProtocolInput('checkbox', 'replaceTimestamp', 'check')
.setFormat('csv')
diff --git a/ui/cypress/tests/datalake/widgetDataConfiguration.ts
b/ui/cypress/tests/datalake/widgetDataConfiguration.ts
index 47fd884..ab74369 100644
--- a/ui/cypress/tests/datalake/widgetDataConfiguration.ts
+++ b/ui/cypress/tests/datalake/widgetDataConfiguration.ts
@@ -16,26 +16,26 @@
*
*/
-import { DataLakeUtils } from '../../support/utils/DataLakeUtils';
import { DataLakeFilterConfig } from
'../../support/model/DataLakeFilterConfig';
+import { DataLakeUtils } from '../../support/utils/DataLakeUtils';
describe('Test Table View in Data Explorer', () => {
before('Setup Test', () => {
- // cy.login();
- cy.initStreamPipesTest();
- DataLakeUtils.loadDataIntoDataLake('datalake/sample.csv');
+ cy.login();
+ // cy.initStreamPipesTest();
+ // DataLakeUtils.loadDataIntoDataLake('datalake/sample.csv');
});
it('Perform Test', () => {
DataLakeUtils.goToDatalake();
- DataLakeUtils.createAndEditDataView();
+ // DataLakeUtils.createAndEditDataView();
// Click edit button
- // cy.dataCy('edit-data-view')
- // .click();
+ cy.dataCy('edit-data-view')
+ .click();
// TODO Set Time Range
cy.dataCy('1_year')
@@ -54,45 +54,60 @@ describe('Test Table View in Data Explorer', () => {
DataLakeUtils.clickCreateButton();
// Validate that X lines are available
- cy.dataCy('data-explorer-table-row', { timeout: 10000
}).should('have.length', 10);
-
- /**
- * Test filter configuration
- */
+ checkTableRows(10);
// Go back to data configuration
DataLakeUtils.selectDataConfig();
- // Test number
+ /**
+ * Test filter configuration
+ */
+ // Test number
let filterConfig = new DataLakeFilterConfig('randomnumber', '22', '=');
DataLakeUtils.dataConfigAddFilter(filterConfig);
- cy.dataCy('data-explorer-table-row', { timeout: 10000
}).should('have.length', 2);
+ checkTableRows(2);
DataLakeUtils.dataConfigRemoveFilter();
- cy.dataCy('data-explorer-table-row', { timeout: 10000
}).should('have.length', 10);
+ checkTableRows(10);
// Test number greater then
filterConfig = new DataLakeFilterConfig('randomnumber', '50', '>');
DataLakeUtils.dataConfigAddFilter(filterConfig);
- cy.dataCy('data-explorer-table-row', { timeout: 10000
}).should('have.length', 5);
+ checkTableRows(5);
DataLakeUtils.dataConfigRemoveFilter();
// Test number smaller then
filterConfig = new DataLakeFilterConfig('randomnumber', '50', '<');
DataLakeUtils.dataConfigAddFilter(filterConfig);
- cy.dataCy('data-explorer-table-row', { timeout: 10000
}).should('have.length', 5);
+ checkTableRows(5);
DataLakeUtils.dataConfigRemoveFilter();
// Test boolean
filterConfig = new DataLakeFilterConfig('randombool', 'true', '=');
DataLakeUtils.dataConfigAddFilter(filterConfig);
- cy.dataCy('data-explorer-table-row', { timeout: 10000
}).should('have.length', 6);
+ checkTableRows(6);
DataLakeUtils.dataConfigRemoveFilter();
// Test string
filterConfig = new DataLakeFilterConfig('randomtext', 'a', '=');
DataLakeUtils.dataConfigAddFilter(filterConfig);
- cy.dataCy('data-explorer-table-row', { timeout: 10000
}).should('have.length', 4);
+ checkTableRows(4);
DataLakeUtils.dataConfigRemoveFilter();
+
+ /**
+ * Test groupBy configuration
+ */
+ // Select group by option
+ cy.dataCy('data-explorer-group-by-randomtext').children().click();
+ cy.dataCy('data-explorer-table-row-randomtext', { timeout: 10000
}).first().contains('a');
+ cy.dataCy('data-explorer-table-row-randomtext', { timeout: 10000
}).last().contains('c');
+ checkTableRows(10);
+ cy.dataCy('data-explorer-group-by-randomtext').children().click();
+
});
+ const checkTableRows = (numberOfRows: number) => {
+ cy.dataCy('data-explorer-table-row-timestamp', { timeout: 10000
}).should('have.length', numberOfRows);
+ };
+
+
});
diff --git
a/ui/src/app/data-explorer/components/designer-panel/data-settings/group-selection-panel/group-selection-panel.component.html
b/ui/src/app/data-explorer/components/designer-panel/data-settings/group-selection-panel/group-selection-panel.component.html
index f61be31..ed7d88a 100644
---
a/ui/src/app/data-explorer/components/designer-panel/data-settings/group-selection-panel/group-selection-panel.component.html
+++
b/ui/src/app/data-explorer/components/designer-panel/data-settings/group-selection-panel/group-selection-panel.component.html
@@ -32,8 +32,12 @@
<div fxLayout="column" class="field-scroll-panel">
<div fxLayout="column"
*ngFor="let groupByField of sourceConfig.queryConfig.groupBy">
- <sp-field-selection [field]="groupByField"
[sourceConfig]="sourceConfig" [widgetId]="widgetId">
- </sp-field-selection>
+ <mat-checkbox [(ngModel)]="groupByField.selected"
+ [attr.data-cy]="'data-explorer-group-by-'+
groupByField.runtimeName"
+ (change)="triggerConfigurationUpdate()"
+ color="accent">
+ {{groupByField.runtimeName}}
+ </mat-checkbox>
</div>
</div>
</div>
\ No newline at end of file
diff --git
a/ui/src/app/data-explorer/components/designer-panel/data-settings/group-selection-panel/group-selection-panel.component.ts
b/ui/src/app/data-explorer/components/designer-panel/data-settings/group-selection-panel/group-selection-panel.component.ts
index 95932e7..1d91233 100644
---
a/ui/src/app/data-explorer/components/designer-panel/data-settings/group-selection-panel/group-selection-panel.component.ts
+++
b/ui/src/app/data-explorer/components/designer-panel/data-settings/group-selection-panel/group-selection-panel.component.ts
@@ -71,4 +71,9 @@ export class GroupSelectionPanelComponent implements OnInit {
this.sourceConfig.queryConfig.groupBy.push(selection);
}
+ triggerConfigurationUpdate() {
+ this.widgetConfigService.notify({ widgetId: this.widgetId, refreshData:
true, refreshView: true });
+ }
+
+
}
diff --git
a/ui/src/app/data-explorer/components/widgets/table/table-widget.component.html
b/ui/src/app/data-explorer/components/widgets/table/table-widget.component.html
index d302a4b..8d5a13e 100644
---
a/ui/src/app/data-explorer/components/widgets/table/table-widget.component.html
+++
b/ui/src/app/data-explorer/components/widgets/table/table-widget.component.html
@@ -39,7 +39,7 @@
<label class="column-header">Timestamp</label>
</th>
<td mat-cell
- data-cy="data-explorer-table-row"
+ data-cy="data-explorer-table-row-timestamp"
*matCellDef="let row" style="text-align: left;">
{{row['time'] | date:'yyyy-MM-dd HH:mm:ss.SSS'}}
</td>
@@ -54,7 +54,9 @@
[ngStyle]="{background:
dataExplorerWidget.baseAppearanceConfig.backgroundColor, color:
dataExplorerWidget.baseAppearanceConfig.textColor}">
<label
class="column-header">{{element.fullDbName}}</label>
</th>
- <td mat-cell *matCellDef="let row" style="text-align:
left;">
+ <td mat-cell *matCellDef="let row"
+ [attr.data-cy]="'data-explorer-table-row-'+
element.fullDbName"
+ style="text-align: left;">
{{row[element.fullDbName]}}
</td>
</div>