Skip to content

Commit

Permalink
Merge pull request #75 from fdm-monster/fix/74-printcompletion-page-d…
Browse files Browse the repository at this point in the history
…oes-not-list-printers-and-printer-namesfloors-are-not-visible

Fix/74 printcompletion page does not list printers and printer namesfloors are not visible
  • Loading branch information
davidzwa authored Apr 29, 2023
2 parents 219a042 + f9c0f76 commit 3664033
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 38 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fdm-monster/client",
"version": "1.0.3",
"version": "1.0.4",
"private": false,
"author": "David Zwart",
"license": "AGPL-3.0-or-later",
Expand Down
2 changes: 1 addition & 1 deletion src/components/Generic/NavigationDrawer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default defineComponent({
["home", "Devices", "/"],
["printer", "Printers", "/printers"],
["settings", "Settings", "/settings"],
["timeline", "PrintScheduling", "/scheduling"],
["timeline", "PrintStatistics", "/statistics"],
["contact_support", "About", "/about"],
],
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ export default defineComponent({
this.loadedCompletions = [];
this.shownCompletions = [];
this.loadedCompletions = await PrintCompletionsService.getCompletions();
this.updateFloors();
this.updatePrinters();
},
printer(printerId: string) {
Expand All @@ -184,37 +185,36 @@ export default defineComponent({
return this.printersStore.floorOfPrinter(printerId);
},
updateFloors() {
// TODO fix
// if (!this.filteredFloors?.length) {
// this.printers = this.availablePrinterGroups;
// return;
// }
// const flattenedGroupIds = this.filteredFloors.flatMap((f) => {
// return f.printers.map((pg) => pg.printerGroupId);
// });
// this.printerGroups = this.availablePrinterGroups.filter((pg) => {
// if (!pg._id) return false;
// return flattenedGroupIds.includes(pg._id);
// });
if (!this.filteredFloors?.length) {
this.floorFdmPrinters = this.printersStore.printers;
return;
}
const flattenedPrinterIds = this.filteredFloors.flatMap((f) => {
return f.printers.map((fp) => fp.printerId);
});
this.floorFdmPrinters = this.printersStore.printers.filter((fp) => {
if (!fp.id) return false;
return flattenedPrinterIds.includes(fp.id);
});
},
updatePrinters() {
const pIds = this.filteredFdmPrinters.map((p) => p.id);
const preSearchPrinters = pIds.length
const preSearchPrints = pIds.length
? this.loadedCompletions.filter((c) => pIds.includes(c._id))
: this.loadedCompletions;
const preSortPrinters = this.printerNameSearch?.length
? preSearchPrinters.filter((p) => {
const preSortPrints = this.printerNameSearch?.length
? preSearchPrints.filter((p) => {
const printer = this.floorFdmPrinters.find((f) => f.id === p._id);
if (!printer) return false;
return (printer.printerName + printer.printerURL)
.toLowerCase()
.includes(this.printerNameSearch.toLowerCase());
})
: preSearchPrinters;
: preSearchPrints;
this.shownCompletions = preSortPrinters.sort((p1, p2) => {
this.shownCompletions = preSortPrints.sort((p1, p2) => {
if (p1.failureCount === p2.failureCount) {
return p1.printCount > p2.printCount ? -1 : 1;
}
Expand Down
15 changes: 15 additions & 0 deletions src/components/PrintStatistics/PrintStatisticsView.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<template>
<v-container>
<PrintStatistics />
</v-container>
</template>

<script lang="ts">
import { defineComponent } from "vue";
import PrintStatistics from "@/components/PrintStatistics/PrintStatistics.vue";
export default defineComponent({
name: "PrintStatisticsView",
components: { PrintStatistics },
});
</script>
8 changes: 4 additions & 4 deletions src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import HomePrinterGrid from "@/views/PrinterGridView.vue";
import PrintersView from "@/components/PrinterList/PrintersView.vue";
import Settings from "@/views/SettingsView.vue";
import About from "@/views/AboutView.vue";
import PrintTimeline from "@/views/PrintTimelineView.vue";
import PrintStatisticsView from "@/components/PrintStatistics/PrintStatisticsView.vue";
import FdmSettings from "@/components/Settings/FdmSettings.vue";
import ServerRelatedSettings from "@/components/Settings/ServerRelatedSettings.vue";
import UserManagementSettings from "@/components/Settings/UserManagementSettings.vue";
Expand Down Expand Up @@ -50,9 +50,9 @@ const routes: Array<RouteConfig> = [
],
},
{
path: "/scheduling",
name: "Print Timeline",
component: PrintTimeline,
path: "/statistics",
name: "Print Statistics",
component: PrintStatisticsView,
},
{
path: "/about",
Expand Down
15 changes: 0 additions & 15 deletions src/views/PrintTimelineView.vue

This file was deleted.

0 comments on commit 3664033

Please sign in to comment.