Web: use title case in status indicator
This commit is contained in:
parent
1cf3cb3344
commit
cfab4f5b76
@ -11,6 +11,7 @@
|
|||||||
import { TabulatorFull as Tabulator } from 'tabulator-tables';
|
import { TabulatorFull as Tabulator } from 'tabulator-tables';
|
||||||
import * as datetime from "@/datetime";
|
import * as datetime from "@/datetime";
|
||||||
import * as API from '@/manager-api'
|
import * as API from '@/manager-api'
|
||||||
|
import { toTitleCase } from '@/strings';
|
||||||
import { apiClient } from '@/stores/api-query-count';
|
import { apiClient } from '@/stores/api-query-count';
|
||||||
|
|
||||||
import JobActionsBar from '@/components/JobActionsBar.vue'
|
import JobActionsBar from '@/components/JobActionsBar.vue'
|
||||||
@ -29,7 +30,8 @@ export default {
|
|||||||
title: 'Status', field: 'status', sorter: 'string',
|
title: 'Status', field: 'status', sorter: 'string',
|
||||||
formatter(cell, formatterParams) { // eslint-disable-line no-unused-vars
|
formatter(cell, formatterParams) { // eslint-disable-line no-unused-vars
|
||||||
const cellValue = cell.getData();
|
const cellValue = cell.getData();
|
||||||
return '<span title="' + cellValue.status + '" class="indicator status-' + cellValue.status + '"></span>';
|
const label = toTitleCase(cellValue.status);
|
||||||
|
return `<span title="${label}" class="indicator status-${cellValue.status}"></span>`;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ title: 'Name', field: 'name', sorter: 'string' },
|
{ title: 'Name', field: 'name', sorter: 'string' },
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
import { TabulatorFull as Tabulator } from 'tabulator-tables';
|
import { TabulatorFull as Tabulator } from 'tabulator-tables';
|
||||||
import * as datetime from "@/datetime";
|
import * as datetime from "@/datetime";
|
||||||
import * as API from '@/manager-api'
|
import * as API from '@/manager-api'
|
||||||
|
import { toTitleCase } from '@/strings';
|
||||||
import { apiClient } from '@/stores/api-query-count';
|
import { apiClient } from '@/stores/api-query-count';
|
||||||
import { useTasks } from '@/stores/tasks';
|
import { useTasks } from '@/stores/tasks';
|
||||||
|
|
||||||
@ -31,7 +32,8 @@ export default {
|
|||||||
title: 'Status', field: 'status', sorter: 'string',
|
title: 'Status', field: 'status', sorter: 'string',
|
||||||
formatter(cell, formatterParams) { // eslint-disable-line no-unused-vars
|
formatter(cell, formatterParams) { // eslint-disable-line no-unused-vars
|
||||||
const cellValue = cell.getData();
|
const cellValue = cell.getData();
|
||||||
return '<span title="' + cellValue.status + '" class="indicator status-' + cellValue.status + '"></span>';
|
const label = toTitleCase(cellValue.status);
|
||||||
|
return `<span title="${label}" class="indicator status-${cellValue.status}"></span>`;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ title: 'Name', field: 'name', sorter: 'string' },
|
{ title: 'Name', field: 'name', sorter: 'string' },
|
||||||
|
7
web/app/src/strings.js
Normal file
7
web/app/src/strings.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
export function toTitleCase(str) {
|
||||||
|
return str
|
||||||
|
.toLowerCase()
|
||||||
|
.split(' ')
|
||||||
|
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
||||||
|
.join(' ');
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user