Skip to content

Commit

Permalink
refactor: Make interactive tutorial work again (#2068)
Browse files Browse the repository at this point in the history
* refactor: Make interactive tutorial work again

* Link to pipeline tutorial from adapter tutorial

* Close welcome dialog in user tests

* Fix user test

* Remove welcome screen click
  • Loading branch information
dominikriemer authored Oct 24, 2023
1 parent 40665f9 commit 1a54649
Show file tree
Hide file tree
Showing 37 changed files with 587 additions and 1,204 deletions.
2 changes: 2 additions & 0 deletions ui/cypress/tests/userManagement/addUserAdmin.smoke.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ describe('Test User Management', () => {
cy.switchUser(user);

UserUtils.goToUserConfiguration();
cy.dataCy('close-tutorial-button').click();

cy.switchUser(UserUtils.adminUser);
UserUtils.goToUserConfiguration();

UserUtils.deleteUser(user);
// Validate that user is removed
cy.dataCy('user-accounts-table-row', { timeout: 10000 }).should(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
<button
class="stepper-button"
[disabled]="!specificAdapterSettingsFormValid"
data-cy="adapter-settings-next-button"
(click)="clickNext()"
color="accent"
mat-raised-button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
} from '@streampipes/platform-services';
import { EditEventPropertyComponent } from '../../../../dialog/edit-event-property/edit-event-property.component';
import { DialogService, PanelType } from '@streampipes/shared-ui';
import { ShepherdService } from '../../../../../services/tour/shepherd.service';

@Component({
selector: 'sp-event-property-row',
Expand Down Expand Up @@ -65,6 +66,7 @@ export class EventPropertyRowComponent implements OnInit {
constructor(
private dialog: MatDialog,
private dialogService: DialogService,
private shepherdService: ShepherdService,
) {}

ngOnInit() {
Expand Down Expand Up @@ -175,6 +177,7 @@ export class EventPropertyRowComponent implements OnInit {
isEditable: this.isEditable,
},
});
this.shepherdService.trigger('adapter-edit-field-clicked');

dialogRef.afterClosed().subscribe(refresh => {
this.timestampProperty = this.isTimestampProperty(this.node.data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
[showTitle]="true"
panelTitle="Result"
fxFlex="100"
data-cy="connect-schema-update-preview"
>
<div header fxLayoutAlign="end center" fxFlex="100">
<button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
placeholder="Adapter Name"
data-cy="sp-adapter-name"
required
(blur)="triggerTutorialAdapterNameAssigned()"
/>
</mat-form-field>
<mat-form-field color="accent">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,7 @@ export class StartAdapterConfigurationComponent implements OnInit {
startAdapterNow: this.startAdapterNow,
},
});

this.shepherdService.trigger('button-startAdapter');
this.shepherdService.trigger('adapter-settings-adapter-started');

dialogRef.afterClosed().subscribe(() => {
this.adapterStartedEmitter.emit();
Expand All @@ -196,5 +195,16 @@ export class StartAdapterConfigurationComponent implements OnInit {
handlePersistOption(selected: boolean) {
this.saveInDataLake = selected;
this.findDefaultTimestamp(selected);
this.checkAndTriggerTutorial('adapter-persist-selected');
}

triggerTutorialAdapterNameAssigned() {
this.checkAndTriggerTutorial('adapter-name-assigned');
}

checkAndTriggerTutorial(actionId: string) {
if (this.adapterDescription.name === 'Tutorial') {
this.shepherdService.trigger(actionId);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,6 @@
(filterChangedEmitter)="applyFilter($event)"
>
</sp-connect-filter-toolbar>
<div
fxFlex="100"
fxLayout="row"
fxLayoutAlign="end center"
style="padding-left: 10px; padding-right: 10px; font-size: 14px"
class="page-container-nav"
>
<button
mat-icon-button
id="startAdapterTutorial3"
(click)="startAdapterTutorial3()"
matTooltip="Tutorial: Generic Adapter"
>
<mat-icon color="accent">school</mat-icon>
</button>
</div>
</div>
<div fxLayout="column" fxFlex="100">
<sp-basic-header-title-component
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,10 @@ export class DataMarketplaceComponent implements OnInit {
});
}

startAdapterTutorial3() {
this.shepherdService.startAdapterTour3();
}

selectAdapter(appId: string) {
this.router.navigate(['connect', 'create', appId]);
this.router.navigate(['connect', 'create', appId]).then(() => {
this.shepherdService.trigger('new-adapter-selected');
});
}

applyFilter(filter: AdapterFilterSettingsModel) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,22 @@
(filterChangedEmitter)="applyFilter($event)"
>
</sp-connect-filter-toolbar>
<div
fxFlex="100"
fxLayout="row"
fxLayoutAlign="end center"
style="padding-left: 10px; padding-right: 10px; font-size: 14px"
class="page-container-nav"
>
<button
mat-icon-button
id="startAdapterTutorial3"
(click)="startAdapterTutorial()"
matTooltip="Tutorial: Generic Adapter"
>
<mat-icon color="accent">school</mat-icon>
</button>
</div>
<button
mat-icon-button
matTooltip="Refresh adapters"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import { AdapterFilterPipe } from '../../filter/adapter-filter.pipe';
import { SpConnectRoutes } from '../../connect.routes';
import { CanNotEditAdapterDialog } from '../../dialog/can-not-edit-adapter-dialog/can-not-edit-adapter-dialog.component';
import { zip } from 'rxjs';
import { ShepherdService } from '../../../services/tour/shepherd.service';

@Component({
selector: 'sp-existing-adapters',
Expand Down Expand Up @@ -84,7 +85,6 @@ export class ExistingAdaptersComponent implements OnInit {
adapterMetrics: Record<string, SpMetricsEntry> = {};

constructor(
public connectService: ConnectService,
private adapterService: AdapterService,
private dialogService: DialogService,
private currentUserService: CurrentUserService,
Expand All @@ -94,6 +94,7 @@ export class ExistingAdaptersComponent implements OnInit {
private adapterFilter: AdapterFilterPipe,
private breadcrumbService: SpBreadcrumbService,
private adapterMonitoringService: AdapterMonitoringService,
private shepherdService: ShepherdService,
) {}

ngOnInit(): void {
Expand Down Expand Up @@ -308,8 +309,14 @@ export class ExistingAdaptersComponent implements OnInit {
});
}

startAdapterTutorial() {
this.shepherdService.startAdapterTour();
}

createNewAdapter(): void {
this.router.navigate(['connect', 'create']);
this.router.navigate(['connect', 'create']).then(() => {
this.shepherdService.trigger('new-adapter-clicked');
});
}

applyFilter(filter: AdapterFilterSettingsModel) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
name="runtimename"
id="runtimename"
data-cy="connect-edit-field-runtime-name"
(blur)="triggerTutorialStep()"
[(ngModel)]="cachedProperty.runtimeName"
/>
</mat-form-field>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
} from 'rxjs/operators';
import { UntypedFormControl } from '@angular/forms';
import { Observable } from 'rxjs';
import { ShepherdService } from '../../../../../services/tour/shepherd.service';

@Component({
selector: 'sp-edit-schema-transformation',
Expand All @@ -52,7 +53,10 @@ export class EditSchemaTransformationComponent implements OnInit {
domainPropertyControl = new UntypedFormControl();
semanticTypes: Observable<string[]>;

constructor(private semanticTypesService: SemanticTypesService) {}
constructor(
private semanticTypesService: SemanticTypesService,
private shepherdService: ShepherdService,
) {}

ngOnInit(): void {
this.semanticTypes = this.domainPropertyControl.valueChanges.pipe(
Expand Down Expand Up @@ -81,4 +85,11 @@ export class EditSchemaTransformationComponent implements OnInit {
}
this.timestampSemanticsChanged.emit(this.isTimestampProperty);
}

triggerTutorialStep(): void {
console.log('lu');
if (this.cachedProperty.runtimeName === 'temp') {
this.shepherdService.trigger('adapter-runtime-name-changed');
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import { DialogRef } from '@streampipes/shared-ui';
import { EditSchemaTransformationComponent } from './components/edit-schema-transformation/edit-schema-transformation.component';
import { EditValueTransformationComponent } from './components/edit-value-transformation/edit-value-transformation.component';
import { EditUnitTransformationComponent } from './components/edit-unit-transformation/edit-unit-transformation.component';
import { ShepherdService } from '../../../services/tour/shepherd.service';

@Component({
selector: 'sp-edit-event-property',
Expand Down Expand Up @@ -77,6 +78,7 @@ export class EditEventPropertyComponent implements OnInit {
private dataTypeService: DataTypesService,
private semanticTypeUtilsService: SemanticTypeUtilsService,
private semanticTypesService: SemanticTypesService,
private shepherdService: ShepherdService,
) {}

ngOnInit(): void {
Expand Down Expand Up @@ -206,6 +208,7 @@ export class EditEventPropertyComponent implements OnInit {
).operator;
}
this.dialogRef.close({ data: this.property });
this.shepherdService.trigger('adapter-field-changed');
}

enableSaveBtn($event: boolean) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
fxLayout="row"
class="draggable-pipeline-element"
fxFlex="100"
id="{{ element.appId }}"
id="{{ element.appId || element.name.toLowerCase().replaceAll(' ', '_') }}"
[attr.data-pe]="element.elementId"
(mouseenter)="updateMouseOver(element.name)"
(mouseleave)="updateMouseOver('')"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,6 @@
</mat-form-field>
</div>
<span fxFlex></span>
<button
mat-icon-button
color="accent"
(click)="startCreatePipelineTour()"
[matTooltip]="'Tutorial'"
style="margin-right: 5px"
>
<i class="material-icons"> school </i>
</button>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,7 @@
*
*/

import {
AfterViewInit,
Component,
EventEmitter,
Input,
OnInit,
Output,
} from '@angular/core';
import { AfterViewInit, Component, Input, OnInit } from '@angular/core';
import { RestApi } from '../../../services/rest-api.service';
import {
PeCategory,
Expand Down Expand Up @@ -69,9 +62,6 @@ export class PipelineElementIconStandComponent
@Input()
allElements: PipelineElementUnion[];

@Output()
startTourEmitter: EventEmitter<void> = new EventEmitter<void>();

elementFilter = '';
allCategories: Map<PipelineElementType, PeCategory[]> = new Map();
categoriesReady = false;
Expand Down Expand Up @@ -177,10 +167,6 @@ export class PipelineElementIconStandComponent
this.makeDraggable();
}

startCreatePipelineTour() {
this.startTourEmitter.emit();
}

changeSorting(availableType: any, sortMode: string) {
availableType.sort = sortMode;
this.makeDraggable();
Expand Down
1 change: 0 additions & 1 deletion ui/src/app/editor/editor.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
<sp-pipeline-element-icon-stand
[allElements]="allElements"
*ngIf="allElementsLoaded"
(startTourEmitter)="startCreatePipelineTour()"
>
</sp-pipeline-element-icon-stand>
</div>
Expand Down
Loading

0 comments on commit 1a54649

Please sign in to comment.