Add regenerate key option in repo view
This commit is contained in:
parent
e9077f1a04
commit
c00aa911d7
|
@ -94,6 +94,9 @@ require 'travis/model'
|
||||||
updateTimes: ->
|
updateTimes: ->
|
||||||
@notifyPropertyChange 'lastBuildDuration'
|
@notifyPropertyChange 'lastBuildDuration'
|
||||||
|
|
||||||
|
regenerateKey: (options) ->
|
||||||
|
Travis.ajax.ajax '/repos/' + @get('id') + '/key', 'post', options
|
||||||
|
|
||||||
@Travis.Repo.reopenClass
|
@Travis.Repo.reopenClass
|
||||||
recent: ->
|
recent: ->
|
||||||
@find()
|
@find()
|
||||||
|
|
|
@ -14,6 +14,11 @@
|
||||||
<a href="#" {{action requeueJob target="view"}}>Rebuild</a>
|
<a href="#" {{action requeueJob target="view"}}>Rebuild</a>
|
||||||
</li>
|
</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{#if view.canRegenerateKey}}
|
||||||
|
<li>
|
||||||
|
<a href="#" name="regenerate-key" class="open-popup" {{action regenerateKeyPopup target="view"}}>Regenerate Key</a>
|
||||||
|
</li>
|
||||||
|
{{/if}}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -44,3 +49,31 @@
|
||||||
<input type="text" class="rdoc" {{bindAttr value="view.rdocStatusImage"}}></input>
|
<input type="text" class="rdoc" {{bindAttr value="view.rdocStatusImage"}}></input>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="regenerate-key" class="popup">
|
||||||
|
<a href="#" class="close" {{action popupClose target="view"}}></a>
|
||||||
|
<p>
|
||||||
|
Do you really want to regenerate ssl keys for this repository? Please note that
|
||||||
|
any data, which is encrypted, such as notification services credentials or secure
|
||||||
|
environment variables will not be accessible during the builds until you re-encrypt
|
||||||
|
it with the new key.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<a class="sync_now button" {{action regenerateKey target="view"}}>Yes! Do it!</a>
|
||||||
|
<span class="or">or</span>
|
||||||
|
<a href="#" class="cancel" {{action popupClose target="view"}}>Cancel</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="regeneration-success" class="popup">
|
||||||
|
<a href="#" class="close" {{action popupClose target="view"}}></a>
|
||||||
|
<p>
|
||||||
|
Key for this repository has been regenerated. If you used previous key
|
||||||
|
for encryption, you will need encrypt your data again with the new key.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
You can read more about encryption keys <a href="http://about.travis-ci.org/docs/user/encryption-keys/">in Travis documentation</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
|
@ -4,7 +4,8 @@ require 'ext/ember/namespace'
|
||||||
View: Em.View.extend
|
View: Em.View.extend
|
||||||
popup: (event) ->
|
popup: (event) ->
|
||||||
@popupCloseAll()
|
@popupCloseAll()
|
||||||
$("##{event.target.name}").toggleClass('display')
|
name = if event.target then event.target.name else event
|
||||||
|
$("##{name}").toggleClass('display')
|
||||||
popupClose: (event) ->
|
popupClose: (event) ->
|
||||||
$(event.target).closest('.popup').removeClass('display')
|
$(event.target).closest('.popup').removeClass('display')
|
||||||
popupCloseAll: ->
|
popupCloseAll: ->
|
||||||
|
|
|
@ -96,6 +96,12 @@
|
||||||
@popup(event)
|
@popup(event)
|
||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
|
|
||||||
|
regenerateKeyPopup: (event) ->
|
||||||
|
@set('active', true)
|
||||||
|
@closeMenu()
|
||||||
|
@popup(event)
|
||||||
|
event.stopPropagation()
|
||||||
|
|
||||||
requeueBuild: ->
|
requeueBuild: ->
|
||||||
@closeMenu()
|
@closeMenu()
|
||||||
@get('build').requeue()
|
@get('build').requeue()
|
||||||
|
@ -104,6 +110,16 @@
|
||||||
@closeMenu()
|
@closeMenu()
|
||||||
@get('job').requeue()
|
@get('job').requeue()
|
||||||
|
|
||||||
|
regenerateKey: ->
|
||||||
|
@popupCloseAll()
|
||||||
|
self = this
|
||||||
|
|
||||||
|
@get('repo').regenerateKey
|
||||||
|
success: ->
|
||||||
|
self.popup('regeneration-success')
|
||||||
|
error: ->
|
||||||
|
Travis.app.router.flashController.loadFlashes([{ error: 'Travis encountered an error while trying to regenerate the key, please try again.'}])
|
||||||
|
|
||||||
canRequeueBuild: (->
|
canRequeueBuild: (->
|
||||||
@get('isBuildTab') && @get('build.isFinished') && @get('hasPermissions')
|
@get('isBuildTab') && @get('build.isFinished') && @get('hasPermissions')
|
||||||
).property('isBuildTab', 'build.isFinished', 'hasPermissions')
|
).property('isBuildTab', 'build.isFinished', 'hasPermissions')
|
||||||
|
@ -112,6 +128,10 @@
|
||||||
@get('isJobTab') && @get('job.isFinished') && @get('hasPermissions')
|
@get('isJobTab') && @get('job.isFinished') && @get('hasPermissions')
|
||||||
).property('isJobTab', 'job.isFinished', 'hasPermissions')
|
).property('isJobTab', 'job.isFinished', 'hasPermissions')
|
||||||
|
|
||||||
|
canRegenerateKey: (->
|
||||||
|
@get('hasPermissions')
|
||||||
|
).property('hasPermissions')
|
||||||
|
|
||||||
isBuildTab: (->
|
isBuildTab: (->
|
||||||
# ['current', 'build', 'job'].indexOf(@get('tab')) > -1
|
# ['current', 'build', 'job'].indexOf(@get('tab')) > -1
|
||||||
@get('tab') in ['current', 'build']
|
@get('tab') in ['current', 'build']
|
||||||
|
|
|
@ -58,4 +58,27 @@
|
||||||
padding: 4px
|
padding: 4px
|
||||||
@include border-radius(3px)
|
@include border-radius(3px)
|
||||||
|
|
||||||
|
#regenerate-key
|
||||||
|
.cancel
|
||||||
|
text-decoration: underline
|
||||||
|
p
|
||||||
|
text-align: center
|
||||||
|
.or
|
||||||
|
display: inline-block
|
||||||
|
margin: 20px 10px 0 10px
|
||||||
|
p:last-of-type
|
||||||
|
margin-bottom: 5px
|
||||||
|
a.button
|
||||||
|
font-size: 13px
|
||||||
|
|
||||||
|
#status-images, #regenerate-key
|
||||||
|
input
|
||||||
|
border: 1px solid $color-border-light
|
||||||
|
width: 505px
|
||||||
|
padding: 4px
|
||||||
|
@include border-radius(3px)
|
||||||
|
|
||||||
|
#regenerate-key, #regeneration-success
|
||||||
|
display: none
|
||||||
|
width: 400px
|
||||||
|
margin: -95px 0 0 -300px
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
position: absolute
|
position: absolute
|
||||||
right: 0
|
right: 0
|
||||||
top: -3px
|
top: -3px
|
||||||
width: 130px
|
width: 135px
|
||||||
background-color: $color-bg-menu
|
background-color: $color-bg-menu
|
||||||
border: 1px solid $color-border-light
|
border: 1px solid $color-border-light
|
||||||
@include border-bottom-radius(4px)
|
@include border-bottom-radius(4px)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user