This repository has been archived on 2022-10-05. You can view files and clone it, but cannot push or open issues or pull requests.
assetLabelGen/ComputersLabelText.vue

62 lines
1.2 KiB
Vue
Raw Normal View History

<template>
<span class="text-content">
2020-03-10 20:22:23 -04:00
<div class="name">
<span class="emoji">{{ emoji }}</span
>{{ name }}
</div>
<div class="hostname">{{ asset.name }}</div>
2020-03-10 20:21:03 -04:00
<div class="mac">{{ getCustom('MAC Address') }}</div>
<div class="mac">{{ getCustom('MAC Address 2') }}</div>
</span>
</template>
<script lang="ts">
import { Vue, Component, Prop } from 'vue-property-decorator';
import { toWords as numberToWords } from 'number-to-words';
import snipeit from './snipeit';
@Component
export default class ComputersLabelText extends Vue {
@Prop(Object) readonly asset: snipeit.Hardware;
2020-03-10 20:22:23 -04:00
get emoji() {
return this.asset.name.includes('Laptop')
? '💻'
: this.asset.name.includes('Desktop')
? '🖥'
: '?';
}
get name() {
return numberToWords(this.asset.name.match(/[0-9]+$/)[0]).toUpperCase();
}
2020-03-10 20:21:03 -04:00
getCustom(field) {
return this.asset.custom_fields[field]?.value;
}
}
</script>
2020-03-10 19:54:10 -04:00
<style scoped>
.text-content {
font-family: monospace;
line-height: 1;
}
.emoji {
font: 'Twemoji Mozilla';
font-size: 20px;
2020-03-10 19:54:10 -04:00
vertical-align: 30%;
}
.name {
font-size: 30px;
2020-03-10 19:54:10 -04:00
line-height: 0.8;
margin-bottom: 0.1em;
}
.mac {
font-size: 10px;
2020-03-10 19:54:10 -04:00
}
</style>