|
|
|
@ -85,7 +85,11 @@
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- footer -->
|
|
|
|
|
<tiny-sidebar-form-footer id={ state.current.id ? state.current.id : false } loading={ state.loading }></tiny-sidebar-form-footer>
|
|
|
|
|
<tiny-sidebar-form-footer
|
|
|
|
|
id={ state.current._id ? state.current._id : false }
|
|
|
|
|
loading={ state.loading }
|
|
|
|
|
handle-delete={ handleDelete }>
|
|
|
|
|
</tiny-sidebar-form-footer>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
@ -125,12 +129,6 @@
|
|
|
|
|
|
|
|
|
|
...sidebarMixin, // adding basic funtion for sidebar
|
|
|
|
|
|
|
|
|
|
state: {
|
|
|
|
|
open: false, // if sidebar is open
|
|
|
|
|
loading: false, // if loading is shown
|
|
|
|
|
current: false
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
@ -140,36 +138,21 @@
|
|
|
|
|
// adding event for open sidebar
|
|
|
|
|
formStore.on('open', (id) => {
|
|
|
|
|
|
|
|
|
|
tagsStore.trigger('update', [])
|
|
|
|
|
|
|
|
|
|
this.state.current = false
|
|
|
|
|
this.state.open = true
|
|
|
|
|
|
|
|
|
|
// if id is send, load apps from pouchdb
|
|
|
|
|
if (id) {
|
|
|
|
|
appsStore.getOne(id)
|
|
|
|
|
} else {
|
|
|
|
|
this.update()
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
// reset tags
|
|
|
|
|
tagsStore.trigger('update', [])
|
|
|
|
|
|
|
|
|
|
// creating formValidator
|
|
|
|
|
this.state.validator = new FormValidator(this.$('.form'), {
|
|
|
|
|
'name': {
|
|
|
|
|
'presence': true
|
|
|
|
|
},
|
|
|
|
|
'command': {
|
|
|
|
|
'presence': true
|
|
|
|
|
},
|
|
|
|
|
'tags': {
|
|
|
|
|
// if id is not undefined, get data from pouchdb
|
|
|
|
|
if (id !== undefined) {
|
|
|
|
|
appsStore.getOne(id)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
this.update()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// adding on success
|
|
|
|
|
this.state.validator.onSuccess((event, data) => {
|
|
|
|
|
this.handleSuccess(event, data)
|
|
|
|
|
})
|
|
|
|
|
this.createValidator()
|
|
|
|
|
|
|
|
|
|
// receive from extensions database
|
|
|
|
|
appsStore.on('success', (data) => {
|
|
|
|
@ -185,6 +168,17 @@
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// receive from extensions database
|
|
|
|
|
appsStore.on('close', (data) => {
|
|
|
|
|
|
|
|
|
|
appsStore.trigger('update')
|
|
|
|
|
|
|
|
|
|
this.state.open = false
|
|
|
|
|
|
|
|
|
|
// stop loading
|
|
|
|
|
this.state.loading = false
|
|
|
|
|
this.update()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
appsStore.on('readyOne', (data) => {
|
|
|
|
|
|
|
|
|
|
this.state.current = data
|
|
|
|
@ -200,7 +194,31 @@
|
|
|
|
|
this.update()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* creating Validator for form
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
createValidator() {
|
|
|
|
|
this.state.validator = new FormValidator(this.$('.form'), {
|
|
|
|
|
'name': {
|
|
|
|
|
'presence': true
|
|
|
|
|
},
|
|
|
|
|
'command': {
|
|
|
|
|
'presence': true
|
|
|
|
|
},
|
|
|
|
|
'tags': {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// adding on success
|
|
|
|
|
this.state.validator.onSuccess((event, data) => {
|
|
|
|
|
this.handleSuccess(event, data)
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* choose a file for command
|
|
|
|
@ -299,6 +317,10 @@
|
|
|
|
|
this.update()
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
handleDelete() {
|
|
|
|
|
appsStore.remove(this.state.current)
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|