fetch repo hook, but hide deactivate section for now

This commit is contained in:
Lisa Passing 2015-07-22 15:05:27 +02:00
parent 4ba671542a
commit 8891b325b3
2 changed files with 17 additions and 3 deletions

View File

@ -1,5 +1,6 @@
`import TravisRoute from 'travis/routes/basic'` `import TravisRoute from 'travis/routes/basic'`
`import Ajax from 'travis/utils/ajax'` `import Ajax from 'travis/utils/ajax'`
`import config from 'travis/config/environment'`
Route = TravisRoute.extend Route = TravisRoute.extend
needsAuth: true needsAuth: true
@ -29,12 +30,25 @@ Route = TravisRoute.extend
Ajax.get "/repos/#{repo.get('id')}/key", (data) => Ajax.get "/repos/#{repo.get('id')}/key", (data) =>
Ember.Object.create(fingerprint: data.fingerprint) 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: () -> model: () ->
return Ember.RSVP.hash({ return Ember.RSVP.hash({
settings: @modelFor('repo').fetchSettings(), settings: @modelFor('repo').fetchSettings(),
envVars: this.fetchEnvVars(), envVars: this.fetchEnvVars(),
sshKey: this.fetchSshKey(), sshKey: this.fetchSshKey(),
customSshKey: this.fetchCustomSshKey() customSshKey: this.fetchCustomSshKey(),
repositoryActive: this.fetchRepositoryActiveFlag()
}); });
`export default Route` `export default Route`

View File

@ -38,10 +38,10 @@
</section> </section>
{{/if}} {{/if}}
<section class="settings-section"> {{!-- <section class="settings-section">
<h2 class="small-title">Deactivate Repository</h2> <h2 class="small-title">Deactivate Repository</h2>
<p>If you'd no longer like to run this project on Travis CI you can deactivate it now.<br>You will be able to reactivate it in the future if you'd like to.</p> <p>If you'd no longer like to run this project on Travis CI you can deactivate it now.<br>You will be able to reactivate it in the future if you'd like to.</p>
<a href="#" class="button--delete" {{action "deactivate"}}>Deactivate Repository</a> <a href="#" class="button--delete" {{action "deactivate"}}>Deactivate Repository</a>
</section> </section> --}}
</div> </div>