2019-10-24 20:53:36 +00:00
|
|
|
import { find } from 'lodash'
|
2020-10-19 19:35:46 +00:00
|
|
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
|
|
|
import { faCircleNotch } from '@fortawesome/free-solid-svg-icons'
|
|
|
|
|
|
|
|
library.add(
|
|
|
|
faCircleNotch
|
|
|
|
)
|
2019-10-24 20:53:36 +00:00
|
|
|
|
|
|
|
const StatusPopover = {
|
|
|
|
name: 'StatusPopover',
|
|
|
|
props: [
|
|
|
|
'statusId'
|
|
|
|
],
|
2020-03-02 06:35:57 +00:00
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
error: false
|
|
|
|
}
|
|
|
|
},
|
2019-10-25 02:14:53 +00:00
|
|
|
computed: {
|
|
|
|
status () {
|
|
|
|
return find(this.$store.state.statuses.allStatuses, { id: this.statusId })
|
|
|
|
}
|
|
|
|
},
|
2019-10-24 20:53:36 +00:00
|
|
|
components: {
|
2020-02-28 16:39:47 +00:00
|
|
|
Status: () => import('../status/status.vue'),
|
|
|
|
Popover: () => import('../popover/popover.vue')
|
2019-10-24 20:53:36 +00:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
enter () {
|
2019-10-25 02:14:53 +00:00
|
|
|
if (!this.status) {
|
2020-06-30 12:15:27 +00:00
|
|
|
if (!this.statusId) {
|
|
|
|
this.error = true
|
|
|
|
return
|
|
|
|
}
|
2019-10-25 02:21:33 +00:00
|
|
|
this.$store.dispatch('fetchStatus', this.statusId)
|
2020-03-02 06:35:57 +00:00
|
|
|
.then(data => (this.error = false))
|
|
|
|
.catch(e => (this.error = true))
|
2019-10-24 20:53:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default StatusPopover
|