# HG changeset patch # User Markus Kottlaender # Date 1553018380 -3600 # Node ID add2d47c25678cec75a77d1a0dff9fae5cb5e7de # Parent 4a5c0e7cb75b64d0ede43cd2835d161a270d32b7 client: tables: implemented simple default sorting diff -r 4a5c0e7cb75b -r add2d47c2567 client/src/components/Bottlenecks.vue --- a/client/src/components/Bottlenecks.vue Tue Mar 19 18:07:50 2019 +0100 +++ b/client/src/components/Bottlenecks.vue Tue Mar 19 18:59:40 2019 +0100 @@ -7,18 +7,17 @@ /> { - return bn.properties.name - .toLowerCase() - .includes(this.searchQuery.toLowerCase()); - }) - .sort((bnA, bnB) => { - switch (this.sortColumn) { - case "name": - if ( - bnA.properties.name.toLowerCase() < - bnB.properties.name.toLowerCase() - ) - return this.sortDirection === "ASC" ? -1 : 1; - if ( - bnA.properties.name.toLowerCase() > - bnB.properties.name.toLowerCase() - ) - return this.sortDirection === "ASC" ? 1 : -1; - return 0; - - case "latestMeasurement": { - if ( - (bnA.properties.current || "") < (bnB.properties.current || "") - ) - return this.sortDirection === "ASC" ? -1 : 1; - if ( - (bnA.properties.current || "") > (bnB.properties.current || "") - ) - return this.sortDirection === "ASC" ? 1 : -1; - return 0; - } - - case "chainage": - if (bnA.properties.from < bnB.properties.from) - return this.sortDirection === "ASC" ? -1 : 1; - if (bnA.properties.from > bnB.properties.from) - return this.sortDirection === "ASC" ? 1 : -1; - return 0; - - default: - return 0; - } - }); + filteredBottlenecks() { + return this.bottlenecksList.filter(bn => { + return bn.properties.name + .toLowerCase() + .includes(this.searchQuery.toLowerCase()); + }); }, selectSurvey(survey, bottleneck) { this.$store @@ -231,10 +192,6 @@ }); }); }, - sortBy(sorting) { - this.sortColumn = sorting.sortColumn; - this.sortDirection = sorting.sortDirection; - }, loadSurveys(bottleneck) { if (bottleneck === this.openBottleneck) { this.openBottleneck = null; diff -r 4a5c0e7cb75b -r add2d47c2567 client/src/components/ImportStretches.vue --- a/client/src/components/ImportStretches.vue Tue Mar 19 18:07:50 2019 +0100 +++ b/client/src/components/ImportStretches.vue Tue Mar 19 18:59:40 2019 +0100 @@ -8,13 +8,19 @@
- +
- {{ stretch.properties["date_info"] | surveyDate }} + {{ stretch.properties.date_info | surveyDate }}
- {{ stretch.properties["source_organization"] }} + {{ stretch.properties.source_organization }}
- + +
@@ -100,14 +78,17 @@ * * Author(s): * Thomas Junk + * Markus Kottländer */ import { mapState, mapGetters } from "vuex"; -import { displayError, displayInfo } from "@/lib/errors.js"; -import { STATES } from "@/store/imports.js"; +import { displayError, displayInfo } from "@/lib/errors"; +import { STATES } from "@/store/imports"; +import { sortTable } from "@/lib/mixins"; export default { name: "importoverviewalt", + mixins: [sortTable], components: { Filters: () => import("./Filters.vue"), LogEntry: () => import("./LogEntry.vue") @@ -118,11 +99,18 @@ }; }, computed: { + ...mapState("application", ["searchQuery"]), ...mapState("imports", ["imports", "reviewed"]), ...mapGetters("imports", ["filters"]) }, methods: { - sortBy() {}, + filteredImports() { + return this.imports.filter(i => { + return (i.kind + i.id) + .toLowerCase() + .includes(this.searchQuery.toLowerCase()); + }); + }, loadLogs() { this.loading = true; this.$store diff -r 4a5c0e7cb75b -r add2d47c2567 client/src/components/importschedule/Importschedule.vue --- a/client/src/components/importschedule/Importschedule.vue Tue Mar 19 18:07:50 2019 +0100 +++ b/client/src/components/importschedule/Importschedule.vue Tue Mar 19 18:59:40 2019 +0100 @@ -24,14 +24,16 @@ - +
{{ schedule.id }}
{{ schedule.kind.toUpperCase() }}
{{ schedule.user }}
@@ -86,6 +88,23 @@ + + - - diff -r 4a5c0e7cb75b -r add2d47c2567 client/src/components/systemconfiguration/PDFTemplates.vue --- a/client/src/components/systemconfiguration/PDFTemplates.vue Tue Mar 19 18:07:50 2019 +0100 +++ b/client/src/components/systemconfiguration/PDFTemplates.vue Tue Mar 19 18:59:40 2019 +0100 @@ -14,12 +14,14 @@ - +
{{ template.name }}
{{ template.time }}
@@ -78,10 +80,12 @@ * Fadi Abbud */ import { HTTP } from "@/lib/http"; -import { displayError, displayInfo } from "@/lib/errors.js"; +import { displayError, displayInfo } from "@/lib/errors"; +import { sortTable } from "@/lib/mixins"; export default { name: "pdftemplates", + mixins: [sortTable], data() { return { templates: [], diff -r 4a5c0e7cb75b -r add2d47c2567 client/src/components/ui/UITableHeader.vue --- a/client/src/components/ui/UITableHeader.vue Tue Mar 19 18:07:50 2019 +0100 +++ b/client/src/components/ui/UITableHeader.vue Tue Mar 19 18:59:40 2019 +0100 @@ -2,7 +2,7 @@
- {{ this.currentPage }} / {{ this.pages }} + {{ this.page }} / {{ this.pages }}