From dd319b343eec8777d532241864540e113d5b0acd Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Fri, 17 Jul 2015 17:58:27 +0200 Subject: [PATCH 1/7] add svg animation of received state --- app/components/jobs-item.coffee | 5 +++++ app/styles/app.scss | 2 ++ app/styles/app/animations/booting-state.sass | 18 ++++++++++++++++++ app/styles/app/layouts/build-job.sass | 3 +++ app/styles/app/modules/icons.sass | 1 - app/templates/components/jobs-item.hbs | 12 +++++++++++- 6 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 app/styles/app/animations/booting-state.sass diff --git a/app/components/jobs-item.coffee b/app/components/jobs-item.coffee index d2a60524..249ddab1 100644 --- a/app/components/jobs-item.coffee +++ b/app/components/jobs-item.coffee @@ -7,6 +7,11 @@ JobsItemComponent = Ember.Component.extend classNameBindings: ['job.state'] classNames: ['tile', 'tile--jobs', 'row'] + isBooting: (-> + if @get('job.state') == 'received' + return true + ).property('job.state') + languages: (-> output = [] diff --git a/app/styles/app.scss b/app/styles/app.scss index f0f266bc..8d65e9c2 100644 --- a/app/styles/app.scss +++ b/app/styles/app.scss @@ -25,6 +25,8 @@ @import "app/components/sync-button"; @import "app/components/loading-indicator"; +@import "app/animations/booting-state"; + @import "app/modules/section"; @import "app/modules/loader"; @import "app/modules/tiles"; diff --git a/app/styles/app/animations/booting-state.sass b/app/styles/app/animations/booting-state.sass new file mode 100644 index 00000000..6c68fb80 --- /dev/null +++ b/app/styles/app/animations/booting-state.sass @@ -0,0 +1,18 @@ +.svg-booting + .bubble + transform-origin: center center + animation: bubbleScale 1.2s infinite linear + + .bubble:nth-of-type(2) + animation-delay: 0.35s + + .bubble:nth-of-type(3) + animation-delay: 0.7s + + +@keyframes bubbleScale + 0%, 80%, 100% + transform: scale(0) + + 40% + transform: scale(1.0) diff --git a/app/styles/app/layouts/build-job.sass b/app/styles/app/layouts/build-job.sass index 3926191f..9006b152 100644 --- a/app/styles/app/layouts/build-job.sass +++ b/app/styles/app/layouts/build-job.sass @@ -38,6 +38,9 @@ .tile-status--job width: 2em + .svg-booting + margin: 0.7em 0.3em + .jobs-item padding: .1em 0 .icon diff --git a/app/styles/app/modules/icons.sass b/app/styles/app/modules/icons.sass index ec27b927..89a0b4cf 100644 --- a/app/styles/app/modules/icons.sass +++ b/app/styles/app/modules/icons.sass @@ -134,7 +134,6 @@ background-image: inline-image('svg/icon-job-errored.svg') .icon--job.started, .icon--job.created, -.icon--job.received, .icon--job.queued, .icon--started-yellow background-image: inline-image('svg/icon-job-started.svg') diff --git a/app/templates/components/jobs-item.hbs b/app/templates/components/jobs-item.hbs index 093678bd..a7a4a676 100644 --- a/app/templates/components/jobs-item.hbs +++ b/app/templates/components/jobs-item.hbs @@ -1,6 +1,16 @@ {{#link-to "job" repo job}}
- + {{#if isBooting}} + + + + + + + + {{else}} + + {{/if}}

From e2be355054fd0d8c1292f828013439dba3e9106b Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Fri, 17 Jul 2015 18:26:34 +0200 Subject: [PATCH 2/7] change states that animate --- app/components/jobs-item.coffee | 10 +++++++--- app/styles/app/modules/icons.sass | 8 +------- app/templates/components/jobs-item.hbs | 2 +- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/app/components/jobs-item.coffee b/app/components/jobs-item.coffee index 249ddab1..eb87dcfc 100644 --- a/app/components/jobs-item.coffee +++ b/app/components/jobs-item.coffee @@ -7,9 +7,13 @@ JobsItemComponent = Ember.Component.extend classNameBindings: ['job.state'] classNames: ['tile', 'tile--jobs', 'row'] - isBooting: (-> - if @get('job.state') == 'received' - return true + isAnimating: (-> + state = @get('job.state') + animationStates = ['received', 'queued', 'started', 'booting'] + + unless animationStates.indexOf(state) == -1 + true + ).property('job.state') languages: (-> diff --git a/app/styles/app/modules/icons.sass b/app/styles/app/modules/icons.sass index 89a0b4cf..64d3a814 100644 --- a/app/styles/app/modules/icons.sass +++ b/app/styles/app/modules/icons.sass @@ -121,21 +121,15 @@ .icon--env background-image: inline-image('svg/icon-environment-dark2.svg') -.icon--cross-red, .icon--job.failed, .icon--job.rejected background-image: inline-image('svg/icon-job-failed.svg') -.icon--check-green, .icon--job.passed, .icon--job.accepted background-image: inline-image('svg/icon-job-passed.svg') -.icon--error-grey, .icon--job.errored background-image: inline-image('svg/icon-job-errored.svg') -.icon--job.started, -.icon--job.created, -.icon--job.queued, -.icon--started-yellow +.icon--job.created background-image: inline-image('svg/icon-job-started.svg') .icon--job.canceled background-image: inline-image('svg/icon-job-canceled.svg') diff --git a/app/templates/components/jobs-item.hbs b/app/templates/components/jobs-item.hbs index a7a4a676..44cd01ad 100644 --- a/app/templates/components/jobs-item.hbs +++ b/app/templates/components/jobs-item.hbs @@ -1,6 +1,6 @@ {{#link-to "job" repo job}}

- {{#if isBooting}} + {{#if isAnimating}} From 63d8db46921c22439b02f8310d5785e7c3c05f3b Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Thu, 23 Jul 2015 17:35:58 +0200 Subject: [PATCH 3/7] switch from svg to css animation --- app/styles/app.scss | 2 -- app/styles/app/animations/booting-state.sass | 18 ----------- app/styles/app/modules/icons.sass | 32 +++++++++++++++++++- app/templates/components/jobs-item.hbs | 8 +---- 4 files changed, 32 insertions(+), 28 deletions(-) delete mode 100644 app/styles/app/animations/booting-state.sass diff --git a/app/styles/app.scss b/app/styles/app.scss index 9542c65b..21280bee 100644 --- a/app/styles/app.scss +++ b/app/styles/app.scss @@ -26,8 +26,6 @@ @import "app/components/sync-button"; @import "app/components/loading-indicator"; -@import "app/animations/booting-state"; - @import "app/modules/section"; @import "app/modules/loader"; @import "app/modules/tiles"; diff --git a/app/styles/app/animations/booting-state.sass b/app/styles/app/animations/booting-state.sass deleted file mode 100644 index 6c68fb80..00000000 --- a/app/styles/app/animations/booting-state.sass +++ /dev/null @@ -1,18 +0,0 @@ -.svg-booting - .bubble - transform-origin: center center - animation: bubbleScale 1.2s infinite linear - - .bubble:nth-of-type(2) - animation-delay: 0.35s - - .bubble:nth-of-type(3) - animation-delay: 0.7s - - -@keyframes bubbleScale - 0%, 80%, 100% - transform: scale(0) - - 40% - transform: scale(1.0) diff --git a/app/styles/app/modules/icons.sass b/app/styles/app/modules/icons.sass index 87308f68..6a43244a 100644 --- a/app/styles/app/modules/icons.sass +++ b/app/styles/app/modules/icons.sass @@ -129,7 +129,11 @@ background-image: inline-image('svg/icon-job-passed.svg') .icon--job.errored background-image: inline-image('svg/icon-job-errored.svg') -.icon--job.created +.icon--job.started, +.icon--job.queued, +.icon--job.booting, +.icon--job.received, +.icon--job.created, background-image: inline-image('svg/icon-job-started.svg') .icon--job.canceled background-image: inline-image('svg/icon-job-canceled.svg') @@ -203,3 +207,29 @@ .icon-flag background-image: inline-image('svg/notice-flag.svg') + + +.icon-receiving + margin: 0.3rem 0.5rem; + display: inline-block; + i + width: 4px + height: 4px + border-radius: 50% + display: inline-block + background-color: $start-bg-color + transform-origin: center center + animation: bubbleScale 1.2s infinite linear + i:nth-of-type(2) + animation-delay: 0.35s + i:nth-of-type(3) + animation-delay: 0.7s + + +@keyframes bubbleScale + 0%, 80%, 100% + transform: scale(0) + + 40% + transform: scale(1.0) + diff --git a/app/templates/components/jobs-item.hbs b/app/templates/components/jobs-item.hbs index 44cd01ad..701c8d09 100644 --- a/app/templates/components/jobs-item.hbs +++ b/app/templates/components/jobs-item.hbs @@ -1,13 +1,7 @@ {{#link-to "job" repo job}}
{{#if isAnimating}} - - - - - - - + {{else}} {{/if}} From 691e02d08f13186d4256b56c2f5952ef2aa2b5df Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Mon, 27 Jul 2015 16:46:16 +0200 Subject: [PATCH 4/7] check for push permission in ssh key settings --- app/routes/settings.coffee | 19 ++++++++++++++++++ app/templates/components/ssh-key.hbs | 19 ++++++++++++------ app/templates/settings.hbs | 11 ++++++++-- tests/integration/components/ssh-key-test.js | 21 ++++++++++++++++++-- 4 files changed, 60 insertions(+), 10 deletions(-) diff --git a/app/routes/settings.coffee b/app/routes/settings.coffee index 33d63f16..76889e85 100644 --- a/app/routes/settings.coffee +++ b/app/routes/settings.coffee @@ -42,12 +42,31 @@ Route = TravisRoute.extend response.active ); + hasPushAccess: -> + repoId = parseInt @modelFor('repo').get('id') + pushAccess = true + + Ajax.get '/users/permissions', (data) => + + admin = data.admin.filter (item) -> + return item == repoId + push = data.push.filter (item) -> + return item == repoId + pull = data.pull.filter (item) -> + return item == repoId + + if Ember.isEmpty admin && Ember.isEmpty push && !Ember.isEmpty pull + pushAccess = false + + pushAccess + model: () -> return Ember.RSVP.hash({ settings: @modelFor('repo').fetchSettings(), envVars: this.fetchEnvVars(), sshKey: this.fetchSshKey(), customSshKey: this.fetchCustomSshKey(), + hasPushAccess: this.hasPushAccess(), repositoryActive: this.fetchRepositoryActiveFlag() }); diff --git a/app/templates/components/ssh-key.hbs b/app/templates/components/ssh-key.hbs index 91b8cadf..6120f9aa 100644 --- a/app/templates/components/ssh-key.hbs +++ b/app/templates/components/ssh-key.hbs @@ -11,12 +11,19 @@ {{#if isDeleting}} {{loading-indicator}} {{else}} -
- - - -
Delete
-
+ {{#if pushAccess}} +
+ + + +
Delete
+
+ {{else}} +
+ +
You can't
delete keys
+
+ {{/if}} {{/if}}
{{else}} diff --git a/app/templates/settings.hbs b/app/templates/settings.hbs index 0fdaecb0..60e25c6d 100644 --- a/app/templates/settings.hbs +++ b/app/templates/settings.hbs @@ -30,12 +30,19 @@

SSH Key

{{#if model.customSshKey}} - {{ssh-key key=model.customSshKey sshKeyDeleted="sshKeyDeleted"}} + {{ssh-key key=model.customSshKey sshKeyDeleted="sshKeyDeleted" pushAccess=model.hasPushAccess}} {{else}} {{ssh-key key=model.sshKey}} - {{add-ssh-key repo=repo sshKeyAdded="sshKeyAdded"}} + + {{#if model.hasPushAccess}} + {{add-ssh-key repo=repo sshKeyAdded="sshKeyAdded"}} + {{/if}} {{/if}} + {{#unless model.hasPushAccess}} +

You don't have sufficient permissons to add or remove ssh keys on this repository.

+ {{/unless}} + {{/if}} {{!--
diff --git a/tests/integration/components/ssh-key-test.js b/tests/integration/components/ssh-key-test.js index 0844f31b..ebdf5390 100644 --- a/tests/integration/components/ssh-key-test.js +++ b/tests/integration/components/ssh-key-test.js @@ -41,7 +41,7 @@ test('it renders the custom ssh key if custom key is set', function(assert) { }); -test('it deletes a custom key', function(assert) { +test('it deletes a custom key if permissions are right', function(assert) { assert.expect(1); var store = this.container.lookup('store:main'); @@ -52,7 +52,7 @@ test('it deletes a custom key', function(assert) { }); this.set('key', key); - this.render(hbs`{{ssh-key key=key sshKeyDeleted="sshKeyDeleted"}}`); + this.render(hbs`{{ssh-key key=key sshKeyDeleted="sshKeyDeleted" pushAccess=true}}`); this.on('sshKeyDeleted', function() {}); this.$('.ssh-key-action a').click(); @@ -60,3 +60,20 @@ test('it deletes a custom key', function(assert) { assert.ok(key.get('isDeleted'), 'key should be deleted'); }); + +test('it does not delete the custom key if permissions are insufficient', function(assert) { + assert.expect(1); + + var store = this.container.lookup('store:main'); + + var key; + Ember.run(function() { + key = store.push('sshKey', {description: 'fookey', fingerprint: 'somethingthing', id: 1}); + }); + + this.set('key', key); + this.render(hbs`{{ssh-key key=key sshKeyDeleted="sshKeyDeleted" pushAccess=false}}`); + + assert.ok(Ember.isEmpty(this.$('.ssh-key-action').find('a')), 'delete link should not be displayed'); + +}); \ No newline at end of file From eeeb64d29ae6509d71c8d9bb45f2786c52a6ba87 Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Tue, 28 Jul 2015 11:06:01 +0200 Subject: [PATCH 5/7] tweak position of help button --- app/styles/app/userlike.sass | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/styles/app/userlike.sass b/app/styles/app/userlike.sass index 20622ffd..657c5b87 100644 --- a/app/styles/app/userlike.sass +++ b/app/styles/app/userlike.sass @@ -2,7 +2,7 @@ .feedback-button display: none position: fixed - right: 4% + right: 9% left: auto bottom: 0 margin: 0 @@ -17,6 +17,9 @@ color: #399399 z-index: 89 + @media #{$medium-up} + right: 5% + .feedback-button:hover transform: translateY(5%) From 4c28a41dffa000d9c14b8c7947dec957feb6f63e Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Tue, 28 Jul 2015 11:31:03 +0200 Subject: [PATCH 6/7] tweak tooltip --- app/styles/app/modules/tooltips.sass | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/styles/app/modules/tooltips.sass b/app/styles/app/modules/tooltips.sass index 4c6d783f..7a8625dc 100644 --- a/app/styles/app/modules/tooltips.sass +++ b/app/styles/app/modules/tooltips.sass @@ -1,8 +1,4 @@ %tooltip - &:hover .tooltip-bubble - transform: translateY(0) - opacity: 1 - .tooltip-bubble position: absolute top: -2.8em @@ -18,6 +14,7 @@ line-height: 1.3 text-align: center white-space: nowrap + visibility: hidden transition: all 100ms ease transform: translateY(20%) @@ -27,7 +24,6 @@ color: $white &:hover text-decoration: underline - &:before content: "" position: absolute @@ -38,6 +34,11 @@ z-index: -1 background-color: #818383 + &:hover .tooltip-bubble + transform: translateY(0) + opacity: 1 + visibility: visible + .tooltip @extend %tooltip .tooltip-bubble From b9434e5baf72249b45259d1ee9f0a4e0b4b3a818 Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Tue, 28 Jul 2015 13:08:05 +0200 Subject: [PATCH 7/7] fix another too dark border --- app/styles/app/layouts/requests.sass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/styles/app/layouts/requests.sass b/app/styles/app/layouts/requests.sass index 74108110..ac331376 100644 --- a/app/styles/app/layouts/requests.sass +++ b/app/styles/app/layouts/requests.sass @@ -34,7 +34,7 @@ .requests-time @media #{$medium-up} padding-left: 2em - border-left: 1px solid $grey-lighter + border-left: 1px solid $cream-dark .tile--jobs padding-left: 2.5em