-
-
Notifications
You must be signed in to change notification settings - Fork 373
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add option to switch the stats between amount, filament and time
Signed-off-by: Stefan Dej <meteyou@gmail.com>
- Loading branch information
Showing
4 changed files
with
92 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,26 @@ | ||
<template> | ||
<v-simple-table> | ||
<tbody> | ||
<tr v-for="status in printStatusArray" :key="status.name"> | ||
<td>{{ status.displayName }}</td> | ||
<td class="text-right">{{ status.value }}</td> | ||
</tr> | ||
<history-all-print-status-table-item | ||
v-for="status in printStatusArray" | ||
:key="status.name" | ||
:item="status" | ||
:value-name="valueName" /> | ||
</tbody> | ||
</v-simple-table> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import Component from 'vue-class-component' | ||
import { Mixins } from 'vue-property-decorator' | ||
import { Mixins, Prop } from 'vue-property-decorator' | ||
import BaseMixin from '@/components/mixins/base' | ||
import { ServerHistoryStateAllPrintStatusEntry } from '@/store/server/history/types' | ||
import HistoryStatsMixin from '@/components/mixins/historyStats' | ||
import HistoryAllPrintStatusTableItem from '@/components/charts/HistoryAllPrintStatusTableItem.vue' | ||
@Component({ | ||
components: {}, | ||
components: { HistoryAllPrintStatusTableItem }, | ||
}) | ||
export default class HistoryAllPrintStatusTable extends Mixins(BaseMixin, HistoryStatsMixin) { | ||
get selectedJobs() { | ||
return this.$store.getters['server/history/getSelectedJobs'] | ||
} | ||
get printStatusArray() { | ||
const output: ServerHistoryStateAllPrintStatusEntry[] = [] | ||
const orgArray = this.selectedJobs.length ? this.selectedPrintStatusChartData : this.allPrintStatusChartData | ||
orgArray.forEach((status: ServerHistoryStateAllPrintStatusEntry) => { | ||
const tmp = { ...status } | ||
tmp.name = status.displayName | ||
output.push(tmp) | ||
}) | ||
return output | ||
} | ||
@Prop({ type: String, default: 'amount' }) valueName!: 'amount' | 'filament' | 'time' | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<template> | ||
<tr> | ||
<td>{{ item.displayName }}</td> | ||
<td class="text-right">{{ value }}</td> | ||
</tr> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import Component from 'vue-class-component' | ||
import { Mixins, Prop } from 'vue-property-decorator' | ||
import BaseMixin from '@/components/mixins/base' | ||
import { ServerHistoryStateAllPrintStatusEntry } from '@/store/server/history/types' | ||
import { formatPrintTime } from '@/plugins/helpers' | ||
@Component({ | ||
components: {}, | ||
}) | ||
export default class HistoryAllPrintStatusTableItem extends Mixins(BaseMixin) { | ||
@Prop({ type: Object }) item!: ServerHistoryStateAllPrintStatusEntry | ||
@Prop({ type: String, default: 'amount' }) valueName!: 'amount' | 'filament' | 'time' | ||
get value() { | ||
if (this.valueName === 'filament') { | ||
if (this.item.value > 1000) return Math.round(this.item.value / 1000).toString() + ' m' | ||
return this.item.value.toString() + ' mm' | ||
} | ||
if (this.valueName === 'time') { | ||
return formatPrintTime(this.item.value, false) | ||
} | ||
return this.item.value.toString() | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters