Fix gauge text labels
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
import { mapGetters, mapActions } from 'vuex'
|
||||
import { chartConstructor } from 'corteza-webapp-compose/src/lib/charts'
|
||||
import { compose, NoID } from '@cortezaproject/corteza-js'
|
||||
import { components } from '@cortezaproject/corteza-vue'
|
||||
@@ -80,6 +80,10 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
...mapActions({
|
||||
resolveUsers: 'user/resolveUsers',
|
||||
}),
|
||||
|
||||
async updateChart () {
|
||||
this.renderer = undefined
|
||||
|
||||
@@ -121,7 +125,7 @@ export default {
|
||||
if (field && ['User', 'Record'].includes(field.kind)) {
|
||||
if (field.kind === 'User') {
|
||||
// Fetch and map users to labels
|
||||
await this.$store.dispatch('user/fetchUsers', data.labels)
|
||||
await this.resolveUsers(data.labels)
|
||||
data.labels = data.labels.map(label => {
|
||||
return field.formatter(this.getUserByID(label)) || label
|
||||
})
|
||||
|
||||
@@ -267,7 +267,7 @@ export default {
|
||||
|
||||
methods: {
|
||||
...mapActions({
|
||||
resolveUsers: 'user/fetchUsers',
|
||||
resolveUsers: 'user/resolveUsers',
|
||||
addUserToResolved: 'user/push',
|
||||
}),
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ export default {
|
||||
const { pageID = NoID } = this.page
|
||||
const { recordID = NoID } = this.record || {}
|
||||
// Construct its uniqueID to identify it
|
||||
const recordListUniqueID = [pageID, recordID, drillDown.blockID].map(v => v || NoID).join('-')
|
||||
const recordListUniqueID = [pageID, recordID, drillDown.blockID, false].map(v => v || NoID).join('-')
|
||||
|
||||
this.$root.$emit(`drill-down-recordList:${recordListUniqueID}`, prefilter)
|
||||
} else {
|
||||
|
||||
@@ -225,13 +225,6 @@ export default {
|
||||
return user.name || user.handle || user.email || ''
|
||||
},
|
||||
|
||||
fetchUsers () {
|
||||
const userListID = this.records.map(r => {
|
||||
return r.ownedBy
|
||||
}).filter((x, i, r) => r.indexOf(x) === i)
|
||||
this.$store.dispatch('user/fetchUsers', userListID)
|
||||
},
|
||||
|
||||
refresh () {
|
||||
if (!this.options.moduleID) {
|
||||
// Make sure block is properly configured
|
||||
@@ -242,7 +235,7 @@ export default {
|
||||
this.fetchRecords(this.roModule, this.expandFilter())
|
||||
.then(rr => {
|
||||
this.records = rr
|
||||
this.fetchUsers()
|
||||
this.fetchUsers([{ name: 'ownedBy', kind: 'User', isSystem: true, isMulti: false }], this.records)
|
||||
})
|
||||
.catch(e => {
|
||||
console.error(e)
|
||||
|
||||
@@ -177,7 +177,7 @@ export default {
|
||||
const { pageID = NoID } = this.page
|
||||
const { recordID = NoID } = this.record || {}
|
||||
// Construct its uniqueID to identify it
|
||||
const recordListUniqueID = [pageID, recordID, drillDown.blockID].map(v => v || NoID).join('-')
|
||||
const recordListUniqueID = [pageID, recordID, drillDown.blockID, false].map(v => v || NoID).join('-')
|
||||
this.$root.$emit(`drill-down-recordList:${recordListUniqueID}`, filter)
|
||||
} else {
|
||||
// Open in modal
|
||||
|
||||
@@ -36,6 +36,8 @@
|
||||
v-model="options.fontSize"
|
||||
type="number"
|
||||
placeholder="16"
|
||||
min="0.1"
|
||||
step="0.1"
|
||||
class="mb-1"
|
||||
/>
|
||||
</b-form-group>
|
||||
|
||||
@@ -299,10 +299,13 @@
|
||||
style="top: 0;"
|
||||
>
|
||||
<b-button
|
||||
variant="outline-primary"
|
||||
:title="$t('metric.edit.refreshData')"
|
||||
variant="outline-light"
|
||||
size="lg"
|
||||
class="d-flex align-items-center text-primary ml-auto border-0 px-2 mt-2 mr-2"
|
||||
@click.prevent="$root.$emit('metric.update')"
|
||||
>
|
||||
{{ $t('metric.edit.refreshData') }}
|
||||
<font-awesome-icon :icon="['fa', 'sync']" />
|
||||
</b-button>
|
||||
|
||||
<div
|
||||
|
||||
@@ -80,7 +80,7 @@ export default {
|
||||
this.page.blocks.forEach((b, index) => {
|
||||
if (b.kind === 'RecordList' && b.options.editable) {
|
||||
const p = new Promise((resolve) => {
|
||||
const recordListUniqueID = [this.page.pageID, (this.record || {}).recordID || NoID, b.blockID].map(v => v || NoID).join('-')
|
||||
const recordListUniqueID = [this.page.pageID, (this.record || {}).recordID, b.blockID, false].map(v => v || NoID).join('-')
|
||||
this.$root.$emit(`record-line:collect:${recordListUniqueID}`, resolve)
|
||||
})
|
||||
|
||||
|
||||
@@ -268,6 +268,10 @@
|
||||
</editor-toolbar>
|
||||
</portal>
|
||||
|
||||
<record-modal
|
||||
:namespace="namespace"
|
||||
/>
|
||||
|
||||
<magnification-modal
|
||||
:namespace="namespace"
|
||||
/>
|
||||
@@ -284,6 +288,7 @@ import PageBlock from 'corteza-webapp-compose/src/components/PageBlocks'
|
||||
import EditorToolbar from 'corteza-webapp-compose/src/components/Admin/EditorToolbar'
|
||||
import { compose, NoID } from '@cortezaproject/corteza-js'
|
||||
import Configurator from 'corteza-webapp-compose/src/components/PageBlocks/Configurator'
|
||||
import RecordModal from 'corteza-webapp-compose/src/components/Public/Record/Modal'
|
||||
import MagnificationModal from 'corteza-webapp-compose/src/components/Public/Page/Block/Modal'
|
||||
import { fetchID } from 'corteza-webapp-compose/src/lib/block'
|
||||
|
||||
@@ -299,6 +304,7 @@ export default {
|
||||
PageBlock,
|
||||
EditorToolbar,
|
||||
PageTranslator,
|
||||
RecordModal,
|
||||
MagnificationModal,
|
||||
},
|
||||
|
||||
@@ -731,7 +737,8 @@ export default {
|
||||
this.usedBlocks.forEach((b, index) => {
|
||||
if (b.kind === 'RecordList' && b.options.editable) {
|
||||
const p = new Promise((resolve) => {
|
||||
const recordListUniqueID = [this.page.pageID, (this.record || {}).recordID || NoID, b.blockID].map(v => v || NoID).join('-')
|
||||
const recordListUniqueID = [this.page.pageID, (this.record || {}).recordID, b.blockID, false].map(v => v || NoID).join('-')
|
||||
console.log(`page-block:validate:${recordListUniqueID}`)
|
||||
this.$root.$emit(`page-block:validate:${recordListUniqueID}`, resolve)
|
||||
})
|
||||
|
||||
|
||||
@@ -15,8 +15,8 @@ export default class GaugeChart extends BaseChart {
|
||||
// Assure required fields
|
||||
for (const v of (this.config.reports || []) as Array<Report>) {
|
||||
for (const d of (v.dimensions || []) as Array<Dimension>) {
|
||||
// Since gauge produces one value we want one dataset, deletedBy is the same for all existing records
|
||||
d.field = 'deletedBy'
|
||||
// Since gauge produces one value we want one dataset, deletedAt is the same for all existing records
|
||||
d.field = 'deletedAt'
|
||||
|
||||
if (!d.meta) {
|
||||
d.meta = {}
|
||||
|
||||
@@ -120,7 +120,8 @@ export class PageBlockMetric extends PageBlock {
|
||||
moduleID,
|
||||
filter,
|
||||
metrics,
|
||||
dimensions: dimensionFunctions.convert({ modifier: 'YEAR', field: 'createdAt' }),
|
||||
// Since metric produces one value we want one dataset, deletedAt is the same for all existing records
|
||||
dimensions: 'deletedAt',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user