From c4bc5a5f8b12b94dbf1f63baa5669e9a92eba2bc Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Wed, 1 Jul 2015 13:08:57 +0200 Subject: [PATCH 01/53] add some vars and markup to start with --- app/styles/app.scss | 3 +- app/styles/app/layouts/settings.sass | 42 ++++++++++++++++++++++++++++ app/templates/settings.hbs | 26 ++++++++++++----- 3 files changed, 63 insertions(+), 8 deletions(-) create mode 100644 app/styles/app/layouts/settings.sass diff --git a/app/styles/app.scss b/app/styles/app.scss index 764e55ba..344aaa5f 100644 --- a/app/styles/app.scss +++ b/app/styles/app.scss @@ -19,7 +19,7 @@ @import "app/misc"; @import "app/popup"; // @import "app/pro"; -@import "app/settings"; +// @import "app/settings"; @import "app/components/travis-switch"; @import "app/components/sync-button"; @@ -57,3 +57,4 @@ @import "app/layouts/caches"; @import "app/layouts/getting-started"; @import "app/layouts/first-sync"; +@import "app/layouts/settings"; diff --git a/app/styles/app/layouts/settings.sass b/app/styles/app/layouts/settings.sass new file mode 100644 index 00000000..4bd93130 --- /dev/null +++ b/app/styles/app/layouts/settings.sass @@ -0,0 +1,42 @@ +// If you'd no longer like to run this project on Travis CI you can deactivate it now.
You will be able to reactivate it in the future if you'd like to. + +$add-green: #3AA95E +$add-green-hover: #3BA85D + +$add-var-bg: #c2c3c5 +$add-var-color: $white +$add-var-radius: 4px + +$deactivate-red: #EB3A3D +$deactivate-red-hover: #D12F2F + +$deactivate-bg: #e93d3c + +$heading-color: #63a4a3 +$heading-size: 18px + +$switch-height: 32px +$switch-size: 11px +$switch-color: $white + +$switch-descr-size: 16px +$switch-descr-color: #8e8f8e + +$switch-descr-inline-size: 12px +$switch-descr-inline-color: #8e8f8e + +$input-border: 1px solid #eeedec +$input-radius: 4px +$input-color: #8e8f8e +$input-width: 78px +$input-height: 32px + +$setting-section-border: 2px solid #f2f3ef + +$env-vars-bg: #f2f3ef +$env-vars-color: #8e8f8e +$env-vars-size: 16px +$env-vars-radius: 4px +$env-vars-pw-bg: #eeedec + +$input-main-height: 30px diff --git a/app/templates/settings.hbs b/app/templates/settings.hbs index cc9e4bc4..73f1054a 100644 --- a/app/templates/settings.hbs +++ b/app/templates/settings.hbs @@ -1,11 +1,23 @@ -
{{outlet}} From 1072577ce03a3658f772ada3bdd6a2a5ee0db2d3 Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Wed, 1 Jul 2015 17:09:05 +0200 Subject: [PATCH 02/53] add compontents for settings --- app/components/env-var.coffee | 55 +++++++++++++++++++ app/components/settings-switch.coffee | 26 +++++++++ app/components/ssh-key.coffee | 5 ++ app/templates/components/env-var.hbs | 1 + app/templates/components/settings-switch.hbs | 9 +++ app/templates/components/ssh-key.hbs | 1 + tests/unit/components/env-var-test.coffee | 17 ++++++ .../components/settings-switch-test.coffee | 17 ++++++ tests/unit/components/ssh-key-test.coffee | 17 ++++++ 9 files changed, 148 insertions(+) create mode 100644 app/components/env-var.coffee create mode 100644 app/components/settings-switch.coffee create mode 100644 app/components/ssh-key.coffee create mode 100644 app/templates/components/env-var.hbs create mode 100644 app/templates/components/settings-switch.hbs create mode 100644 app/templates/components/ssh-key.hbs create mode 100644 tests/unit/components/env-var-test.coffee create mode 100644 tests/unit/components/settings-switch-test.coffee create mode 100644 tests/unit/components/ssh-key-test.coffee diff --git a/app/components/env-var.coffee b/app/components/env-var.coffee new file mode 100644 index 00000000..52a7e3e7 --- /dev/null +++ b/app/components/env-var.coffee @@ -0,0 +1,55 @@ +`import Ember from 'ember'` + +EnvVarComponent = Ember.Component.extend + + + name: DS.attr() + value: DS.attr() + public: DS.attr('boolean') + + repo: DS.belongsTo('repo', async: true) + + isEditing: false + isDeleting: false + + validates: + name: ['presence'] + + actionType: 'Save' + showValueField: Ember.computed.alias('public') + + value: ( (key, value) -> + if arguments.length == 2 + @get('model').set('value', value) + value + else if @get('public') + @get('model.value') + else + '••••••••••••••••' + ).property('model.value', 'public') + + actions: + delete: -> + return if @get('isDeleting') + @set('isDeleting', true) + + @get('model').destroyRecord() + + edit: -> + @set('isEditing', true) + + cancel: -> + @set('isEditing', false) + @get('model').revert() + + save: -> + return if @get('isSaving') + + if @isValid() + env_var = @get('model') + + # TODO: handle errors + env_var.save().then => + @set('isEditing', false) + +`export default EnvVarComponent` diff --git a/app/components/settings-switch.coffee b/app/components/settings-switch.coffee new file mode 100644 index 00000000..2381b68c --- /dev/null +++ b/app/components/settings-switch.coffee @@ -0,0 +1,26 @@ +`import Ember from 'ember'` + +SettingsSwitchComponent = Ember.Component.extend + + tagName: 'a' + classNames: ['settings-switch'] + classNameBindings: ['_active:active'] + + # TODO: how to handle overriding properties to + # avoid naming it _action? + _active: (-> + @get('target.active') || @get('active') + ).property('target.active', 'active') + + click: -> + target = @get('target') + if @get('toggleAutomatically') != 'false' + if target + @set('target.active', !@get('target.active')) + else + @set('active', !@get('active')) + # allow for bindings to propagate + Ember.run.next this, -> + @sendAction('action', target) + +`export default SettingsSwitchComponent` diff --git a/app/components/ssh-key.coffee b/app/components/ssh-key.coffee new file mode 100644 index 00000000..939f29dc --- /dev/null +++ b/app/components/ssh-key.coffee @@ -0,0 +1,5 @@ +`import Ember from 'ember'` + +SshKeyComponent = Ember.Component.extend() + +`export default SshKeyComponent` diff --git a/app/templates/components/env-var.hbs b/app/templates/components/env-var.hbs new file mode 100644 index 00000000..afa31207 --- /dev/null +++ b/app/templates/components/env-var.hbs @@ -0,0 +1 @@ +

this is an env-var

diff --git a/app/templates/components/settings-switch.hbs b/app/templates/components/settings-switch.hbs new file mode 100644 index 00000000..e4c7672d --- /dev/null +++ b/app/templates/components/settings-switch.hbs @@ -0,0 +1,9 @@ +
+ + ON + + + OFF + +
+Some label text \ No newline at end of file diff --git a/app/templates/components/ssh-key.hbs b/app/templates/components/ssh-key.hbs new file mode 100644 index 00000000..437eda01 --- /dev/null +++ b/app/templates/components/ssh-key.hbs @@ -0,0 +1 @@ +

This is an ssh key

diff --git a/tests/unit/components/env-var-test.coffee b/tests/unit/components/env-var-test.coffee new file mode 100644 index 00000000..ece08e45 --- /dev/null +++ b/tests/unit/components/env-var-test.coffee @@ -0,0 +1,17 @@ +`import { test, moduleForComponent } from 'ember-qunit'` + +moduleForComponent 'env-var', { + # specify the other units that are required for this test + # needs: ['component:foo', 'helper:bar'] +} + +test 'it renders', (assert) -> + assert.expect 2 + + # creates the component instance + component = @subject() + assert.equal component._state, 'preRender' + + # renders the component to the page + @render() + assert.equal component._state, 'inDOM' diff --git a/tests/unit/components/settings-switch-test.coffee b/tests/unit/components/settings-switch-test.coffee new file mode 100644 index 00000000..674547fc --- /dev/null +++ b/tests/unit/components/settings-switch-test.coffee @@ -0,0 +1,17 @@ +`import { test, moduleForComponent } from 'ember-qunit'` + +moduleForComponent 'settings-switch', { + # specify the other units that are required for this test + # needs: ['component:foo', 'helper:bar'] +} + +test 'it renders', (assert) -> + assert.expect 2 + + # creates the component instance + component = @subject() + assert.equal component._state, 'preRender' + + # renders the component to the page + @render() + assert.equal component._state, 'inDOM' diff --git a/tests/unit/components/ssh-key-test.coffee b/tests/unit/components/ssh-key-test.coffee new file mode 100644 index 00000000..9cb96498 --- /dev/null +++ b/tests/unit/components/ssh-key-test.coffee @@ -0,0 +1,17 @@ +`import { test, moduleForComponent } from 'ember-qunit'` + +moduleForComponent 'ssh-key', { + # specify the other units that are required for this test + # needs: ['component:foo', 'helper:bar'] +} + +test 'it renders', (assert) -> + assert.expect 2 + + # creates the component instance + component = @subject() + assert.equal component._state, 'preRender' + + # renders the component to the page + @render() + assert.equal component._state, 'inDOM' From 2ebd6e893ae2236b16f5e80c7408cfad8e00eab4 Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Wed, 1 Jul 2015 17:09:34 +0200 Subject: [PATCH 03/53] add some styles for settings and new switches --- app/routes/settings/index.coffee | 9 ++ app/styles/app.scss | 2 +- app/styles/app/_mixins/vars.sass | 1 + app/styles/app/layouts/settings.sass | 58 +++++++++--- app/styles/app/modules/switch.sass | 137 ++++++++++++++++++--------- app/templates/settings.hbs | 30 ++++-- 6 files changed, 176 insertions(+), 61 deletions(-) diff --git a/app/routes/settings/index.coffee b/app/routes/settings/index.coffee index a4bedd1a..325b1fb7 100644 --- a/app/routes/settings/index.coffee +++ b/app/routes/settings/index.coffee @@ -5,7 +5,16 @@ Route = TravisRoute.extend model: -> repo = @modelFor('repo') + console.log('######### YEHA ###############') repo.fetchSettings().then (settings) -> + + console.log(settings) repo.set('settings', settings) + # return Ember.RSVP.hash({ + # settings: repo.fetchSettings(), + # envVars: repo.envVars(), + # sshKey: repo.sshKey() + # }) + `export default Route` diff --git a/app/styles/app.scss b/app/styles/app.scss index 344aaa5f..699c03dc 100644 --- a/app/styles/app.scss +++ b/app/styles/app.scss @@ -21,7 +21,7 @@ // @import "app/pro"; // @import "app/settings"; -@import "app/components/travis-switch"; +// @import "app/components/travis-switch"; @import "app/components/sync-button"; @import "app/components/loading-indicator"; diff --git a/app/styles/app/_mixins/vars.sass b/app/styles/app/_mixins/vars.sass index c7a3c05d..9e70afe0 100644 --- a/app/styles/app/_mixins/vars.sass +++ b/app/styles/app/_mixins/vars.sass @@ -2,6 +2,7 @@ $font-size-ml: 18px $font-size-m: 16px $font-size-sm: 14px $line-height-m: 1.3 +$font-size-s: 12px // colors $teal1: #5BA5A4 diff --git a/app/styles/app/layouts/settings.sass b/app/styles/app/layouts/settings.sass index 4bd93130..f6ed552e 100644 --- a/app/styles/app/layouts/settings.sass +++ b/app/styles/app/layouts/settings.sass @@ -1,4 +1,3 @@ -// If you'd no longer like to run this project on Travis CI you can deactivate it now.
You will be able to reactivate it in the future if you'd like to. $add-green: #3AA95E $add-green-hover: #3BA85D @@ -15,16 +14,6 @@ $deactivate-bg: #e93d3c $heading-color: #63a4a3 $heading-size: 18px -$switch-height: 32px -$switch-size: 11px -$switch-color: $white - -$switch-descr-size: 16px -$switch-descr-color: #8e8f8e - -$switch-descr-inline-size: 12px -$switch-descr-inline-color: #8e8f8e - $input-border: 1px solid #eeedec $input-radius: 4px $input-color: #8e8f8e @@ -40,3 +29,50 @@ $env-vars-radius: 4px $env-vars-pw-bg: #eeedec $input-main-height: 30px + + +.small-title + font-size: 18px + color: $heading-color + font-weight: 400 + + +.settings + padding-top: .8em + +.settings-section + padding: 0 0 1em + margin-bottom: 1.5em + border-bottom: $setting-section-border + &:last-of-type + border-bottom: none + .small-title + margin-top: 0 + + +.settings-list + padding: 0 + margin: 0 + list-style: none + + li + margin-bottom: 1rem + @media #{$medium-up} + display: inline-block + width: grid-calc(11, 24) + +.settings-input + display: inline-block; + margin-right: 1rem; + vertical-align: middle + & + .label + vertical-align: middle + input + border: 1px solid #eeedec + border-radius: 4px + color: #8e8f8e + text-align: center + height: 32px; + display: inline-block; + width: 80px; + \ No newline at end of file diff --git a/app/styles/app/modules/switch.sass b/app/styles/app/modules/switch.sass index b29ca7af..ca91e119 100644 --- a/app/styles/app/modules/switch.sass +++ b/app/styles/app/modules/switch.sass @@ -1,55 +1,106 @@ -.profile-switch +%switch $switch-height: 28px $switch-inner-height: 22px $switch-width: 62px $switch-inner-width: 27px + box-sizing: border-box + position: relative + width: $switch-width + height: $switch-height + background-color: #d1d1d1 + border: none + cursor: pointer + @extend %border-radius-4px + &:before + content: none + &:after + content: "" + display: block + position: absolute + top: ($switch-height - $switch-inner-height) / 2 + right: ($switch-width - ($switch-inner-width * 2)) / 2 + height: $switch-inner-height + width: $switch-inner-width + background-color: #919191 + background-repeat: no-repeat + background-size: 14px 14px + background-position: 6px + transition: right 200ms ease + @extend .icon-hook-off + @extend %border-radius-4px + + &.active + background-color: #b6d5b6 + &:after + right: $switch-width - $switch-inner-width - (($switch-width - ($switch-inner-width * 2)) / 2) + background-color: #39a85b + @extend .icon-hook-on + + &.disabled + cursor: default + pointer-events: none + opacity: .5 + + .active &.disabled + background-color: #b6d5b6 + &:after + right: $switch-width - $switch-inner-width - (($switch-width - ($switch-inner-width * 2)) / 2) + background-color: #39a85b + @extend .icon-hook-on + + + +.profile-switch span display: none .switch - box-sizing: border-box - position: relative - width: $switch-width + @extend %switch + + +// NEW SWITCH +.settings-switch + $switch-width: 80px + $switch-height: 32px + + div + display: inline-block height: $switch-height - background-color: #d1d1d1 - border: none - cursor: pointer - @extend %border-radius-4px - &:before - content: none - &:after - content: "" - display: block - position: absolute - top: ($switch-height - $switch-inner-height) / 2 - right: ($switch-width - ($switch-inner-width * 2)) / 2 - height: $switch-inner-height - width: $switch-inner-width - background-color: #919191 - background-repeat: no-repeat - background-size: 14px 14px - background-position: 6px - transition: right 200ms ease - @extend .icon-hook-off - @extend %border-radius-4px + width: $switch-width + margin-right: 1em + padding: 3px 3px 3px 4px + vertical-align: middle; + font-size: $font-size-s + border-radius: 4px + background-color: #E2E1E2 + span + display: inline-block + width: 36px + height: 26px + vertical-align: middle; + border-radius: 4px + background-color: #A5A4A4 + color: $white + text-align: center; + font-weight: 300; + line-height: 2.2; + .label + vertical-align: middle; + font-size: $font-size-m + color: $grey-medium + .on + display: none + margin-left: 0 - &.active - background-color: #b6d5b6 - &:after - right: $switch-width - $switch-inner-width - (($switch-width - ($switch-inner-width * 2)) / 2) - background-color: #39a85b - @extend .icon-hook-on - - &.disabled - cursor: default - pointer-events: none - opacity: .5 - - .active &.disabled - background-color: #b6d5b6 - &:after - right: $switch-width - $switch-inner-width - (($switch-width - ($switch-inner-width * 2)) / 2) - background-color: #39a85b - @extend .icon-hook-on + &.active + div + background-color: #B8D6B9 + span + background-color: #3BA85D + .on + display: inline-block + margin-left: 36px + .off + display: none diff --git a/app/templates/settings.hbs b/app/templates/settings.hbs index 73f1054a..2c2bf0c6 100644 --- a/app/templates/settings.hbs +++ b/app/templates/settings.hbs @@ -1,24 +1,42 @@
-

General Settings

+

General Settings

+ +
    +
  • {{settings-switch}}
  • +
  • +
    Concurrent jobs +
  • +
  • {{settings-switch}}
  • +
  • {{settings-switch}}
  • +
+
-

Environment Variables

+

Environment Variables

+ + {{env-var}} + +
{{#if config.endpoints.sshKey}}
-

SSH Key

+

SSH Key

+ + {{ssh-key}}
{{/if}}
-

Deactivate Repository

+

Deactivate Repository

+

If you'd no longer like to run this project on Travis CI you can deactivate it now.
You will be able to reactivate it in the future if you'd like to.

+ Deactivate Repository
-
+{{!--
{{outlet}} -
+
--}} From 0d4e3a029ae16607e628312c90145ab9fab00c7c Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Wed, 1 Jul 2015 18:28:23 +0200 Subject: [PATCH 04/53] add new icons and some env var styles --- app/components/env-var.coffee | 1 + app/styles/app/layouts/settings.sass | 66 +++++++++++++++++++++++---- app/styles/app/modules/icons.sass | 15 ++++++ app/templates/components/env-var.hbs | 14 +++++- app/templates/settings.hbs | 10 ++-- public/images/svg/delete-disabled.svg | 11 +++++ public/images/svg/delete-hover.svg | 10 ++++ public/images/svg/delete.svg | 10 ++++ public/images/svg/fingerprint.svg | 49 ++++++++++++++++++++ public/images/svg/key.svg | 10 ++++ 10 files changed, 183 insertions(+), 13 deletions(-) create mode 100644 public/images/svg/delete-disabled.svg create mode 100644 public/images/svg/delete-hover.svg create mode 100644 public/images/svg/delete.svg create mode 100644 public/images/svg/fingerprint.svg create mode 100644 public/images/svg/key.svg diff --git a/app/components/env-var.coffee b/app/components/env-var.coffee index 52a7e3e7..bb4047f9 100644 --- a/app/components/env-var.coffee +++ b/app/components/env-var.coffee @@ -2,6 +2,7 @@ EnvVarComponent = Ember.Component.extend + classNames: ['settings-envvar'] name: DS.attr() value: DS.attr() diff --git a/app/styles/app/layouts/settings.sass b/app/styles/app/layouts/settings.sass index f6ed552e..092a946b 100644 --- a/app/styles/app/layouts/settings.sass +++ b/app/styles/app/layouts/settings.sass @@ -49,30 +49,78 @@ $input-main-height: 30px .small-title margin-top: 0 - -.settings-list +%settings-list padding: 0 margin: 0 list-style: none - li margin-bottom: 1rem + +.settings-list--columns + @extend %settings-list + li @media #{$medium-up} display: inline-block width: grid-calc(11, 24) +.settings-list--envvars + @extend %settings-list + .settings-input - display: inline-block; - margin-right: 1rem; + display: inline-block + margin-right: 1rem vertical-align: middle & + .label vertical-align: middle input + display: inline-block + height: 32px + width: 80px border: 1px solid #eeedec border-radius: 4px + font-size: $font-size-s color: #8e8f8e text-align: center - height: 32px; - display: inline-block; - width: 80px; - \ No newline at end of file + +.settings-envvar + padding: .6em .5em + border-radius: 4px + background-color: #F6F5F5 + +.env-var-name + display: inline-block + vertical-align: middle + @media #{$medium-up} + width: grid-calc(6, 12) + +.env-var-value + display: inline-block + input + display: inline-block + width: 100% + padding: 0.7em 0.5em 0.7em 2.2em + border-radius: 4px + border: none + background-color: #eeedec + color: #8e8f8e + @extend .icon-lock + background: + size: 14px + repeat: no-repeat + position: 0.4em 0.7em + @media #{$medium-up} + width: grid-calc(3, 12) + +.env-var-action + display: inline-block + text-align: right + line-height: 2 + + .icon-delete + @extend %icon + @extend .icon-delete + width: 1.1em + height: 1.3em + @media #{$medium-up} + width: grid-calc(1, 24) + float: right diff --git a/app/styles/app/modules/icons.sass b/app/styles/app/modules/icons.sass index f10322c2..07a7aece 100644 --- a/app/styles/app/modules/icons.sass +++ b/app/styles/app/modules/icons.sass @@ -177,6 +177,21 @@ .icon-hook-off background-image: inline-image('svg/hooks-off.svg') +.icon-delete + background-image: inline-image('svg/delete.svg') + +.icon-delete-hover + background-image: inline-image('svg/delete-hover.svg') + +.icon-delete-disabled + background-image: inline-image('svg/delete-disabled.svg') + +.icon-key + background-image: inline-image('svg/key.svg') + +.icon-fingerprint + background-image: inline-image('svg/fingerprint.svg') + .icon--plus &:after content: "+" diff --git a/app/templates/components/env-var.hbs b/app/templates/components/env-var.hbs index afa31207..4f8745fc 100644 --- a/app/templates/components/env-var.hbs +++ b/app/templates/components/env-var.hbs @@ -1 +1,13 @@ -

this is an env-var

+ +
THIS_IS_THE_ENV_NAME
+
+ +
+ \ No newline at end of file diff --git a/app/templates/settings.hbs b/app/templates/settings.hbs index 2c2bf0c6..906e972e 100644 --- a/app/templates/settings.hbs +++ b/app/templates/settings.hbs @@ -3,7 +3,7 @@

General Settings

-
    +
    • {{settings-switch}}
    • Concurrent jobs @@ -17,8 +17,12 @@

      Environment Variables

      - {{env-var}} - +
        +
      • {{env-var}}
      • +
      • {{env-var}}
      • +
      • {{env-var}}
      • +
      • {{env-var}}
      • +
      {{#if config.endpoints.sshKey}} diff --git a/public/images/svg/delete-disabled.svg b/public/images/svg/delete-disabled.svg new file mode 100644 index 00000000..659f2bc7 --- /dev/null +++ b/public/images/svg/delete-disabled.svg @@ -0,0 +1,11 @@ + + + + + + + + + diff --git a/public/images/svg/delete-hover.svg b/public/images/svg/delete-hover.svg new file mode 100644 index 00000000..7cca4ced --- /dev/null +++ b/public/images/svg/delete-hover.svg @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/public/images/svg/delete.svg b/public/images/svg/delete.svg new file mode 100644 index 00000000..dafc9615 --- /dev/null +++ b/public/images/svg/delete.svg @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/public/images/svg/fingerprint.svg b/public/images/svg/fingerprint.svg new file mode 100644 index 00000000..3dba05e4 --- /dev/null +++ b/public/images/svg/fingerprint.svg @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/images/svg/key.svg b/public/images/svg/key.svg new file mode 100644 index 00000000..71f5bba1 --- /dev/null +++ b/public/images/svg/key.svg @@ -0,0 +1,10 @@ + + + + + + + From 413a3260220cb8bd46a19efa0f38c464bb330e29 Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Thu, 2 Jul 2015 11:52:10 +0200 Subject: [PATCH 05/53] add delete button tooltips --- app/styles/app/layouts/settings.sass | 52 +++++++++++++++++++++++----- 1 file changed, 44 insertions(+), 8 deletions(-) diff --git a/app/styles/app/layouts/settings.sass b/app/styles/app/layouts/settings.sass index 092a946b..1ca743c6 100644 --- a/app/styles/app/layouts/settings.sass +++ b/app/styles/app/layouts/settings.sass @@ -89,12 +89,15 @@ $input-main-height: 30px .env-var-name display: inline-block + width: grid-calc(6, 12) vertical-align: middle - @media #{$medium-up} - width: grid-calc(6, 12) .env-var-value display: inline-block + width: grid-calc(4, 12) + @media #{$medium-up} + width: grid-calc(3, 12) + input display: inline-block width: 100% @@ -108,19 +111,52 @@ $input-main-height: 30px size: 14px repeat: no-repeat position: 0.4em 0.7em - @media #{$medium-up} - width: grid-calc(3, 12) .env-var-action + position: relative display: inline-block - text-align: right line-height: 2 + width: grid-calc(2, 24) + float: right .icon-delete @extend %icon @extend .icon-delete + display: block width: 1.1em height: 1.3em - @media #{$medium-up} - width: grid-calc(1, 24) - float: right + margin: .2em auto 0 + + + .tooltip + display: none + position: absolute + right: 0 + left: 0 + top: -2.7em + width: 4.2em + margin: auto + padding: 0 .8em + z-index: 5 + background-color: #818383 + border-radius: 4px + color: $white + &:before + content: "" + position: absolute + bottom: -0.3em + left: 39% + width: 1em + height: 1em + transform: rotate(45deg) + z-index: -1 + background-color: #818383 + + &:hover + .icon-delete + @extend .icon-delete-hover + .tooltip + display: block + + + From 859ed2cdea57a44c3f5c29587db520a88d69bb7b Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Thu, 2 Jul 2015 14:48:46 +0200 Subject: [PATCH 06/53] style env vars form --- app/styles/app/layouts/settings.sass | 56 +++++++++++++++++++- app/styles/app/modules/switch.sass | 3 +- app/templates/components/settings-switch.hbs | 2 +- app/templates/settings.hbs | 18 +++++++ 4 files changed, 76 insertions(+), 3 deletions(-) diff --git a/app/styles/app/layouts/settings.sass b/app/styles/app/layouts/settings.sass index 1ca743c6..9e9aa55c 100644 --- a/app/styles/app/layouts/settings.sass +++ b/app/styles/app/layouts/settings.sass @@ -89,8 +89,13 @@ $input-main-height: 30px .env-var-name display: inline-block + position: relative width: grid-calc(6, 12) vertical-align: middle + overflow: hidden + &:after + content: "" + @include fadeOut(right, -90deg, #F6F5F5) .env-var-value display: inline-block @@ -126,7 +131,6 @@ $input-main-height: 30px width: 1.1em height: 1.3em margin: .2em auto 0 - .tooltip display: none @@ -159,4 +163,54 @@ $input-main-height: 30px display: block +.form--envvar + .form-elem + display: inline-block + vertical-align: middle + + .form-elem:first-of-type, + .form-elem:nth-of-type(2) + width: 49.6% + .form-elem:nth-of-type(3) + width: 50% + .form-elem:last-of-type + width: 50% + float: right + text-align: right + + @media #{$medium-up} + .form-elem:first-of-type, + .form-elem:nth-of-type(2) + width: 32% + margin-right: 1em + .form-elem:nth-of-type(3) + width: 24% + .form-elem:last-of-type + width: 6% + float: right + text-align: right + input + display: inline-block + height: 32px + width: 100% + padding: .2em .4em + border: 1px solid #eeedec + border-radius: 4px + color: #8e8f8e + font-size: $font-size-sm + + .form-submit + padding: .5em .8em + color: $white + font-size: $font-size-sm + &:hover + background-color: #3BA85D + cursor: pointer + //refactor into switch component + .settings-switch + .label + display: inline-block + width: 7em + font-size: 12px + line-height: 1.3 diff --git a/app/styles/app/modules/switch.sass b/app/styles/app/modules/switch.sass index ca91e119..aa233826 100644 --- a/app/styles/app/modules/switch.sass +++ b/app/styles/app/modules/switch.sass @@ -93,6 +93,8 @@ .on display: none margin-left: 0 + .off + margin-left: 36px &.active div @@ -101,6 +103,5 @@ background-color: #3BA85D .on display: inline-block - margin-left: 36px .off display: none diff --git a/app/templates/components/settings-switch.hbs b/app/templates/components/settings-switch.hbs index e4c7672d..beb759a1 100644 --- a/app/templates/components/settings-switch.hbs +++ b/app/templates/components/settings-switch.hbs @@ -6,4 +6,4 @@ OFF
-Some label text \ No newline at end of file +Some label text diff --git a/app/templates/settings.hbs b/app/templates/settings.hbs index 906e972e..0f1e170b 100644 --- a/app/templates/settings.hbs +++ b/app/templates/settings.hbs @@ -24,6 +24,24 @@
  • {{env-var}}
  • + +
    +
    +
    + +
    +
    + +
    +
    + {{settings-switch inline="true"}} +
    +
    + +
    +
    +
    + {{#if config.endpoints.sshKey}}
    From bd6e1e347b0567dd80bc03d81d34b56da9eebe67 Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Thu, 2 Jul 2015 17:50:26 +0200 Subject: [PATCH 07/53] put styles on ssh-key settings --- app/components/ssh-key.coffee | 4 +- app/styles/app.scss | 6 +- app/styles/app/layouts/settings.sass | 115 +++++++++++++++++++++------ app/templates/components/ssh-key.hbs | 36 ++++++++- app/templates/settings.hbs | 16 ++++ 5 files changed, 147 insertions(+), 30 deletions(-) diff --git a/app/components/ssh-key.coffee b/app/components/ssh-key.coffee index 939f29dc..72eb23f7 100644 --- a/app/components/ssh-key.coffee +++ b/app/components/ssh-key.coffee @@ -1,5 +1,7 @@ `import Ember from 'ember'` -SshKeyComponent = Ember.Component.extend() +SshKeyComponent = Ember.Component.extend + + classNames: ['settings-sshkey'] `export default SshKeyComponent` diff --git a/app/styles/app.scss b/app/styles/app.scss index 699c03dc..42507ce7 100644 --- a/app/styles/app.scss +++ b/app/styles/app.scss @@ -9,13 +9,13 @@ @import "app/ansi"; @import "app/auth"; @import "app/charm"; -@import "app/forms"; -@import "app/github"; +// @import "app/forms"; +// @import "app/github"; @import "app/main/annotations"; @import "app/main/list"; @import "app/main/log"; -@import "app/main/sponsors"; +// @import "app/main/sponsors"; @import "app/misc"; @import "app/popup"; // @import "app/pro"; diff --git a/app/styles/app/layouts/settings.sass b/app/styles/app/layouts/settings.sass index 9e9aa55c..8411fbfa 100644 --- a/app/styles/app/layouts/settings.sass +++ b/app/styles/app/layouts/settings.sass @@ -120,7 +120,6 @@ $input-main-height: 30px .env-var-action position: relative display: inline-block - line-height: 2 width: grid-calc(2, 24) float: right @@ -132,30 +131,96 @@ $input-main-height: 30px height: 1.3em margin: .2em auto 0 - .tooltip - display: none - position: absolute - right: 0 - left: 0 - top: -2.7em - width: 4.2em - margin: auto - padding: 0 .8em - z-index: 5 - background-color: #818383 - border-radius: 4px - color: $white - &:before - content: "" - position: absolute - bottom: -0.3em - left: 39% - width: 1em - height: 1em - transform: rotate(45deg) - z-index: -1 - background-color: #818383 + &:hover + .icon-delete + @extend .icon-delete-hover + .tooltip + display: block +.tooltip + display: none + position: absolute + right: 0 + left: 0 + top: -2.7em + width: auto + margin: auto + padding: .2em .8em .3em + z-index: 5 + background-color: #818383 + border-radius: 4px + color: $white + white-space: nowrap + &:before + content: "" + position: absolute + bottom: -0.3em + left: 39% + width: 1em + height: 1em + transform: rotate(45deg) + z-index: -1 + background-color: #818383 + +.settings-sshkey + display: block + margin-bottom: 1rem + padding: .6em .5em + border-radius: 4px + background-color: #F6F5F5 + + span + vertical-align: middle + +.ssh-key-name + display: inline-block + position: relative + vertical-align: middle + width: 40% + white-space: nowrap + overflow: hidden + .icon-key + @extend %icon + @extend .icon-key + width: 1.2em + height: 1.3em + &:after + content: "" + @include fadeOut(right, -90deg, #F6F5F5) + +.ssh-key-value + display: inline-block + vertical-align: middle + width: grid-calc(3, 12) + text-align: right + white-space: nowrap + .icon-fingerprint + @extend %icon + @extend .icon-fingerprint + width: 1.3em + height: 1.3em + margin-right: .5em + +.ssh-key-action + display: inline-block + position: relative + vertical-align: middle + width: grid-calc(2, 24) + float: right + .icon-delete + @extend %icon + @extend .icon-delete + display: block + width: 1.1em + height: 1.3em + margin: .2em auto 0 + .icon-delete-disabled + @extend %icon + @extend .icon-delete-disabled + display: block + width: 1.1em + height: 1.3em + margin: .2em auto 0 &:hover .icon-delete @extend .icon-delete-hover @@ -181,7 +246,7 @@ $input-main-height: 30px @media #{$medium-up} .form-elem:first-of-type, .form-elem:nth-of-type(2) - width: 32% + width: 31.5% margin-right: 1em .form-elem:nth-of-type(3) width: 24% diff --git a/app/templates/components/ssh-key.hbs b/app/templates/components/ssh-key.hbs index 437eda01..cb3e6214 100644 --- a/app/templates/components/ssh-key.hbs +++ b/app/templates/components/ssh-key.hbs @@ -1 +1,35 @@ -

    This is an ssh key

    +{{#if custom}} +
    + + TRAVIS_PRIVATE_KEY +
    +
    + + e1:b1:83:06:7e:51:6d:5e:e0:e0:60:96:ca:ac:3d:8a +
    + +{{else}} +
    + + no custom key set +
    +
    + + e1:b1:83:06:7e:51:6d:5e:e0:e0:60:96:ca:ac:3d:8a +
    + +{{/if}} diff --git a/app/templates/settings.hbs b/app/templates/settings.hbs index 0f1e170b..52b1192a 100644 --- a/app/templates/settings.hbs +++ b/app/templates/settings.hbs @@ -48,6 +48,22 @@

    SSH Key

    {{ssh-key}} + {{ssh-key custom=true}} + +
    + Add custom SSH Key +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    {{/if}}
    From c0b49095b433e79efeecbc74111e063397ef90a5 Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Thu, 2 Jul 2015 18:14:31 +0200 Subject: [PATCH 08/53] add ssh-key from styles --- app/styles/app/layouts/settings.sass | 38 +++++++++++++++++++++++++++- app/styles/app/modules/buttons.sass | 17 +++++-------- app/templates/settings.hbs | 2 +- 3 files changed, 44 insertions(+), 13 deletions(-) diff --git a/app/styles/app/layouts/settings.sass b/app/styles/app/layouts/settings.sass index 8411fbfa..d14b8bf2 100644 --- a/app/styles/app/layouts/settings.sass +++ b/app/styles/app/layouts/settings.sass @@ -194,6 +194,7 @@ $input-main-height: 30px width: grid-calc(3, 12) text-align: right white-space: nowrap + overflow: hidden .icon-fingerprint @extend %icon @extend .icon-fingerprint @@ -258,7 +259,7 @@ $input-main-height: 30px display: inline-block height: 32px width: 100% - padding: .2em .4em + padding: .4em .4em border: 1px solid #eeedec border-radius: 4px color: #8e8f8e @@ -268,6 +269,7 @@ $input-main-height: 30px padding: .5em .8em color: $white font-size: $font-size-sm + font-weight: 300 &:hover background-color: #3BA85D cursor: pointer @@ -279,3 +281,37 @@ $input-main-height: 30px font-size: 12px line-height: 1.3 +.form--sshkey + + .form-elem + margin-bottom: .5rem + @media #{$medium-up} + .form-elem + max-width: 460px + + input + display: inline-block + height: 32px + width: 100% + padding: .4em .4em + border: 1px solid #eeedec + border-radius: 4px + color: #8e8f8e + font-size: $font-size-sm + textarea + display: inline-block + width: 100% + padding: .2em .4em + border: 1px solid #eeedec + border-radius: 4px + color: #8e8f8e + font-size: $font-size-sm + .form-submit + padding: .5em .8em + color: $white + font-size: $font-size-sm + font-weight: 300 + width: auto + &:hover + background-color: #3BA85D + diff --git a/app/styles/app/modules/buttons.sass b/app/styles/app/modules/buttons.sass index 4caac525..cbd9e47a 100644 --- a/app/styles/app/modules/buttons.sass +++ b/app/styles/app/modules/buttons.sass @@ -4,24 +4,22 @@ $button-border-color: #d4d4d4 -.button +.button, +.btn font-family: $font-family-sans-serif - font-size: $font-size-tiny - font-weight: normal position: relative overflow: visible display: inline-block padding: 5px 10px - border: 1px solid $button-border-color - margin: 0 - background-color: #E9E9E7 - background-clip: padding-box cursor: pointer outline: none text-decoration: none text-align: center - color: $gray-dark-3 + color: $white white-space: nowrap + background-color: #C2C3C5 + border-radius: 4px + font-weight: 300 .button:hover, .button:focus, @@ -84,9 +82,6 @@ $button-border-color: #d4d4d4 position: relative top: -0.15em -.btn - @extend .button - @extend %border-radius-4px .button--green border: none font-size: $font-size-small diff --git a/app/templates/settings.hbs b/app/templates/settings.hbs index 52b1192a..eea5133b 100644 --- a/app/templates/settings.hbs +++ b/app/templates/settings.hbs @@ -60,7 +60,7 @@
    - +
    From e75fbc24852580d2dab301b54d93678320cc3939 Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Mon, 6 Jul 2015 20:25:50 +0200 Subject: [PATCH 09/53] refactor switch styles --- app/components/hook-switch.coffee | 2 +- app/components/settings-switch.coffee | 2 +- app/styles/app/layouts/profile.sass | 10 +- app/styles/app/layouts/settings.sass | 11 +- app/styles/app/modules/icons.sass | 4 +- app/styles/app/modules/switch.sass | 132 ++++++++----------- app/templates/components/hook-switch.hbs | 15 ++- app/templates/components/settings-switch.hbs | 2 +- 8 files changed, 75 insertions(+), 103 deletions(-) diff --git a/app/components/hook-switch.coffee b/app/components/hook-switch.coffee index 18468089..7f76944f 100644 --- a/app/components/hook-switch.coffee +++ b/app/components/hook-switch.coffee @@ -2,7 +2,7 @@ HookSwitchComponent = Ember.Component.extend tagName: 'a' - classNames: ['travis-switch', 'switch'] + classNames: ['switch--icon'] classNameBindings: ['active'] activeBinding: "hook.active" diff --git a/app/components/settings-switch.coffee b/app/components/settings-switch.coffee index 2381b68c..4f21d6ab 100644 --- a/app/components/settings-switch.coffee +++ b/app/components/settings-switch.coffee @@ -3,7 +3,7 @@ SettingsSwitchComponent = Ember.Component.extend tagName: 'a' - classNames: ['settings-switch'] + classNames: ['switch'] classNameBindings: ['_active:active'] # TODO: how to handle overriding properties to diff --git a/app/styles/app/layouts/profile.sass b/app/styles/app/layouts/profile.sass index 49df720b..fb644ec0 100644 --- a/app/styles/app/layouts/profile.sass +++ b/app/styles/app/layouts/profile.sass @@ -135,16 +135,12 @@ p.profile-user-last @media #{$medium-up} width: grid-calc(7, 24) @media #{$large-up} - width: grid-calc(5, 24) - .switch - display: inline-block - vertical-align: middle + width: grid-calc(6, 24) .profile-settings display: inline-block - margin-left: 1rem; padding: .2em .2em .2em .5em; height: 28px; - vertical-align: bottom; + vertical-align: middle; .icon width: 14px height: 14px @@ -188,7 +184,7 @@ p.profile-user-last span display: inline-block @media #{$large-up} - width: grid-calc(19, 24) + width: grid-calc(18, 24) .profile-additional diff --git a/app/styles/app/layouts/settings.sass b/app/styles/app/layouts/settings.sass index d14b8bf2..eaddbc9a 100644 --- a/app/styles/app/layouts/settings.sass +++ b/app/styles/app/layouts/settings.sass @@ -191,10 +191,12 @@ $input-main-height: 30px .ssh-key-value display: inline-block vertical-align: middle - width: grid-calc(3, 12) + width: 48% text-align: right white-space: nowrap overflow: hidden + @media #{$medium-up} + width: grid-calc(3, 12) .icon-fingerprint @extend %icon @extend .icon-fingerprint @@ -273,13 +275,6 @@ $input-main-height: 30px &:hover background-color: #3BA85D cursor: pointer - //refactor into switch component - .settings-switch - .label - display: inline-block - width: 7em - font-size: 12px - line-height: 1.3 .form--sshkey diff --git a/app/styles/app/modules/icons.sass b/app/styles/app/modules/icons.sass index 07a7aece..9293f89e 100644 --- a/app/styles/app/modules/icons.sass +++ b/app/styles/app/modules/icons.sass @@ -172,9 +172,9 @@ .icon--dismiss-grey background-image: inline-image('svg/dismiss.svg') -.icon-hook-on +%icon-hook-on background-image: inline-image('svg/hooks-on.svg') -.icon-hook-off +%icon-hook-off background-image: inline-image('svg/hooks-off.svg') .icon-delete diff --git a/app/styles/app/modules/switch.sass b/app/styles/app/modules/switch.sass index aa233826..07079dfe 100644 --- a/app/styles/app/modules/switch.sass +++ b/app/styles/app/modules/switch.sass @@ -1,95 +1,48 @@ %switch - $switch-height: 28px - $switch-inner-height: 22px - $switch-width: 62px - $switch-inner-width: 27px - - box-sizing: border-box - position: relative - width: $switch-width - height: $switch-height - background-color: #d1d1d1 - border: none - cursor: pointer - @extend %border-radius-4px - &:before - content: none - &:after - content: "" - display: block - position: absolute - top: ($switch-height - $switch-inner-height) / 2 - right: ($switch-width - ($switch-inner-width * 2)) / 2 - height: $switch-inner-height - width: $switch-inner-width - background-color: #919191 - background-repeat: no-repeat - background-size: 14px 14px - background-position: 6px - transition: right 200ms ease - @extend .icon-hook-off - @extend %border-radius-4px - - &.active - background-color: #b6d5b6 - &:after - right: $switch-width - $switch-inner-width - (($switch-width - ($switch-inner-width * 2)) / 2) - background-color: #39a85b - @extend .icon-hook-on - - &.disabled - cursor: default - pointer-events: none - opacity: .5 - - .active &.disabled - background-color: #b6d5b6 - &:after - right: $switch-width - $switch-inner-width - (($switch-width - ($switch-inner-width * 2)) / 2) - background-color: #39a85b - @extend .icon-hook-on - - - -.profile-switch - span - display: none - - .switch - @extend %switch - - -// NEW SWITCH -.settings-switch - $switch-width: 80px $switch-height: 32px + $switch-width: 80px - div + $switch-inner-width: 36px + $switch-inner-heigth: 26px + + .switch-inner display: inline-block - height: $switch-height width: $switch-width + height: $switch-height margin-right: 1em padding: 3px 3px 3px 4px - vertical-align: middle; - font-size: $font-size-s - border-radius: 4px + vertical-align: middle + overflow: visible background-color: #E2E1E2 + border-radius: 4px + border: none + cursor: pointer span - display: inline-block - width: 36px - height: 26px - vertical-align: middle; + width: $switch-inner-width + height: $switch-inner-heigth border-radius: 4px background-color: #A5A4A4 color: $white - text-align: center; - font-weight: 300; - line-height: 2.2; + text-align: center + font-weight: 300 + font-size: 12px + line-height: 2.2 + + span + display: inline-block + vertical-align: middle + .label - vertical-align: middle; + vertical-align: middle font-size: $font-size-m color: $grey-medium + display: inline-block + &.label--small .label + width: 7em + font-size: 12px + line-height: 1.3 + .on display: none margin-left: 0 @@ -97,7 +50,7 @@ margin-left: 36px &.active - div + .switch-inner background-color: #B8D6B9 span background-color: #3BA85D @@ -105,3 +58,28 @@ display: inline-block .off display: none + + &.disabled + cursor: default + pointer-events: none + opacity: .5 + + +.switch + @extend %switch + +.switch--icon + @extend %switch + + .on, + .off + text-indent: 99%; + overflow: hidden; + white-space: nowrap; + background-size: 1.1em + background-position: 50% + background-repeat: no-repeat + .off + @extend %icon-hook-off + .on + @extend %icon-hook-on diff --git a/app/templates/components/hook-switch.hbs b/app/templates/components/hook-switch.hbs index dbed063c..4c13ab83 100644 --- a/app/templates/components/hook-switch.hbs +++ b/app/templates/components/hook-switch.hbs @@ -1,6 +1,9 @@ - - ON - - - OFF - +
    + + ON + + + OFF + +
    + diff --git a/app/templates/components/settings-switch.hbs b/app/templates/components/settings-switch.hbs index beb759a1..8ebee2b5 100644 --- a/app/templates/components/settings-switch.hbs +++ b/app/templates/components/settings-switch.hbs @@ -1,4 +1,4 @@ -
    +
    ON From 7601e15ab8bdada7030363ad5556fdb1ec4440bd Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Tue, 7 Jul 2015 15:00:07 +0200 Subject: [PATCH 10/53] refactor tooltips --- app/styles/app/layouts/settings.sass | 34 ++-------- app/styles/app/modules/switch.sass | 2 +- app/styles/app/modules/tooltips.sass | 93 +++++++++++++++----------- app/templates/components/env-var.hbs | 14 ++-- app/templates/components/jobs-list.hbs | 6 +- app/templates/components/ssh-key.hbs | 24 +++---- app/templates/jobs.hbs | 6 +- 7 files changed, 85 insertions(+), 94 deletions(-) diff --git a/app/styles/app/layouts/settings.sass b/app/styles/app/layouts/settings.sass index eaddbc9a..1f405acc 100644 --- a/app/styles/app/layouts/settings.sass +++ b/app/styles/app/layouts/settings.sass @@ -122,45 +122,21 @@ $input-main-height: 30px display: inline-block width: grid-calc(2, 24) float: right + text-align: center + + a + padding: 1em .icon-delete @extend %icon @extend .icon-delete - display: block width: 1.1em height: 1.3em - margin: .2em auto 0 &:hover .icon-delete @extend .icon-delete-hover - .tooltip - display: block -.tooltip - display: none - position: absolute - right: 0 - left: 0 - top: -2.7em - width: auto - margin: auto - padding: .2em .8em .3em - z-index: 5 - background-color: #818383 - border-radius: 4px - color: $white - white-space: nowrap - &:before - content: "" - position: absolute - bottom: -0.3em - left: 39% - width: 1em - height: 1em - transform: rotate(45deg) - z-index: -1 - background-color: #818383 .settings-sshkey display: block @@ -227,8 +203,6 @@ $input-main-height: 30px &:hover .icon-delete @extend .icon-delete-hover - .tooltip - display: block .form--envvar diff --git a/app/styles/app/modules/switch.sass b/app/styles/app/modules/switch.sass index 07079dfe..22b6d73a 100644 --- a/app/styles/app/modules/switch.sass +++ b/app/styles/app/modules/switch.sass @@ -11,7 +11,7 @@ width: $switch-width height: $switch-height margin-right: 1em - padding: 3px 3px 3px 4px + padding: 2px 3px 3px 4px vertical-align: middle overflow: visible background-color: #E2E1E2 diff --git a/app/styles/app/modules/tooltips.sass b/app/styles/app/modules/tooltips.sass index db463507..f0a784a5 100644 --- a/app/styles/app/modules/tooltips.sass +++ b/app/styles/app/modules/tooltips.sass @@ -1,42 +1,59 @@ +%tooltip + &:hover + .tooltip-bubble + transform: translateY(0) + opacity: 1 -$tooltip-grey: #6A6C6D + .tooltip-bubble + position: absolute + top: -3.2em + width: auto + height: 1.9em + margin: auto + padding: .2em .8em .3em + z-index: 5 + background-color: #818383 + border-radius: 4px + color: $white + text-align: center + white-space: nowrap + + transition: all 100ms ease + transform: translateY(20%) + opacity: 0 + + &:before + content: "" + position: absolute + bottom: -0.3em + width: 1em + height: 1em + transform: rotate(45deg) + z-index: -1 + background-color: #818383 .tooltip + @extend %tooltip + .tooltip-bubble + right: 0 + left: 0 + &:before + left: 42% + +.tooltip--right + @extend %tooltip + .tooltip-bubble + right: -0.5em + &:before + left: 72% + +.tooltip--jobs + @extend %tooltip + display: inline-block position: relative - display: none - -.tooltip-inner - position: absolute - bottom: 0 - right: 0 - background: $tooltip-grey - color: $white - font-size: $font-size-small - line-height: 18px - text-align: center - padding: 8px 5px - @extend %border-radius-4px - - &:after - content: '' - position: absolute - top: 98% - right: 3em - width: 0 - height: 0 - border-top: 13px solid $tooltip-grey - border-right: 13px solid transparent - border-left: 13px solid transparent - - @media #{$small-only} - bottom: -2.5em - - @media #{$medium-up} - width: 18rem - -.tooltip-inner - height: 4.1em - top: -8em - left: 4em - &:after - left: 3.7em \ No newline at end of file + .tooltip-bubble + top: -4.5em + left: -2em + height: 3.7em + &:before + left: 15% diff --git a/app/templates/components/env-var.hbs b/app/templates/components/env-var.hbs index 4f8745fc..ef2d900e 100644 --- a/app/templates/components/env-var.hbs +++ b/app/templates/components/env-var.hbs @@ -4,10 +4,10 @@
    \ No newline at end of file +
    + + + +
    Delete
    +
    +
    diff --git a/app/templates/components/jobs-list.hbs b/app/templates/components/jobs-list.hbs index 13055aa8..5751f165 100644 --- a/app/templates/components/jobs-list.hbs +++ b/app/templates/components/jobs-list.hbs @@ -5,9 +5,9 @@

    Build Jobs

    {{else}}

    Allowed Failures - -
    -

    These are jobs you can allow to fail without failing your entire build

    +
    + +

    These are jobs you can allow to fail
    without failing your entire build

    {{/if}} diff --git a/app/templates/components/ssh-key.hbs b/app/templates/components/ssh-key.hbs index cb3e6214..987ac2f4 100644 --- a/app/templates/components/ssh-key.hbs +++ b/app/templates/components/ssh-key.hbs @@ -8,12 +8,12 @@ e1:b1:83:06:7e:51:6d:5e:e0:e0:60:96:ca:ac:3d:8a
    - - -

    - Delete -

    -
    +
    + + + +
    Delete
    +
    {{else}}
    @@ -25,11 +25,11 @@ e1:b1:83:06:7e:51:6d:5e:e0:e0:60:96:ca:ac:3d:8a
    - - -

    - Default keys cannot be deleted -

    -
    +
    + + + +
    Default keys cannot be deleted
    +
    {{/if}} diff --git a/app/templates/jobs.hbs b/app/templates/jobs.hbs index 166d3252..32cd45db 100644 --- a/app/templates/jobs.hbs +++ b/app/templates/jobs.hbs @@ -5,9 +5,9 @@

    Build Jobs

    {{else}}

    Allowed Failures - -
    -

    These are jobs are allowed to fail, without failing your entire build.

    +
    + +

    These are jobs are allowed to fail, without failing your entire build.

    {{/if}} From b575d7825095f5d5b7e2ab409c21b0b25abcf337 Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Tue, 7 Jul 2015 15:39:02 +0200 Subject: [PATCH 11/53] fix tests --- app/styles/app/modules/switch.sass | 2 +- tests/unit/components/hooks-list-item-test.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/styles/app/modules/switch.sass b/app/styles/app/modules/switch.sass index 22b6d73a..07079dfe 100644 --- a/app/styles/app/modules/switch.sass +++ b/app/styles/app/modules/switch.sass @@ -11,7 +11,7 @@ width: $switch-width height: $switch-height margin-right: 1em - padding: 2px 3px 3px 4px + padding: 3px 3px 3px 4px vertical-align: middle overflow: visible background-color: #E2E1E2 diff --git a/tests/unit/components/hooks-list-item-test.coffee b/tests/unit/components/hooks-list-item-test.coffee index f0ddafdc..f1818119 100644 --- a/tests/unit/components/hooks-list-item-test.coffee +++ b/tests/unit/components/hooks-list-item-test.coffee @@ -20,5 +20,5 @@ test 'it renders', -> @append() ok component.$().hasClass('active'), 'component should have active class' - ok component.$('.travis-switch').hasClass('active'), 'switch should have active class' + ok component.$('.switch--icon').hasClass('active'), 'switch should have active class' equal component.$('.profile-repo span').text().trim(), 'A foo repo', 'repo description should be displayed' From 572804653cd1e6ca2340c6a481890ec156b4c667 Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Tue, 7 Jul 2015 18:47:57 +0200 Subject: [PATCH 12/53] trying some thing in the settings route. No idea what I'm doing --- app/routes/settings/index.coffee | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/app/routes/settings/index.coffee b/app/routes/settings/index.coffee index 325b1fb7..a91a1ebd 100644 --- a/app/routes/settings/index.coffee +++ b/app/routes/settings/index.coffee @@ -1,4 +1,5 @@ `import TravisRoute from 'travis/routes/basic'` +`import config from 'travis/config/environment'` Route = TravisRoute.extend titleToken: 'Settings' @@ -6,15 +7,32 @@ Route = TravisRoute.extend model: -> repo = @modelFor('repo') console.log('######### YEHA ###############') + repo.fetchSettings().then (settings) -> console.log(settings) repo.set('settings', settings) - # return Ember.RSVP.hash({ - # settings: repo.fetchSettings(), - # envVars: repo.envVars(), - # sshKey: repo.sshKey() - # }) + # return { + + # settings: (-> + # $.ajax('https://api.travis-ci.org/v3/repos/#{repo.id}/settings', { + # headers: { + # Authorization: 'token ' + @auth.token() + # } + # }).then (response) -> + # console.log(response); + # return response + # ) + # env_vars: (-> + # $.ajax('/settings/env_vars?repository_id={repo.id}', { + # headers: { + # Authorization: 'token ' + @auth.token() + # } + # }).then (response) -> + # console.log(response); + # return response + # ) + # } `export default Route` From a6d4c2f6f77e3e0817c411b1ac115ca9ac03d405 Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Tue, 7 Jul 2015 19:34:27 +0200 Subject: [PATCH 13/53] refactor form styles from settings page --- app/styles/app.scss | 1 + app/styles/app/layouts/settings.sass | 108 --------------------------- app/styles/app/modules/forms.sass | 69 +++++++++++++++++ 3 files changed, 70 insertions(+), 108 deletions(-) create mode 100644 app/styles/app/modules/forms.sass diff --git a/app/styles/app.scss b/app/styles/app.scss index 42507ce7..0c45fd13 100644 --- a/app/styles/app.scss +++ b/app/styles/app.scss @@ -38,6 +38,7 @@ @import "app/modules/media"; @import "app/modules/switch"; @import "app/modules/memberlist"; +@import "app/modules/forms"; @import "app/layout"; @import "app/layouts/dashboard"; diff --git a/app/styles/app/layouts/settings.sass b/app/styles/app/layouts/settings.sass index 1f405acc..dfd9d745 100644 --- a/app/styles/app/layouts/settings.sass +++ b/app/styles/app/layouts/settings.sass @@ -1,42 +1,13 @@ -$add-green: #3AA95E -$add-green-hover: #3BA85D - -$add-var-bg: #c2c3c5 -$add-var-color: $white -$add-var-radius: 4px - -$deactivate-red: #EB3A3D -$deactivate-red-hover: #D12F2F - -$deactivate-bg: #e93d3c $heading-color: #63a4a3 -$heading-size: 18px - -$input-border: 1px solid #eeedec -$input-radius: 4px -$input-color: #8e8f8e -$input-width: 78px -$input-height: 32px - $setting-section-border: 2px solid #f2f3ef -$env-vars-bg: #f2f3ef -$env-vars-color: #8e8f8e -$env-vars-size: 16px -$env-vars-radius: 4px -$env-vars-pw-bg: #eeedec - -$input-main-height: 30px - - .small-title font-size: 18px color: $heading-color font-weight: 400 - .settings padding-top: .8em @@ -205,82 +176,3 @@ $input-main-height: 30px @extend .icon-delete-hover -.form--envvar - .form-elem - display: inline-block - vertical-align: middle - - .form-elem:first-of-type, - .form-elem:nth-of-type(2) - width: 49.6% - .form-elem:nth-of-type(3) - width: 50% - .form-elem:last-of-type - width: 50% - float: right - text-align: right - - @media #{$medium-up} - .form-elem:first-of-type, - .form-elem:nth-of-type(2) - width: 31.5% - margin-right: 1em - .form-elem:nth-of-type(3) - width: 24% - .form-elem:last-of-type - width: 6% - float: right - text-align: right - input - display: inline-block - height: 32px - width: 100% - padding: .4em .4em - border: 1px solid #eeedec - border-radius: 4px - color: #8e8f8e - font-size: $font-size-sm - - .form-submit - padding: .5em .8em - color: $white - font-size: $font-size-sm - font-weight: 300 - &:hover - background-color: #3BA85D - cursor: pointer - -.form--sshkey - - .form-elem - margin-bottom: .5rem - @media #{$medium-up} - .form-elem - max-width: 460px - - input - display: inline-block - height: 32px - width: 100% - padding: .4em .4em - border: 1px solid #eeedec - border-radius: 4px - color: #8e8f8e - font-size: $font-size-sm - textarea - display: inline-block - width: 100% - padding: .2em .4em - border: 1px solid #eeedec - border-radius: 4px - color: #8e8f8e - font-size: $font-size-sm - .form-submit - padding: .5em .8em - color: $white - font-size: $font-size-sm - font-weight: 300 - width: auto - &:hover - background-color: #3BA85D - diff --git a/app/styles/app/modules/forms.sass b/app/styles/app/modules/forms.sass new file mode 100644 index 00000000..f86ab0d4 --- /dev/null +++ b/app/styles/app/modules/forms.sass @@ -0,0 +1,69 @@ + +%input-base + display: inline-block + width: 100% + padding: .4em .4em + border: 1px solid #eeedec + border-radius: 4px + color: #8e8f8e + font-size: $font-size-sm + +input[type="text"], +input[type="email"], +input[type="number"], +input[type="password"] + @extend %input-base + height: 32px + +textarea + @extend %input-base + + +.form-submit + display: inline-block + border: none + border-radius: 4px + padding: .5em .8em + color: $white + font-size: $font-size-sm + font-weight: 300 + background-color: $grey-lighter + &:hover + background-color: #3BA85D + cursor: pointer + + +.form--sshkey + .form-elem + margin-bottom: .5rem + @media #{$medium-up} + .form-elem + max-width: 460px + + +.form--envvar + .form-elem + display: inline-block + vertical-align: middle + + .form-elem:first-of-type, + .form-elem:nth-of-type(2) + width: 49.6% + .form-elem:nth-of-type(3) + width: 50% + .form-elem:last-of-type + width: 50% + float: right + text-align: right + + @media #{$medium-up} + .form-elem:first-of-type, + .form-elem:nth-of-type(2) + width: 31.5% + margin-right: 1em + .form-elem:nth-of-type(3) + width: 24% + .form-elem:last-of-type + width: 6% + float: right + text-align: right From f6a1b455e6ab6fc1b0b92f00d8590c7254040534 Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Tue, 7 Jul 2015 20:17:04 +0200 Subject: [PATCH 14/53] refactor more settings styles --- app/styles/app/_mixins/vars.sass | 6 +- app/styles/app/layouts/owner.sass | 4 +- app/styles/app/layouts/settings.sass | 141 ++++++++++++--------------- app/styles/app/layouts/sidebar.sass | 2 +- app/styles/app/modules/tabs.sass | 6 +- 5 files changed, 72 insertions(+), 87 deletions(-) diff --git a/app/styles/app/_mixins/vars.sass b/app/styles/app/_mixins/vars.sass index 9e70afe0..37e869da 100644 --- a/app/styles/app/_mixins/vars.sass +++ b/app/styles/app/_mixins/vars.sass @@ -4,10 +4,6 @@ $font-size-sm: 14px $line-height-m: 1.3 $font-size-s: 12px -// colors -$teal1: #5BA5A4 -$teal2: #63A4A3 - $blue-grey: #404650 $blue-grey-light: #d8e2e6 $light-gray: #e9e9e7 @@ -35,7 +31,7 @@ $error-color: $fail-color $start-color: #D2C93B $start-bg-color: #D2CA24 $cancel-color: #A1A0A0 -$dropdown-color: $teal1 +$dropdown-color: $teal-light $created-color: #CDBC2C $dashboard-text-color: #9d9fa1 diff --git a/app/styles/app/layouts/owner.sass b/app/styles/app/layouts/owner.sass index 47245fbe..afacf718 100644 --- a/app/styles/app/layouts/owner.sass +++ b/app/styles/app/layouts/owner.sass @@ -112,7 +112,7 @@ .active, .active:hover, position: relative - color: $teal2 + color: $teal-dark &:after content: "" position: absolute @@ -120,7 +120,7 @@ bottom: -0.25em width: 100% height: 2px - background-color: $teal1 + background-color: $teal-light .active font-weight: 600 diff --git a/app/styles/app/layouts/settings.sass b/app/styles/app/layouts/settings.sass index dfd9d745..911d8e8a 100644 --- a/app/styles/app/layouts/settings.sass +++ b/app/styles/app/layouts/settings.sass @@ -1,11 +1,8 @@ -$heading-color: #63a4a3 -$setting-section-border: 2px solid #f2f3ef - .small-title font-size: 18px - color: $heading-color + color: $teal-light font-weight: 400 .settings @@ -14,12 +11,14 @@ $setting-section-border: 2px solid #f2f3ef .settings-section padding: 0 0 1em margin-bottom: 1.5em - border-bottom: $setting-section-border + border-bottom: 2px solid #f2f3ef &:last-of-type border-bottom: none .small-title margin-top: 0 + + %settings-list padding: 0 margin: 0 @@ -44,36 +43,78 @@ $setting-section-border: 2px solid #f2f3ef & + .label vertical-align: middle input - display: inline-block - height: 32px width: 80px - border: 1px solid #eeedec - border-radius: 4px font-size: $font-size-s - color: #8e8f8e text-align: center -.settings-envvar + + +%settings-row padding: .6em .5em border-radius: 4px background-color: #F6F5F5 -.env-var-name +.settings-envvar + @extend %settings-row + +.settings-sshkey + @extend %settings-row + display: block + margin-bottom: 1rem + span + vertical-align: middle + + + +%settings-name-section display: inline-block position: relative - width: grid-calc(6, 12) vertical-align: middle overflow: hidden + white-space: nowrap &:after content: "" @include fadeOut(right, -90deg, #F6F5F5) +.ssh-key-name + @extend %settings-name-section + width: 40% + .icon-key + @extend %icon + @extend .icon-key + width: 1.2em + height: 1.3em + +.env-var-name + @extend %settings-name-section + width: grid-calc(6, 12) + + + +%settings-value-section + display: inline-block + vertical-align: middle + white-space: nowrap + overflow: hidden + +.ssh-key-value + @extend %settings-value-section + width: 48% + text-align: right + @media #{$medium-up} + width: grid-calc(3, 12) + .icon-fingerprint + @extend %icon + @extend .icon-fingerprint + width: 1.3em + height: 1.3em + margin-right: .5em + .env-var-value display: inline-block width: grid-calc(4, 12) @media #{$medium-up} width: grid-calc(3, 12) - input display: inline-block width: 100% @@ -88,81 +129,32 @@ $setting-section-border: 2px solid #f2f3ef repeat: no-repeat position: 0.4em 0.7em -.env-var-action - position: relative + + +%settings-action-section display: inline-block + position: relative width: grid-calc(2, 24) float: right + vertical-align: middle text-align: center - - a - padding: 1em - .icon-delete @extend %icon @extend .icon-delete width: 1.1em height: 1.3em - &:hover .icon-delete @extend .icon-delete-hover - -.settings-sshkey - display: block - margin-bottom: 1rem - padding: .6em .5em - border-radius: 4px - background-color: #F6F5F5 - - span - vertical-align: middle - -.ssh-key-name - display: inline-block - position: relative - vertical-align: middle - width: 40% - white-space: nowrap - overflow: hidden - .icon-key - @extend %icon - @extend .icon-key - width: 1.2em - height: 1.3em - &:after - content: "" - @include fadeOut(right, -90deg, #F6F5F5) - -.ssh-key-value - display: inline-block - vertical-align: middle - width: 48% - text-align: right - white-space: nowrap - overflow: hidden - @media #{$medium-up} - width: grid-calc(3, 12) - .icon-fingerprint - @extend %icon - @extend .icon-fingerprint - width: 1.3em - height: 1.3em - margin-right: .5em +.env-var-action + @extend %settings-action-section + a + padding: 1em .ssh-key-action - display: inline-block - position: relative - vertical-align: middle - width: grid-calc(2, 24) - float: right + @extend %settings-action-section .icon-delete - @extend %icon - @extend .icon-delete - display: block - width: 1.1em - height: 1.3em margin: .2em auto 0 .icon-delete-disabled @extend %icon @@ -171,8 +163,5 @@ $setting-section-border: 2px solid #f2f3ef width: 1.1em height: 1.3em margin: .2em auto 0 - &:hover - .icon-delete - @extend .icon-delete-hover diff --git a/app/styles/app/layouts/sidebar.sass b/app/styles/app/layouts/sidebar.sass index bb6fdfbd..7ed7b3c1 100644 --- a/app/styles/app/layouts/sidebar.sass +++ b/app/styles/app/layouts/sidebar.sass @@ -77,7 +77,7 @@ $sb-font-size: 14px #tab_new a:hover .icon--plus:after - color: $teal1 + color: $teal-light &:after bottom: -2px diff --git a/app/styles/app/modules/tabs.sass b/app/styles/app/modules/tabs.sass index a5889c10..1423673c 100644 --- a/app/styles/app/modules/tabs.sass +++ b/app/styles/app/modules/tabs.sass @@ -20,7 +20,7 @@ .active a, a:hover position: relative - color: $teal2 + color: $teal-dark &:after content: "" position: absolute @@ -28,7 +28,7 @@ bottom: -0.25em width: 100% height: 2px - background-color: $teal2 + background-color: $teal-dark .active a font-weight: 600 @@ -68,7 +68,7 @@ color: $grey-light padding: .5em 0 .active - color: $teal2 + color: $teal-dark @media #{$medium-up} border-bottom: solid $cream-dark 2px From e407dd69fb37979000cebb2ef0e84ca108c409c1 Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Wed, 8 Jul 2015 16:56:42 +0200 Subject: [PATCH 15/53] fix some responsive issues on settings page --- app/styles/app/layouts/settings.sass | 45 ++++++++++++++-------------- app/styles/app/modules/forms.sass | 14 +++------ app/styles/app/modules/tooltips.sass | 18 +++++++---- app/templates/components/ssh-key.hbs | 4 +-- 4 files changed, 42 insertions(+), 39 deletions(-) diff --git a/app/styles/app/layouts/settings.sass b/app/styles/app/layouts/settings.sass index 911d8e8a..6de7e0f9 100644 --- a/app/styles/app/layouts/settings.sass +++ b/app/styles/app/layouts/settings.sass @@ -1,5 +1,4 @@ - .small-title font-size: 18px color: $teal-light @@ -17,8 +16,6 @@ .small-title margin-top: 0 - - %settings-list padding: 0 margin: 0 @@ -38,7 +35,7 @@ .settings-input display: inline-block - margin-right: 1rem + margin-right: 1.4rem vertical-align: middle & + .label vertical-align: middle @@ -47,8 +44,6 @@ font-size: $font-size-s text-align: center - - %settings-row padding: .6em .5em border-radius: 4px @@ -64,8 +59,6 @@ span vertical-align: middle - - %settings-name-section display: inline-block position: relative @@ -78,17 +71,25 @@ .ssh-key-name @extend %settings-name-section - width: 40% + width: 100% + margin-bottom: 1em .icon-key @extend %icon @extend .icon-key width: 1.2em height: 1.3em + @media #{$medium-up} + width: 40% + margin-bottom: 0 + .env-var-name @extend %settings-name-section - width: grid-calc(6, 12) - + width: 100% + margin-bottom: 1em + @media #{$medium-up} + width: grid-calc(6, 12) + margin-bottom: 0 %settings-value-section @@ -96,25 +97,23 @@ vertical-align: middle white-space: nowrap overflow: hidden + width: 76% + @media #{$medium-up} + width: grid-calc(3, 12) .ssh-key-value @extend %settings-value-section - width: 48% - text-align: right - @media #{$medium-up} - width: grid-calc(3, 12) .icon-fingerprint @extend %icon @extend .icon-fingerprint width: 1.3em height: 1.3em margin-right: .5em + @media #{$medium-up} + text-align: right .env-var-value - display: inline-block - width: grid-calc(4, 12) - @media #{$medium-up} - width: grid-calc(3, 12) + @extend %settings-value-section input display: inline-block width: 100% @@ -130,11 +129,10 @@ position: 0.4em 0.7em - %settings-action-section display: inline-block position: relative - width: grid-calc(2, 24) + width: 24% float: right vertical-align: middle text-align: center @@ -146,6 +144,10 @@ &:hover .icon-delete @extend .icon-delete-hover + @media #{$medium-up} + width: grid-calc(4, 24) + @media #{$xlarge-up} + width: grid-calc(4, 36) .env-var-action @extend %settings-action-section @@ -164,4 +166,3 @@ height: 1.3em margin: .2em auto 0 - diff --git a/app/styles/app/modules/forms.sass b/app/styles/app/modules/forms.sass index f86ab0d4..600541f3 100644 --- a/app/styles/app/modules/forms.sass +++ b/app/styles/app/modules/forms.sass @@ -45,18 +45,12 @@ textarea .form-elem display: inline-block vertical-align: middle - - .form-elem:first-of-type, - .form-elem:nth-of-type(2) - width: 49.6% - .form-elem:nth-of-type(3) - width: 50% - .form-elem:last-of-type - width: 50% - float: right - text-align: right + width: 100% + margin-bottom: 1em @media #{$medium-up} + .form-elem + margin-bottom: 0 .form-elem:first-of-type, .form-elem:nth-of-type(2) width: 31.5% diff --git a/app/styles/app/modules/tooltips.sass b/app/styles/app/modules/tooltips.sass index f0a784a5..e5b88721 100644 --- a/app/styles/app/modules/tooltips.sass +++ b/app/styles/app/modules/tooltips.sass @@ -8,9 +8,10 @@ position: absolute top: -3.2em width: auto + max-width: 8.6em height: 1.9em margin: auto - padding: .2em .8em .3em + padding: .2em .4em .3em z-index: 5 background-color: #818383 border-radius: 4px @@ -38,14 +39,21 @@ right: 0 left: 0 &:before - left: 42% + left: 46% + @media #{$medium-up} + left: 42% -.tooltip--right +.tooltip--height @extend %tooltip .tooltip-bubble - right: -0.5em + right: 0 + left: 0 + top: -4em + height: 3.2em &:before - left: 72% + left: 46% + @media #{$medium-up} + left: 42% .tooltip--jobs @extend %tooltip diff --git a/app/templates/components/ssh-key.hbs b/app/templates/components/ssh-key.hbs index 987ac2f4..94c5c741 100644 --- a/app/templates/components/ssh-key.hbs +++ b/app/templates/components/ssh-key.hbs @@ -25,11 +25,11 @@ e1:b1:83:06:7e:51:6d:5e:e0:e0:60:96:ca:ac:3d:8a
    -
    +
    -
    Default keys cannot be deleted
    +
    Default keys
    cannot be deleted
    {{/if}} From e6bbdba6dce6435134601e4afc6d480a2de1a60d Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Thu, 7 May 2015 14:12:56 +0200 Subject: [PATCH 16/53] Update ember to 1.13.3 --- Brocfile.js | 55 -------------------------------------- bower.json | 4 +-- ember-cli-build.js | 44 ++++++++++++++++++++++++++++++ package.json | 14 +++++----- tests/helpers/start-app.js | 1 - 5 files changed, 54 insertions(+), 64 deletions(-) delete mode 100644 Brocfile.js create mode 100644 ember-cli-build.js diff --git a/Brocfile.js b/Brocfile.js deleted file mode 100644 index 89133ebc..00000000 --- a/Brocfile.js +++ /dev/null @@ -1,55 +0,0 @@ -/* global require, module */ - -var EmberApp = require('ember-cli/lib/broccoli/ember-app'); - -var fingerprint, - assetsHost; - -if (process.env.DISABLE_FINGERPRINTS) { - fingerprint = false; -} else { - fingerprint = { - extensions: ['js', 'css', 'png', 'jpg', 'gif', 'map', 'svg'] - }; - - if (assetsHost = process.env.ASSETS_HOST) { - if (assetsHost.substr(-1) !== '/') { - assetsHost = assetsHost + '/' - } - fingerprint.prepend = assetsHost - } -} - -var app = new EmberApp({ - fingerprint: fingerprint, - vendorFiles: { - // next line is needed to prevent ember-cli to load - // handlebars (it happens automatically in 0.1.x) - 'handlebars.js': null - } -}); - -app.import('bower_components/pusher/dist/pusher.js'); -app.import('bower_components/jquery-timeago/jquery.timeago.js'); -app.import('bower_components/visibilityjs/lib/visibility.core.js'); -app.import('bower_components/visibilityjs/lib/visibility.timers.js'); -app.import('bower_components/JavaScript-MD5/js/md5.js'); -app.import('vendor/ansiparse.js'); -app.import('vendor/log.js'); -app.import('vendor/customerio.js'); -app.import('vendor/charmscout.js'); -app.import('bower_components/moment/moment.js'); -// Use `app.import` to add additional libraries to the generated -// output files. -// -// If you need to use different assets in different -// environments, specify an object as the first parameter. That -// object's keys should be the environment name and the values -// should be the asset to use in that environment. -// -// If the library that you are including contains AMD or ES6 -// modules that you would like to import into your application -// please specify an object with the list of modules as keys -// along with the exports of each module as its value. - -module.exports = app.toTree(); diff --git a/bower.json b/bower.json index 75ea2846..4562f880 100644 --- a/bower.json +++ b/bower.json @@ -3,14 +3,14 @@ "dependencies": { "handlebars": "2.0.0", "jquery": "^1.11.1", - "ember": "1.11.3", + "ember": "1.13.3", "ember-data": "1.0.0-beta.16.1", "ember-resolver": "~0.1.15", "loader.js": "ember-cli/loader.js#1.0.1", "ember-cli-shims": "ember-cli/ember-cli-shims#0.0.3", "ember-cli-test-loader": "ember-cli/ember-cli-test-loader#0.1.0", "ember-load-initializers": "ember-cli/ember-load-initializers#0.1.4", - "ember-qunit": "0.3.1", + "ember-qunit": "0.4.0", "ember-qunit-notifications": "0.0.5", "qunit": "~1.17.1", "visibilityjs": "~1.2.1", diff --git a/ember-cli-build.js b/ember-cli-build.js new file mode 100644 index 00000000..bd46cd4e --- /dev/null +++ b/ember-cli-build.js @@ -0,0 +1,44 @@ +/* global require, module */ +var EmberApp = require('ember-cli/lib/broccoli/ember-app'); + +module.exports = function(defaults) { + var fingerprint, + assetsHost; + + if (process.env.DISABLE_FINGERPRINTS) { + fingerprint = false; + } else { + fingerprint = { + extensions: ['js', 'css', 'png', 'jpg', 'gif', 'map', 'svg'] + }; + + if (assetsHost = process.env.ASSETS_HOST) { + if (assetsHost.substr(-1) !== '/') { + assetsHost = assetsHost + '/' + } + fingerprint.prepend = assetsHost + } + } + + var app = new EmberApp({ + fingerprint: fingerprint, + vendorFiles: { + // next line is needed to prevent ember-cli to load + // handlebars (it happens automatically in 0.1.x) + 'handlebars.js': null + } + }); + + app.import('bower_components/pusher/dist/pusher.js'); + app.import('bower_components/jquery-timeago/jquery.timeago.js'); + app.import('bower_components/visibilityjs/lib/visibility.core.js'); + app.import('bower_components/visibilityjs/lib/visibility.timers.js'); + app.import('bower_components/JavaScript-MD5/js/md5.js'); + app.import('vendor/ansiparse.js'); + app.import('vendor/log.js'); + app.import('vendor/customerio.js'); + app.import('vendor/charmscout.js'); + app.import('bower_components/moment/moment.js'); + + return app.toTree(); +}; diff --git a/package.json b/package.json index 474b9a91..dd69ed6e 100644 --- a/package.json +++ b/package.json @@ -21,23 +21,25 @@ "devDependencies": { "broccoli-asset-rev": "^2.0.2", "broccoli-sass": "0.6.5", - "ember-cli": "^0.2.3", - "ember-cli-app-version": "0.3.3", + "ember-cli": "^1.13.1", + "ember-cli-app-version": "0.4.0", "ember-cli-autoprefixer": "^0.3.0", "ember-cli-babel": "5.0.0", "ember-cli-coffeescript": "0.10.0", "ember-cli-content-security-policy": "0.4.0", "ember-cli-dependency-checker": "0.0.8", "ember-cli-document-title": "0.1.0", - "ember-cli-htmlbars": "0.7.4", - "ember-cli-ic-ajax": "0.1.1", + "ember-cli-htmlbars": "0.7.9", + "ember-cli-htmlbars-inline-precompile": "^0.1.1", + "ember-cli-ic-ajax": "0.2.1", "ember-cli-inject-live-reload": "^1.3.0", "ember-cli-inline-images": "^0.0.4", "ember-cli-pretender": "0.3.1", - "ember-cli-qunit": "0.3.10", + "ember-cli-qunit": "0.3.15", + "ember-cli-release": "0.2.3", "ember-cli-sauce": "^1.1.0", "ember-cli-uglify": "1.0.1", - "ember-data": "1.0.0-beta.16.1", + "ember-data": "1.13.5", "ember-export-application-global": "^1.0.2", "ember-try": "0.0.7" } diff --git a/tests/helpers/start-app.js b/tests/helpers/start-app.js index 5e64fef6..e06c4970 100644 --- a/tests/helpers/start-app.js +++ b/tests/helpers/start-app.js @@ -1,6 +1,5 @@ import Ember from 'ember'; import Application from '../../app'; -import Router from '../../router'; import config from '../../config/environment'; export default function startApp(attrs) { From cb9c26d3a54414da761178470a238011dc06d5b2 Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Tue, 14 Jul 2015 15:54:19 +0200 Subject: [PATCH 17/53] work on envvars --- app/components/add-env-var.coffee | 38 +++++++++++++++++ app/components/env-var.coffee | 15 ++----- app/controllers/settings.coffee | 7 +++ app/routes/settings.coffee | 12 ++++++ app/routes/settings/index.coffee | 1 - app/styles/app/layouts/settings.sass | 6 +++ app/styles/app/modules/buttons.sass | 6 --- app/templates/components/add-env-var.hbs | 47 +++++++++++++++++++++ app/templates/components/env-var.hbs | 4 +- app/templates/components/travis-switch.hbs | 16 ++++--- app/templates/settings.hbs | 24 ++--------- tests/unit/controllers/settings-test.coffee | 12 ++++++ 12 files changed, 140 insertions(+), 48 deletions(-) create mode 100644 app/components/add-env-var.coffee create mode 100644 app/controllers/settings.coffee create mode 100644 app/templates/components/add-env-var.hbs create mode 100644 tests/unit/controllers/settings-test.coffee diff --git a/app/components/add-env-var.coffee b/app/components/add-env-var.coffee new file mode 100644 index 00000000..fbffbfb2 --- /dev/null +++ b/app/components/add-env-var.coffee @@ -0,0 +1,38 @@ +`import Ember from 'ember'` + +AddEnvVarComponent = Ember.Component.extend + + classNames: ['form--envvar'] + + store: Ember.inject.service() + + isValid: () -> + true + + reset: -> + @setProperties(name: null, value: null, public: null) + + actions: + save: -> + return if @get('isSaving') + @set('isSaving', true) + + if @isValid() + env_var = @get('store').createRecord('env_var', + name: @get('name') + value: @get('value') + public: @get('public') + repo: @get('repo') + ) + + self = this + env_var.save().then => + @set('isSaving', false) + @reset() + , => + @set('isSaving', false) + else + @set('isSaving', false) + + +`export default AddEnvVarComponent` diff --git a/app/components/env-var.coffee b/app/components/env-var.coffee index bb4047f9..b013604e 100644 --- a/app/components/env-var.coffee +++ b/app/components/env-var.coffee @@ -4,12 +4,6 @@ EnvVarComponent = Ember.Component.extend classNames: ['settings-envvar'] - name: DS.attr() - value: DS.attr() - public: DS.attr('boolean') - - repo: DS.belongsTo('repo', async: true) - isEditing: false isDeleting: false @@ -20,14 +14,11 @@ EnvVarComponent = Ember.Component.extend showValueField: Ember.computed.alias('public') value: ( (key, value) -> - if arguments.length == 2 - @get('model').set('value', value) - value - else if @get('public') - @get('model.value') + if @get('envVar.public') + @get('envVar.value') else '••••••••••••••••' - ).property('model.value', 'public') + ).property('envVar.value', 'envVar.public') actions: delete: -> diff --git a/app/controllers/settings.coffee b/app/controllers/settings.coffee new file mode 100644 index 00000000..9d535b96 --- /dev/null +++ b/app/controllers/settings.coffee @@ -0,0 +1,7 @@ +`import Ember from 'ember'` + +SettingsController = Ember.Controller.extend + + envVars: Ember.computed.filterBy('model.envVars', 'isNew', false) + +`export default SettingsController` diff --git a/app/routes/settings.coffee b/app/routes/settings.coffee index aeaae42c..cb9a0f0e 100644 --- a/app/routes/settings.coffee +++ b/app/routes/settings.coffee @@ -3,6 +3,18 @@ Route = TravisRoute.extend needsAuth: true setupController: (controller, model) -> + @_super.apply(this, arguments) + controller.set('repo', @modelFor('repo')) @controllerFor('repo').activate('settings') + fetchEnvVars: () -> + repo = @modelFor('repo') + repo.get('envVars.promise') + + model: () -> + return Ember.RSVP.hash({ + envVars: this.fetchEnvVars(), + # sshKey: this.fetchSshKey() + }); + `export default Route` diff --git a/app/routes/settings/index.coffee b/app/routes/settings/index.coffee index a91a1ebd..d9845989 100644 --- a/app/routes/settings/index.coffee +++ b/app/routes/settings/index.coffee @@ -6,7 +6,6 @@ Route = TravisRoute.extend model: -> repo = @modelFor('repo') - console.log('######### YEHA ###############') repo.fetchSettings().then (settings) -> diff --git a/app/styles/app/layouts/settings.sass b/app/styles/app/layouts/settings.sass index 6de7e0f9..ce4456f9 100644 --- a/app/styles/app/layouts/settings.sass +++ b/app/styles/app/layouts/settings.sass @@ -114,6 +114,12 @@ .env-var-value @extend %settings-value-section + + // public value + // background-image: none; + // font-size: 16px; + // padding: 0.4rem 0 0.4rem 0.7rem; + input display: inline-block width: 100% diff --git a/app/styles/app/modules/buttons.sass b/app/styles/app/modules/buttons.sass index 2a7c463e..7ea35a31 100644 --- a/app/styles/app/modules/buttons.sass +++ b/app/styles/app/modules/buttons.sass @@ -81,12 +81,6 @@ $button-border-color: #d4d4d4 position: relative top: -0.15em -<<<<<<< HEAD -======= -.btn - @extend .button - border-radius: 2px ->>>>>>> master .button--green border: none font-size: $font-size-small diff --git a/app/templates/components/add-env-var.hbs b/app/templates/components/add-env-var.hbs new file mode 100644 index 00000000..a0dded7c --- /dev/null +++ b/app/templates/components/add-env-var.hbs @@ -0,0 +1,47 @@ +
    +
    + {{input value=name class="env-name" placeholder="Name"}} +
    +
    + {{input value=value class="env-value" placeholder="Value"}} +
    +
    + {{travis-switch active=public}} +
    +
    + +
    +
    + +{{!-- + + +
    + {{#travis-field "name"}} + + {{input value=name class="env-name" placeholder="Name"}} {{travis-errors "name"}} + {{/travis-field}} + = + {{#if showValueField}} +
    + {{#label for="value" class="value"}}Value:{{/label}} + {{input value=value class="env-value" placeholder="Value"}} +
    + {{else}} +
    + {{value}} +
    + {{/if}} +
    + {{travis-switch active=public}} + {{#label for="secure" class="public"}}Display value in build logs{{/label}} +
    + +
    + + or + Cancel +
    +
    + + --}} \ No newline at end of file diff --git a/app/templates/components/env-var.hbs b/app/templates/components/env-var.hbs index ef2d900e..5a260f16 100644 --- a/app/templates/components/env-var.hbs +++ b/app/templates/components/env-var.hbs @@ -1,7 +1,7 @@ -
    THIS_IS_THE_ENV_NAME
    +
    {{envVar.name}}
    - +
    diff --git a/app/templates/components/travis-switch.hbs b/app/templates/components/travis-switch.hbs index c82e3447..a33d23b7 100644 --- a/app/templates/components/travis-switch.hbs +++ b/app/templates/components/travis-switch.hbs @@ -1,7 +1,9 @@ - - - ON - - - OFF - \ No newline at end of file +
    + + ON + + + OFF + +
    +Display value in build log diff --git a/app/templates/settings.hbs b/app/templates/settings.hbs index eea5133b..93689a2b 100644 --- a/app/templates/settings.hbs +++ b/app/templates/settings.hbs @@ -18,29 +18,13 @@

    Environment Variables

      -
    • {{env-var}}
    • -
    • {{env-var}}
    • -
    • {{env-var}}
    • -
    • {{env-var}}
    • + {{#each envVars as |envVar|}} +
    • {{env-var envVar=envVar}}
    • + {{/each}}
    + {{add-env-var repo=repo}} -
    -
    -
    - -
    -
    - -
    -
    - {{settings-switch inline="true"}} -
    -
    - -
    -
    -
    {{#if config.endpoints.sshKey}} diff --git a/tests/unit/controllers/settings-test.coffee b/tests/unit/controllers/settings-test.coffee new file mode 100644 index 00000000..c64b14d9 --- /dev/null +++ b/tests/unit/controllers/settings-test.coffee @@ -0,0 +1,12 @@ +`import { test, moduleFor } from 'ember-qunit'` + +moduleFor 'controller:settings', { + # Specify the other units that are required for this test. + # needs: ['controller:foo'] +} + +# Replace this with your real tests. +test 'it exists', (assert) -> + controller = @subject() + assert.ok controller + From f6fec80b5d8a1b7cfa93e05e5728f6f4d299b487 Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Wed, 15 Jul 2015 16:50:18 +0200 Subject: [PATCH 18/53] add env var form tests --- app/components/add-env-var.coffee | 10 ++- app/templates/components/add-env-var.hbs | 5 +- ember-cli-build.js | 1 - .../components/add-env-var-test.js | 62 +++++++++++++++++++ tests/unit/components/add-env-var-test.coffee | 17 +++++ 5 files changed, 92 insertions(+), 3 deletions(-) create mode 100644 tests/integration/components/add-env-var-test.js create mode 100644 tests/unit/components/add-env-var-test.coffee diff --git a/app/components/add-env-var.coffee b/app/components/add-env-var.coffee index fbffbfb2..b4a674e3 100644 --- a/app/components/add-env-var.coffee +++ b/app/components/add-env-var.coffee @@ -7,13 +7,18 @@ AddEnvVarComponent = Ember.Component.extend store: Ember.inject.service() isValid: () -> - true + if Ember.isBlank(@get('name')) + this.set('nameIsBlank', true) + false + else + true reset: -> @setProperties(name: null, value: null, public: null) actions: save: -> + console.log('SUBMITTED') return if @get('isSaving') @set('isSaving', true) @@ -34,5 +39,8 @@ AddEnvVarComponent = Ember.Component.extend else @set('isSaving', false) + nameChanged: -> + this.set('nameIsBlank', false) + `export default AddEnvVarComponent` diff --git a/app/templates/components/add-env-var.hbs b/app/templates/components/add-env-var.hbs index a0dded7c..8d25dbb8 100644 --- a/app/templates/components/add-env-var.hbs +++ b/app/templates/components/add-env-var.hbs @@ -1,6 +1,9 @@
    + {{#if nameIsBlank }} +

    Name cannot be blank

    + {{/if}}
    - {{input value=name class="env-name" placeholder="Name"}} + {{input value=name class="env-name" on="key-press" action="nameChanged" placeholder="Name"}}
    {{input value=value class="env-value" placeholder="Value"}} diff --git a/ember-cli-build.js b/ember-cli-build.js index bd46cd4e..620c6457 100644 --- a/ember-cli-build.js +++ b/ember-cli-build.js @@ -37,7 +37,6 @@ module.exports = function(defaults) { app.import('vendor/ansiparse.js'); app.import('vendor/log.js'); app.import('vendor/customerio.js'); - app.import('vendor/charmscout.js'); app.import('bower_components/moment/moment.js'); return app.toTree(); diff --git a/tests/integration/components/add-env-var-test.js b/tests/integration/components/add-env-var-test.js new file mode 100644 index 00000000..e210a047 --- /dev/null +++ b/tests/integration/components/add-env-var-test.js @@ -0,0 +1,62 @@ +import { moduleForComponent, test } from 'ember-qunit'; +import hbs from 'htmlbars-inline-precompile'; + + +moduleForComponent('add-env-var', 'Integration | Component | add env-var', { + integration: true +}); + +test('it adds an env var on submit', function(assert) { + assert.expect(5); + + var store = this.container.lookup('store:main'); + assert.equal(store.all('envVar').get('length'), 0, 'precond: store should be empty'); + + var repo; + Ember.run(function() { + repo = store.push('repo', {id: 1, slug: 'travis-ci/travis-web'}); + }); + + this.set('repo', repo); + + this.render(hbs`{{add-env-var repo=repo}}`); + + this.$('.env-name').val('FOO'); + var e = jQuery.Event("keyup"); + e.which = 50; + this.$('.env-name').trigger(e); + + this.$('.env-value').val('bar'); + var e = jQuery.Event("keyup"); + e.which = 50; + this.$('.env-value').trigger(e); + + this.$('.form-submit').click(); + + assert.equal(store.all('envVar').get('length'), 1, 'env var should be added to store'); + + var envVar = store.all('envVar').objectAt(0); + + assert.equal(envVar.get('name'), 'FOO', 'name should be set for the env var'); + assert.equal(envVar.get('value'), 'bar', 'value should be set for the env var'); + assert.equal(envVar.get('repo.slug'), 'travis-ci/travis-web', 'repo should be set for the env var'); +}); + +test('it shows an error if no name is present', function(assert) { + assert.expect(3); + + this.render(hbs`{{add-env-var repo=repo}}`); + + this.$('.env-name').val(); + assert.ok(Ember.isBlank(this.$('.env-name').val()), 'precond: name input should be empty'); + + this.$('.form-submit').click(); + + assert.ok(this.$('.form-error').length, 'the error message should be displayed'); + + var e = jQuery.Event("keypress"); + e.which = 50; + this.$('.env-name').trigger(e); + + assert.ok(!this.$('.form-error').length, 'the error message should be removed after value is changed'); +}); \ No newline at end of file diff --git a/tests/unit/components/add-env-var-test.coffee b/tests/unit/components/add-env-var-test.coffee new file mode 100644 index 00000000..ece08e45 --- /dev/null +++ b/tests/unit/components/add-env-var-test.coffee @@ -0,0 +1,17 @@ +`import { test, moduleForComponent } from 'ember-qunit'` + +moduleForComponent 'env-var', { + # specify the other units that are required for this test + # needs: ['component:foo', 'helper:bar'] +} + +test 'it renders', (assert) -> + assert.expect 2 + + # creates the component instance + component = @subject() + assert.equal component._state, 'preRender' + + # renders the component to the page + @render() + assert.equal component._state, 'inDOM' From 68ea7071e0bfc8c53dea361d29050b9ca70d68fc Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Wed, 15 Jul 2015 18:22:43 +0200 Subject: [PATCH 19/53] fix new ui bugs on profile page --- app/styles/app/layouts/profile.sass | 4 ++-- app/templates/account.hbs | 2 +- app/templates/profile.hbs | 4 +++- app/templates/profile/show.hbs | 3 ++- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/styles/app/layouts/profile.sass b/app/styles/app/layouts/profile.sass index 479bf037..f9a135d5 100644 --- a/app/styles/app/layouts/profile.sass +++ b/app/styles/app/layouts/profile.sass @@ -154,7 +154,7 @@ p.profile-user-last display: inline-block padding: .2em .2em .2em .5em; height: 28px; - vertical-align: middle; + vertical-align: bottom; .icon width: 14px height: 14px @@ -199,7 +199,7 @@ p.profile-user-last span display: inline-block @media #{$large-up} - width: grid-calc(18, 24) + width: grid-calc(19, 24) .profile-additional diff --git a/app/templates/account.hbs b/app/templates/account.hbs index 3b56f897..3b813080 100644 --- a/app/templates/account.hbs +++ b/app/templates/account.hbs @@ -22,7 +22,7 @@ {{/if}}
    -

    {{view.name}}

    +

    {{user.name}}

    {{#if user.isSyncing}} diff --git a/app/templates/profile.hbs b/app/templates/profile.hbs index c24cd689..f5977610 100644 --- a/app/templates/profile.hbs +++ b/app/templates/profile.hbs @@ -1 +1,3 @@ -{{outlet}} +
    + {{outlet}} +
    \ No newline at end of file diff --git a/app/templates/profile/show.hbs b/app/templates/profile/show.hbs index e772d428..f1f831bf 100644 --- a/app/templates/profile/show.hbs +++ b/app/templates/profile/show.hbs @@ -1,3 +1,4 @@ -
    +{{!--
    {{outlet}}
    + --}} \ No newline at end of file From a7ad2c0a63da402c10613d5d5124b4896661737b Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Wed, 15 Jul 2015 20:12:13 +0200 Subject: [PATCH 20/53] add some env var form error styles --- app/components/add-env-var.coffee | 1 + app/styles/app/layouts/settings.sass | 11 +++++++++++ app/styles/app/modules/forms.sass | 2 +- app/templates/components/add-env-var.hbs | 6 +++--- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/app/components/add-env-var.coffee b/app/components/add-env-var.coffee index b4a674e3..830a1fac 100644 --- a/app/components/add-env-var.coffee +++ b/app/components/add-env-var.coffee @@ -3,6 +3,7 @@ AddEnvVarComponent = Ember.Component.extend classNames: ['form--envvar'] + classNameBindings: ['nameIsBlank:form-error'] store: Ember.inject.service() diff --git a/app/styles/app/layouts/settings.sass b/app/styles/app/layouts/settings.sass index ce4456f9..e11522f0 100644 --- a/app/styles/app/layouts/settings.sass +++ b/app/styles/app/layouts/settings.sass @@ -172,3 +172,14 @@ height: 1.3em margin: .2em auto 0 +.form-error + .env-name + border: $fail-color 2px solid + .form-error + color: $fail-color + font-size: 14px + margin: 0 + + + + diff --git a/app/styles/app/modules/forms.sass b/app/styles/app/modules/forms.sass index 600541f3..da463443 100644 --- a/app/styles/app/modules/forms.sass +++ b/app/styles/app/modules/forms.sass @@ -44,7 +44,7 @@ textarea .form--envvar .form-elem display: inline-block - vertical-align: middle + vertical-align: top width: 100% margin-bottom: 1em diff --git a/app/templates/components/add-env-var.hbs b/app/templates/components/add-env-var.hbs index 8d25dbb8..cad73dfd 100644 --- a/app/templates/components/add-env-var.hbs +++ b/app/templates/components/add-env-var.hbs @@ -1,9 +1,9 @@ - {{#if nameIsBlank }} -

    Name cannot be blank

    - {{/if}}
    {{input value=name class="env-name" on="key-press" action="nameChanged" placeholder="Name"}} + {{#if nameIsBlank }} +

    Name cannot be blank

    + {{/if}}
    {{input value=value class="env-value" placeholder="Value"}} From a2af72a10d53cb66b83adc5593e77beb3bb9d89e Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Thu, 16 Jul 2015 12:03:08 +0200 Subject: [PATCH 21/53] add styles for public env-vars and tweak some other styles --- app/components/env-var.coffee | 1 + app/styles/app/layouts/settings.sass | 28 ++++++------------- app/styles/app/modules/forms.sass | 15 ++++++++++ app/styles/app/modules/tooltips.sass | 2 +- app/templates/components/add-env-var.hbs | 2 +- .../components/add-env-var-test.js | 4 +-- 6 files changed, 29 insertions(+), 23 deletions(-) diff --git a/app/components/env-var.coffee b/app/components/env-var.coffee index b013604e..1dbe3435 100644 --- a/app/components/env-var.coffee +++ b/app/components/env-var.coffee @@ -3,6 +3,7 @@ EnvVarComponent = Ember.Component.extend classNames: ['settings-envvar'] + classNameBindings: ['envVar.public:is-public'] isEditing: false isDeleting: false diff --git a/app/styles/app/layouts/settings.sass b/app/styles/app/layouts/settings.sass index e11522f0..76d56e08 100644 --- a/app/styles/app/layouts/settings.sass +++ b/app/styles/app/layouts/settings.sass @@ -115,15 +115,10 @@ .env-var-value @extend %settings-value-section - // public value - // background-image: none; - // font-size: 16px; - // padding: 0.4rem 0 0.4rem 0.7rem; - input display: inline-block width: 100% - padding: 0.7em 0.5em 0.7em 2.2em + padding: 0.7em 0.5em 0.7em 2.6em border-radius: 4px border: none background-color: #eeedec @@ -132,8 +127,12 @@ background: size: 14px repeat: no-repeat - position: 0.4em 0.7em - + position: 0.8em 0.7em + .is-public & + input + background-image: none; + padding: 0.4em 0 0.5em 0.9em; + font-size: 14px; %settings-action-section display: inline-block @@ -146,7 +145,8 @@ @extend %icon @extend .icon-delete width: 1.1em - height: 1.3em + height: 1.6em + background-position: 0 4px &:hover .icon-delete @extend .icon-delete-hover @@ -172,14 +172,4 @@ height: 1.3em margin: .2em auto 0 -.form-error - .env-name - border: $fail-color 2px solid - .form-error - color: $fail-color - font-size: 14px - margin: 0 - - - diff --git a/app/styles/app/modules/forms.sass b/app/styles/app/modules/forms.sass index da463443..c3adb1be 100644 --- a/app/styles/app/modules/forms.sass +++ b/app/styles/app/modules/forms.sass @@ -47,6 +47,11 @@ textarea vertical-align: top width: 100% margin-bottom: 1em + .switch + .label + font-size: $font-size-s + width: 7rem; + line-height: 1.2; @media #{$medium-up} .form-elem @@ -61,3 +66,13 @@ textarea width: 6% float: right text-align: right + + +.form-error + .env-name + border: $fail-color 2px solid + .form-error-message + color: $fail-color + font-size: 14px + padding: .2em 0 + margin: 0 diff --git a/app/styles/app/modules/tooltips.sass b/app/styles/app/modules/tooltips.sass index e5b88721..957d462d 100644 --- a/app/styles/app/modules/tooltips.sass +++ b/app/styles/app/modules/tooltips.sass @@ -53,7 +53,7 @@ &:before left: 46% @media #{$medium-up} - left: 42% + left: 44% .tooltip--jobs @extend %tooltip diff --git a/app/templates/components/add-env-var.hbs b/app/templates/components/add-env-var.hbs index cad73dfd..06dce42c 100644 --- a/app/templates/components/add-env-var.hbs +++ b/app/templates/components/add-env-var.hbs @@ -2,7 +2,7 @@
    {{input value=name class="env-name" on="key-press" action="nameChanged" placeholder="Name"}} {{#if nameIsBlank }} -

    Name cannot be blank

    +

    Name cannot be blank

    {{/if}}
    diff --git a/tests/integration/components/add-env-var-test.js b/tests/integration/components/add-env-var-test.js index e210a047..d138fe54 100644 --- a/tests/integration/components/add-env-var-test.js +++ b/tests/integration/components/add-env-var-test.js @@ -52,11 +52,11 @@ test('it shows an error if no name is present', function(assert) { this.$('.form-submit').click(); - assert.ok(this.$('.form-error').length, 'the error message should be displayed'); + assert.ok(this.$('.form-error-message').length, 'the error message should be displayed'); var e = jQuery.Event("keypress"); e.which = 50; this.$('.env-name').trigger(e); - assert.ok(!this.$('.form-error').length, 'the error message should be removed after value is changed'); + assert.ok(!this.$('.form-error-message').length, 'the error message should be removed after value is changed'); }); \ No newline at end of file From cc0bed2974dac7b56eacfb15921b5a3a42c8e4e7 Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Thu, 16 Jul 2015 12:28:14 +0200 Subject: [PATCH 22/53] fix failing tests --- .jshintrc | 3 ++- app/utils/helpers.coffee | 7 ++++--- tests/.jshintrc | 3 ++- tests/integration/components/add-env-var-test.js | 7 ++++--- tests/unit/components/builds-item-test.coffee | 4 +++- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/.jshintrc b/.jshintrc index 08096eff..45569263 100644 --- a/.jshintrc +++ b/.jshintrc @@ -2,7 +2,8 @@ "predef": [ "document", "window", - "-Promise" + "-Promise", + "jQuery" ], "browser": true, "boss": true, diff --git a/app/utils/helpers.coffee b/app/utils/helpers.coffee index 0bc38926..52d7bb0d 100644 --- a/app/utils/helpers.coffee +++ b/app/utils/helpers.coffee @@ -2,6 +2,7 @@ `import { githubCommit as githubCommitUrl } from 'travis/utils/urls'` `import configKeysMap from 'travis/utils/keys-map'` `import config from 'travis/config/environment'` +`import Ember from 'ember'` timeago = $.timeago mapObject = $.map @@ -66,9 +67,9 @@ formatMessage = (message, options) -> message = message || '' message = message.split(/\n/)[0] if options.short message = _emojize(_escape(message)) - if !!options.repo - message = githubify(message, options.repo.get('owner'), options.repo.get('name')) - if !!options.pre + if options.repo + message = githubify(message, Ember.get(options.repo, 'owner'), Ember.get(options.repo, 'name')) + if options.pre message = message.replace /\n/g, '
    ' message diff --git a/tests/.jshintrc b/tests/.jshintrc index 6ebf71a0..618a5861 100644 --- a/tests/.jshintrc +++ b/tests/.jshintrc @@ -44,7 +44,8 @@ "andThen", "currentURL", "currentPath", - "currentRouteName" + "currentRouteName", + "jQuery" ], "node": false, "browser": false, diff --git a/tests/integration/components/add-env-var-test.js b/tests/integration/components/add-env-var-test.js index d138fe54..66963000 100644 --- a/tests/integration/components/add-env-var-test.js +++ b/tests/integration/components/add-env-var-test.js @@ -1,3 +1,4 @@ +import Ember from 'ember'; import { moduleForComponent, test } from 'ember-qunit'; import hbs from 'htmlbars-inline-precompile'; @@ -22,12 +23,12 @@ test('it adds an env var on submit', function(assert) { this.render(hbs`{{add-env-var repo=repo}}`); this.$('.env-name').val('FOO'); - var e = jQuery.Event("keyup"); + var e = $.Event("keyup"); e.which = 50; this.$('.env-name').trigger(e); this.$('.env-value').val('bar'); - var e = jQuery.Event("keyup"); + e = $.Event("keyup"); e.which = 50; this.$('.env-value').trigger(e); @@ -54,7 +55,7 @@ test('it shows an error if no name is present', function(assert) { assert.ok(this.$('.form-error-message').length, 'the error message should be displayed'); - var e = jQuery.Event("keypress"); + var e = $.Event("keypress"); e.which = 50; this.$('.env-name').trigger(e); diff --git a/tests/unit/components/builds-item-test.coffee b/tests/unit/components/builds-item-test.coffee index 8578e522..b4496a79 100644 --- a/tests/unit/components/builds-item-test.coffee +++ b/tests/unit/components/builds-item-test.coffee @@ -25,7 +25,9 @@ test 'it renders', (assert) -> slug: 'foo/bar' } } - component = @subject(build: attributes) + + component = @subject() + component.set('build', attributes) @append() ok component.$().hasClass('passed'), 'component has right status class' From 99f828ef6501a75c4d8ee5066430f1623f0b5ba5 Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Thu, 16 Jul 2015 12:48:19 +0200 Subject: [PATCH 23/53] add some and refactor add-env-var tests --- app/templates/components/add-env-var.hbs | 2 +- tests/helpers/fill-in.js | 7 +++ .../components/add-env-var-test.js | 54 ++++++++++++++----- 3 files changed, 48 insertions(+), 15 deletions(-) create mode 100644 tests/helpers/fill-in.js diff --git a/app/templates/components/add-env-var.hbs b/app/templates/components/add-env-var.hbs index 06dce42c..a5c97428 100644 --- a/app/templates/components/add-env-var.hbs +++ b/app/templates/components/add-env-var.hbs @@ -1,6 +1,6 @@
    - {{input value=name class="env-name" on="key-press" action="nameChanged" placeholder="Name"}} + {{input value=name class="env-name" on="key-up" action="nameChanged" placeholder="Name"}} {{#if nameIsBlank }}

    Name cannot be blank

    {{/if}} diff --git a/tests/helpers/fill-in.js b/tests/helpers/fill-in.js new file mode 100644 index 00000000..129971fc --- /dev/null +++ b/tests/helpers/fill-in.js @@ -0,0 +1,7 @@ + +export default function (elem, text, event = 'keyup') { + var e = $.Event(event); + e.which = 50; + elem.val(text); + elem.trigger(e); +} diff --git a/tests/integration/components/add-env-var-test.js b/tests/integration/components/add-env-var-test.js index 66963000..9e719926 100644 --- a/tests/integration/components/add-env-var-test.js +++ b/tests/integration/components/add-env-var-test.js @@ -1,6 +1,7 @@ import Ember from 'ember'; import { moduleForComponent, test } from 'ember-qunit'; import hbs from 'htmlbars-inline-precompile'; +import fillIn from '../../helpers/fill-in'; moduleForComponent('add-env-var', 'Integration | Component | add env-var', { @@ -8,7 +9,7 @@ moduleForComponent('add-env-var', 'Integration | Component | add env-var', { }); test('it adds an env var on submit', function(assert) { - assert.expect(5); + assert.expect(6); var store = this.container.lookup('store:main'); assert.equal(store.all('envVar').get('length'), 0, 'precond: store should be empty'); @@ -22,15 +23,8 @@ test('it adds an env var on submit', function(assert) { this.render(hbs`{{add-env-var repo=repo}}`); - this.$('.env-name').val('FOO'); - var e = $.Event("keyup"); - e.which = 50; - this.$('.env-name').trigger(e); - - this.$('.env-value').val('bar'); - e = $.Event("keyup"); - e.which = 50; - this.$('.env-value').trigger(e); + fillIn(this.$('.env-name'), 'FOO'); + fillIn(this.$('.env-value'), 'bar'); this.$('.form-submit').click(); @@ -41,6 +35,7 @@ test('it adds an env var on submit', function(assert) { assert.equal(envVar.get('name'), 'FOO', 'name should be set for the env var'); assert.equal(envVar.get('value'), 'bar', 'value should be set for the env var'); assert.equal(envVar.get('repo.slug'), 'travis-ci/travis-web', 'repo should be set for the env var'); + assert.ok(!envVar.get('public'), 'env var should be private'); }); test('it shows an error if no name is present', function(assert) { @@ -55,9 +50,40 @@ test('it shows an error if no name is present', function(assert) { assert.ok(this.$('.form-error-message').length, 'the error message should be displayed'); - var e = $.Event("keypress"); - e.which = 50; - this.$('.env-name').trigger(e); + fillIn(this.$('.env-name'), 'FOO'); + fillIn(this.$('.env-value'), 'bar'); assert.ok(!this.$('.form-error-message').length, 'the error message should be removed after value is changed'); -}); \ No newline at end of file +}); + +test('it adds a public env var on submit', function(assert) { + assert.expect(6); + + var store = this.container.lookup('store:main'); + assert.equal(store.all('envVar').get('length'), 0, 'precond: store should be empty'); + + var repo; + Ember.run(function() { + repo = store.push('repo', {id: 1, slug: 'travis-ci/travis-web'}); + }); + + this.set('repo', repo); + + this.render(hbs`{{add-env-var repo=repo}}`); + + fillIn(this.$('.env-name'), 'FOO'); + fillIn(this.$('.env-value'), 'bar'); + + this.$('.switch').click(); + + this.$('.form-submit').click(); + + assert.equal(store.all('envVar').get('length'), 1, 'env var should be added to store'); + + var envVar = store.all('envVar').objectAt(0); + + assert.equal(envVar.get('name'), 'FOO', 'name should be set for the env var'); + assert.equal(envVar.get('value'), 'bar', 'value should be set for the env var'); + assert.equal(envVar.get('repo.slug'), 'travis-ci/travis-web', 'repo should be set for the env var'); + assert.ok(envVar.get('public'), 'env var should be public'); +}); From 004d890a08db7042e03d953038a007ef7d65ad32 Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Thu, 16 Jul 2015 15:46:39 +0200 Subject: [PATCH 24/53] add delete env-var functionality --- app/components/env-var.coffee | 21 +------------ app/templates/components/add-env-var.hbs | 39 +++--------------------- app/templates/components/env-var.hbs | 12 +++++--- 3 files changed, 14 insertions(+), 58 deletions(-) diff --git a/app/components/env-var.coffee b/app/components/env-var.coffee index 1dbe3435..61acca7e 100644 --- a/app/components/env-var.coffee +++ b/app/components/env-var.coffee @@ -5,7 +5,6 @@ EnvVarComponent = Ember.Component.extend classNames: ['settings-envvar'] classNameBindings: ['envVar.public:is-public'] - isEditing: false isDeleting: false validates: @@ -25,24 +24,6 @@ EnvVarComponent = Ember.Component.extend delete: -> return if @get('isDeleting') @set('isDeleting', true) - - @get('model').destroyRecord() - - edit: -> - @set('isEditing', true) - - cancel: -> - @set('isEditing', false) - @get('model').revert() - - save: -> - return if @get('isSaving') - - if @isValid() - env_var = @get('model') - - # TODO: handle errors - env_var.save().then => - @set('isEditing', false) + @get('envVar').destroyRecord() `export default EnvVarComponent` diff --git a/app/templates/components/add-env-var.hbs b/app/templates/components/add-env-var.hbs index a5c97428..9bae2cc6 100644 --- a/app/templates/components/add-env-var.hbs +++ b/app/templates/components/add-env-var.hbs @@ -12,39 +12,10 @@ {{travis-switch active=public}}
    - + {{#if isSaving}} + {{loading-indicator}} + {{else}} + + {{/if}}
    - -{{!-- - - -
    - {{#travis-field "name"}} - - {{input value=name class="env-name" placeholder="Name"}} {{travis-errors "name"}} - {{/travis-field}} - = - {{#if showValueField}} -
    - {{#label for="value" class="value"}}Value:{{/label}} - {{input value=value class="env-value" placeholder="Value"}} -
    - {{else}} -
    - {{value}} -
    - {{/if}} -
    - {{travis-switch active=public}} - {{#label for="secure" class="public"}}Display value in build logs{{/label}} -
    - -
    - - or - Cancel -
    -
    - - --}} \ No newline at end of file diff --git a/app/templates/components/env-var.hbs b/app/templates/components/env-var.hbs index 5a260f16..e9c86e34 100644 --- a/app/templates/components/env-var.hbs +++ b/app/templates/components/env-var.hbs @@ -5,9 +5,13 @@
    - - - -
    Delete
    + {{#if isDeleting}} + {{loading-indicator}} + {{else}} + + + +
    Delete
    + {{/if}}
    From 8d4762eb81aad412b94ddef4a502e13d04b8233b Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Thu, 16 Jul 2015 16:56:50 +0200 Subject: [PATCH 25/53] add env-var integration test --- tests/integration/components/env-var-test.js | 60 ++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 tests/integration/components/env-var-test.js diff --git a/tests/integration/components/env-var-test.js b/tests/integration/components/env-var-test.js new file mode 100644 index 00000000..6c9fbed5 --- /dev/null +++ b/tests/integration/components/env-var-test.js @@ -0,0 +1,60 @@ +import Ember from 'ember'; +import { moduleForComponent, test } from 'ember-qunit'; +import hbs from 'htmlbars-inline-precompile'; +import fillIn from '../../helpers/fill-in'; + + +moduleForComponent('env-var', 'Integration | Component | env-var', { + integration: true +}); + +test('it renders an env-var with private value', function(assert) { + assert.expect(2); + + var store = this.container.lookup('store:main'); + Ember.run(() => { + var envVar = store.push('envVar', {id: 1, name: 'foo', value: 'bar', public: false}); + this.set('envVar', envVar); + }); + + this.render(hbs`{{env-var envVar=envVar}}`); + + assert.equal(this.$('.env-var-name').text(), 'foo', 'name should be displayed'); + assert.equal(this.$('.env-var-value input').val(), '••••••••••••••••', 'value should be hidden'); + +}); + +test('it renders an env-var with public value', function(assert) { + assert.expect(2); + + var store = this.container.lookup('store:main'); + Ember.run(() => { + var envVar = store.push('envVar', {id: 1, name: 'foo', value: 'bar', public: true}); + this.set('envVar', envVar); + }); + + this.render(hbs`{{env-var envVar=envVar}}`); + + assert.equal(this.$('.env-var-name').text(), 'foo', 'name should be displayed'); + assert.equal(this.$('.env-var-value input').val(), 'bar', 'value should be hidden'); + +}); + +// test('it deletes an env-var', function(assert) { +// assert.expect(2); + +// var store = this.container.lookup('store:main'); +// Ember.run(() => { +// var envVar = store.push('envVar', {id: 1, name: 'foo', value: 'bar', public: true}); +// this.set('envVar', envVar); +// }); + +// this.render(hbs`{{env-var envVar=envVar}}`); + +// assert.equal(store.all('envVar').get('length'), 1, 'precond: store should have an env-var'); + +// this.$('.env-var-action a').click(); + +// assert.equal(store.all('envVar').get('length'), 0, 'env-var should be deleted'); + +// }); From 2accdd56264d4a9d09dd7f936e059cdfd2413674 Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Fri, 17 Jul 2015 11:39:46 +0200 Subject: [PATCH 26/53] try fetching ssh keys --- app/components/ssh-key.coffee | 3 +++ app/routes/settings.coffee | 19 +++++++++++++- app/templates/components/ssh-key.hbs | 10 +++++--- app/templates/settings.hbs | 37 ++++++++++++++++------------ 4 files changed, 48 insertions(+), 21 deletions(-) diff --git a/app/components/ssh-key.coffee b/app/components/ssh-key.coffee index 72eb23f7..490d7aaa 100644 --- a/app/components/ssh-key.coffee +++ b/app/components/ssh-key.coffee @@ -4,4 +4,7 @@ SshKeyComponent = Ember.Component.extend classNames: ['settings-sshkey'] + isCustom: () -> + false + `export default SshKeyComponent` diff --git a/app/routes/settings.coffee b/app/routes/settings.coffee index cb9a0f0e..1c50a2f5 100644 --- a/app/routes/settings.coffee +++ b/app/routes/settings.coffee @@ -1,4 +1,5 @@ `import TravisRoute from 'travis/routes/basic'` +`import Ajax from 'travis/utils/ajax'` Route = TravisRoute.extend needsAuth: true @@ -11,10 +12,26 @@ Route = TravisRoute.extend repo = @modelFor('repo') repo.get('envVars.promise') + fetchSshKey: () -> + repo = @modelFor('repo') + self = this + @store.find('sshKey', repo.get('id')).then ( (result) -> result unless result.get('isNew') ), (xhr) -> + if xhr.status == 404 + # if there is no model, just return null. I'm not sure if this is the + # best answer, maybe we should just redirect to different route, like + # ssh_key.new or ssh_key.no_key + return false + + fetchCustomSshKey: () -> + repo = @modelFor('repo') + Ajax.get "/repos/#{repo.get('id')}/key", (data) => + Ember.Object.create(fingerprint: data.fingerprint) + model: () -> return Ember.RSVP.hash({ envVars: this.fetchEnvVars(), - # sshKey: this.fetchSshKey() + sshKey: this.fetchSshKey(), + customSshKey: this.fetchCustomSshKey() }); `export default Route` diff --git a/app/templates/components/ssh-key.hbs b/app/templates/components/ssh-key.hbs index 94c5c741..3e4a2350 100644 --- a/app/templates/components/ssh-key.hbs +++ b/app/templates/components/ssh-key.hbs @@ -1,11 +1,12 @@ -{{#if custom}} +{{#if isCustom}}
    - TRAVIS_PRIVATE_KEY + {{key.description}}
    - e1:b1:83:06:7e:51:6d:5e:e0:e0:60:96:ca:ac:3d:8a + {{key.fingerprint}} + {{fingerprint}}
    @@ -22,7 +23,8 @@
    - e1:b1:83:06:7e:51:6d:5e:e0:e0:60:96:ca:ac:3d:8a + {{key.fingerprint}} + {{fingerprint}}
    diff --git a/app/templates/settings.hbs b/app/templates/settings.hbs index 93689a2b..ec8954ae 100644 --- a/app/templates/settings.hbs +++ b/app/templates/settings.hbs @@ -31,23 +31,28 @@

    SSH Key

    - {{ssh-key}} - {{ssh-key custom=true}} + {{#if sshKey}} + {{ssh-key key=sshKey}} -
    - Add custom SSH Key -
    -
    - -
    -
    - -
    -
    - -
    -
    -
    +
    + Add custom SSH Key +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    + {{else}} + {{ssh-key key=customSshKey}} + {{/if}} + +
    {{/if}}
    From b32ce35a05ac35cadfda8607dc0a5ae75efdf2ab Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Mon, 20 Jul 2015 17:11:59 +0200 Subject: [PATCH 27/53] fix ssh-key displays --- app/components/ssh-key.coffee | 17 +++++++++++++++-- app/models/ssh-key.coffee | 1 + app/routes/settings.coffee | 4 ++-- app/templates/components/ssh-key.hbs | 10 +++------- app/templates/settings.hbs | 10 ++++------ 5 files changed, 25 insertions(+), 17 deletions(-) diff --git a/app/components/ssh-key.coffee b/app/components/ssh-key.coffee index 490d7aaa..88d62182 100644 --- a/app/components/ssh-key.coffee +++ b/app/components/ssh-key.coffee @@ -4,7 +4,20 @@ SshKeyComponent = Ember.Component.extend classNames: ['settings-sshkey'] - isCustom: () -> - false + isDeleting: false + + actions: + delete: -> + console.log('isDeleting') + + # return if @get('isDeleting') + # @set('isDeleting', true) + + # deletingDone = => @set('isDeleting', false) + + # @get('model').deleteRecord() + # @get('model').save().then(deletingDone, deletingDone).then => + # @set('model', null) + `export default SshKeyComponent` diff --git a/app/models/ssh-key.coffee b/app/models/ssh-key.coffee index 896712a3..8bb1f2fd 100644 --- a/app/models/ssh-key.coffee +++ b/app/models/ssh-key.coffee @@ -5,5 +5,6 @@ SshKey = Model.extend value: DS.attr() description: DS.attr() fingerprint: DS.attr() + isCustom: true `export default SshKey` diff --git a/app/routes/settings.coffee b/app/routes/settings.coffee index 1c50a2f5..6e95d53e 100644 --- a/app/routes/settings.coffee +++ b/app/routes/settings.coffee @@ -12,7 +12,7 @@ Route = TravisRoute.extend repo = @modelFor('repo') repo.get('envVars.promise') - fetchSshKey: () -> + fetchCustomSshKey: () -> repo = @modelFor('repo') self = this @store.find('sshKey', repo.get('id')).then ( (result) -> result unless result.get('isNew') ), (xhr) -> @@ -22,7 +22,7 @@ Route = TravisRoute.extend # ssh_key.new or ssh_key.no_key return false - fetchCustomSshKey: () -> + fetchSshKey: () -> repo = @modelFor('repo') Ajax.get "/repos/#{repo.get('id')}/key", (data) => Ember.Object.create(fingerprint: data.fingerprint) diff --git a/app/templates/components/ssh-key.hbs b/app/templates/components/ssh-key.hbs index 3e4a2350..7e11e550 100644 --- a/app/templates/components/ssh-key.hbs +++ b/app/templates/components/ssh-key.hbs @@ -1,4 +1,4 @@ -{{#if isCustom}} +{{#if key.isCustom}}
    {{key.description}} @@ -6,11 +6,10 @@
    {{key.fingerprint}} - {{fingerprint}}
    - +
    Delete
    @@ -24,13 +23,10 @@
    {{key.fingerprint}} - {{fingerprint}}
    - - - +
    Default keys
    cannot be deleted
    diff --git a/app/templates/settings.hbs b/app/templates/settings.hbs index ec8954ae..04745a97 100644 --- a/app/templates/settings.hbs +++ b/app/templates/settings.hbs @@ -31,11 +31,11 @@

    SSH Key

    - {{#if sshKey}} - {{ssh-key key=sshKey}} - + {{#if model.customSshKey}} + {{ssh-key key=model.customSshKey}} + {{else}} + {{ssh-key key=model.sshKey}}
    - Add custom SSH Key
    @@ -48,8 +48,6 @@
    - {{else}} - {{ssh-key key=customSshKey}} {{/if}} From fcfd63459128f6cc727776644e9a15532ec84d41 Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Mon, 20 Jul 2015 17:19:34 +0200 Subject: [PATCH 28/53] add add-ssh-key component --- app/components/add-ssh-key.coffee | 8 ++++++++ app/templates/components/add-ssh-key.hbs | 11 +++++++++++ app/templates/settings.hbs | 19 +------------------ 3 files changed, 20 insertions(+), 18 deletions(-) create mode 100644 app/components/add-ssh-key.coffee create mode 100644 app/templates/components/add-ssh-key.hbs diff --git a/app/components/add-ssh-key.coffee b/app/components/add-ssh-key.coffee new file mode 100644 index 00000000..3de91684 --- /dev/null +++ b/app/components/add-ssh-key.coffee @@ -0,0 +1,8 @@ +`import Ember from 'ember'` + +AddSshKeyComponent = Ember.Component.extend + + classNames: ['form--sshkey'] + + +`export default AddSshKeyComponent` diff --git a/app/templates/components/add-ssh-key.hbs b/app/templates/components/add-ssh-key.hbs new file mode 100644 index 00000000..1f44a246 --- /dev/null +++ b/app/templates/components/add-ssh-key.hbs @@ -0,0 +1,11 @@ +
    +
    + +
    +
    + +
    +
    + +
    +
    diff --git a/app/templates/settings.hbs b/app/templates/settings.hbs index 04745a97..4fd90540 100644 --- a/app/templates/settings.hbs +++ b/app/templates/settings.hbs @@ -35,19 +35,7 @@ {{ssh-key key=model.customSshKey}} {{else}} {{ssh-key key=model.sshKey}} -
    -
    -
    - -
    -
    - -
    -
    - -
    -
    -
    + {{add-ssh-key }} {{/if}} @@ -60,8 +48,3 @@
    - - -{{!--
    - {{outlet}} -
    --}} From 87ddf9979a75a1e082f2be3015e7c56a38226bc0 Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Mon, 20 Jul 2015 17:58:32 +0200 Subject: [PATCH 29/53] copy some methods from ssh-key controller to add-ssh-key component --- app/components/add-env-var.coffee | 1 - app/components/add-ssh-key.coffee | 51 ++++++++++++++++++++++++ app/templates/components/add-ssh-key.hbs | 12 ++++-- app/templates/settings.hbs | 3 +- 4 files changed, 60 insertions(+), 7 deletions(-) diff --git a/app/components/add-env-var.coffee b/app/components/add-env-var.coffee index 830a1fac..df96537e 100644 --- a/app/components/add-env-var.coffee +++ b/app/components/add-env-var.coffee @@ -19,7 +19,6 @@ AddEnvVarComponent = Ember.Component.extend actions: save: -> - console.log('SUBMITTED') return if @get('isSaving') @set('isSaving', true) diff --git a/app/components/add-ssh-key.coffee b/app/components/add-ssh-key.coffee index 3de91684..6a36169f 100644 --- a/app/components/add-ssh-key.coffee +++ b/app/components/add-ssh-key.coffee @@ -4,5 +4,56 @@ AddSshKeyComponent = Ember.Component.extend classNames: ['form--sshkey'] + store: Ember.inject.service() + isSaving: false + + isValid: () -> + true + + reset: -> + @setProperties(description: null, value: null) + + actions: + + add: -> + # not sure how to integrate that with 'save' in the compotent + id = @get('repo.id') + model = @store.recordForId('sshKey', id) + # TODO: this can be removed in favor of simply unloading record + # once https://github.com/emberjs/data/pull/2867 + # and https://github.com/emberjs/data/pull/2870 are merged + if model + @store.dematerializeRecord(model) + typeMap = @store.typeMapFor('sshKey') + idToRecord = typeMap.idToRecord + delete idToRecord[id] + + model = @store.createRecord('sshKey', id: id) + @set('model', model) + @set('isEditing', true) + + save: -> + return if @get('isSaving') + @set('isSaving', true) + + if @isValid() + + ssh_key = @get('store').createRecord('ssh_key', + description: @get('description') + value: @get('value') + fingerprint: 'I dont know?' + repo: @get('repo') + ) + self = this + ssh_key.save().then => + @set('isSaving', false) + @reset() + , => + @set('isSaving', false) + + # if error.errors + # @addErrorsFromResponse(error.errors) + else + @set('isSaving', false) `export default AddSshKeyComponent` diff --git a/app/templates/components/add-ssh-key.hbs b/app/templates/components/add-ssh-key.hbs index 1f44a246..eec4e6d5 100644 --- a/app/templates/components/add-ssh-key.hbs +++ b/app/templates/components/add-ssh-key.hbs @@ -1,11 +1,15 @@ -
    +
    - + {{input value=description class="ssh-description" placeholder="Description"}}
    - + {{textarea value=value class="ssh-value" rows="10" placeholder="SSH Key"}}
    - + {{#if isSaving}} + {{loading-indicator}} + {{else}} + + {{/if}}
    diff --git a/app/templates/settings.hbs b/app/templates/settings.hbs index 4fd90540..9af9fb47 100644 --- a/app/templates/settings.hbs +++ b/app/templates/settings.hbs @@ -35,10 +35,9 @@ {{ssh-key key=model.customSshKey}} {{else}} {{ssh-key key=model.sshKey}} - {{add-ssh-key }} + {{add-ssh-key repo=repo}} {{/if}} -
    {{/if}}
    From 7293e06c0eb528b521592737252eaea404dd7622 Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Tue, 21 Jul 2015 14:10:37 +0200 Subject: [PATCH 30/53] add save functionality to ssh-keys --- app/components/add-ssh-key.coffee | 63 ++++++++++++++---------- app/templates/components/add-ssh-key.hbs | 3 ++ 2 files changed, 40 insertions(+), 26 deletions(-) diff --git a/app/components/add-ssh-key.coffee b/app/components/add-ssh-key.coffee index 6a36169f..21cdf261 100644 --- a/app/components/add-ssh-key.coffee +++ b/app/components/add-ssh-key.coffee @@ -1,4 +1,4 @@ -`import Ember from 'ember'` +# `import Ember from 'ember'` AddSshKeyComponent = Ember.Component.extend @@ -7,52 +7,63 @@ AddSshKeyComponent = Ember.Component.extend store: Ember.inject.service() isSaving: false + didInsertElement: () -> + id = @get('repo.id') + model = @get('store').recordForId('sshKey', id) + # TODO: this can be removed in favor of simply unloading record + # once https://github.com/emberjs/data/pull/2867 + # and https://github.com/emberjs/data/pull/2870 are merged + if model + @get('store').dematerializeRecord(model) + typeMap = @get('store').typeMapFor('sshKey') + idToRecord = typeMap.idToRecord + delete idToRecord[id] + + model = @get('store').createRecord('sshKey', id: id) + @set('model', model) + isValid: () -> - true + if Ember.isBlank(@get('value')) + this.set('valueError', 'Value can\'t be blank.') + false + else + true reset: -> @setProperties(description: null, value: null) + valueChanged: (-> + this.set('valueError', false) + ).observes('value') + + addErrorsFromResponse: (errArr) -> + error = errArr[0] + if error.code == 'not_a_private_key' + this.set('valueError', 'This key is not a private key.') + else if error.code == 'key_with_a_passphrase' + this.set('valueError', 'We can\'t use key with a passphrase.') + actions: - add: -> - # not sure how to integrate that with 'save' in the compotent - id = @get('repo.id') - model = @store.recordForId('sshKey', id) - # TODO: this can be removed in favor of simply unloading record - # once https://github.com/emberjs/data/pull/2867 - # and https://github.com/emberjs/data/pull/2870 are merged - if model - @store.dematerializeRecord(model) - typeMap = @store.typeMapFor('sshKey') - idToRecord = typeMap.idToRecord - delete idToRecord[id] - - model = @store.createRecord('sshKey', id: id) - @set('model', model) - @set('isEditing', true) - save: -> + this.set('valueError', false) return if @get('isSaving') @set('isSaving', true) - if @isValid() - ssh_key = @get('store').createRecord('ssh_key', + ssh_key = @get('model').setProperties( description: @get('description') value: @get('value') - fingerprint: 'I dont know?' - repo: @get('repo') ) self = this ssh_key.save().then => @set('isSaving', false) @reset() - , => + , (error) => @set('isSaving', false) + if error.errors + @addErrorsFromResponse(error.errors) - # if error.errors - # @addErrorsFromResponse(error.errors) else @set('isSaving', false) diff --git a/app/templates/components/add-ssh-key.hbs b/app/templates/components/add-ssh-key.hbs index eec4e6d5..900f7d4b 100644 --- a/app/templates/components/add-ssh-key.hbs +++ b/app/templates/components/add-ssh-key.hbs @@ -4,6 +4,9 @@
    {{textarea value=value class="ssh-value" rows="10" placeholder="SSH Key"}} + {{#if valueError}} +

    {{valueError}}

    + {{/if}}
    {{#if isSaving}} From 8f7603c9fe44195bea81cd709641e148031ac220 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Tue, 21 Jul 2015 14:32:21 +0200 Subject: [PATCH 31/53] Add customSshKey to controller after it's created in the component --- app/components/add-ssh-key.coffee | 8 +++++--- app/controllers/settings.coffee | 4 +++- app/templates/settings.hbs | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/components/add-ssh-key.coffee b/app/components/add-ssh-key.coffee index 21cdf261..07e4e74e 100644 --- a/app/components/add-ssh-key.coffee +++ b/app/components/add-ssh-key.coffee @@ -40,10 +40,10 @@ AddSshKeyComponent = Ember.Component.extend error = errArr[0] if error.code == 'not_a_private_key' this.set('valueError', 'This key is not a private key.') - else if error.code == 'key_with_a_passphrase' + else if error.code == 'key_with_a_passphrase' this.set('valueError', 'We can\'t use key with a passphrase.') - actions: + actions: save: -> this.set('valueError', false) @@ -55,10 +55,12 @@ AddSshKeyComponent = Ember.Component.extend description: @get('description') value: @get('value') ) - self = this + ssh_key.save().then => @set('isSaving', false) @reset() + + @sendAction('sshKeyAdded', ssh_key) , (error) => @set('isSaving', false) if error.errors diff --git a/app/controllers/settings.coffee b/app/controllers/settings.coffee index 9d535b96..0006d2bf 100644 --- a/app/controllers/settings.coffee +++ b/app/controllers/settings.coffee @@ -1,7 +1,9 @@ `import Ember from 'ember'` SettingsController = Ember.Controller.extend - envVars: Ember.computed.filterBy('model.envVars', 'isNew', false) + actions: + sshKeyAdded: (sshKey) -> + @set('model.customSshKey', sshKey) `export default SettingsController` diff --git a/app/templates/settings.hbs b/app/templates/settings.hbs index 9af9fb47..90ef2770 100644 --- a/app/templates/settings.hbs +++ b/app/templates/settings.hbs @@ -35,7 +35,7 @@ {{ssh-key key=model.customSshKey}} {{else}} {{ssh-key key=model.sshKey}} - {{add-ssh-key repo=repo}} + {{add-ssh-key repo=repo sshKeyAdded="sshKeyAdded"}} {{/if}} From 34510791b0dc561fe6bc1e9cba75fb120ccdb7e6 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Tue, 21 Jul 2015 14:32:33 +0200 Subject: [PATCH 32/53] Implement delete action for ssh-key --- app/components/ssh-key.coffee | 14 ++++++-------- app/controllers/settings.coffee | 4 ++++ app/templates/components/ssh-key.hbs | 16 ++++++++++------ app/templates/settings.hbs | 2 +- 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/app/components/ssh-key.coffee b/app/components/ssh-key.coffee index 88d62182..33475041 100644 --- a/app/components/ssh-key.coffee +++ b/app/components/ssh-key.coffee @@ -8,16 +8,14 @@ SshKeyComponent = Ember.Component.extend actions: delete: -> - console.log('isDeleting') + return if @get('isDeleting') + @set('isDeleting', true) - # return if @get('isDeleting') - # @set('isDeleting', true) + deletingDone = => @set('isDeleting', false) - # deletingDone = => @set('isDeleting', false) - - # @get('model').deleteRecord() - # @get('model').save().then(deletingDone, deletingDone).then => - # @set('model', null) + @get('key').deleteRecord() + @get('key').save().then(deletingDone, deletingDone).then => + @sendAction('sshKeyDeleted') `export default SshKeyComponent` diff --git a/app/controllers/settings.coffee b/app/controllers/settings.coffee index 0006d2bf..2b2ff314 100644 --- a/app/controllers/settings.coffee +++ b/app/controllers/settings.coffee @@ -6,4 +6,8 @@ SettingsController = Ember.Controller.extend actions: sshKeyAdded: (sshKey) -> @set('model.customSshKey', sshKey) + + sshKeyDeleted: -> + @set('model.customSshKey', null) + `export default SettingsController` diff --git a/app/templates/components/ssh-key.hbs b/app/templates/components/ssh-key.hbs index 7e11e550..91b8cadf 100644 --- a/app/templates/components/ssh-key.hbs +++ b/app/templates/components/ssh-key.hbs @@ -8,12 +8,16 @@ {{key.fingerprint}}
    -
    - - - -
    Delete
    -
    + {{#if isDeleting}} + {{loading-indicator}} + {{else}} +
    + + + +
    Delete
    +
    + {{/if}}
    {{else}}
    diff --git a/app/templates/settings.hbs b/app/templates/settings.hbs index 90ef2770..d455bac8 100644 --- a/app/templates/settings.hbs +++ b/app/templates/settings.hbs @@ -32,7 +32,7 @@

    SSH Key

    {{#if model.customSshKey}} - {{ssh-key key=model.customSshKey}} + {{ssh-key key=model.customSshKey sshKeyDeleted="sshKeyDeleted"}} {{else}} {{ssh-key key=model.sshKey}} {{add-ssh-key repo=repo sshKeyAdded="sshKeyAdded"}} From b4f9cd95e828cddf854b043a23f626c762af87b3 Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Tue, 21 Jul 2015 15:35:10 +0200 Subject: [PATCH 33/53] add tests for ssh-key components --- app/templates/components/add-ssh-key.hbs | 2 +- .../components/add-ssh-key-test.js | 73 +++++++++++++++++++ tests/integration/components/ssh-key-test.js | 62 ++++++++++++++++ 3 files changed, 136 insertions(+), 1 deletion(-) create mode 100644 tests/integration/components/add-ssh-key-test.js create mode 100644 tests/integration/components/ssh-key-test.js diff --git a/app/templates/components/add-ssh-key.hbs b/app/templates/components/add-ssh-key.hbs index 900f7d4b..d0b25b61 100644 --- a/app/templates/components/add-ssh-key.hbs +++ b/app/templates/components/add-ssh-key.hbs @@ -5,7 +5,7 @@
    {{textarea value=value class="ssh-value" rows="10" placeholder="SSH Key"}} {{#if valueError}} -

    {{valueError}}

    +

    {{valueError}}

    {{/if}}
    diff --git a/tests/integration/components/add-ssh-key-test.js b/tests/integration/components/add-ssh-key-test.js new file mode 100644 index 00000000..8e47afe3 --- /dev/null +++ b/tests/integration/components/add-ssh-key-test.js @@ -0,0 +1,73 @@ +import Ember from 'ember'; +import { moduleForComponent, test } from 'ember-qunit'; +import hbs from 'htmlbars-inline-precompile'; +import fillIn from '../../helpers/fill-in'; + + +moduleForComponent('add-ssh-key', 'Integration | Component | add ssh-key', { + integration: true +}); + +test('it adds an ssh key on submit', function(assert) { + assert.expect(6); + + var store = this.container.lookup('store:main'); + + var repo; + Ember.run(function() { + repo = store.push('repo', {id: 1, slug: 'travis-ci/travis-web'}); + }); + + this.set('repo', repo); + + this.render(hbs`{{add-ssh-key repo=repo sshKeyAdded="sshKeyAdded"}}`); + + var sshKey = store.all('sshKey').objectAt(0); + + assert.ok(! sshKey.get('description'), 'description should be blank'); + assert.ok(! sshKey.get('value'), 'value should be blank'); + assert.equal(sshKey.get('id'), 1, 'ssh key id is set to repo id'); + + fillIn(this.$('.ssh-description'), 'FOO'); + fillIn(this.$('.ssh-value'), 'bar'); + + this.$('.form-submit').click(); + + assert.equal(sshKey.get('description'), 'FOO', 'description should be set'); + assert.equal(sshKey.get('value'), 'bar', 'value should be set'); + assert.equal(sshKey.get('id'), 1, 'ssh key id should still be repo id'); + +}); + + +test('it throws an error if value for ssh key is blank', function(assert) { + assert.expect(5); + + var store = this.container.lookup('store:main'); + + var repo; + Ember.run(function() { + repo = store.push('repo', {id: 1, slug: 'travis-ci/travis-web'}); + }); + + this.set('repo', repo); + + this.render(hbs`{{add-ssh-key repo=repo sshKeyAdded="sshKeyAdded"}}`); + + var sshKey = store.all('sshKey').objectAt(0); + + assert.ok(! sshKey.get('description'), 'description should be blank'); + assert.ok(! sshKey.get('value'), 'value should be blank'); + assert.equal(sshKey.get('id'), 1, 'ssh key id is set to repo id'); + + fillIn(this.$('.ssh-description'), 'FOO'); + fillIn(this.$('.ssh-value'), ''); + + this.$('.form-submit').click(); + + assert.ok(this.$('.form-error-message').length, 'there is an error message if value is blank'); + + fillIn(this.$('.ssh-value'), 'bar'); + assert.ok(!this.$('.form-error-message').length, 'error message is removed if value is filled in'); + +}); diff --git a/tests/integration/components/ssh-key-test.js b/tests/integration/components/ssh-key-test.js new file mode 100644 index 00000000..9cb898d9 --- /dev/null +++ b/tests/integration/components/ssh-key-test.js @@ -0,0 +1,62 @@ +import Ember from 'ember'; +import { moduleForComponent, test } from 'ember-qunit'; +import hbs from 'htmlbars-inline-precompile'; +import fillIn from '../../helpers/fill-in'; + + +moduleForComponent('ssh-key', 'Integration | Component | ssh-key', { + integration: true +}); + +test('it renders the default ssh key if no custom key is set', function(assert) { + assert.expect(2); + + var store = this.container.lookup('store:main'); + + var key = Ember.Object.create({fingerprint: 'fingerprint'}); + this.set('key', key); + this.render(hbs`{{ssh-key key=key sshKeyDeleted="sshKeyDeleted"}}`); + + assert.equal(this.$('.ssh-key-name').text().trim(), 'no custom key set', 'should display that no custom key is set'); + assert.equal(this.$('.ssh-key-value').text().trim(), 'fingerprint', 'should display default key fingerprint'); + +}); + +test('it renders the custom ssh key if custom key is set', function(assert) { + assert.expect(2); + + 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"}}`); + + assert.equal(this.$('.ssh-key-name').text().trim(), 'fookey', 'should display key description'); + assert.equal(this.$('.ssh-key-value').text().trim(), 'somethingthing', 'should display custom key fingerprint'); + +}); + + +test('it deletes a custom key', 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"}}`); + this.on('sshKeyDeleted', function() {}) + + this.$('.ssh-key-action a').click(); + + assert.ok(key.get('isDeleted'), 'key should be deleted') + +}); From c74cf7932a41a06a4d02ac6365b08ab9cc2ef237 Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Tue, 21 Jul 2015 15:44:17 +0200 Subject: [PATCH 34/53] add proper error styles to ssh-key form --- app/components/add-ssh-key.coffee | 1 + app/styles/app/modules/forms.sass | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/components/add-ssh-key.coffee b/app/components/add-ssh-key.coffee index 07e4e74e..a98e82c1 100644 --- a/app/components/add-ssh-key.coffee +++ b/app/components/add-ssh-key.coffee @@ -3,6 +3,7 @@ AddSshKeyComponent = Ember.Component.extend classNames: ['form--sshkey'] + classNameBindings: ['valueError:form-error'] store: Ember.inject.service() isSaving: false diff --git a/app/styles/app/modules/forms.sass b/app/styles/app/modules/forms.sass index c3adb1be..82f8976d 100644 --- a/app/styles/app/modules/forms.sass +++ b/app/styles/app/modules/forms.sass @@ -69,7 +69,8 @@ textarea .form-error - .env-name + .env-name, + .ssh-value border: $fail-color 2px solid .form-error-message color: $fail-color From dd4580f151885ec0b48a3c7fceb908be15c759b5 Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Tue, 21 Jul 2015 16:12:24 +0200 Subject: [PATCH 35/53] change ssh-key error-message wording --- app/components/add-ssh-key.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/components/add-ssh-key.coffee b/app/components/add-ssh-key.coffee index a98e82c1..38bada68 100644 --- a/app/components/add-ssh-key.coffee +++ b/app/components/add-ssh-key.coffee @@ -42,7 +42,7 @@ AddSshKeyComponent = Ember.Component.extend if error.code == 'not_a_private_key' this.set('valueError', 'This key is not a private key.') else if error.code == 'key_with_a_passphrase' - this.set('valueError', 'We can\'t use key with a passphrase.') + this.set('valueError', 'The key can\'t have a passphrase.') actions: From e7aa74872dd4543bc3cb2e8acd991e18f844f494 Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Tue, 21 Jul 2015 17:24:18 +0200 Subject: [PATCH 36/53] add general settings functionality --- app/components/settings-switch.coffee | 27 ++++++++------------ app/routes/settings.coffee | 1 + app/styles/app/modules/tooltips.sass | 8 +++--- app/templates/components/settings-switch.hbs | 5 +++- app/templates/settings.hbs | 6 ++--- tests/integration/components/ssh-key-test.js | 4 +-- 6 files changed, 25 insertions(+), 26 deletions(-) diff --git a/app/components/settings-switch.coffee b/app/components/settings-switch.coffee index 4f21d6ab..53677cce 100644 --- a/app/components/settings-switch.coffee +++ b/app/components/settings-switch.coffee @@ -4,23 +4,18 @@ SettingsSwitchComponent = Ember.Component.extend tagName: 'a' classNames: ['switch'] - classNameBindings: ['_active:active'] - - # TODO: how to handle overriding properties to - # avoid naming it _action? - _active: (-> - @get('target.active') || @get('active') - ).property('target.active', 'active') + classNameBindings: ['active'] click: -> - target = @get('target') - if @get('toggleAutomatically') != 'false' - if target - @set('target.active', !@get('target.active')) - else - @set('active', !@get('active')) - # allow for bindings to propagate - Ember.run.next this, -> - @sendAction('action', target) + return if @get('isSaving') + @set('isSaving', true) + @toggleProperty('active') + setting = {} + setting[@get('key')] = @get('active') + @get('repo').saveSettings(setting).then => + @set('isSaving', false) + , => + @set('isSaving', false) + Travis.flash(error: 'There was an error while saving settings. Please try again.') `export default SettingsSwitchComponent` diff --git a/app/routes/settings.coffee b/app/routes/settings.coffee index 6e95d53e..669bb17c 100644 --- a/app/routes/settings.coffee +++ b/app/routes/settings.coffee @@ -29,6 +29,7 @@ Route = TravisRoute.extend model: () -> return Ember.RSVP.hash({ + settings: @modelFor('repo').fetchSettings(), envVars: this.fetchEnvVars(), sshKey: this.fetchSshKey(), customSshKey: this.fetchCustomSshKey() diff --git a/app/styles/app/modules/tooltips.sass b/app/styles/app/modules/tooltips.sass index 957d462d..9f917e65 100644 --- a/app/styles/app/modules/tooltips.sass +++ b/app/styles/app/modules/tooltips.sass @@ -1,8 +1,8 @@ %tooltip - &:hover - .tooltip-bubble - transform: translateY(0) - opacity: 1 + &:hover .tooltip-bubble, + &:hover + .tooltip-bubble + transform: translateY(0) + opacity: 1 .tooltip-bubble position: absolute diff --git a/app/templates/components/settings-switch.hbs b/app/templates/components/settings-switch.hbs index 8ebee2b5..e6f90dd4 100644 --- a/app/templates/components/settings-switch.hbs +++ b/app/templates/components/settings-switch.hbs @@ -6,4 +6,7 @@ OFF
    -Some label text +{{description}} +{{#if isSaving}} + {{loading-indicator}} +{{/if}} \ No newline at end of file diff --git a/app/templates/settings.hbs b/app/templates/settings.hbs index d455bac8..af325a1e 100644 --- a/app/templates/settings.hbs +++ b/app/templates/settings.hbs @@ -4,12 +4,12 @@

    General Settings

      -
    • {{settings-switch}}
    • +
    • {{settings-switch active=model.settings.builds_only_with_travis_yml repo=repo description="Build only if .travis.yml is present" key="builds_only_with_travis_yml"}}
    • Concurrent jobs
    • -
    • {{settings-switch}}
    • -
    • {{settings-switch}}
    • +
    • {{settings-switch active=model.settings.build_pushes repo=repo description="Build pushes" key="build_pushes"}}
    • +
    • {{settings-switch active=model.settings.build_pull_requests repo=repo description="Build pull requests" key="build_pull_requests"}}
    diff --git a/tests/integration/components/ssh-key-test.js b/tests/integration/components/ssh-key-test.js index 9cb898d9..0844f31b 100644 --- a/tests/integration/components/ssh-key-test.js +++ b/tests/integration/components/ssh-key-test.js @@ -53,10 +53,10 @@ test('it deletes a custom key', function(assert) { this.set('key', key); this.render(hbs`{{ssh-key key=key sshKeyDeleted="sshKeyDeleted"}}`); - this.on('sshKeyDeleted', function() {}) + this.on('sshKeyDeleted', function() {}); this.$('.ssh-key-action a').click(); - assert.ok(key.get('isDeleted'), 'key should be deleted') + assert.ok(key.get('isDeleted'), 'key should be deleted'); }); From 271724f99491672aca0bf0f47d938ec8b3996569 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Tue, 21 Jul 2015 18:01:46 +0200 Subject: [PATCH 37/53] Implement concurrent builds limit in settings --- app/controllers/settings.coffee | 29 ++++++++++++++++++++++ app/routes/settings.coffee | 2 ++ app/templates/components/add-env-var.hbs | 2 +- app/templates/components/travis-switch.hbs | 2 +- app/templates/settings.hbs | 11 +++++--- 5 files changed, 41 insertions(+), 5 deletions(-) diff --git a/app/controllers/settings.coffee b/app/controllers/settings.coffee index 2b2ff314..1f504f8d 100644 --- a/app/controllers/settings.coffee +++ b/app/controllers/settings.coffee @@ -1,6 +1,13 @@ `import Ember from 'ember'` SettingsController = Ember.Controller.extend + concurrentBuildsLimitDescription: (-> + description = "Limit concurrent jobs" + if @get('concurrentBuildsLimit') + description += ": " + description + ).property('concurrentBuildsLimit') + envVars: Ember.computed.filterBy('model.envVars', 'isNew', false) actions: @@ -10,4 +17,26 @@ SettingsController = Ember.Controller.extend sshKeyDeleted: -> @set('model.customSshKey', null) + concurrentBuildsLimitChanged: -> + unless @get('concurrentBuildsLimit') + return if @get('isSaving') + @set('isSaving', true) + + savingFinished = => + @set('isSaving', false) + + @get('repo').saveSettings(maximum_number_of_builds: 0).then(savingFinished, savingFinished) + @set('model.settings.maximum_number_of_builds', 0) + + concurrentBuildsLimitValueChanged: -> + repo = @get('repo') + concurrentBuildsLimit = parseInt(@get('model.settings.maximum_number_of_builds')) + if concurrentBuildsLimit + @set('isSaving', true) + savingFinished = => + @set('isSaving', false) + + repo.saveSettings(maximum_number_of_builds: concurrentBuildsLimit). + then(savingFinished, savingFinished) + `export default SettingsController` diff --git a/app/routes/settings.coffee b/app/routes/settings.coffee index 669bb17c..3a2888a9 100644 --- a/app/routes/settings.coffee +++ b/app/routes/settings.coffee @@ -8,6 +8,8 @@ Route = TravisRoute.extend controller.set('repo', @modelFor('repo')) @controllerFor('repo').activate('settings') + controller.set('concurrentBuildsLimit', !!model.settings.maximum_number_of_builds) + fetchEnvVars: () -> repo = @modelFor('repo') repo.get('envVars.promise') diff --git a/app/templates/components/add-env-var.hbs b/app/templates/components/add-env-var.hbs index 9bae2cc6..d891308f 100644 --- a/app/templates/components/add-env-var.hbs +++ b/app/templates/components/add-env-var.hbs @@ -9,7 +9,7 @@ {{input value=value class="env-value" placeholder="Value"}}
    - {{travis-switch active=public}} + {{travis-switch active=public description="Display value in build log"}}
    {{#if isSaving}} diff --git a/app/templates/components/travis-switch.hbs b/app/templates/components/travis-switch.hbs index a33d23b7..053ef31c 100644 --- a/app/templates/components/travis-switch.hbs +++ b/app/templates/components/travis-switch.hbs @@ -6,4 +6,4 @@ OFF
    -Display value in build log +{{description}} diff --git a/app/templates/settings.hbs b/app/templates/settings.hbs index af325a1e..f7d6c795 100644 --- a/app/templates/settings.hbs +++ b/app/templates/settings.hbs @@ -1,12 +1,17 @@
    - +

    General Settings

    • {{settings-switch active=model.settings.builds_only_with_travis_yml repo=repo description="Build only if .travis.yml is present" key="builds_only_with_travis_yml"}}
    • -
    • -
      Concurrent jobs +
    • {{travis-switch active=concurrentBuildsLimit description=concurrentBuildsLimitDescription action="concurrentBuildsLimitChanged"}} + {{#if concurrentBuildsLimit}} + {{input pattern="/^[0-9]+$/" value=model.settings.maximum_number_of_builds on="key-up" action="concurrentBuildsLimitValueChanged"}} + {{/if}} + {{#if isSaving}} + {{loading-indicator}} + {{/if}}
    • {{settings-switch active=model.settings.build_pushes repo=repo description="Build pushes" key="build_pushes"}}
    • {{settings-switch active=model.settings.build_pull_requests repo=repo description="Build pull requests" key="build_pull_requests"}}
    • From 7652f9b5b0d02dca8a8f59a6f47ad790013cef7d Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Tue, 21 Jul 2015 18:51:30 +0200 Subject: [PATCH 38/53] some styles for switches --- app/components/loading-indicator.coffee | 2 +- app/controllers/settings.coffee | 2 +- app/styles/app.scss | 2 +- app/styles/app/components/loading-indicator.sass | 3 +++ app/styles/app/layouts/settings.sass | 10 ++++++++++ app/templates/settings.hbs | 5 +++-- 6 files changed, 19 insertions(+), 5 deletions(-) diff --git a/app/components/loading-indicator.coffee b/app/components/loading-indicator.coffee index b53ac20a..a5ebb185 100644 --- a/app/components/loading-indicator.coffee +++ b/app/components/loading-indicator.coffee @@ -2,7 +2,7 @@ LoadingIndicatorComponent = Ember.Component.extend tagName: 'div' - classNameBindings: ['center:loading-container'] + classNameBindings: ['center:loading-container', 'inline:inline'] center: false `export default LoadingIndicatorComponent` diff --git a/app/controllers/settings.coffee b/app/controllers/settings.coffee index 1f504f8d..4ff4d46f 100644 --- a/app/controllers/settings.coffee +++ b/app/controllers/settings.coffee @@ -4,7 +4,7 @@ SettingsController = Ember.Controller.extend concurrentBuildsLimitDescription: (-> description = "Limit concurrent jobs" if @get('concurrentBuildsLimit') - description += ": " + description += " " description ).property('concurrentBuildsLimit') diff --git a/app/styles/app.scss b/app/styles/app.scss index 705d8bf2..21280bee 100644 --- a/app/styles/app.scss +++ b/app/styles/app.scss @@ -61,6 +61,6 @@ @import "app/layouts/caches"; @import "app/layouts/getting-started"; @import "app/layouts/first-sync"; -@import "app/layouts/settings"; @import "app/layouts/missing-notice"; +@import "app/layouts/settings"; diff --git a/app/styles/app/components/loading-indicator.sass b/app/styles/app/components/loading-indicator.sass index 165035ba..57660068 100644 --- a/app/styles/app/components/loading-indicator.sass +++ b/app/styles/app/components/loading-indicator.sass @@ -16,6 +16,9 @@ &:nth-child(3) animation-delay: 0.6s +.inline + display: inline-block + @keyframes bouncedelay 0%, 80%, 100% transform: scale(0) diff --git a/app/styles/app/layouts/settings.sass b/app/styles/app/layouts/settings.sass index 76d56e08..13aa6dea 100644 --- a/app/styles/app/layouts/settings.sass +++ b/app/styles/app/layouts/settings.sass @@ -16,6 +16,10 @@ .small-title margin-top: 0 + .switch + div + display: inline-block + %settings-list padding: 0 margin: 0 @@ -44,6 +48,12 @@ font-size: $font-size-s text-align: center +input.settings-concurrent + display: inline-block + width: 3em + margin: 0 .5em + text-align: center + %settings-row padding: .6em .5em border-radius: 4px diff --git a/app/templates/settings.hbs b/app/templates/settings.hbs index f7d6c795..dedd4b63 100644 --- a/app/templates/settings.hbs +++ b/app/templates/settings.hbs @@ -6,11 +6,12 @@
      • {{settings-switch active=model.settings.builds_only_with_travis_yml repo=repo description="Build only if .travis.yml is present" key="builds_only_with_travis_yml"}}
      • {{travis-switch active=concurrentBuildsLimit description=concurrentBuildsLimitDescription action="concurrentBuildsLimitChanged"}} + {{#if concurrentBuildsLimit}} - {{input pattern="/^[0-9]+$/" value=model.settings.maximum_number_of_builds on="key-up" action="concurrentBuildsLimitValueChanged"}} + {{input pattern="/^[0-9]+$/" value=model.settings.maximum_number_of_builds on="key-up" action="concurrentBuildsLimitValueChanged" class="settings-concurrent"}} {{/if}} {{#if isSaving}} - {{loading-indicator}} + {{loading-indicator inline=true}} {{/if}}
      • {{settings-switch active=model.settings.build_pushes repo=repo description="Build pushes" key="build_pushes"}}
      • From 7817cd47e4094d87ee91db2f95415d21d58f2aea Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Wed, 22 Jul 2015 10:48:50 +0200 Subject: [PATCH 39/53] add bg-color to default btn styles --- app/styles/app/modules/buttons.sass | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/styles/app/modules/buttons.sass b/app/styles/app/modules/buttons.sass index 7ea35a31..d081c2a9 100644 --- a/app/styles/app/modules/buttons.sass +++ b/app/styles/app/modules/buttons.sass @@ -18,15 +18,14 @@ $button-border-color: #d4d4d4 color: $white white-space: nowrap border-radius: 2px - + background-color: $grey-lighter .button:hover, .button:focus, .button:active, .button.active border-color: $button-border-color - border-bottom-color: #2a65a0 - background-color: #40454f + background-color: $grey-medium text-decoration: none color: #fff From 868995bf097ed8aaa4709fdb6ee13d8ee2a67829 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Wed, 22 Jul 2015 10:55:18 +0200 Subject: [PATCH 40/53] Move concurrent build limit flow into a component --- app/components/limit-concurrent-builds.coffee | 37 +++++++++++++++++++ app/controllers/settings.coffee | 29 --------------- .../components/limit-concurrent-builds.hbs | 7 ++++ app/templates/settings.hbs | 10 +---- 4 files changed, 45 insertions(+), 38 deletions(-) create mode 100644 app/components/limit-concurrent-builds.coffee create mode 100644 app/templates/components/limit-concurrent-builds.hbs diff --git a/app/components/limit-concurrent-builds.coffee b/app/components/limit-concurrent-builds.coffee new file mode 100644 index 00000000..07fcdea8 --- /dev/null +++ b/app/components/limit-concurrent-builds.coffee @@ -0,0 +1,37 @@ +`import Ember from 'ember'` + +LimitConcurrentBuildsComponent = Ember.Component.extend + description: (-> + description = "Limit concurrent jobs" + if @get('enabled') + description += " " + description + ).property('enabled') + + + actions: + toggle: -> + unless @get('enabled') + return if @get('value') == 0 + return if @get('isSaving') + @set('isSaving', true) + + savingFinished = => + @set('isSaving', false) + + @get('repo').saveSettings(maximum_number_of_builds: 0).then(savingFinished, savingFinished) + @set('value', 0) + + limitChanged: -> + repo = @get('repo') + limit = parseInt(@get('value')) + if limit + @set('isSaving', true) + savingFinished = => + @set('isSaving', false) + + repo.saveSettings(maximum_number_of_builds: limit). + then(savingFinished, savingFinished) + + +`export default LimitConcurrentBuildsComponent` diff --git a/app/controllers/settings.coffee b/app/controllers/settings.coffee index 4ff4d46f..2b2ff314 100644 --- a/app/controllers/settings.coffee +++ b/app/controllers/settings.coffee @@ -1,13 +1,6 @@ `import Ember from 'ember'` SettingsController = Ember.Controller.extend - concurrentBuildsLimitDescription: (-> - description = "Limit concurrent jobs" - if @get('concurrentBuildsLimit') - description += " " - description - ).property('concurrentBuildsLimit') - envVars: Ember.computed.filterBy('model.envVars', 'isNew', false) actions: @@ -17,26 +10,4 @@ SettingsController = Ember.Controller.extend sshKeyDeleted: -> @set('model.customSshKey', null) - concurrentBuildsLimitChanged: -> - unless @get('concurrentBuildsLimit') - return if @get('isSaving') - @set('isSaving', true) - - savingFinished = => - @set('isSaving', false) - - @get('repo').saveSettings(maximum_number_of_builds: 0).then(savingFinished, savingFinished) - @set('model.settings.maximum_number_of_builds', 0) - - concurrentBuildsLimitValueChanged: -> - repo = @get('repo') - concurrentBuildsLimit = parseInt(@get('model.settings.maximum_number_of_builds')) - if concurrentBuildsLimit - @set('isSaving', true) - savingFinished = => - @set('isSaving', false) - - repo.saveSettings(maximum_number_of_builds: concurrentBuildsLimit). - then(savingFinished, savingFinished) - `export default SettingsController` diff --git a/app/templates/components/limit-concurrent-builds.hbs b/app/templates/components/limit-concurrent-builds.hbs new file mode 100644 index 00000000..0d4f449e --- /dev/null +++ b/app/templates/components/limit-concurrent-builds.hbs @@ -0,0 +1,7 @@ +{{travis-switch active=enabled description=description action="toggle"}} +{{#if enabled}} + {{input pattern="/^[0-9]+$/" value=value on="key-up" action="limitChanged"}} +{{/if}} +{{#if isSaving}} + {{loading-indicator}} +{{/if}} diff --git a/app/templates/settings.hbs b/app/templates/settings.hbs index dedd4b63..f7b5373a 100644 --- a/app/templates/settings.hbs +++ b/app/templates/settings.hbs @@ -5,15 +5,7 @@
        • {{settings-switch active=model.settings.builds_only_with_travis_yml repo=repo description="Build only if .travis.yml is present" key="builds_only_with_travis_yml"}}
        • -
        • {{travis-switch active=concurrentBuildsLimit description=concurrentBuildsLimitDescription action="concurrentBuildsLimitChanged"}} - - {{#if concurrentBuildsLimit}} - {{input pattern="/^[0-9]+$/" value=model.settings.maximum_number_of_builds on="key-up" action="concurrentBuildsLimitValueChanged" class="settings-concurrent"}} - {{/if}} - {{#if isSaving}} - {{loading-indicator inline=true}} - {{/if}} -
        • +
        • {{limit-concurrent-builds value=model.settings.maximum_number_of_builds enabled=concurrentBuildsLimit repo=repo}}
        • {{settings-switch active=model.settings.build_pushes repo=repo description="Build pushes" key="build_pushes"}}
        • {{settings-switch active=model.settings.build_pull_requests repo=repo description="Build pull requests" key="build_pull_requests"}}
        From 0efcaabc62f4c2c648dfc26195b1babe7106dbdb Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Wed, 22 Jul 2015 11:30:32 +0200 Subject: [PATCH 41/53] push some pixels on settings --- app/components/limit-concurrent-builds.coffee | 3 +++ app/components/loading-indicator.coffee | 2 +- app/styles/app/components/loading-indicator.sass | 5 ++--- app/styles/app/layouts/settings.sass | 14 +++++++++----- .../components/limit-concurrent-builds.hbs | 2 +- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/app/components/limit-concurrent-builds.coffee b/app/components/limit-concurrent-builds.coffee index 07fcdea8..e4eff2d8 100644 --- a/app/components/limit-concurrent-builds.coffee +++ b/app/components/limit-concurrent-builds.coffee @@ -1,6 +1,9 @@ `import Ember from 'ember'` LimitConcurrentBuildsComponent = Ember.Component.extend + + classNames: ['limit-concurrent-builds'] + description: (-> description = "Limit concurrent jobs" if @get('enabled') diff --git a/app/components/loading-indicator.coffee b/app/components/loading-indicator.coffee index a5ebb185..a076ae52 100644 --- a/app/components/loading-indicator.coffee +++ b/app/components/loading-indicator.coffee @@ -2,7 +2,7 @@ LoadingIndicatorComponent = Ember.Component.extend tagName: 'div' - classNameBindings: ['center:loading-container', 'inline:inline'] + classNameBindings: ['center:loading-container', 'inline:inline-block'] center: false `export default LoadingIndicatorComponent` diff --git a/app/styles/app/components/loading-indicator.sass b/app/styles/app/components/loading-indicator.sass index 57660068..80729325 100644 --- a/app/styles/app/components/loading-indicator.sass +++ b/app/styles/app/components/loading-indicator.sass @@ -16,9 +16,6 @@ &:nth-child(3) animation-delay: 0.6s -.inline - display: inline-block - @keyframes bouncedelay 0%, 80%, 100% transform: scale(0) @@ -29,6 +26,8 @@ text-align: center padding: 1.5em 1em +.inline-block + display: inline-block .loading-indicator--white @extend .loading-indicator diff --git a/app/styles/app/layouts/settings.sass b/app/styles/app/layouts/settings.sass index 13aa6dea..b03a6017 100644 --- a/app/styles/app/layouts/settings.sass +++ b/app/styles/app/layouts/settings.sass @@ -48,16 +48,20 @@ font-size: $font-size-s text-align: center -input.settings-concurrent - display: inline-block - width: 3em - margin: 0 .5em - text-align: center +.limit-concurrent-builds + input + display: inline-block + width: 3em + height: 30px + margin: 0 .5em + text-align: center %settings-row padding: .6em .5em border-radius: 4px background-color: #F6F5F5 + @media #{$medium-up} + height: 47px .settings-envvar @extend %settings-row diff --git a/app/templates/components/limit-concurrent-builds.hbs b/app/templates/components/limit-concurrent-builds.hbs index 0d4f449e..21f60ea5 100644 --- a/app/templates/components/limit-concurrent-builds.hbs +++ b/app/templates/components/limit-concurrent-builds.hbs @@ -3,5 +3,5 @@ {{input pattern="/^[0-9]+$/" value=value on="key-up" action="limitChanged"}} {{/if}} {{#if isSaving}} - {{loading-indicator}} +{{loading-indicator inline=true}} {{/if}} From bed880019ffddba15eb85aa5f2663d5ab6429e78 Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Wed, 22 Jul 2015 12:51:03 +0200 Subject: [PATCH 42/53] add help icon to concurrency build setting --- app/controllers/settings.coffee | 5 ++++ app/styles/app/layouts/build-job.sass | 2 +- app/styles/app/modules/tooltips.sass | 27 ++++++++++++++++--- .../components/limit-concurrent-builds.hbs | 6 +++++ app/templates/settings.hbs | 2 +- 5 files changed, 36 insertions(+), 6 deletions(-) diff --git a/app/controllers/settings.coffee b/app/controllers/settings.coffee index 2b2ff314..c96cc4cc 100644 --- a/app/controllers/settings.coffee +++ b/app/controllers/settings.coffee @@ -10,4 +10,9 @@ SettingsController = Ember.Controller.extend sshKeyDeleted: -> @set('model.customSshKey', null) + deactivate: -> + console.log('deactivate') + debugger + + `export default SettingsController` diff --git a/app/styles/app/layouts/build-job.sass b/app/styles/app/layouts/build-job.sass index 3926191f..3e8c6886 100644 --- a/app/styles/app/layouts/build-job.sass +++ b/app/styles/app/layouts/build-job.sass @@ -68,7 +68,7 @@ overflow: hidden .job-id width: grid-calc(3, 24) - border-right: solid 1px $grey-lighter + border-right: solid 1px $cream-dark .job-os width: grid-calc(1, 24) text-align: center diff --git a/app/styles/app/modules/tooltips.sass b/app/styles/app/modules/tooltips.sass index 9f917e65..b56331c9 100644 --- a/app/styles/app/modules/tooltips.sass +++ b/app/styles/app/modules/tooltips.sass @@ -1,6 +1,5 @@ %tooltip - &:hover .tooltip-bubble, - &:hover + .tooltip-bubble + &:hover .tooltip-bubble transform: translateY(0) opacity: 1 @@ -8,7 +7,6 @@ position: absolute top: -3.2em width: auto - max-width: 8.6em height: 1.9em margin: auto padding: .2em .4em .3em @@ -23,6 +21,11 @@ transform: translateY(20%) opacity: 0 + a + color: $white + &:hover + text-decoration: underline + &:before content: "" position: absolute @@ -38,6 +41,7 @@ .tooltip-bubble right: 0 left: 0 + max-width: 8.6em &:before left: 46% @media #{$medium-up} @@ -50,6 +54,7 @@ left: 0 top: -4em height: 3.2em + max-width: 8.6em &:before left: 46% @media #{$medium-up} @@ -61,7 +66,21 @@ position: relative .tooltip-bubble top: -4.5em - left: -2em + left: -1.9em height: 3.7em &:before left: 15% + +.tooltip--settings + @extend %tooltip + display: inline-block + position: relative + .icon + width: 1.2em + height: 1.2em + vertical-align: middle + .tooltip-bubble + top: -2.6em + left: -1.9em + &:before + left: 2em diff --git a/app/templates/components/limit-concurrent-builds.hbs b/app/templates/components/limit-concurrent-builds.hbs index 21f60ea5..3132554f 100644 --- a/app/templates/components/limit-concurrent-builds.hbs +++ b/app/templates/components/limit-concurrent-builds.hbs @@ -1,4 +1,10 @@ {{travis-switch active=enabled description=description action="toggle"}} + {{#if enabled}} {{input pattern="/^[0-9]+$/" value=value on="key-up" action="limitChanged"}} {{/if}} diff --git a/app/templates/settings.hbs b/app/templates/settings.hbs index f7b5373a..de7299f0 100644 --- a/app/templates/settings.hbs +++ b/app/templates/settings.hbs @@ -41,7 +41,7 @@

        Deactivate Repository

        If you'd no longer like to run this project on Travis CI you can deactivate it now.
        You will be able to reactivate it in the future if you'd like to.

        - Deactivate Repository + Deactivate Repository
    From 4ba671542a3843c04698a8716cab671603c13fb4 Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Wed, 22 Jul 2015 13:08:37 +0200 Subject: [PATCH 43/53] nudge some tooltip pixels --- app/styles/app/modules/tooltips.sass | 7 ++++--- app/templates/components/limit-concurrent-builds.hbs | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/styles/app/modules/tooltips.sass b/app/styles/app/modules/tooltips.sass index b56331c9..aec21d71 100644 --- a/app/styles/app/modules/tooltips.sass +++ b/app/styles/app/modules/tooltips.sass @@ -45,7 +45,7 @@ &:before left: 46% @media #{$medium-up} - left: 42% + left: 45% .tooltip--height @extend %tooltip @@ -56,7 +56,7 @@ height: 3.2em max-width: 8.6em &:before - left: 46% + left: 41% @media #{$medium-up} left: 44% @@ -80,7 +80,8 @@ height: 1.2em vertical-align: middle .tooltip-bubble - top: -2.6em + top: -4em left: -1.9em + height: 3.4em &:before left: 2em diff --git a/app/templates/components/limit-concurrent-builds.hbs b/app/templates/components/limit-concurrent-builds.hbs index 3132554f..b1781f3f 100644 --- a/app/templates/components/limit-concurrent-builds.hbs +++ b/app/templates/components/limit-concurrent-builds.hbs @@ -1,7 +1,7 @@ {{travis-switch active=enabled description=description action="toggle"}} From 8891b325b3e7321c77566b9c37af69bc96fcdc85 Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Wed, 22 Jul 2015 15:05:27 +0200 Subject: [PATCH 44/53] fetch repo hook, but hide deactivate section for now --- app/routes/settings.coffee | 16 +++++++++++++++- app/templates/settings.hbs | 4 ++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/app/routes/settings.coffee b/app/routes/settings.coffee index 3a2888a9..33d63f16 100644 --- a/app/routes/settings.coffee +++ b/app/routes/settings.coffee @@ -1,5 +1,6 @@ `import TravisRoute from 'travis/routes/basic'` `import Ajax from 'travis/utils/ajax'` +`import config from 'travis/config/environment'` Route = TravisRoute.extend needsAuth: true @@ -29,12 +30,25 @@ Route = TravisRoute.extend Ajax.get "/repos/#{repo.get('id')}/key", (data) => Ember.Object.create(fingerprint: data.fingerprint) + fetchRepositoryActiveFlag: -> + repoId = @modelFor('repo').get('id') + apiEndpoint = config.apiEndpoint + + $.ajax("#{apiEndpoint}/v3/repo/#{repoId}", { + headers: { + Authorization: 'token ' + @auth.token() + } + }).then( (response) -> + response.active + ); + model: () -> return Ember.RSVP.hash({ settings: @modelFor('repo').fetchSettings(), envVars: this.fetchEnvVars(), sshKey: this.fetchSshKey(), - customSshKey: this.fetchCustomSshKey() + customSshKey: this.fetchCustomSshKey(), + repositoryActive: this.fetchRepositoryActiveFlag() }); `export default Route` diff --git a/app/templates/settings.hbs b/app/templates/settings.hbs index de7299f0..bfb23762 100644 --- a/app/templates/settings.hbs +++ b/app/templates/settings.hbs @@ -38,10 +38,10 @@ {{/if}} -
    + {{!--

    Deactivate Repository

    If you'd no longer like to run this project on Travis CI you can deactivate it now.
    You will be able to reactivate it in the future if you'd like to.

    Deactivate Repository -
    +
    --}}
    From 183b4bf966ec81692548752e85dd9434d7302561 Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Wed, 22 Jul 2015 15:32:03 +0200 Subject: [PATCH 45/53] remove weird bpoxshadow in Firefox --- app/styles/app/layouts/settings.sass | 1 + 1 file changed, 1 insertion(+) diff --git a/app/styles/app/layouts/settings.sass b/app/styles/app/layouts/settings.sass index b03a6017..9f8e8931 100644 --- a/app/styles/app/layouts/settings.sass +++ b/app/styles/app/layouts/settings.sass @@ -55,6 +55,7 @@ height: 30px margin: 0 .5em text-align: center + box-shadow: none %settings-row padding: .6em .5em From 4ca636caf16ff7410b1116de60ea50df00807752 Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Wed, 22 Jul 2015 17:15:05 +0200 Subject: [PATCH 46/53] decrease font-size on tooltips, rearrange settings switches, more spacing between settings sections --- app/styles/app/layouts/settings.sass | 2 +- app/styles/app/modules/tooltips.sass | 12 ++++++------ app/templates/settings.hbs | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/styles/app/layouts/settings.sass b/app/styles/app/layouts/settings.sass index 9f8e8931..82df0ada 100644 --- a/app/styles/app/layouts/settings.sass +++ b/app/styles/app/layouts/settings.sass @@ -9,7 +9,7 @@ .settings-section padding: 0 0 1em - margin-bottom: 1.5em + margin-bottom: 3em border-bottom: 2px solid #f2f3ef &:last-of-type border-bottom: none diff --git a/app/styles/app/modules/tooltips.sass b/app/styles/app/modules/tooltips.sass index aec21d71..382ea53d 100644 --- a/app/styles/app/modules/tooltips.sass +++ b/app/styles/app/modules/tooltips.sass @@ -5,15 +5,17 @@ .tooltip-bubble position: absolute - top: -3.2em + top: -2.8em width: auto height: 1.9em margin: auto - padding: .2em .4em .3em + padding: .3em .4em .3em z-index: 5 background-color: #818383 border-radius: 4px color: $white + font-size: $font-size-sm + line-height: 1.5 text-align: center white-space: nowrap @@ -41,11 +43,9 @@ .tooltip-bubble right: 0 left: 0 - max-width: 8.6em + max-width: 5em &:before - left: 46% - @media #{$medium-up} - left: 45% + left: 40% .tooltip--height @extend %tooltip diff --git a/app/templates/settings.hbs b/app/templates/settings.hbs index bfb23762..0fdaecb0 100644 --- a/app/templates/settings.hbs +++ b/app/templates/settings.hbs @@ -5,8 +5,8 @@
    • {{settings-switch active=model.settings.builds_only_with_travis_yml repo=repo description="Build only if .travis.yml is present" key="builds_only_with_travis_yml"}}
    • -
    • {{limit-concurrent-builds value=model.settings.maximum_number_of_builds enabled=concurrentBuildsLimit repo=repo}}
    • {{settings-switch active=model.settings.build_pushes repo=repo description="Build pushes" key="build_pushes"}}
    • +
    • {{limit-concurrent-builds value=model.settings.maximum_number_of_builds enabled=concurrentBuildsLimit repo=repo}}
    • {{settings-switch active=model.settings.build_pull_requests repo=repo description="Build pull requests" key="build_pull_requests"}}
    From d2abeb6841e4c2e52c81559654ea64c6e267944d Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Wed, 22 Jul 2015 17:23:47 +0200 Subject: [PATCH 47/53] even less tooltip line height --- app/styles/app/modules/tooltips.sass | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/styles/app/modules/tooltips.sass b/app/styles/app/modules/tooltips.sass index 382ea53d..ebe75b29 100644 --- a/app/styles/app/modules/tooltips.sass +++ b/app/styles/app/modules/tooltips.sass @@ -15,7 +15,7 @@ border-radius: 4px color: $white font-size: $font-size-sm - line-height: 1.5 + line-height: 1.3 text-align: center white-space: nowrap @@ -82,6 +82,6 @@ .tooltip-bubble top: -4em left: -1.9em - height: 3.4em + height: 3.2em &:before left: 2em From 6578e8b3ce1ee798cf6a863e6482f29f2a6fd3bc Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Thu, 23 Jul 2015 12:24:40 +0200 Subject: [PATCH 48/53] don't let fingerprints get cut off --- app/styles/app/layouts/settings.sass | 24 ++++++++++++++++-------- app/styles/app/modules/tooltips.sass | 4 +--- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/app/styles/app/layouts/settings.sass b/app/styles/app/layouts/settings.sass index 82df0ada..72bc903e 100644 --- a/app/styles/app/layouts/settings.sass +++ b/app/styles/app/layouts/settings.sass @@ -71,8 +71,11 @@ @extend %settings-row display: block margin-bottom: 1rem + overflow: hidden span vertical-align: middle + @media #{$medium-up} + overflow: visible %settings-name-section display: inline-block @@ -95,7 +98,7 @@ height: 1.3em @media #{$medium-up} - width: 40% + width: 32% margin-bottom: 0 .env-var-name @@ -110,14 +113,11 @@ %settings-value-section display: inline-block vertical-align: middle - white-space: nowrap overflow: hidden - width: 76% - @media #{$medium-up} - width: grid-calc(3, 12) .ssh-key-value @extend %settings-value-section + word-break: break-all .icon-fingerprint @extend %icon @extend .icon-fingerprint @@ -125,11 +125,16 @@ height: 1.3em margin-right: .5em @media #{$medium-up} - text-align: right + width: grid-calc(6, 12) + word-break: normal + white-space: nowrap .env-var-value @extend %settings-value-section - + white-space: nowrap + width: 76% + @media #{$medium-up} + width: grid-calc(3, 12) input display: inline-block width: 100% @@ -152,8 +157,8 @@ %settings-action-section display: inline-block position: relative - width: 24% float: right + width: 24% vertical-align: middle text-align: center .icon-delete @@ -177,6 +182,9 @@ .ssh-key-action @extend %settings-action-section + margin-top: 1em + @media #{$medium-up} + margin-top: 0 .icon-delete margin: .2em auto 0 .icon-delete-disabled diff --git a/app/styles/app/modules/tooltips.sass b/app/styles/app/modules/tooltips.sass index ebe75b29..4c6d783f 100644 --- a/app/styles/app/modules/tooltips.sass +++ b/app/styles/app/modules/tooltips.sass @@ -56,9 +56,7 @@ height: 3.2em max-width: 8.6em &:before - left: 41% - @media #{$medium-up} - left: 44% + left: 45% .tooltip--jobs @extend %tooltip From dac21f6164c53dd645e14c287705639890faf53a Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Thu, 23 Jul 2015 12:37:23 +0200 Subject: [PATCH 49/53] show legacy note first, then job not yet started notice --- app/templates/jobs/pre.hbs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/app/templates/jobs/pre.hbs b/app/templates/jobs/pre.hbs index eaccc851..5e2914ad 100644 --- a/app/templates/jobs/pre.hbs +++ b/app/templates/jobs/pre.hbs @@ -1,22 +1,22 @@ {{remove-log-popup job=view.job}}
    + + {{#if auth.signedIn}} + {{#if view.job.isLegacyInfrastructure}} + {{#if view.job.isFinished}} +

    + This job ran on our legacy infrastructure. Please read our docs on how to upgrade

    + {{else}} +

    + This job is running on our legacy infrastructure. Please read our docs on how to upgrade

    + {{/if}} + {{/if}} + {{/if}} + {{#if view.job.notStarted}}
    Hang tight, the log cannot be shown until the build has started.
    {{/if}} - -{{#if auth.signedIn}} - {{#if view.job.isLegacyInfrastructure}} - {{#if view.job.isFinished}} -

    - This job ran on our legacy infrastructure. Please read our docs on how to upgrade

    - {{else}} -

    - This job is running on our legacy infrastructure. Please read our docs on how to upgrade

    - {{/if}} - {{/if}} -{{/if}} -
    From 14ac3872c3f1a6bc60d66ea47e810b4b883a2d27 Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Thu, 23 Jul 2015 12:38:53 +0200 Subject: [PATCH 50/53] moving feedback button a bit more to the left --- app/styles/app/userlike.sass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/styles/app/userlike.sass b/app/styles/app/userlike.sass index e1f809bf..20622ffd 100644 --- a/app/styles/app/userlike.sass +++ b/app/styles/app/userlike.sass @@ -2,7 +2,7 @@ .feedback-button display: none position: fixed - right: 1% + right: 4% left: auto bottom: 0 margin: 0 From cf7849a446146530731e582ac03340461240cedd Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Thu, 23 Jul 2015 14:54:20 +0200 Subject: [PATCH 51/53] fix missing styles on hooks without admin rights --- app/templates/account.hbs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/templates/account.hbs b/app/templates/account.hbs index 3b813080..0d792399 100644 --- a/app/templates/account.hbs +++ b/app/templates/account.hbs @@ -94,7 +94,16 @@