2019-02-14 19:00:04 +03:00
|
|
|
import Vue from 'vue'
|
|
|
|
import { Mixin } from 'vue-mixin-decorator'
|
|
|
|
import ConflictDialog from 'client/components/ConflictDialog.vue'
|
2019-04-18 00:52:43 +03:00
|
|
|
import DeferredPromise from 'utils/DeferredPromise'
|
2019-02-14 19:00:04 +03:00
|
|
|
|
|
|
|
const ComponentClass = Vue.extend(ConflictDialog)
|
|
|
|
|
|
|
|
interface IConflictDialogProps {
|
|
|
|
serverModified: string,
|
|
|
|
modified: string,
|
|
|
|
merged: string
|
|
|
|
}
|
|
|
|
|
|
|
|
@Mixin
|
|
|
|
export default class ConflictDialogMixin extends Vue {
|
|
|
|
async openConflictDialog ({ serverModified, modified, merged }: IConflictDialogProps): Promise<string> {
|
|
|
|
const instance = new ComponentClass({
|
|
|
|
propsData: {
|
|
|
|
value: true,
|
|
|
|
serverModified,
|
|
|
|
modified,
|
|
|
|
merged
|
|
|
|
}
|
|
|
|
})
|
|
|
|
instance.$mount()
|
|
|
|
const deferredPromise = new DeferredPromise()
|
|
|
|
this.$el.appendChild(instance.$el)
|
|
|
|
instance.$on('save', (newVal) => {
|
|
|
|
instance.$destroy()
|
|
|
|
deferredPromise.resolve(newVal)
|
|
|
|
})
|
|
|
|
|
|
|
|
return deferredPromise
|
|
|
|
}
|
|
|
|
}
|