Skip to content

Commit 55e44c6

Browse files
JHoellitenthedominikriemer
authored
Moved Add Assets for Charts from PopUp during Save to Button in Edit Mode (apache#3853)
Co-authored-by: Philipp Zehnder <tenthe@users.noreply.github.com> Co-authored-by: Dominik Riemer <dominik.riemer@gmail.com>
1 parent 045abd5 commit 55e44c6

File tree

16 files changed

+225
-232
lines changed

16 files changed

+225
-232
lines changed

ui/cypress/support/utils/connect/ConnectBtns.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class ConnectBtns {
3131
}
3232

3333
public static editAdapter() {
34-
return cy.dataCy('edit-adapter');
34+
return cy.dataCy('edit-adapter', { timeout: 10000 });
3535
}
3636

3737
public static stopAdapter() {

ui/cypress/support/utils/dataExplorer/DataExplorerBtns.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
import { GeneralUtils } from '../GeneralUtils';
2020

21-
export class DataLakeBtns {
21+
export class DataExplorerBtns {
2222
public static refreshDataLakeMeasures() {
2323
return cy.dataCy('refresh-data-lake-measures');
2424
}
@@ -30,7 +30,21 @@ export class DataLakeBtns {
3030
public static saveDashboard() {
3131
return cy.dataCy('save-data-view').click();
3232
}
33+
public static saveChartsToAssetBtn() {
34+
return cy
35+
.dataCy('add-to-Asset-data-view-btn', { timeout: 10000 })
36+
.should('exist')
37+
.click();
38+
}
3339

40+
public static chartAssetCheckboxBtn() {
41+
return cy.dataCy('sp-show-chart-asset-checkbox');
42+
}
43+
public static confirmAssetSelectionBtn() {
44+
return cy
45+
.dataCy('asset-dialog-confirm-delete', { timeout: 10000 })
46+
.click();
47+
}
3448
public static editDataViewButton(widgetName: string) {
3549
GeneralUtils.openMenuForRow(widgetName);
3650
return cy

ui/cypress/support/utils/dataExplorer/DataExplorerUtils.ts

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { ConnectBtns } from '../connect/ConnectBtns';
2626
import { AdapterBuilder } from '../../builder/AdapterBuilder';
2727
import { differenceInMonths } from 'date-fns';
2828
import { GeneralUtils } from '../GeneralUtils';
29+
import { DataExplorerBtns } from './DataExplorerBtns';
2930

3031
export class DataExplorerUtils {
3132
public static goToDatalake() {
@@ -125,7 +126,6 @@ export class DataExplorerUtils {
125126

126127
cy.get('mat-tree.asset-tree', { timeout: 10000 }).should('exist');
127128
assetNameList.forEach(assetName => {
128-
console.log(assetName);
129129
cy.get('mat-tree.asset-tree')
130130
.find('.mat-tree-node')
131131
.contains(assetName)
@@ -254,15 +254,6 @@ export class DataExplorerUtils {
254254
cy.dataCy('save-data-view-btn', { timeout: 10000 }).click({
255255
force: true,
256256
});
257-
cy.dataCy('asset-dialog-cancel-delete', { timeout: 10000 }).click({
258-
force: true,
259-
});
260-
}
261-
262-
public static saveToAddAssets() {
263-
cy.dataCy('save-data-view-btn', { timeout: 10000 }).click({
264-
force: true,
265-
});
266257
}
267258

268259
public static saveDashboardConfiguration() {
@@ -273,6 +264,18 @@ export class DataExplorerUtils {
273264
return cy.dataCy('empty-dashboard');
274265
}
275266

267+
public static addChartsToAsset(assetNameList = []) {
268+
DataExplorerBtns.saveChartsToAssetBtn();
269+
270+
cy.dataCy('sp-show-chart-asset-checkbox').then($checkbox => {
271+
if (!$checkbox.is(':checked')) {
272+
cy.wrap($checkbox).click({ force: true });
273+
}
274+
});
275+
this.addToAsset(assetNameList);
276+
DataExplorerBtns.confirmAssetSelectionBtn();
277+
}
278+
276279
public static addToAsset(assetNameList = []) {
277280
cy.get('mat-tree.asset-tree', { timeout: 10000 }).should('exist');
278281

@@ -284,12 +287,6 @@ export class DataExplorerUtils {
284287
});
285288
}
286289

287-
public static saveAssetLinkFromChart() {
288-
cy.dataCy('asset-dialog-confirm-delete', { timeout: 10000 }).click({
289-
force: true,
290-
});
291-
}
292-
293290
public static deleteDashboard(dashboardName: string) {
294291
GeneralUtils.openMenuForRow(dashboardName);
295292
cy.dataCy('delete-dashboard-' + dashboardName, {
@@ -663,8 +660,9 @@ export class DataExplorerUtils {
663660
// Create Diagram
664661
DataExplorerUtils.addDataViewAndTableWidget('NewWidget', 'Persist');
665662
//Save
666-
DataExplorerUtils.saveToAddAssets();
667-
DataExplorerUtils.addToAsset(assetNames);
668-
DataExplorerUtils.saveAssetLinkFromChart();
663+
DataExplorerUtils.addChartsToAsset(assetNames);
664+
DataExplorerUtils.saveDataViewConfiguration();
665+
//Necessary for the background task to finish otherwise it steps back to charts from the following task
666+
cy.wait(500);
669667
}
670668
}

ui/cypress/tests/connect/editAdapter.smoke.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { ConnectBtns } from '../../support/utils/connect/ConnectBtns';
2121
import { AdapterBuilder } from '../../support/builder/AdapterBuilder';
2222
import { ConnectEventSchemaUtils } from '../../support/utils/connect/ConnectEventSchemaUtils';
2323
import { DataExplorerUtils } from '../../support/utils/dataExplorer/DataExplorerUtils';
24-
import { DataLakeBtns } from '../../support/utils/dataExplorer/DataExplorerBtns';
24+
import { DataExplorerBtns } from '../../support/utils/dataExplorer/DataExplorerBtns';
2525

2626
describe('Test Edit Adapter', () => {
2727
beforeEach('Setup Test', () => {
@@ -110,7 +110,7 @@ describe('Test Edit Adapter', () => {
110110

111111
cy.wait(3000);
112112

113-
DataLakeBtns.refreshDataLakeMeasures().click();
113+
DataExplorerBtns.refreshDataLakeMeasures().click();
114114

115115
DataExplorerUtils.waitForCountingResults();
116116

ui/cypress/tests/dataExplorer/addAssetsToDataView.smoke.spec.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,17 @@ describe('Creates a new adapter with a linked asset', () => {
3434

3535
it('Add Assets during Chart generation', () => {
3636
DataExplorerUtils.createDataViewWithAssets([assetName1, assetName2]);
37+
AssetUtils.goToAssets();
38+
AssetUtils.checkAmountOfAssets(3);
3739
//Test
3840
AssetUtils.checkAmountOfLinkedResourcesByAssetName(assetName1, 1);
3941
AssetUtils.checkAmountOfLinkedResourcesByAssetName(assetName2, 1);
4042
});
4143

4244
it('Edit Assets during Chart generation', () => {
4345
DataExplorerUtils.createDataViewWithAssets([assetName1, assetName2]);
46+
AssetUtils.goToAssets();
47+
AssetUtils.checkAmountOfAssets(3);
4448
//Test
4549
AssetUtils.checkAmountOfLinkedResourcesByAssetName(assetName1, 1);
4650
AssetUtils.checkAmountOfLinkedResourcesByAssetName(assetName2, 1);
@@ -49,11 +53,13 @@ describe('Creates a new adapter with a linked asset', () => {
4953
DataExplorerUtils.goToDatalake();
5054
DataExplorerUtils.editDataView('NewWidget');
5155
DataExplorerUtils.renameWidget('Rename');
56+
DataExplorerUtils.addChartsToAsset([assetName1, assetName3]);
57+
DataExplorerUtils.saveDataViewConfiguration();
58+
//Neceassary for Background Task to finish
59+
cy.wait(500);
5260

53-
DataExplorerUtils.saveToAddAssets();
54-
DataExplorerUtils.addToAsset([assetName1, assetName3]);
55-
DataExplorerUtils.saveAssetLinkFromChart();
56-
61+
AssetUtils.goToAssets();
62+
AssetUtils.checkAmountOfAssets(3);
5763
AssetUtils.checkAmountOfLinkedResourcesByAssetName(assetName2, 1);
5864
AssetUtils.checkAmountOfLinkedResourcesByAssetName(assetName3, 1);
5965
AssetUtils.checkResourceNamingByAssetName(assetName2, 'Rename');

ui/cypress/tests/dataExplorer/dataViewAssets.spec.ts

Lines changed: 0 additions & 60 deletions
This file was deleted.

ui/cypress/tests/dataExplorer/timeOrderDataView.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*/
1818

1919
import { DataExplorerUtils } from '../../support/utils/dataExplorer/DataExplorerUtils';
20-
import { DataLakeBtns } from '../../support/utils/dataExplorer/DataExplorerBtns';
20+
import { DataExplorerBtns } from '../../support/utils/dataExplorer/DataExplorerBtns';
2121
import { DataExplorerWidget } from '../../support/model/DataExplorerWidget';
2222

2323
describe('Test Time Order in Data Explorer', () => {
@@ -53,7 +53,7 @@ describe('Test Time Order in Data Explorer', () => {
5353

5454
// Save and leave view, edit view again and check ascending order
5555
DataExplorerUtils.saveDataViewConfiguration();
56-
DataLakeBtns.editDataViewButton('New chart');
56+
DataExplorerBtns.editDataViewButton('New chart');
5757
DataExplorerUtils.clickOrderBy('ascending');
5858
DataExplorerUtils.openVisualizationConfig();
5959
DataExplorerUtils.selectVisualizationType(DataExplorerWidget.TABLE);

ui/deployment/i18n/de.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"Stop pipeline": "Pipeline stoppen",
3333
"Name": "Name",
3434
"Last modified": "Zuletzt geändert",
35-
"Show": "anzeigen",
35+
"Show": "Anzeigen",
3636
"Edit": "Bearbeiten",
3737
"Manage permissions": "Berechtigungen verwalten",
3838
"Delete": "Löschen",

ui/src/app/connect/dialog/adapter-started/adapter-started-dialog.component.ts

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ export class AdapterStartedDialog implements OnInit {
298298

299299
await this.saveAssets(linkageData);
300300

301-
this.setSuccessMessage(linkageData);
301+
this.setSuccessMessage();
302302
} catch (err) {
303303
console.error('Error in addToAsset:', err);
304304
}
@@ -359,33 +359,15 @@ export class AdapterStartedDialog implements OnInit {
359359
);
360360
}
361361

362-
private setSuccessMessage(linkageData: LinkageData[]): void {
363-
const assetTypesList = this.formatWithAnd(
364-
linkageData.map(data => data.type),
365-
);
362+
private setSuccessMessage(): void {
366363
if (this.selectedAssets.length > 0) {
367-
const assetIdsList = this.formatWithAnd(
368-
this.selectedAssets.map(asset => asset.assetName),
369-
);
370-
371364
this.addToAssetText = this.translateService.instant(
372-
'Your {{assetTypes}} were successfully added to {{assetIds}}.',
373-
{
374-
assetTypes: assetTypesList,
375-
assetIds: assetIdsList,
376-
},
365+
'Your Assets were successfully added.',
377366
);
378367
}
379368
if (this.deselectedAssets && this.deselectedAssets.length > 0) {
380-
const assetIdsRemovedList = this.formatWithAnd(
381-
this.deselectedAssets.map(asset => asset.assetName),
382-
);
383369
this.deletedFromAssetText = this.translateService.instant(
384-
'Your {{assetTypes}} were successfully deleted from {{assetIds}}.',
385-
{
386-
assetTypes: assetTypesList,
387-
assetIds: assetIdsRemovedList,
388-
},
370+
'Your Assets were successfully deleted.',
389371
);
390372
}
391373
}

ui/src/app/data-explorer/components/chart-view/data-explorer-chart-view.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
(updateDateRangeEmitter)="updateDateRange($event)"
3737
(saveDataViewEmitter)="saveDataView()"
3838
(discardDataViewEmitter)="discardChanges()"
39+
(addToAssetEmitter)="addAssetDialog()"
3940
fxFlex="100"
4041
>
4142
</sp-data-explorer-data-view-toolbar>

0 commit comments

Comments
 (0)