Skip to content

[#610][2] Add Anchor IDs and The First Step of Tutorial - #660

Merged
bolichen97 merged 6 commits into
masterfrom
bolin-tutorial-library-merge#2
Aug 28, 2018
Merged

bolichen97 merged 6 commits into
masterfrom
bolin-tutorial-library-merge#2

Conversation

@bolichen97

Copy link
Copy Markdown

The goal of this PR is to create all necessary Anchor IDs and the first step of the tutorial.

The library we use to achieve this goal is ngx-tour

Define anchor points for the tour steps by adding the tourAnchor directive throughout app.
"div tourAnchor="some.anchor.id"

Define tour steps using tourService.initialize(steps)
this.tourService.initialize([{
anchorId: 'some.anchor.id',
content: 'Some content',
title: 'First',
}, {
anchorId: 'another.anchor.id',
content: 'Other content',
title: 'Second',
}]);


The final goal of PR [#610] is to implement a tutorial into new GUI.

@bolichen97 bolichen97 added the gui label Aug 27, 2018
@zuozhiw zuozhiw changed the title [#610][1] Add Anchor IDs and The First Step of Tutorial [#610][2] Add Anchor IDs and The First Step of Tutorial Aug 28, 2018

constructor(public tourService: TourService) {
this.tourService.end$.subscribe(() => {
location.reload();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we refresh the page after the tour finishes?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After the whole tutorial steps, the workflow that we formed as the example will remain on screen if we do not refresh the page after the tour finished.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's open for discussion but I think we shouldn't refresh the page automatically. The user might want to play with the workflow around for some more time. Let's remove the refresh for now and discuss it again after everything's finished.

export class ProductTourComponent implements OnInit {

constructor(public tourService: TourService) { }
public loaded = false;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this variable is not use (at least in this PR)

location.reload();
});

this.tourService.initialize([{

@zuozhiw zuozhiw Aug 28, 2018 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we initialize the tourService inside the constructor or in other Angular life cycle callbacks, such as onInit? What's the recommended way by the library?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the library's demo project code, the author initialize tourService inside the constructor

<ng-template let-step="step">
<p class="tour-step-content" [innerHTML] = 'tourService.currentStep.content'></p>
<div class="tour-step-navigation">
<button *ngIf="tourService.hasPrev(step)" class="btn btn-sm btn-light" (click)="tourService.prev()">« Prev</button>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't see the Prev/Next buttons in my browser, the CSS seems also broken, please fix that.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prev/Next buttons will appear only if we have multiple steps

<texera-property-editor class="texera-property-editor-grid-container grid-container"></texera-property-editor>
<texera-workflow-editor class="texera-workflow-editor-grid-container grid-container"></texera-workflow-editor>
<texera-result-panel class="texera-result-panel-grid-container grid-container"></texera-result-panel>
<texera-navigation class="texera-navigation-grid-container grid-container" tourAnchor="texera-navigation-grid-container"></texera-navigation>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these anchor points used in this PR or following PRs?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

those anchor ids will used in the following PRs

@zuozhiw

zuozhiw commented Aug 28, 2018 •

Copy link
Copy Markdown
Contributor

Left a few comments on the PR. The CSS seems broken for me.

The test cases fail, and I've fixed them for you.

The test cases fail in 2 places:

  1. In navigation.component.spec.ts, it says no provider for NgbTourService. The reason is that in Angular, we need to provide the dependencies to the component separately in the testing file. You correctly fixed the problem in product-tour.component.spec.ts. Not sure why you didn't fix the navigation component.

  2. In some components, there is [tourAnchor]='xxx', in some others, there is tourAnchor='xxx'. Notice that the first way has [] around tourAnchor, and this is NOT correct in this case. [tourAnchor] means we want to pass a attribute to an Angular component. Normal tourAnchor means we just want to make it a regular DOM attribute.

@zuozhiw

zuozhiw commented Aug 28, 2018

Copy link
Copy Markdown
Contributor

@bobbyfine Looks good to merge. Although the CSS is broken now, I assume they'll be fixed in subsequent PRs. Look forward to review the next PR.

@bolichen97 bolichen97 mentioned this pull request Aug 28, 2018
5 tasks done
@bolichen97
bolichen97 merged commit 3a16437 into master Aug 28, 2018
@bolichen97
bolichen97 deleted the bolin-tutorial-library-merge#2 branch August 28, 2018 21:54
@Yicong-Huang Yicong-Huang added frontend Changes related to the frontend GUI and removed gui labels Jul 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend Changes related to the frontend GUI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants