Skip to content

Commit

Permalink
Various BugFixes
Browse files Browse the repository at this point in the history
+page.svelte
* Fixed checkbox boolean/String issue

+page.ts
* Added case insensitivity to stl file extensions

service.go
* Added base ModelsDir to GCode MetaData Lookup
  • Loading branch information
dp1140a committed Feb 21, 2024
1 parent 920c2d1 commit 97f02ab
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion front/src/routes/models/[modelId]/+page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const load = async ({ fetch, params }) => {
* Fetch STL thumbnails as Base64 strings and attach to modelFile
*/
for (let i = 0; i < model.modelFiles.length; i++) {
if (model.modelFiles[i].path.split('.').pop() === 'stl') {
if (model.modelFiles[i].path.split('.').pop().toLowerCase() === 'stl') {
//console.log(model.modelFiles[i]);
model.modelFiles[i]['thumbnail'] = await _getSTLThumbnail(
model.modelFiles[i],
Expand Down
9 changes: 4 additions & 5 deletions front/src/routes/printers/[printerId]/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<script lang="ts">
import { type ModalSettings, getModalStore } from '@skeletonlabs/skeleton';
import RadialGauge from '$lib/RadialGauge.svelte';
import { GetPrinterFiles, CheckPrinterStatus, type PrinterStatus } from '$lib/Printer';
import { GetPrinterFiles, CheckPrinterStatus, type PrinterStatus, type Printer } from '$lib/Printer';
import { GetPrinterJob, type JobInformation } from '$lib/Job';
import { _apiUrl, handleError, SecondsPrettyPrint } from '$lib/Utils.js';
import { goto, invalidateAll } from '$app/navigation';
export let data;
const modalStore = getModalStore();
let printer = data.printer;
let printer:Printer = data.printer;
let online = data.status.online;
let printerStatus: PrinterStatus = data.status.printerStatus;
Expand Down Expand Up @@ -300,14 +300,14 @@
* updatePrinter
*/
const updatePrinter = async () => {
//console.log(model)
let body = JSON.stringify(printer)
await fetch(_apiUrl(`/v1/printer/${printer._id}`), {
method: 'PUT',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify(printer)
body: body
})
.then(handleError) // skips to .catch if error is thrown
.then((response) => {
Expand Down Expand Up @@ -422,7 +422,6 @@
name="autoConnect"
bind:checked={printer.autoConnect}
on:input={needsSave}
bind:value={printer.autoConnect}
/>
</div>
<div class="">
Expand Down
3 changes: 2 additions & 1 deletion pkg/api/model/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,8 @@ func (ms ModelService) AddNote(model types.Model) (err error) {
}

func (ms ModelService) GetGCodeMetaData(path string) (gcode.GCodeMetaData, error) {
g := gcode.NewGCode(path)
g := gcode.NewGCode(filepath.Join(ms.config.ModelsDir, path))
fmt.Println(path)
err := g.ParseGCode(false)
if err != nil {
log.Error(err)
Expand Down

0 comments on commit 97f02ab

Please sign in to comment.