try fetching ssh keys
This commit is contained in:
parent
8d4762eb81
commit
2accdd5626
|
@ -4,4 +4,7 @@ SshKeyComponent = Ember.Component.extend
|
||||||
|
|
||||||
classNames: ['settings-sshkey']
|
classNames: ['settings-sshkey']
|
||||||
|
|
||||||
|
isCustom: () ->
|
||||||
|
false
|
||||||
|
|
||||||
`export default SshKeyComponent`
|
`export default SshKeyComponent`
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
`import TravisRoute from 'travis/routes/basic'`
|
`import TravisRoute from 'travis/routes/basic'`
|
||||||
|
`import Ajax from 'travis/utils/ajax'`
|
||||||
|
|
||||||
Route = TravisRoute.extend
|
Route = TravisRoute.extend
|
||||||
needsAuth: true
|
needsAuth: true
|
||||||
|
@ -11,10 +12,26 @@ Route = TravisRoute.extend
|
||||||
repo = @modelFor('repo')
|
repo = @modelFor('repo')
|
||||||
repo.get('envVars.promise')
|
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: () ->
|
model: () ->
|
||||||
return Ember.RSVP.hash({
|
return Ember.RSVP.hash({
|
||||||
envVars: this.fetchEnvVars(),
|
envVars: this.fetchEnvVars(),
|
||||||
# sshKey: this.fetchSshKey()
|
sshKey: this.fetchSshKey(),
|
||||||
|
customSshKey: this.fetchCustomSshKey()
|
||||||
});
|
});
|
||||||
|
|
||||||
`export default Route`
|
`export default Route`
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
{{#if custom}}
|
{{#if isCustom}}
|
||||||
<div class="ssh-key-name">
|
<div class="ssh-key-name">
|
||||||
<span class="icon-key"></span>
|
<span class="icon-key"></span>
|
||||||
<span>TRAVIS_PRIVATE_KEY</span>
|
<span>{{key.description}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="ssh-key-value">
|
<div class="ssh-key-value">
|
||||||
<span class="icon-fingerprint"></span>
|
<span class="icon-fingerprint"></span>
|
||||||
<span>e1:b1:83:06:7e:51:6d:5e:e0:e0:60:96:ca:ac:3d:8a</span>
|
<span>{{key.fingerprint}}</span>
|
||||||
|
<span>{{fingerprint}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="ssh-key-action">
|
<div class="ssh-key-action">
|
||||||
<div class="tooltip">
|
<div class="tooltip">
|
||||||
|
@ -22,7 +23,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="ssh-key-value">
|
<div class="ssh-key-value">
|
||||||
<span class="icon-fingerprint"></span>
|
<span class="icon-fingerprint"></span>
|
||||||
<span>e1:b1:83:06:7e:51:6d:5e:e0:e0:60:96:ca:ac:3d:8a</span>
|
<span>{{key.fingerprint}}</span>
|
||||||
|
<span>{{fingerprint}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="ssh-key-action">
|
<div class="ssh-key-action">
|
||||||
<div class="tooltip--height">
|
<div class="tooltip--height">
|
||||||
|
|
|
@ -31,23 +31,28 @@
|
||||||
<section class="settings-section">
|
<section class="settings-section">
|
||||||
<h2 class="small-title">SSH Key</h2>
|
<h2 class="small-title">SSH Key</h2>
|
||||||
|
|
||||||
{{ssh-key}}
|
{{#if sshKey}}
|
||||||
{{ssh-key custom=true}}
|
{{ssh-key key=sshKey}}
|
||||||
|
|
||||||
|
<div class="form--sshkey">
|
||||||
|
<a href="" class="button">Add custom SSH Key</a>
|
||||||
|
<form action="">
|
||||||
|
<div class="form-elem">
|
||||||
|
<input type="text" placeholder="Description">
|
||||||
|
</div>
|
||||||
|
<div class="form-elem">
|
||||||
|
<textarea name="" id="" cols="30" rows="10" placeholder="SSH key"></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="form-elem">
|
||||||
|
<input type="submit" class="form-submit" value="Add">
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
{{else}}
|
||||||
|
{{ssh-key key=customSshKey}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
|
||||||
<div class="form--sshkey">
|
|
||||||
<a href="" class="button">Add custom SSH Key</a>
|
|
||||||
<form action="">
|
|
||||||
<div class="form-elem">
|
|
||||||
<input type="text" placeholder="Description">
|
|
||||||
</div>
|
|
||||||
<div class="form-elem">
|
|
||||||
<textarea name="" id="" cols="30" rows="10" placeholder="SSH key"></textarea>
|
|
||||||
</div>
|
|
||||||
<div class="form-elem">
|
|
||||||
<input type="submit" class="form-submit" value="Add">
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</section>
|
</section>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<section class="settings-section">
|
<section class="settings-section">
|
||||||
|
|
Loading…
Reference in New Issue
Block a user