Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(aio): add service worker guide #20736

Closed

Conversation

kapunahelewong
Copy link
Contributor

@kapunahelewong kapunahelewong commented Dec 1, 2017

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[x] Documentation content changes
[ ] angular.io application / infrastructure changes
[ ] Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Adds new Service Worker documentation and example.

Does this PR introduce a breaking change?

[ ] Yes
[ ] No

Other information

This PR is for working out the problems in the original SW PR #20716.

@mary-poppins
Copy link

You can preview 0aa146c at https://pr20736-0aa146c.ngbuilds.io/.

@mary-poppins
Copy link

You can preview 6d1d3be at https://pr20736-6d1d3be.ngbuilds.io/.

@mary-poppins
Copy link

You can preview 5e207d0 at https://pr20736-5e207d0.ngbuilds.io/.

@mary-poppins
Copy link

You can preview aedadf6 at https://pr20736-aedadf6.ngbuilds.io/.

@mary-poppins
Copy link

You can preview 8efb6bc at https://pr20736-8efb6bc.ngbuilds.io/.

@mary-poppins
Copy link

You can preview e0d7fe3 at https://pr20736-e0d7fe3.ngbuilds.io/.

@mary-poppins
Copy link

You can preview 4522b3f at https://pr20736-4522b3f.ngbuilds.io/.

@mary-poppins
Copy link

You can preview 766a0c9 at https://pr20736-766a0c9.ngbuilds.io/.

@mary-poppins
Copy link

You can preview dc39778 at https://pr20736-dc39778.ngbuilds.io/.

@IgorMinar IgorMinar added area: service-worker Issues related to the @angular/service-worker package comp: docs action: review The PR is still awaiting reviews from at least one requested reviewer labels Dec 5, 2017
@mary-poppins
Copy link

You can preview c79275b at https://pr20736-c79275b.ngbuilds.io/.

@kapunahelewong kapunahelewong changed the title [WIP] Troubleshooting: docs(aio): add service worker guide content and update nav docs(aio): add service worker guide content and update nav Dec 5, 2017
@kapunahelewong kapunahelewong changed the title docs(aio): add service worker guide content and update nav docs(aio): add service worker guide Dec 5, 2017
@mary-poppins
Copy link

You can preview f945fe9 at https://pr20736-f945fe9.ngbuilds.io/.

@mary-poppins
Copy link

You can preview 83fe3dc at https://pr20736-83fe3dc.ngbuilds.io/.

@mary-poppins
Copy link

You can preview 8dd050d at https://pr20736-8dd050d.ngbuilds.io/.

@alxhub alxhub requested a review from IgorMinar December 6, 2017 00:34
Copy link
Contributor

@IgorMinar IgorMinar left a comment

Choose a reason for hiding this comment

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

lgtm for package.json and other config changes. I haven't reviewed the content, but I don't expect that I was supposed to.

@IgorMinar IgorMinar added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Dec 6, 2017
@IgorMinar IgorMinar added the target: major This PR is targeted for the next major release label Dec 6, 2017
@IgorMinar IgorMinar closed this in 9bbec42 Dec 6, 2017
Copy link
Member

@gkalpak gkalpak left a comment

Choose a reason for hiding this comment

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

I haven't looked at the actual content (*.md files), but here are some comments:

The offline-checkbox image has the Memory highlighted (although not the current tab), which is a little confusing. Can we have an image with the Network tab highlighted?

The welcome-msg-en.png image says "Welcome to app", but the actual app will show "Welcome to Service Workers". Same for the welcome-msg-fr.png.

The empty aio/content/examples/service-worker-getstart/src/app/app.component.css should be removed.

"tooltip": "The ngsw-config.json configuration file controls service worker caching behavior."
}
]
},
Copy link
Member

Choose a reason for hiding this comment

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

Should Service Workers be in Fundamentals (rather than Techniques)? (Just checking...)

Copy link
Contributor

Choose a reason for hiding this comment

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

Service Workers is under Fundamentals.

{
"url": "guide/service-worker-devops",
"title": "Service Workers in Production",
"tooltip": "Information about running applications with service workers, including application update management, debugging, and killing applications."
Copy link
Member

Choose a reason for hiding this comment

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

This tooltip is a little too long. How about:

Running applications with service workers, managing application update, debugging, and killing applications.

{
"url": "guide/service-worker-configref",
"title": "Reference: Configuration File",
"tooltip": "The ngsw-config.json configuration file controls service worker caching behavior."
Copy link
Member

Choose a reason for hiding this comment

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

Why not Configuring service worker caching behavior (to be more consistent with other tooltips)?

If you look at the Network tab, you can verify that the service worker is active.

<figure>
<img src="generated/images/guide/service-worker/sw-active.png" alt="Requests are marked as from ServiceWorker">
Copy link
Member

Choose a reason for hiding this comment

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

This image is too wide and gets truncated at certain screen sizes. Make sure it is no wider than 660px.

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
Copy link
Member

Choose a reason for hiding this comment

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

If this is not needed, let's remove it.

it(`should have as title 'app'`, async(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('app');
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't it be Service Workers? Are these tests run at all (I don't think so). Do we need them (given that they are pretty basic and the assertions could/should be covered in the e2e tests)?


describe('sw-example App', () => {
let page: AppPage;
let logo = element(by.css('img'));
Copy link
Member

Choose a reason for hiding this comment

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

Since this is only used once, why not move it inside the respective test?

});
});

});
Copy link
Member

@gkalpak gkalpak Dec 6, 2017

Choose a reason for hiding this comment

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

We should somehow include the services into the tests. Right now, the only ServiceWorker related thing that is tested is ServiceWorkerModule.register(...). We should include the services into the app (i.e. inject them somewhere) and ensure that they at least do not break.

"resources": {
"files": [
"/favicon.ico",
"/index.html"
Copy link
Member

Choose a reason for hiding this comment

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

Does index.html have to be in here?

Copy link
Contributor

Choose a reason for hiding this comment

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

yes - Checked with Alex

import { SwUpdate } from '@angular/service-worker';

import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/interval';
Copy link
Member

Choose a reason for hiding this comment

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

It is better to replace the above 2 lines with: import { interval } from 'rxjs/observable/interval';

Copy link
Contributor

Choose a reason for hiding this comment

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

The app fails to compile when we remove the import Observable line. So keeping it as is.

Copy link
Member

Choose a reason for hiding this comment

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

It fails to compile, because you still mention Observable.interval below. It should be changed to just interval (in addition to replacing the above two lines per my previous comment.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok

@gkalpak
Copy link
Member

gkalpak commented Dec 6, 2017

Oh...too late 😞

@kapunahelewong
Copy link
Contributor Author

@gkalpak @chembu is going to address these comments in a new PR. Handing this back to @chembu now.

@gkalpak
Copy link
Member

gkalpak commented Dec 6, 2017

Awesome! Feel free to ping me if you want me to take look.

@kapunahelewong
Copy link
Contributor Author

@chembu ^^

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker area: service-worker Issues related to the @angular/service-worker package cla: yes target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants