Compare commits

...

7 Commits

Author SHA1 Message Date
D. Berge
77258b12e9 Merge branch '62-service-desk-from-ss-om-magseisfairfield-com-bug-report' into 'devel'
Resolve "Service Desk (from ss.om@magseisfairfield.com): Bug report"

Closes #62

See merge request wgp/dougal/software!4
2020-10-15 17:20:30 +00:00
D. Berge
6896d8bc87 Change sequence renumbering behaviour.
By default, change just the number of the sequence
being edited. It is checked for conflict with other
planned sequences but not with anything already acquired.

If the user ticks the ‘shift all’ checkbox, then all
planned sequences are shifted by the same amount.
2020-10-15 19:07:27 +02:00
D. Berge
80b463fbb7 Change default sequence assignment for planned lines.
If there are other lines in the planner, we increment the
highest numbered sequence in the planner by one.

If there are no planned lines, we take the highest numbered
raw sequence and increment by one.
2020-10-15 19:05:14 +02:00
D. Berge
e0cd52f21a Replace favicon 2020-10-11 12:17:40 +02:00
D. Berge
d902806c32 Replace logo 2020-10-11 12:08:00 +02:00
D. Berge
f3e171264c Fix development websocket URL 2020-10-09 18:10:14 +02:00
D. Berge
6e7016e2ac Merge branch '59-planner' into 'devel'
Resolve "Planner"

Closes #59

See merge request wgp/dougal/software!2
2020-10-09 15:58:06 +00:00
6 changed files with 59 additions and 11 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 210 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -4,7 +4,7 @@
app
clipped-left
>
<v-img src="https://aaltronav.eu/media/aaltronav-logo.svg"
<v-img src="/wgp-logo.png"
contain
max-height="32px" max-width="32px"
></v-img>

View File

@@ -58,6 +58,11 @@
single-line
>
</v-text-field>
<v-checkbox
v-model="shiftAll"
class="mt-0"
label="Shift all planned sequences"
></v-checkbox>
</template>
</v-edit-dialog>
</template>
@@ -320,6 +325,7 @@ export default {
queuedReload: false,
plannerConfig: null,
shiftAll: false, // Shift all sequences checkbox
// Context menu stuff
contextMenuShow: false,
@@ -355,7 +361,11 @@ export default {
await this.shiftTimesAfter(item, delta);
await this.saveItem({sequence: item.sequence, key: 'ts1', value: ts1});
} else if (oldVal.key == "sequence") {
await this.shiftSequences(oldVal.value-item.sequence);
if (this.shiftAll) {
await this.shiftSequences(oldVal.value-item.sequence);
} else {
await this.shiftSequence(item, oldVal.value);
}
} else if (item[oldVal.key] != oldVal.value) {
if (await this.saveItem(oldVal)) {
item[oldVal.key] = oldVal.value;
@@ -449,6 +459,38 @@ export default {
}
},
async shiftSequence (item, newSequence) {
if (item.sequence == newSequence) {
// Nothing to do
return;
}
const conflict = this.items.find(i => i.sequence == newSequence)
if (conflict) {
this.showSnack([`Sequence ${newSequence} already exists`, "error"]);
} else {
// Cannot do this check at the moment as we would have to load the list of sequences.
// TODO We will do this after refactoring.
/*
if (this.sequences.find(i => i.sequence == newSequence)) {
this.showSnack([`Sequence ${newSequence} conflicts with a line that's already been acquired`, "warning"]);
}
*/
const url = `/project/${this.$route.params.project}/plan/${item.sequence}`;
const init = {
method: "PATCH",
headers: {"Content-Type": "application/json"},
body: {
sequence: newSequence,
name: null
} // Setting name to null causes it to be regenerated
}
await this.api([url, init]);
}
},
async shiftTimesAfter(item, delta) {
const pos = this.items.indexOf(item)+1;
if (pos != 0) {
@@ -546,7 +588,7 @@ export default {
: item;
},
...mapActions(["api"])
...mapActions(["api", "showSnack"])
},
async mounted () {

View File

@@ -8,7 +8,7 @@ module.exports = {
target: "http://localhost:3000",
},
"^/ws(/|$)": {
target: "http://localhost:3000",
target: "ws://localhost:3000",
ws: true
}
}

View File

@@ -19,14 +19,20 @@ async function getDistance (client, payload) {
}
async function getSequence (client) {
// Get the next free sequence from planned data
// if there is any planned lines, if not get the
// next available from raw lines
const text = `
SELECT max(sequence)+1 AS sequence
FROM (
SELECT sequence
FROM raw_lines
UNION SELECT sequence
FROM planned_lines
) t;
WITH p AS (
SELECT max(sequence) AS sequence
FROM planned_lines
),
r AS (
SELECT max(sequence) AS sequence
FROM raw_lines
)
SELECT COALESCE(p.sequence, r.sequence)+1 AS sequence
FROM p, r;
`;
const res = await client.query(text);