Unverified Commit 5efbc138 authored by BojanSovticEngIT's avatar BojanSovticEngIT Committed by GitHub
Browse files

[KNOWAGE-7124][KNOWAGE-7127][KNOWAGE-7126][KNOWAGE-7123][KNOWAGE-7129]

parent 7f703fcb
......@@ -149,6 +149,10 @@ export default defineComponent({
})
this.cf = { formula: '' } as IKnCalculatedField
if (!this.readOnly && this.template && !this.template.parameters && this.source === 'QBE') {
this.cf = { colName: this.template.alias, formula: this.template.expression } as IKnCalculatedField
}
},
updated() {
......
......@@ -36,7 +36,7 @@ export function buildCalculatedField(calcFieldOutput, selectedQueryFields) {
calculatedField.id.expressionSimple = cleanExpression(calculatedField.id.expressionSimple)
calculatedField.formula = cleanExpression(addedParameters.expression)
calculatedField.expression = cleanExpression(addedParameters.expressionSimple)
calculatedField.longDescription = cleanExpression(addedParameters.expression)
calculatedField.longDescription = cleanExpression(addedParameters.alias + ' : ' + addedParameters.alias)
return calculatedField
}
......
......@@ -73,7 +73,9 @@ export interface iField {
longDescription: string
order: string
type: string
visible: boolean
visible: boolean,
attributes?: any,
originalId?: string
}
export interface iQueryResult {
......
......@@ -85,6 +85,7 @@
@entityDropped="onDropComplete($event, false)"
@groupingChanged="onGroupingChanged"
@openCalculatedFieldDialog="editCalcField"
@fieldDeleted="onFieldDeleted"
></QBESimpleTable>
<QBESmartTable
v-else
......@@ -694,7 +695,8 @@ export default defineComponent({
format: field.format,
longDescription: field.attributes.longDescription,
distinct: editQueryObj.distinct,
leaf: field.leaf
leaf: field.leaf,
originalId: field.id
} as any
}
// eslint-disable-next-line no-prototype-builtins
......@@ -805,6 +807,7 @@ export default defineComponent({
let indexOfFieldToDelete = this.selectedQuery.fields.findIndex((field) => {
return field.uniqueID === uniqueID
})
this.onFieldDeleted({ ...this.selectedQuery.fields[indexOfFieldToDelete] })
this.selectedQuery.fields.splice(indexOfFieldToDelete, 1)
this.updateSmartView()
},
......@@ -865,6 +868,13 @@ export default defineComponent({
this.userRole = role as any
this.filtersData = {}
await this.loadPage()
},
onFieldDeleted(field: any) {
for (let i = this.selectedQuery.havings.length - 1; i >= 0; i--) {
if (this.selectedQuery.havings[i].leftOperandValue === field.id) {
this.selectedQuery.havings.splice(i, 1)
}
}
}
}
})
......
......@@ -95,6 +95,18 @@ export default defineComponent({
}
})
this.nextFilterIndex = crypto.randomBytes(16).toString('hex')
if (this.filterDialogData.field.type === 'inline.calculated.field') {
this.setCalculatedFieldLongDescription(this.filterDialogData.field, this.filterDialogData.field.originalId as string)
} else if (this.filterDialogData.field.attributes?.type === 'inLineCalculatedField') {
this.setCalculatedFieldLongDescription(this.filterDialogData.field, this.filterDialogData.field.id)
}
},
setCalculatedFieldLongDescription(field: any, id: string | null) {
if (id) {
const temp = id.substring(id.lastIndexOf('.') + 1)
const tempSplitted = temp.split(':')
field.longDescription = tempSplitted[0] + ' : ' + tempSplitted[1]
}
},
loadParameters() {
this.parameters = this.propParameters ? [...this.propParameters] : []
......@@ -116,10 +128,10 @@ export default defineComponent({
filterDescripion: 'Filter' + this.nextFilterIndex,
filterInd: this.nextFilterIndex,
promptable: false,
leftOperandValue: field.id,
leftOperandValue: this.filterDialogData?.field.attributes?.type === 'inLineCalculatedField' ? this.filterDialogData?.field.attributes.formState : field.id,
leftOperandDescription: field.longDescription ?? field.attributes.longDescription,
leftOperandLongDescription: field.longDescription ?? field.attributes.longDescription,
leftOperandType: 'Field Content',
leftOperandType: this.filterDialogData?.field.type === 'inline.calculated.field' || this.filterDialogData?.field.attributes?.type === 'inLineCalculatedField' ? 'inline.calculated.field' : 'Field Content',
leftOperandDefaultValue: null,
leftOperandLastValue: null,
leftOperandAlias: field.alias ?? field.attributes.field,
......@@ -183,7 +195,7 @@ export default defineComponent({
}
},
temporalFiltersEnabled() {
return (this.$store.state as any).user.functionalities.includes('Timespan') && (this.filterDialogData?.field.dataType.toLowerCase() === 'java.sql.date' || this.filterDialogData?.field.dataType.toLowerCase() === 'java.sql.timestamp')
return (this.$store.state as any).user.functionalities.includes('Timespan') && (this.filterDialogData?.field.dataType?.toLowerCase() === 'java.sql.date' || this.filterDialogData?.field.dataType?.toLowerCase() === 'java.sql.timestamp')
},
async openTemporalFilterDialog() {
await this.$http.get(process.env.VUE_APP_RESTFUL_SERVICES_PATH + `1.0/timespan/listTimespan/?types=DAY_OF_WEEK&types=DAY_OF_WEEK&types=DAY_OF_WEEK`).then((response: AxiosResponse<any>) => (this.temporalFilters = response.data.data))
......@@ -197,13 +209,13 @@ export default defineComponent({
filterDescripion: 'Filter' + this.nextFilterIndex,
filterInd: this.nextFilterIndex,
promptable: false,
leftOperandValue: this.filterDialogData?.field.id,
leftOperandDescription: this.filterDialogData?.field.longDescription,
leftOperandLongDescription: this.filterDialogData?.field.longDescription,
leftOperandType: 'Field Content',
leftOperandValue: this.filterDialogData?.field.attributes?.type === 'inLineCalculatedField' ? this.filterDialogData?.field.attributes.formState : this.filterDialogData?.field.id,
leftOperandDescription: this.filterDialogData?.field.longDescription ?? this.filterDialogData?.field.attributes.longDescription,
leftOperandLongDescription: this.filterDialogData?.field.longDescription ?? this.filterDialogData?.field.attributes.longDescription,
leftOperandType: this.filterDialogData?.field.type === 'inline.calculated.field' || this.filterDialogData?.field.attributes?.type === 'inLineCalculatedField' ? 'inline.calculated.field' : 'Field Content',
leftOperandDefaultValue: null,
leftOperandLastValue: null,
leftOperandAlias: this.filterDialogData?.field.alias,
leftOperandAlias: this.filterDialogData?.field.alias ?? this.filterDialogData?.field.attributes.field,
leftOperandDataType: '',
operator: 'BETWEEN',
rightType: 'manual',
......
......@@ -80,7 +80,7 @@ export default defineComponent({
leftOperandValue: field.id,
leftOperandDescription: field.entity + ': ' + field.funct + ' (' + field.alias + ')',
leftOperandLongDescription: field.entity + ': ' + field.funct + ' (' + field.alias + ')',
leftOperandType: 'Field Content',
leftOperandType: field.type === 'inline.calculated.field' || field.attributes?.type === 'inLineCalculatedField' ? 'inline.calculated.field' : 'Field Content',
leftOperandDefaultValue: null,
leftOperandLastValue: null,
operator: 'EQUALS TO',
......
......@@ -38,7 +38,7 @@ export default defineComponent({
name: 'qbe-simple-table',
props: { query: { type: Object as PropType<iQuery> } },
components: { Checkbox, Column, DataTable, Dropdown, Menu },
emits: ['columnVisibilityChanged', 'openFilterDialog', 'openHavingDialog', 'entityDropped', 'groupingChanged', 'openCalculatedFieldDialog'],
emits: ['columnVisibilityChanged', 'openFilterDialog', 'openHavingDialog', 'entityDropped', 'groupingChanged', 'openCalculatedFieldDialog', 'fieldDeleted'],
data() {
return {
QBESimpleTableDescriptor,
......@@ -118,6 +118,7 @@ export default defineComponent({
this.$emit('groupingChanged', field)
},
deleteColumn(index: number) {
this.$emit('fieldDeleted', { ...this.rows[index] })
this.rows.splice(index, 1)
}
}
......
......@@ -51,6 +51,7 @@
<template #body="slotProps">
<span v-if="typeof slotProps.data[`column_${index + 1}`] === 'number' && slotProps.data[`column_${index + 1}`]"> {{ getFormattedNumber(slotProps.data[`column_${index + 1}`]) }}</span>
<span v-if="previewData?.metaData?.fields[index + 1]?.type === 'date' && col.type != 'inline.calculated.field'">{{ getFormattedDate(slotProps.data[`column_${index + 1}`], previewData.metaData.fields[index + 1].metawebDateFormat, 'DD/MM/YYYY') }} </span>
<span v-else-if="previewData?.metaData?.fields[index + 1]?.type === 'date' && col.type == 'inline.calculated.field'">{{ getFormattedDate(slotProps.data[`column_${index + 1}`], col.id.format, 'DD/MM/YYYY') }} </span>
<span v-else-if="previewData?.metaData?.fields[index + 1]?.type === 'timestamp' && col.type != 'inline.calculated.field'">{{ getFormattedDate(slotProps.data[`column_${index + 1}`], previewData.metaData.fields[index + 1].metawebDateFormat, 'DD/MM/YYYY HH:mm:ss.SSS') }} </span>
<span v-else-if="previewData?.metaData?.fields[index + 1]?.type === 'timestamp' && col.type == 'inline.calculated.field'">{{ getFormattedDate(slotProps.data[`column_${index + 1}`], col.id.format, 'DD/MM/YYYY HH:mm:ss.SSS') }} </span>
<span v-else v-tooltip.bottom="slotProps.data[`column_${index + 1}`]">{{ slotProps.data[`column_${index + 1}`] }}</span>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment