summaryrefslogtreecommitdiff
path: root/src/components/Mixins/TableDataFormatterMixin.js
diff options
context:
space:
mode:
authorYoshie Muranaka <yoshiemuranaka@gmail.com>2020-06-18 22:45:13 +0300
committerYoshie Muranaka <yoshiemuranaka@gmail.com>2020-06-18 22:51:00 +0300
commit386df45f71ecbdac5ef7b8d828010ac48587d479 (patch)
treea0e7defeee1cf81faf3f9d9f9d78b3465c9d82a7 /src/components/Mixins/TableDataFormatterMixin.js
parent54c6bfc2d40def4db1bc3a13ab92ee71091b1e4f (diff)
downloadwebui-vue-386df45f71ecbdac5ef7b8d828010ac48587d479.tar.xz
Update TableDataFormatter filename
Changed TableDataFormatter to TableDataFormatterMixin to be consistent with other Mixin files. Signed-off-by: Yoshie Muranaka <yoshiemuranaka@gmail.com> Change-Id: Iae6528deda3099cf730150164739ee2fb64bbfe3
Diffstat (limited to 'src/components/Mixins/TableDataFormatterMixin.js')
-rw-r--r--src/components/Mixins/TableDataFormatterMixin.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/components/Mixins/TableDataFormatterMixin.js b/src/components/Mixins/TableDataFormatterMixin.js
new file mode 100644
index 00000000..77db7de9
--- /dev/null
+++ b/src/components/Mixins/TableDataFormatterMixin.js
@@ -0,0 +1,28 @@
+const TableDataFormatterMixin = {
+ methods: {
+ tableFormatter(value) {
+ if (value === undefined || value === null || value === '') {
+ return '--';
+ } else {
+ return value;
+ }
+ },
+ statusIcon(status) {
+ switch (status) {
+ case 'OK':
+ return 'success';
+ case 'Warning':
+ return 'warning';
+ case 'Critical':
+ return 'danger';
+ default:
+ return '';
+ }
+ },
+ tableFormatterArray(value) {
+ return value.join(', ');
+ }
+ }
+};
+
+export default TableDataFormatterMixin;