add delete env-var functionality
This commit is contained in:
parent
99f828ef65
commit
004d890a08
|
@ -5,7 +5,6 @@ EnvVarComponent = Ember.Component.extend
|
||||||
classNames: ['settings-envvar']
|
classNames: ['settings-envvar']
|
||||||
classNameBindings: ['envVar.public:is-public']
|
classNameBindings: ['envVar.public:is-public']
|
||||||
|
|
||||||
isEditing: false
|
|
||||||
isDeleting: false
|
isDeleting: false
|
||||||
|
|
||||||
validates:
|
validates:
|
||||||
|
@ -25,24 +24,6 @@ EnvVarComponent = Ember.Component.extend
|
||||||
delete: ->
|
delete: ->
|
||||||
return if @get('isDeleting')
|
return if @get('isDeleting')
|
||||||
@set('isDeleting', true)
|
@set('isDeleting', true)
|
||||||
|
@get('envVar').destroyRecord()
|
||||||
@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`
|
`export default EnvVarComponent`
|
||||||
|
|
|
@ -12,39 +12,10 @@
|
||||||
{{travis-switch active=public}}
|
{{travis-switch active=public}}
|
||||||
</div>
|
</div>
|
||||||
<div class="form-elem">
|
<div class="form-elem">
|
||||||
<input type="submit" value="Add" class="form-submit {{if isSaving "saving"}}" disabled={{isSaving}} />
|
{{#if isSaving}}
|
||||||
|
{{loading-indicator}}
|
||||||
|
{{else}}
|
||||||
|
<input type="submit" value="Add" class="form-submit" />
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{{!--
|
|
||||||
|
|
||||||
|
|
||||||
<form class="env-var" {{action "save" on="submit"}}>
|
|
||||||
{{#travis-field "name"}}
|
|
||||||
|
|
||||||
{{input value=name class="env-name" placeholder="Name"}} {{travis-errors "name"}}
|
|
||||||
{{/travis-field}}
|
|
||||||
<span class="equals">=</span>
|
|
||||||
{{#if showValueField}}
|
|
||||||
<div class="field value value--extra">
|
|
||||||
{{#label for="value" class="value"}}Value:{{/label}}
|
|
||||||
{{input value=value class="env-value" placeholder="Value"}}
|
|
||||||
</div>
|
|
||||||
{{else}}
|
|
||||||
<div class="field name">
|
|
||||||
<span class="value value-display secure">{{value}}</span>
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
<div class="field field--switch">
|
|
||||||
{{travis-switch active=public}}
|
|
||||||
{{#label for="secure" class="public"}}Display value in build logs{{/label}}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="actions">
|
|
||||||
<input type="submit" {{bind-attr value=actionType class=":submit-env-var isSaving:saving" disabled=isSaving}} />
|
|
||||||
<span class="or">or</span>
|
|
||||||
<a href="#" class="cancel-env-var" {{action "cancel"}}>Cancel</a>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
--}}
|
|
|
@ -5,9 +5,13 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="env-var-action">
|
<div class="env-var-action">
|
||||||
<div class="tooltip">
|
<div class="tooltip">
|
||||||
<a href="#" title="">
|
{{#if isDeleting}}
|
||||||
<span class="icon-delete"></span>
|
{{loading-indicator}}
|
||||||
</a>
|
{{else}}
|
||||||
<div class="tooltip-bubble">Delete</div>
|
<a href="#" title="" {{action "delete" on="click"}}>
|
||||||
|
<span class="icon-delete"></span>
|
||||||
|
</a>
|
||||||
|
<div class="tooltip-bubble">Delete</div>
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user