Add and sync the last change column to use coalesce sorting

This commit is contained in:
Jože Fortun
2022-12-01 10:46:24 +01:00
parent 79dc5b9a70
commit 4e6ab9705a
13 changed files with 94 additions and 37 deletions
+6 -2
View File
@@ -10,7 +10,7 @@ export default {
filter: {},
pagination: {
limit: 10,
limit: 12,
pageCursor: undefined,
prevPage: '',
nextPage: '',
@@ -123,9 +123,13 @@ export default {
}, 300),
encodeListParams () {
const { sortBy, sortDesc } = this.sorting
let { sortBy, sortDesc } = this.sorting
const { limit, pageCursor } = this.pagination
if (sortBy === 'changedAt') {
sortBy = 'coalesce(deletedAt, updatedAt, createdAt)'
}
const sort = sortBy ? `${sortBy} ${sortDesc ? 'DESC' : 'ASC'}` : undefined
return {
@@ -92,8 +92,8 @@
/>
</template>
<template #updatedAt="{ item }">
{{ (item.updatedAt || item.createdAt) | locFullDateTime }}
<template #changedAt="{ item }">
{{ (item.deletedAt || item.updatedAt || item.createdAt) | locFullDateTime }}
</template>
</c-resource-list>
</b-col>
@@ -159,15 +159,18 @@ export default {
return [
{
key: 'name',
label: this.$t('chart.columns.name'),
sortable: true,
tdClass: 'text-nowrap',
},
{
key: 'handle',
label: this.$t('chart.columns.handle'),
sortable: true,
},
{
key: 'updatedAt',
key: 'changedAt',
label: this.$t('chart.columns.changedAt'),
sortable: true,
class: 'text-right text-nowrap',
},
@@ -145,8 +145,8 @@
</div>
</template>
<template #updatedAt="{ item }">
{{ (item.updatedAt || item.createdAt) | locFullDateTime }}
<template #changedAt="{ item }">
{{ (item.deletedAt || item.updatedAt || item.createdAt) | locFullDateTime }}
</template>
</c-resource-list>
</b-col>
@@ -214,15 +214,18 @@ export default {
return [
{
key: 'name',
label: this.$t('list.columns.name'),
sortable: true,
tdClass: 'text-nowrap',
},
{
key: 'handle',
label: this.$t('list.columns.handle'),
sortable: true,
},
{
key: 'updatedAt',
key: 'changedAt',
label: this.$t('list.columns.changedAt'),
sortable: true,
class: 'text-right text-nowrap',
},
@@ -83,18 +83,15 @@
/>
</div>
</template>
<template #name="{ item }">
{{ item.name }}
<b-badge
v-if="!item.enabled"
variant="warning"
>
{{ $t('disabled') }}
</b-badge>
<template #enabled="{ item }">
<font-awesome-icon
:icon="['fas', item.enabled ? 'check' : 'times']"
/>
</template>
<template #updatedAt="{ item }">
{{ (item.updatedAt || item.createdAt) | locFullDateTime }}
<template #changedAt="{ item }">
{{ (item.deletedAt || item.updatedAt || item.createdAt) | locFullDateTime }}
</template>
</c-resource-list>
</b-row>
@@ -124,13 +121,17 @@ export default {
return {
primaryKey: 'namespaceID',
pagination: {
limit: 13,
},
filter: {
query: '',
},
sorting: {
sortBy: 'createdAt',
sortDesc: true,
sortBy: 'name',
sortDesc: false,
},
}
},
@@ -172,14 +173,24 @@ export default {
{
key: 'slug',
sortable: true,
label: this.$t('table.columns.slug'),
class: 'text-nowrap',
label: this.$t('table.columns.handle'),
},
{
key: 'updatedAt',
key: 'enabled',
label: this.$t('table.columns.enabled'),
class: 'text-center',
},
{
key: 'changedAt',
sortable: true,
class: 'text-nowrap',
label: this.$t('table.columns.last-change'),
label: this.$t('table.columns.changedAt'),
class: 'text-right text-nowrap',
},
{
key: 'actions',
label: '',
tdClass: 'text-right text-nowrap',
},
]
},
@@ -10,7 +10,7 @@ export default {
filter: {},
pagination: {
limit: 10,
limit: 12,
pageCursor: undefined,
prevPage: '',
nextPage: '',
@@ -123,9 +123,13 @@ export default {
}, 300),
encodeListParams () {
const { sortBy, sortDesc } = this.sorting
let { sortBy, sortDesc } = this.sorting
const { limit, pageCursor } = this.pagination
if (sortBy === 'changedAt') {
sortBy = 'coalesce(deletedAt, updatedAt, createdAt)'
}
const sort = sortBy ? `${sortBy} ${sortDesc ? 'DESC' : 'ASC'}` : undefined
return {
@@ -54,8 +54,8 @@
{{ r.meta.name }}
</template>
<template #updatedAt="{ item }">
{{ (item.updatedAt || item.createdAt) | locFullDateTime }}
<template #changedAt="{ item }">
{{ (item.deletedAt || item.updatedAt || item.createdAt) | locFullDateTime }}
</template>
<template #actions="{ item: r }">
@@ -122,8 +122,8 @@ export default {
},
sorting: {
sortBy: 'updatedAt',
sortDesc: true,
sortBy: 'name',
sortDesc: false,
},
}
},
@@ -145,14 +145,18 @@ export default {
return [
{
key: 'name',
label: this.$t('columns.name'),
sortable: true,
tdClass: 'text-nowrap',
},
{
key: 'handle',
label: this.$t('columns.handle'),
sortable: true,
},
{
key: 'updatedAt',
key: 'changedAt',
label: this.$t('columns.changedAt'),
sortable: true,
class: 'text-right text-nowrap',
},
@@ -10,7 +10,7 @@ export default {
filter: {},
pagination: {
limit: 10,
limit: 11,
pageCursor: undefined,
prevPage: '',
nextPage: '',
@@ -123,9 +123,13 @@ export default {
}, 300),
encodeListParams () {
const { sortBy, sortDesc } = this.sorting
let { sortBy, sortDesc } = this.sorting
const { limit, pageCursor } = this.pagination
if (sortBy === 'changedAt') {
sortBy = 'coalesce(deletedAt, updatedAt, createdAt)'
}
const sort = sortBy ? `${sortBy} ${sortDesc ? 'DESC' : 'ASC'}` : undefined
return {
@@ -130,8 +130,8 @@
/>
</template>
<template #updatedAt="{ item }">
{{ (item.updatedAt || item.createdAt) | locFullDateTime }}
<template #changedAt="{ item }">
{{ (item.deletedAt || item.updatedAt || item.createdAt) | locFullDateTime }}
</template>
<template #actions="{ item: w }">
@@ -212,17 +212,19 @@ export default {
return [
{
key: 'handle',
label: this.$t('general:name'),
label: this.$t('general:columns.name'),
sortable: true,
tdClass: 'text-nowrap',
},
{
key: 'enabled',
label: this.$t('general:columns.enabled'),
sortable: true,
class: 'text-center',
},
{
key: 'steps',
label: this.$t('general:columns.steps'),
tdClass: 'align-middle',
class: 'text-center',
formatter: steps => {
@@ -230,7 +232,8 @@ export default {
},
},
{
key: 'updatedAt',
key: 'changedAt',
label: this.$t('general:columns.changedAt'),
sortable: true,
class: 'text-right text-nowrap',
},
@@ -71,6 +71,10 @@ chart:
addGauge: Gauge chart
addGeneric: Generic chart
createFailed: Could not create a chart
columns:
name: Name
handle: Handle
changedAt: Last change
configure:
label: Configure chart
reportLabel: Report {{l}}
@@ -193,6 +193,12 @@ newPlaceholder: Name used on the list of modules
noModule: No modules
noModuleFilter: No module matches your search
list:
columns:
name: Name
handle: Handle
changedAt: Last change
recordPage:
create: Create record page
edit: Edit record page
@@ -73,3 +73,5 @@ manage:
sidebar:
configure: Namespace pages
hide: Hide sidebar on namespace public pages
slug: Short name
enabled: Enabled
@@ -9,3 +9,7 @@ title: Reports
tooltip:
permissions: Report permissions
untitledTitle: Untitled report
columns:
name: Name
handle: Handle
changedAt: Last change
@@ -46,3 +46,8 @@ resourceList:
tooltip:
permissions: Workflow permissions
columns:
name: Name
enabled: Enabled
steps: Steps
changedAt: Last change