2020-10-19 22:35:46 +03:00
|
|
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
|
|
|
|
import { faCircleNotch } from '@fortawesome/free-solid-svg-icons'
|
2026-01-06 16:23:17 +02:00
|
|
|
import { find } from 'lodash'
|
2021-04-25 13:23:16 +03:00
|
|
|
import { defineAsyncComponent } from 'vue'
|
2020-10-19 22:35:46 +03:00
|
|
|
|
2026-01-06 16:22:52 +02:00
|
|
|
library.add(faCircleNotch)
|
2019-10-24 16:53:36 -04:00
|
|
|
|
|
|
|
|
const StatusPopover = {
|
|
|
|
|
name: 'StatusPopover',
|
2026-01-06 16:22:52 +02:00
|
|
|
props: ['statusId'],
|
|
|
|
|
data() {
|
2020-03-02 08:35:57 +02:00
|
|
|
return {
|
2026-01-06 16:22:52 +02:00
|
|
|
error: false,
|
2020-03-02 08:35:57 +02:00
|
|
|
}
|
|
|
|
|
},
|
2019-10-24 22:14:53 -04:00
|
|
|
computed: {
|
2026-01-06 16:22:52 +02:00
|
|
|
status() {
|
2019-10-24 22:14:53 -04:00
|
|
|
return find(this.$store.state.statuses.allStatuses, { id: this.statusId })
|
2026-01-06 16:22:52 +02:00
|
|
|
},
|
2019-10-24 22:14:53 -04:00
|
|
|
},
|
2019-10-24 16:53:36 -04:00
|
|
|
components: {
|
2021-04-25 13:23:16 +03:00
|
|
|
Status: defineAsyncComponent(() => import('../status/status.vue')),
|
2026-01-06 16:22:52 +02:00
|
|
|
Popover: defineAsyncComponent(() => import('../popover/popover.vue')),
|
2019-10-24 16:53:36 -04:00
|
|
|
},
|
|
|
|
|
methods: {
|
2026-01-06 16:22:52 +02:00
|
|
|
enter() {
|
2019-10-24 22:14:53 -04:00
|
|
|
if (!this.status) {
|
2020-06-30 15:15:27 +03:00
|
|
|
if (!this.statusId) {
|
|
|
|
|
this.error = true
|
|
|
|
|
return
|
|
|
|
|
}
|
2026-01-06 16:22:52 +02:00
|
|
|
this.$store
|
|
|
|
|
.dispatch('fetchStatus', this.statusId)
|
2025-02-04 15:23:21 +02:00
|
|
|
.then(() => (this.error = false))
|
|
|
|
|
.catch(() => (this.error = true))
|
2019-10-24 16:53:36 -04:00
|
|
|
}
|
2026-01-06 16:22:52 +02:00
|
|
|
},
|
2022-06-22 00:34:22 +03:00
|
|
|
},
|
|
|
|
|
watch: {
|
2026-01-06 16:22:52 +02:00
|
|
|
status(newStatus, oldStatus) {
|
2022-06-22 00:34:22 +03:00
|
|
|
if (newStatus !== oldStatus) {
|
2022-06-27 14:28:51 +03:00
|
|
|
this.$nextTick(() => this.$refs.popover.updateStyles())
|
2022-06-22 00:34:22 +03:00
|
|
|
}
|
2026-01-06 16:22:52 +02:00
|
|
|
},
|
|
|
|
|
},
|
2019-10-24 16:53:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default StatusPopover
|