From 8a5671245ccf47748861f864ee3498aef5aff693 Mon Sep 17 00:00:00 2001 From: simurai Date: Sat, 12 Nov 2016 14:14:57 +0900 Subject: [PATCH 1/3] Add progress styles --- styles/push-pull-menu-view.less | 35 +++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/styles/push-pull-menu-view.less b/styles/push-pull-menu-view.less index 68f97b0b0b..1bec64fe34 100644 --- a/styles/push-pull-menu-view.less +++ b/styles/push-pull-menu-view.less @@ -51,4 +51,39 @@ display: none; } } + + + // Progress indicator + &.in-progress { + .icon-mark-github { + position: relative; + color: @text-color; + &:before { + color: inherit; + } + &:after { + content: ""; + position: absolute; + top: -4px; + left: -4px; + width: 24px; + height: 24px; + border-top: 2px dotted; + border-right: 2px dotted; + border-bottom: 2px dotted transparent; + border-radius: 16px; + + // To limit CPU usage, the animation plays for some time at normal speed, + // then slows down frame-rate for a while and stops at some point + -webkit-animation: git-PushPullMenuView-animation 2s linear 12, + git-PushPullMenuView-animation 4s 24s steps(12) 100; + } + } + } +} + + +// Animations +@-webkit-keyframes git-PushPullMenuView-animation { + 100% { transform: rotate(360deg); } } From 619989ddf939fe184fd2ecd2b2929b9f88faf8c6 Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Mon, 14 Nov 2016 12:20:47 -0800 Subject: [PATCH 2/3] Apply in-progress class to PushPullMenuView for remote interactions --- lib/views/push-pull-menu-view.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/views/push-pull-menu-view.js b/lib/views/push-pull-menu-view.js index f3499a0165..ae1ace43ec 100644 --- a/lib/views/push-pull-menu-view.js +++ b/lib/views/push-pull-menu-view.js @@ -12,6 +12,7 @@ export default class PushPullMenuView { this.push = this.push.bind(this) this.pull = this.pull.bind(this) this.fetch = this.fetch.bind(this) + this.inProgress = false etch.initialize(this) } @@ -31,7 +32,7 @@ export default class PushPullMenuView { render () { return ( -
+
@@ -55,26 +56,36 @@ export default class PushPullMenuView { } async fetch () { + this.inProgress = true + etch.update(this) try { await this.props.fetch() } catch (error) { if (!(error instanceof GitError)) throw error this.errorMessage = error.stdErr + } finally { + this.inProgress = false return etch.update(this) } } async pull () { + this.inProgress = true + etch.update(this) try { await this.props.pull() } catch (error) { if (!(error instanceof GitError)) throw error this.errorMessage = error.stdErr + } finally { + this.inProgress = false return etch.update(this) } } async push (event) { + this.inProgress = true + etch.update(this) try { await this.props.push({force: event.metaKey, setUpstream: !this.props.remoteName}) } catch (error) { @@ -84,6 +95,8 @@ export default class PushPullMenuView { } else { this.errorMessage = error.stdErr } + } finally { + this.inProgress = false return etch.update(this) } } From 3be02f59ae957c41738b99e52021fdf83c92c24b Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Mon, 14 Nov 2016 15:06:34 -0800 Subject: [PATCH 3/3] Fix test --- test/controllers/status-bar-tile-controller.test.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/controllers/status-bar-tile-controller.test.js b/test/controllers/status-bar-tile-controller.test.js index f9d784670b..35a3121ac3 100644 --- a/test/controllers/status-bar-tile-controller.test.js +++ b/test/controllers/status-bar-tile-controller.test.js @@ -275,7 +275,8 @@ describe('StatusBarTileController', () => { assert.equal(pullButton.textContent, 'Pull (2)') pushButton.dispatchEvent(new MouseEvent('click')) - await etch.getScheduler().getNextUpdatePromise() + await etch.getScheduler().getNextUpdatePromise() // update for loading + await etch.getScheduler().getNextUpdatePromise() // update for error message assert.match(message.innerHTML, /Push rejected/) pushButton.dispatchEvent(new MouseEvent('click', {metaKey: true}))