diff --git a/package.json b/package.json index b6c47943..010ee978 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@fdm-monster/client", - "version": "1.0.1", + "version": "1.0.2", "private": false, "author": "David Zwart", "license": "AGPL-3.0-or-later", diff --git a/src/components/PrinterList/PrinterDetails.vue b/src/components/PrinterList/PrinterDetails.vue index 8abd5652..7a40c30e 100644 --- a/src/components/PrinterList/PrinterDetails.vue +++ b/src/components/PrinterList/PrinterDetails.vue @@ -17,7 +17,6 @@ WebSocket: {{ printer.webSocketState?.colour }}
Printer: {{ printer.printerState?.state }}
Files: {{ getPrinterFileCount() }}
- Sort Index: {{ printer.sortIndex }}
Id: {{ printer.id }} diff --git a/src/views/PrintersView.vue b/src/components/PrinterList/PrintersView.vue similarity index 96% rename from src/views/PrintersView.vue rename to src/components/PrinterList/PrintersView.vue index 74bd358e..55bc3a58 100644 --- a/src/views/PrintersView.vue +++ b/src/components/PrinterList/PrintersView.vue @@ -145,9 +145,9 @@ import SyncPrinterNameAction from "@/components/Generic/Actions/SyncPrinterNameA import { usePrintersStore } from "@/store/printers.store"; import { useDialogsStore } from "@/store/dialog.store"; import { DialogName } from "@/components/Generic/Dialogs/dialog.constants"; -import { firmwareUpdateSection } from "../constants/experimental.constants"; -import PrinterCreateAction from "../components/Generic/Actions/PrinterCreateAction.vue"; -import PrinterDeleteAction from "../components/Generic/Actions/PrinterDeleteAction.vue"; +import { firmwareUpdateSection } from "@/constants/experimental.constants"; +import PrinterCreateAction from "@/components/Generic/Actions/PrinterCreateAction.vue"; +import PrinterDeleteAction from "@/components/Generic/Actions/PrinterDeleteAction.vue"; interface Data { showJsonImportDialog: boolean; @@ -186,12 +186,6 @@ export default defineComponent({ search: "", expanded: [], tableHeaders: [ - { - text: "Order", - align: "start", - sortable: true, - value: "sortIndex", - }, { text: "Enabled", value: "enabled" }, { text: "Printer Name", diff --git a/src/models/printers/crud/create-printer.model.ts b/src/models/printers/crud/create-printer.model.ts index d66865fb..0a937a5b 100644 --- a/src/models/printers/crud/create-printer.model.ts +++ b/src/models/printers/crud/create-printer.model.ts @@ -10,7 +10,6 @@ export const getDefaultCreatePrinter = (): PreCreatePrinter => ({ printerHostPort: 80, websocketPrefix: "ws", printerHostName: "", - sortIndex: 0, apiKey: "", enabled: true, stepSize: 1, @@ -23,7 +22,6 @@ export interface PreCreatePrinter { id?: string; // Only in case of update enabled: boolean; - sortIndex: number; printerName: string; websocketPrefix: WebSocketProtocol; @@ -44,7 +42,6 @@ export interface CreatePrinter { id?: string; // Only in case of update enabled: boolean; - sortIndex: number; printerName: string; webSocketURL: string; diff --git a/src/models/printers/printer.model.ts b/src/models/printers/printer.model.ts index 40895ecd..3dae1a88 100644 --- a/src/models/printers/printer.model.ts +++ b/src/models/printers/printer.model.ts @@ -33,8 +33,8 @@ export interface Printer { currentJob: PrinterCurrentJob | PrinterJob; enabled: boolean; + dateAdded: number; disabledReason: string; - sortIndex: number; printerName: string; webSocketURL: string; apiKey: string; diff --git a/src/router/index.ts b/src/router/index.ts index 7bdcbe3b..1573bc19 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,7 +1,7 @@ import Vue from "vue"; import VueRouter, { RouteConfig } from "vue-router"; import HomePrinterGrid from "@/views/PrinterGridView.vue"; -import Printers from "@/views/PrintersView.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"; @@ -20,8 +20,8 @@ const routes: Array = [ }, { path: "/printers", - name: "Printers", - component: Printers, + name: "PrintersView", + component: PrintersView, }, { path: "/settings", diff --git a/src/store/printers.store.ts b/src/store/printers.store.ts index 0718ed5f..c0f61394 100644 --- a/src/store/printers.store.ts +++ b/src/store/printers.store.ts @@ -120,7 +120,9 @@ export const usePrintersStore = defineStore("Printers", { async createPrinter(newPrinter: CreatePrinter) { const data = await PrintersService.createPrinter(newPrinter); this.printers.push(data); - this.printers.sort((a: Printer, b: Printer) => (a.sortIndex > b.sortIndex ? 1 : -1)); + this.printers.sort((a: Printer, b: Printer) => + a.printerName?.toLowerCase()?.localeCompare(b?.printerName?.toLowerCase()) ? 1 : -1 + ); return data; }, async createTestPrinter(newPrinter: CreatePrinter) { @@ -128,7 +130,6 @@ export const usePrintersStore = defineStore("Printers", { this.testPrinters = data; return data; }, - // TODO renamed toggleSelectedPrinter(printer: Printer) { const selectedPrinterIndex = this.selectedPrinters.findIndex((sp) => sp.id == printer.id); if (selectedPrinterIndex === -1) { @@ -208,7 +209,9 @@ export const usePrintersStore = defineStore("Printers", { if (viewedPrinterId) { this.sideNavPrinter = printers.find((p) => p.id === viewedPrinterId); } - this.printers = printers; + this.printers = printers.sort((a: Printer, b: Printer) => + a.printerName?.toLowerCase()?.localeCompare(b?.printerName?.toLowerCase()) ? 1 : -1 + ); }, _popPrinter(printerId: string) { const printerIndex = this.printers.findIndex((p: Printer) => p.id === printerId);