Commit 63b0cb2f authored by jackie / Andrea Ida Malkah Klaura's avatar jackie / Andrea Ida Malkah Klaura
Browse files

FEAT: implements all conflict resolution modes

parent 4682abaf
...@@ -337,12 +337,40 @@ export default { ...@@ -337,12 +337,40 @@ export default {
}, },
resolveEvent (toResolve, mode) { resolveEvent (toResolve, mode) {
this.$log.debug('resolveEvent:', toResolve)
this.conflictCount -= toResolve.collisions.length this.conflictCount -= toResolve.collisions.length
let slotIndex = this.calendarSlots.findIndex(s => s.id === toResolve.id) let slotIndex = this.calendarSlots.findIndex(s => s.id === toResolve.id)
switch (mode) { switch (mode) {
case 'theirs': case 'theirs':
this.conflictSolutions[toResolve.hash] = 'theirs' this.conflictSolutions[toResolve.hash] = mode
this.calendarSlots[slotIndex].className = 'ours-discarded' this.calendarSlots[slotIndex].className = 'timeslot-discarded'
for (let theirs of toResolve.collisions) {
this.calendarSlots.find(s => s.id === theirs.id).className = 'timeslot-accepted'
}
this.renderView(null)
break
case 'ours':
this.conflictSolutions[toResolve.hash] = mode
this.calendarSlots[slotIndex].className = 'timeslot-accepted'
for (let theirs of toResolve.collisions) {
this.calendarSlots.find(s => s.id === theirs.id).className = 'timeslot-discarded'
}
this.renderView(null)
break
case 'theirs-start':
case 'theirs-end':
case 'theirs-both':
case 'ours-start':
case 'ours-end':
case 'ours-both':
this.conflictSolutions[toResolve.hash] = mode
this.calendarSlots[slotIndex].className = 'timeslot-partly'
this.calendarSlots[slotIndex].title = 'new [' + mode + ']'
for (let theirs of toResolve.collisions) {
this.calendarSlots.find(s => s.id === theirs.id).className = 'timeslot-partly-theirs'
}
this.renderView(null) this.renderView(null)
break break
...@@ -413,7 +441,6 @@ export default { ...@@ -413,7 +441,6 @@ export default {
}, },
loadTimeslots (start, end) { loadTimeslots (start, end) {
this.$log.debug('loadTimeslots: currentShow = '+this.currentShow)
this.loaded.timeslots = false this.loaded.timeslots = false
let uri = process.env.VUE_APP_API_STEERING + 'timeslots?start=' + start + '&end=' + end let uri = process.env.VUE_APP_API_STEERING + 'timeslots?start=' + start + '&end=' + end
axios.get(uri, { axios.get(uri, {
...@@ -469,9 +496,21 @@ a.currentShow { ...@@ -469,9 +496,21 @@ a.currentShow {
.noconflict { .noconflict {
background-color: #17a2b8; background-color: #17a2b8;
} }
.ours-discarded { .timeslot-discarded {
background-color: #b00; background-color: #b00;
opacity: 0.5; opacity: 0.5;
text-decoration: line-through !important; text-decoration: line-through !important;
} }
.timeslot-accepted {
background-color: #17a2b8;
}
.timeslot-partly {
background-color: #17a2b8;
opacity: 0.5;
font-weight: bold;
}
.timeslot-partly-theirs {
background-color: #17a2b8;
opacity: 0.25;
}
</style> </style>
...@@ -169,6 +169,7 @@ export default { ...@@ -169,6 +169,7 @@ export default {
if (response.data.projected === undefined) { if (response.data.projected === undefined) {
this.$parent.renderView(null) this.$parent.renderView(null)
} else { } else {
this.$log.debug('Timeslot conflict. Switching to resolve mode.')
this.$parent.resolve(response.data) this.$parent.resolve(response.data)
} }
this.$refs.modalEmissionManagerCreate.hide() this.$refs.modalEmissionManagerCreate.hide()
......
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
v-if="toResolve.solutionChoices.indexOf('theirs-start') >= 0" v-if="toResolve.solutionChoices.indexOf('theirs-start') >= 0"
variant="info" variant="info"
size="sm" size="sm"
@click="notYetImplemented" @click="resolve('theirs-start')"
> >
theirs-start<br> theirs-start<br>
TODO: describe TODO: describe
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
v-if="toResolve.solutionChoices.indexOf('theirs-end') >= 0" v-if="toResolve.solutionChoices.indexOf('theirs-end') >= 0"
variant="info" variant="info"
size="sm" size="sm"
@click="notYetImplemented" @click="resolve('theirs-end')"
> >
theirs-end<br> theirs-end<br>
TODO: describe TODO: describe
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
v-if="toResolve.solutionChoices.indexOf('theirs-both') >= 0" v-if="toResolve.solutionChoices.indexOf('theirs-both') >= 0"
variant="info" variant="info"
size="sm" size="sm"
@click="notYetImplemented" @click="resolve('theirs-both')"
> >
theirs-both<br> theirs-both<br>
TODO: describe TODO: describe
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
v-if="toResolve.solutionChoices.indexOf('ours-start') >= 0" v-if="toResolve.solutionChoices.indexOf('ours-start') >= 0"
variant="info" variant="info"
size="sm" size="sm"
@click="notYetImplemented" @click="resolve('ours-start')"
> >
ours-start<br> ours-start<br>
TODO: describe TODO: describe
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
v-if="toResolve.solutionChoices.indexOf('ours-end') >= 0" v-if="toResolve.solutionChoices.indexOf('ours-end') >= 0"
variant="info" variant="info"
size="sm" size="sm"
@click="notYetImplemented" @click="resolve('ours-end')"
> >
ours-end<br> ours-end<br>
TODO: describe TODO: describe
...@@ -122,7 +122,7 @@ ...@@ -122,7 +122,7 @@
v-if="toResolve.solutionChoices.indexOf('ours-both') >= 0" v-if="toResolve.solutionChoices.indexOf('ours-both') >= 0"
variant="info" variant="info"
size="sm" size="sm"
@click="notYetImplemented" @click="resolve('ours-both')"
> >
ours-both<br> ours-both<br>
TODO: describe TODO: describe
...@@ -159,6 +159,12 @@ export default { ...@@ -159,6 +159,12 @@ export default {
switch (mode) { switch (mode) {
case 'ours': case 'ours':
case 'theirs': case 'theirs':
case 'theirs-start':
case 'theirs-end':
case 'theirs-both':
case 'ours-start':
case 'ours-end':
case 'ours-both':
this.$parent.resolveEvent(this.toResolve, mode) this.$parent.resolveEvent(this.toResolve, mode)
this.$refs.modalEmissionManagerResolve.hide() this.$refs.modalEmissionManagerResolve.hide()
break break
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment