forked from dalibo/pev2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMiscDetail.vue
More file actions
50 lines (45 loc) · 1.21 KB
/
Copy pathMiscDetail.vue
File metadata and controls
50 lines (45 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<script lang="ts" setup>
import { onBeforeMount, reactive, ref } from "vue"
import _ from "lodash"
import type { Node } from "@/interfaces"
import { NodeProp } from "@/enums"
import { shouldShowProp } from "@/services/help-service"
import { formatNodeProp } from "@/filters"
const nodeProps = ref<
{
key: keyof typeof NodeProp
value: unknown
}[]
>()
interface Props {
node: Node
}
const props = defineProps<Props>()
const node = reactive<Node>(props.node)
onBeforeMount(() => {
calculateProps()
})
// create an array of node propeties so that they can be displayed in the view
function calculateProps() {
nodeProps.value = _.chain(node)
.omit(NodeProp.PLANS)
.omit(NodeProp.WORKERS)
.map((value, key) => {
return { key: key as keyof typeof NodeProp, value }
})
.value()
}
</script>
<template>
<table class="table table-sm prop-list mb-0">
<template v-for="(prop, key) in nodeProps" :key="key">
<tr v-if="shouldShowProp(prop.key, prop.value)">
<td width="40%">{{ prop.key }}</td>
<td v-html="formatNodeProp(prop.key, prop.value)"></td>
</tr>
</template>
</table>
<div class="text-secondary text-end">
<em>* Calculated value</em>
</div>
</template>