2
0
mirror of https://github.com/ad1217/PrinterStatus synced 2024-11-22 07:23:48 -05:00
PrinterStatus/src/PrinterCard.vue

39 lines
1.1 KiB
Vue
Raw Normal View History

<template>
<div class="card">
2021-11-03 15:04:18 -04:00
<h3 class="card-header">{{ name || 'Unknown' }}</h3>
<img class="card-img webcam" :src="'/webcam/' + slug" />
<div v-if="status">
<div>{{ status.state.text }}</div>
<div>Job File Name: {{ status.job.file.name || 'None' }}</div>
2020-09-25 18:55:58 -04:00
<div v-if="status.progress.completion">
<div>
Job Completion:
{{ status.progress.completion.toFixed(2) }}%
<progress :value="status.progress.completion" max="100"></progress>
</div>
<div>
Job Time: {{ formatDuration(status.progress.printTime) }} elapsed,
{{ formatDuration(status.progress.printTimeLeft) }} left
</div>
</div>
<div>User: {{ status.job.user || '-' }}</div>
</div>
</div>
</template>
<script setup lang="ts">
2020-09-25 18:55:58 -04:00
import prettyMilliseconds from 'pretty-ms';
import * as octoprint from '../types/octoprint';
defineProps<{
slug: string;
name?: string;
status: octoprint.CurrentOrHistoryPayload | null;
}>();
2020-09-25 18:55:58 -04:00
function formatDuration(seconds: number): string {
return prettyMilliseconds(seconds * 1000);
}
</script>