Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Dynamically update the updates tooltip - #778

Merged
damieng merged 13 commits into
masterfrom
wl-updates-tooltip
Nov 14, 2016
Merged

damieng merged 13 commits into
masterfrom
wl-updates-tooltip

Conversation

@winstliu

@winstliu winstliu commented Apr 28, 2016 •

Copy link
Copy Markdown
Contributor

Instead of removing the updates tooltip as soon as it gets clicked, dynamically update the number of updates left in the tooltip as individual packages get updated. When there are no outdated packages left, the tooltip will disappear.

Closes #511

Instead of removing it as soon as it gets clicked, dynamically update
the number of updates left as individual packages get updated.  When
there are no outdated packages left, the tooltip will disappear.

Does not work yet due to what I believe to be different package managers
being called.
@winstliu

Copy link
Copy Markdown
Contributor Author

This now actually works (yay!).

Something else I'd like to do though is also update the update count when packages are detected to be outdated. This will require an event like package-update-available, but then the view also needs to cache the list of outdated packages so that subsequent calls to getOutdated() doesn't keep increasing the update count. Working on this now, but consider what I have right now reviewable.

@lee-dohm

Copy link
Copy Markdown
Contributor

Looks good to me. I haven't had a chance to test it. Is this something you're going to continue working on? Or is it something you'd like to merge now and then do the other part as a separate PR?

Because only showing it when the Settings View first initialized was
boring.
@winstliu

Copy link
Copy Markdown
Contributor Author

@lee-dohm I managed to get the other part working, so I guess so! The update count now shows up whenever updates are available, not only when the Settings View first initializes (because that's just boring). I'll start working on the specs, which knowing me might take a long time.

Basic testing (setting CACHE_EXPIRY to 1 and downgrading multiple packages, checking for updates, updating them, reloading the window, etc) didn't catch anything unusual.

expiry: Date.now() + @CACHE_EXPIRY

for pack in packages
@emitPackageEvent 'update-available', pack

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This could also be outdated to match the function name.

Also fix this.showDeprecatedNotification not being defined
@lee-dohm

Copy link
Copy Markdown
Contributor

I'm still planning to take a look at this. This week has been bonkers. I've got it on my todo list for Monday.

@lee-dohm

Copy link
Copy Markdown
Contributor

This looks good except for the tests that are still marked TODO and have no body 😀

@winstliu winstliu changed the title [WIP] Dynamically update the updates tooltip Dynamically update the updates tooltip Oct 6, 2016
@winstliu

winstliu commented Oct 6, 2016

Copy link
Copy Markdown
Contributor Author

No longer WIP. Specs have been finished.

Comment thread lib/main.coffee
packageManager = new PackageManager()
Promise.all([packageManager.getOutdated(), packageManager.getInstalled()]).then (values) ->
outdatedPackages = values[0]
packageManager ?= new PackageManager() # TODO: Why is this needed when the package manager is initialized at the top of the file?

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.

Does it error without this?

@winstliu winstliu Oct 23, 2016 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

All the relevant specs (except the first one) fail because packageManager is null without this line. The first spec seems to correctly get the packageManager from the top of the file. It does not matter which spec you make the first (eg, if you comment out the first spec, then the second spec will run successfully and all others will fail).

@damieng
damieng merged commit 50c768c into master Nov 14, 2016
@damieng
damieng deleted the wl-updates-tooltip branch November 14, 2016 01:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants