|
|
@ -5,6 +5,8 @@
|
|
|
|
<!-- header -->
|
|
|
|
<!-- header -->
|
|
|
|
<tiny-sidebar-form-header title="New" close={ (event) => { handleClose(event) }}></tiny-sidebar-form-header>
|
|
|
|
<tiny-sidebar-form-header title="New" close={ (event) => { handleClose(event) }}></tiny-sidebar-form-header>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="sidebar__form">
|
|
|
|
|
|
|
|
|
|
|
|
<!-- body -->
|
|
|
|
<!-- body -->
|
|
|
|
<form class="form" novalidate method="post" onsubmit={ (event) => ( state.validator.submit(event) ) }>
|
|
|
|
<form class="form" novalidate method="post" onsubmit={ (event) => ( state.validator.submit(event) ) }>
|
|
|
|
<div class="sidebar__body">
|
|
|
|
<div class="sidebar__body">
|
|
|
@ -23,7 +25,7 @@
|
|
|
|
command*
|
|
|
|
command*
|
|
|
|
<div class="field-input-group">
|
|
|
|
<div class="field-input-group">
|
|
|
|
<input class="field-text" type="text" name="command" value="{ state.current.command ? state.current.command : '' }" />
|
|
|
|
<input class="field-text" type="text" name="command" value="{ state.current.command ? state.current.command : '' }" />
|
|
|
|
<button class="button m-bottom-0" type="button" onclick={ handleSelectProgram }>
|
|
|
|
<button class="button button--hover-icon-contrast m-bottom-0" type="button" onclick={ handleSelectProgram }>
|
|
|
|
<svg class="icon">
|
|
|
|
<svg class="icon">
|
|
|
|
<use xlink:href="symbol-defs.svg#icon-folder" />
|
|
|
|
<use xlink:href="symbol-defs.svg#icon-folder" />
|
|
|
|
</svg>
|
|
|
|
</svg>
|
|
|
@ -38,7 +40,7 @@
|
|
|
|
<div class="field-group">
|
|
|
|
<div class="field-group">
|
|
|
|
<label class="field-label">
|
|
|
|
<label class="field-label">
|
|
|
|
tags
|
|
|
|
tags
|
|
|
|
<potato-field-tags name="tags" value={ state.current.tags ? state.current.tags : '' }></potato-field-tags>
|
|
|
|
<potato-field-tags name="tags"></potato-field-tags>
|
|
|
|
</label>
|
|
|
|
</label>
|
|
|
|
<field-error name="tags[]"></field-error>
|
|
|
|
<field-error name="tags[]"></field-error>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
@ -54,24 +56,24 @@
|
|
|
|
<!-- media -->
|
|
|
|
<!-- media -->
|
|
|
|
<div class="field-group">
|
|
|
|
<div class="field-group">
|
|
|
|
<label class="field-label">
|
|
|
|
<label class="field-label">
|
|
|
|
<button class="button button--upload m-top-3 w-100" type="button" onclick={ (event) => { handleSelectMedia(event) }}>
|
|
|
|
Thumbnail<br />
|
|
|
|
Add Image
|
|
|
|
<button class="button button--hover-icon-contrast m-top-3" type="button" onclick={ (event) => { handleSelectThumbnail(event) }}>
|
|
|
|
<svg class="icon m-left-3">
|
|
|
|
<svg class="icon">
|
|
|
|
<use xlink:href="symbol-defs.svg#icon-image" />
|
|
|
|
<use xlink:href="symbol-defs.svg#icon-image" />
|
|
|
|
</svg>
|
|
|
|
</svg>
|
|
|
|
</button>
|
|
|
|
</button>
|
|
|
|
</label>
|
|
|
|
</label>
|
|
|
|
<div class="field-media" if={ state.current.media }>
|
|
|
|
<div class="field-media" if={ state.current.thumbnail }>
|
|
|
|
<button class="button button--small" type="button" onclick={ (event) => { handleRemoveMedia(event) }}>
|
|
|
|
|
|
|
|
<svg class="icon">
|
|
|
|
|
|
|
|
<use xlink:href="symbol-defs.svg#icon-delete" />
|
|
|
|
|
|
|
|
</svg>
|
|
|
|
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<div class="field-media__img">
|
|
|
|
<div class="field-media__img">
|
|
|
|
<img src={ toImage(state.current.media) } />
|
|
|
|
<button class="button button--hover-icon-contrast" type="button" onclick={ (event) => { handleRemoveThumbnail(event) }}>
|
|
|
|
|
|
|
|
<svg class="icon">
|
|
|
|
|
|
|
|
<use xlink:href="symbol-defs.svg#icon-delete" />
|
|
|
|
|
|
|
|
</svg>
|
|
|
|
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<img class="w-100" src={ toImage(state.current.thumbnail) } />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<field-error name="media"></field-error>
|
|
|
|
<field-error name="thumbnail"></field-error>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<tiny-loading active={ state.loading }></tiny-loading>
|
|
|
|
<tiny-loading active={ state.loading }></tiny-loading>
|
|
|
@ -80,6 +82,7 @@
|
|
|
|
<!-- footer -->
|
|
|
|
<!-- 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 }></tiny-sidebar-form-footer>
|
|
|
|
</form>
|
|
|
|
</form>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
@ -97,6 +100,9 @@
|
|
|
|
// store for sidebar
|
|
|
|
// store for sidebar
|
|
|
|
import appsStore from './../stores/apps.js'
|
|
|
|
import appsStore from './../stores/apps.js'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// store for tags
|
|
|
|
|
|
|
|
import tagsStore from './../stores/tags.js'
|
|
|
|
|
|
|
|
|
|
|
|
// validator
|
|
|
|
// validator
|
|
|
|
import FormValidator from '@tiny-components/validator/src/formValidator.js'
|
|
|
|
import FormValidator from '@tiny-components/validator/src/formValidator.js'
|
|
|
|
|
|
|
|
|
|
|
@ -118,12 +124,20 @@
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
async onMounted() {
|
|
|
|
onMounted() {
|
|
|
|
|
|
|
|
|
|
|
|
// adding event for open sidebar
|
|
|
|
// adding event for open sidebar
|
|
|
|
formStore.on('open', () => {
|
|
|
|
formStore.on('open', (id) => {
|
|
|
|
this.state.open = true
|
|
|
|
|
|
|
|
this.update()
|
|
|
|
// if id is send, load apps from pouchdb
|
|
|
|
|
|
|
|
if (id) {
|
|
|
|
|
|
|
|
Neutralino.extensions.dispatch('js.neutralino.pouchdb', 'pouchdb.apps.findOne', {
|
|
|
|
|
|
|
|
'id': id
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.state.open = true
|
|
|
|
|
|
|
|
this.update()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
// creating formValidator
|
|
|
|
// creating formValidator
|
|
|
@ -144,6 +158,27 @@
|
|
|
|
this.handleSuccess(event, data)
|
|
|
|
this.handleSuccess(event, data)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// receive from extensions database
|
|
|
|
|
|
|
|
Neutralino.events.on('pouchdb.apps.success', (event) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
appsStore.trigger('updated')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// stop loading
|
|
|
|
|
|
|
|
this.state.loading = false
|
|
|
|
|
|
|
|
this.update()
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// receive from extensions database
|
|
|
|
|
|
|
|
Neutralino.events.on('pouchdb.apps.readyOne', (event) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.state.current = event.detail
|
|
|
|
|
|
|
|
tagsStore.trigger('update', this.state.current.tags)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// stop loading
|
|
|
|
|
|
|
|
this.state.loading = false
|
|
|
|
|
|
|
|
this.update()
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -160,7 +195,19 @@
|
|
|
|
'defaultPath': '/home/'
|
|
|
|
'defaultPath': '/home/'
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
this.current.command = entry
|
|
|
|
this.state.current.command = entry
|
|
|
|
|
|
|
|
this.update()
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
handleRemoveThumbnail(event) {
|
|
|
|
|
|
|
|
event.preventDefault()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.state.current.thumbnail = null
|
|
|
|
this.update()
|
|
|
|
this.update()
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
@ -176,20 +223,11 @@
|
|
|
|
this.state.loading = true
|
|
|
|
this.state.loading = true
|
|
|
|
this.update()
|
|
|
|
this.update()
|
|
|
|
|
|
|
|
|
|
|
|
// receive from extensions database
|
|
|
|
// adding thumbnail
|
|
|
|
Neutralino.events.on('pouchdb.apps.success', (event) => {
|
|
|
|
data.thumbnail = this.state.current.thumbnail
|
|
|
|
|
|
|
|
|
|
|
|
appsStore.trigger('updated')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// stop loading
|
|
|
|
|
|
|
|
this.state.loading = false
|
|
|
|
|
|
|
|
this.update()
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data.media = this.state.current.media
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// send to extensions database
|
|
|
|
// send to extensions database
|
|
|
|
Neutralino.extensions.dispatch('js.neutralino.database', 'pouchdb.apps.create', data)
|
|
|
|
Neutralino.extensions.dispatch('js.neutralino.pouchdb', 'pouchdb.apps.create', data)
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -218,16 +256,20 @@
|
|
|
|
this.update()
|
|
|
|
this.update()
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
toImage(media) {
|
|
|
|
|
|
|
|
return 'data:image/png;base64,' + media
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param {object} media
|
|
|
|
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
toImage(media) {
|
|
|
|
|
|
|
|
return 'data:image/png;base64,' + media
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
reset() {
|
|
|
|
reset() {
|
|
|
|
|
|
|
|
this.state.current = {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|