Add regenerate key option in repo view
This commit is contained in:
parent
e9077f1a04
commit
c00aa911d7
|
@ -94,6 +94,9 @@ require 'travis/model'
|
|||
updateTimes: ->
|
||||
@notifyPropertyChange 'lastBuildDuration'
|
||||
|
||||
regenerateKey: (options) ->
|
||||
Travis.ajax.ajax '/repos/' + @get('id') + '/key', 'post', options
|
||||
|
||||
@Travis.Repo.reopenClass
|
||||
recent: ->
|
||||
@find()
|
||||
|
|
|
@ -14,6 +14,11 @@
|
|||
<a href="#" {{action requeueJob target="view"}}>Rebuild</a>
|
||||
</li>
|
||||
{{/if}}
|
||||
{{#if view.canRegenerateKey}}
|
||||
<li>
|
||||
<a href="#" name="regenerate-key" class="open-popup" {{action regenerateKeyPopup target="view"}}>Regenerate Key</a>
|
||||
</li>
|
||||
{{/if}}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
@ -44,3 +49,31 @@
|
|||
<input type="text" class="rdoc" {{bindAttr value="view.rdocStatusImage"}}></input>
|
||||
</p>
|
||||
</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
|
||||
popup: (event) ->
|
||||
@popupCloseAll()
|
||||
$("##{event.target.name}").toggleClass('display')
|
||||
name = if event.target then event.target.name else event
|
||||
$("##{name}").toggleClass('display')
|
||||
popupClose: (event) ->
|
||||
$(event.target).closest('.popup').removeClass('display')
|
||||
popupCloseAll: ->
|
||||
|
|
|
@ -96,6 +96,12 @@
|
|||
@popup(event)
|
||||
event.stopPropagation()
|
||||
|
||||
regenerateKeyPopup: (event) ->
|
||||
@set('active', true)
|
||||
@closeMenu()
|
||||
@popup(event)
|
||||
event.stopPropagation()
|
||||
|
||||
requeueBuild: ->
|
||||
@closeMenu()
|
||||
@get('build').requeue()
|
||||
|
@ -104,6 +110,16 @@
|
|||
@closeMenu()
|
||||
@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: (->
|
||||
@get('isBuildTab') && @get('build.isFinished') && @get('hasPermissions')
|
||||
).property('isBuildTab', 'build.isFinished', 'hasPermissions')
|
||||
|
@ -112,6 +128,10 @@
|
|||
@get('isJobTab') && @get('job.isFinished') && @get('hasPermissions')
|
||||
).property('isJobTab', 'job.isFinished', 'hasPermissions')
|
||||
|
||||
canRegenerateKey: (->
|
||||
@get('hasPermissions')
|
||||
).property('hasPermissions')
|
||||
|
||||
isBuildTab: (->
|
||||
# ['current', 'build', 'job'].indexOf(@get('tab')) > -1
|
||||
@get('tab') in ['current', 'build']
|
||||
|
|
|
@ -58,4 +58,27 @@
|
|||
padding: 4px
|
||||
@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
|
||||
right: 0
|
||||
top: -3px
|
||||
width: 130px
|
||||
width: 135px
|
||||
background-color: $color-bg-menu
|
||||
border: 1px solid $color-border-light
|
||||
@include border-bottom-radius(4px)
|
||||
|
|
Loading…
Reference in New Issue
Block a user