Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix KNOWAGE-7679 #925

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
e1487f8
Bugfix KNOWAGE-8373
BojanSovticEngIT Jan 22, 2024
1897300
Reverted changes for KNOWAGE-8374
BojanSovticEngIT Jan 22, 2024
dce9031
Merge remote-tracking branch 'upstream/knowage-server-8.1' into dashb…
BojanSovticEngIT Jan 22, 2024
0e987b6
Bugfix KNOWAGE-8374
BojanSovticEngIT Jan 22, 2024
2374ccf
Merge remote-tracking branch 'upstream/knowage-server-8.1' into dashb…
BojanSovticEngIT Apr 19, 2024
fb50f34
Possible bugfix KNOWAGE-8460
BojanSovticEngIT Apr 19, 2024
b6a77de
Merge branch 'knowage-server-8.1' of https://github.com/KnowageLabs/K…
BojanSovticEngIT Jul 19, 2024
6b8cfa1
Possible bugfix KNOWAGE-8571
BojanSovticEngIT Jul 19, 2024
b5b9d74
Possible Bugfix KNOWAGE-8586
BojanSovticEngIT Jul 26, 2024
f3e682c
Merge branch 'knowage-server-8.1' into dashboard-sprint-15-bugfix-8.1
Redjaw Jul 26, 2024
449ffec
Bugfix KNOWAGE-8560
BojanSovticEngIT Jul 26, 2024
8f1ceb6
Possible bugfix KNOWAGE-8571
BojanSovticEngIT Aug 1, 2024
6df16c7
Merge branch 'knowage-server-8.1' into dashboard-sprint-15-bugfix-8.1
Redjaw Aug 1, 2024
d68687c
Bugfix KNOWAGE-8571
BojanSovticEngIT Aug 6, 2024
1c2f340
Merge branch 'dashboard-sprint-15-bugfix-8.1' of https://github.com/v…
BojanSovticEngIT Aug 6, 2024
5e73985
Merge branch 'knowage-server-8.1' into dashboard-sprint-15-bugfix-8.1
Redjaw Aug 6, 2024
07db227
Possible bugfix KNOWAGE-8543
BojanSovticEngIT Aug 6, 2024
8179c0c
Merge branch 'dashboard-sprint-15-bugfix-8.1' of https://github.com/v…
BojanSovticEngIT Aug 6, 2024
a53160b
Possible bugfix KNOWAGE-7893
BojanSovticEngIT Aug 6, 2024
260ccb5
Bugfix KNOWAGE-7679
BojanSovticEngIT Aug 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { luxonFormatDate } from '@/helpers/commons/localeHelper';
import { luxonFormatDate } from '@/helpers/commons/localeHelper'
import { AxiosResponse } from 'axios'
import { iParameter } from './KnParameterSidebar'

Expand Down Expand Up @@ -29,7 +29,7 @@ export async function dataDependencyCheck(loadedParameters: { filterStatus: iPar
loading = true

resetParameterValueToEmptyValues(parameter)
if (resetValue) return
if (resetValue || !parameter.parameterValue?.[0]?.value) return

const postData = { label: document?.label, parameters: getFormattedParameters(loadedParameters, userDateFormat), paramId: parameter.urlName, role: sessionRole }
let url = '2.0/documentExeParameters/admissibleValues'
Expand Down Expand Up @@ -95,7 +95,7 @@ const getValueAndDescriptionIndex = (parameter: iParameter) => {
return { valueIndex: valueIndex ?? '', descriptionIndex: descriptionIndex ?? '' }
}

export function getFormattedParameters(loadedParameters: { filterStatus: iParameter[], isReadyForExecution: boolean }, userDateFormat: string) {
export function getFormattedParameters(loadedParameters: { filterStatus: iParameter[]; isReadyForExecution: boolean }, userDateFormat: string) {
let parameters = [] as any[]

Object.keys(loadedParameters.filterStatus).forEach((key: any) => {
Expand All @@ -104,8 +104,7 @@ export function getFormattedParameters(loadedParameters: { filterStatus: iParame
if (parameter.type === 'DATE') {
const dateValue = getFormattedDateParameterValue(parameter, userDateFormat)
parameters.push({ urlName: parameter.urlName, value: dateValue, description: dateValue })
}
else if (!parameter.multivalue) {
} else if (!parameter.multivalue) {
if (!parameter.parameterValue[0]) parameter.parameterValue[0] = { value: '', description: '' }
parameters.push({ urlName: parameter.urlName, value: parameter.parameterValue[0].value, description: parameter.parameterValue[0].description })
} else {
Expand Down Expand Up @@ -154,14 +153,16 @@ export function addDefaultValueForSelectionTypeParameters(parameter: iParameter)
}
}

function addSingleDriverDefaultValue(parameter: iParameter, valueAndDescriptionIndex: { valueIndex: string, descriptionIndex: string }) {
function addSingleDriverDefaultValue(parameter: iParameter, valueAndDescriptionIndex: { valueIndex: string; descriptionIndex: string }) {
if (!parameter.driverDefaultValue[0]) return
parameter.parameterValue = [{ value: parameter.driverDefaultValue[0][valueAndDescriptionIndex.valueIndex], description: parameter.driverDefaultValue[0][valueAndDescriptionIndex.descriptionIndex] }]
removeNonCompatibleParameterValues(parameter)
}

function addMultiDriverDefaultValue(parameter: iParameter, valueAndDescriptionIndex: { valueIndex: string, descriptionIndex: string }) {
parameter.parameterValue = parameter.driverDefaultValue.map((defaultValue: any) => { return { value: defaultValue[valueAndDescriptionIndex.valueIndex], description: defaultValue[valueAndDescriptionIndex.descriptionIndex] } })
function addMultiDriverDefaultValue(parameter: iParameter, valueAndDescriptionIndex: { valueIndex: string; descriptionIndex: string }) {
parameter.parameterValue = parameter.driverDefaultValue.map((defaultValue: any) => {
return { value: defaultValue[valueAndDescriptionIndex.valueIndex], description: defaultValue[valueAndDescriptionIndex.descriptionIndex] }
})
removeNonCompatibleParameterValues(parameter)
}

Expand All @@ -171,4 +172,4 @@ function removeNonCompatibleParameterValues(parameter: iParameter) {
if (index === undefined || index === -1) parameter.parameterValue.splice(i, 1)
}
if (!parameter.multivalue && parameter.parameterValue.length === 0) parameter.parameterValue = [{ value: '', description: '' }]
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { AxiosResponse } from 'axios'
import { iParameter, } from './KnParameterSidebar'
import { iParameter } from './KnParameterSidebar'
import { formatParameterDataOptions, getFormattedParameters, addDefaultValueForSelectionTypeParameters, resetParameterValueToEmptyValues } from './KnParameterSidebarDataDependency'


export function setLovsDependency(loadedParameters: { filterStatus: iParameter[], isReadyForExecution: boolean }, parameter: iParameter) {
export function setLovsDependency(loadedParameters: { filterStatus: iParameter[]; isReadyForExecution: boolean }, parameter: iParameter) {
if (parameter.dependencies.lov.length !== 0) {
parameter.dependencies.lov.forEach((dependency: any) => {
const index = loadedParameters.filterStatus.findIndex((param: any) => {
Expand All @@ -18,19 +17,19 @@ export function setLovsDependency(loadedParameters: { filterStatus: iParameter[]
}
}

export async function updateLovDependency(loadedParameters: { filterStatus: iParameter[], isReadyForExecution: boolean }, parameter: iParameter, loading: boolean, document: any, sessionRole: string | null, $http: any, mode: string, resetValue: boolean, userDateFormat: string) {
export async function updateLovDependency(loadedParameters: { filterStatus: iParameter[]; isReadyForExecution: boolean }, parameter: iParameter, loading: boolean, document: any, sessionRole: string | null, $http: any, mode: string, resetValue: boolean, userDateFormat: string) {
if (parameter && parameter.lovDependentParameters) {
for (let i = 0; i < parameter.lovDependentParameters.length; i++) {
await lovDependencyCheck(loadedParameters, parameter.lovDependentParameters[i], loading, document, sessionRole, $http, mode, resetValue, userDateFormat)
}
}
}

export async function lovDependencyCheck(loadedParameters: { filterStatus: iParameter[], isReadyForExecution: boolean }, parameter: iParameter, loading: boolean, document: any, sessionRole: string | null, $http: any, mode: string, resetValue: boolean, userDateFormat: string) {
export async function lovDependencyCheck(loadedParameters: { filterStatus: iParameter[]; isReadyForExecution: boolean }, parameter: iParameter, loading: boolean, document: any, sessionRole: string | null, $http: any, mode: string, resetValue: boolean, userDateFormat: string) {
loading = true

resetParameterValueToEmptyValues(parameter)
if (resetValue) return
if (resetValue || !parameter.parameterValue?.[0]?.value) return

const postData = { label: document?.label, parameters: getFormattedParameters(loadedParameters, userDateFormat), paramId: parameter.urlName, role: sessionRole }
let url = '2.0/documentExeParameters/admissibleValues'
Expand All @@ -39,11 +38,14 @@ export async function lovDependencyCheck(loadedParameters: { filterStatus: iPara
url = document.type === 'businessModel' ? `1.0/businessmodel/${document.name}/admissibleValues` : `/3.0/datasets/${document.label}/admissibleValues`
}

await $http.post(process.env.VUE_APP_RESTFUL_SERVICES_PATH + url, postData).then((response: AxiosResponse<any>) => {
parameter.data = response.data.result.data
parameter.metadata = response.data.result.metadata
formatParameterAfterDataDependencyCheck(parameter)
}).catch(() => { })
await $http
.post(process.env.VUE_APP_RESTFUL_SERVICES_PATH + url, postData)
.then((response: AxiosResponse<any>) => {
parameter.data = response.data.result.data
parameter.metadata = response.data.result.metadata
formatParameterAfterDataDependencyCheck(parameter)
})
.catch(() => {})
loading = false
}

Expand All @@ -69,4 +71,4 @@ export function formatParameterAfterDataDependencyCheck(parameter: any) {
}

addDefaultValueForSelectionTypeParameters(parameter)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ function checkIfMultivalueDriverContainsCrossNavigationValue(tempParam: any, cro
export function getValidDate(value: string, serverDateFormat: string) {
const extractedDateValue = extractDatePart(value)
let momentDate = moment(deepcopy(extractedDateValue))
const tempServerDateFormat = serverDateFormat.replaceAll('y', 'Y')
const tempServerDateFormat = convertToMomentFormat(serverDateFormat)
const validFormats = [tempServerDateFormat, 'DD/MM/YYYY', 'DD/MM/YYYY HH:mm:ss.SSS']
let tempDateFormatFromTheDateValue = extractDateFormatPart(value)
if (tempDateFormatFromTheDateValue) {
tempDateFormatFromTheDateValue = tempDateFormatFromTheDateValue === 'yyyy-MM-dd' ? 'YYYY-MM-DD' : tempDateFormatFromTheDateValue
tempDateFormatFromTheDateValue = convertToMomentFormat(tempDateFormatFromTheDateValue)
validFormats.unshift(tempDateFormatFromTheDateValue)
}
for (let i = 0; i < validFormats.length; i++) {
Expand All @@ -58,6 +58,10 @@ export function getValidDate(value: string, serverDateFormat: string) {
return ''
}

function convertToMomentFormat(format: string) {
return format.replace(/yyyy/g, 'YYYY').replace(/dd/g, 'DD').replace(/mm/g, 'MM')
}

function extractDatePart(dateString: string) {
if (dateString.includes('#')) {
return dateString.split('#')[0]
Expand Down
28 changes: 20 additions & 8 deletions knowage-vue/src/modules/documentExecution/olap/Olap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -543,10 +543,7 @@ export default defineComponent({
.post(process.env.VUE_APP_OLAP_PATH + `1.0/axis/moveDimensionToOtherAxis?SBI_EXECUTION_ID=${this.id}`, toSend, { headers: { Accept: 'application/json, text/plain, */*', 'Content-Type': 'application/json;charset=UTF-8' } })
.then((response: AxiosResponse<any>) => {
this.olap = response.data
if (this.olapDesigner && this.olapDesigner.template) {
this.olapDesigner.template.wrappedObject.olap.MDXMondrianQuery.XML_TAG_TEXT_CONTENT = this.olap.MDXWITHOUTCF
this.olapDesigner.template.wrappedObject.olap.MDXQUERY.XML_TAG_TEXT_CONTENT = this.olap.MDXWITHOUTCF
}
if (this.olapDesigner && this.olapDesigner.template) this.updateOlapDesignerWithMDXFromOlap()
})
.catch(() => this.$store.commit('setError', { title: this.$t('common.toast.error'), msg: this.$t('documentExecution.olap.filterToolbar.putFilterOnAxisError') }))
this.formatOlapTable()
Expand All @@ -556,7 +553,10 @@ export default defineComponent({
this.loading = true
await this.$http
.post(process.env.VUE_APP_OLAP_PATH + `1.0/axis/swap?SBI_EXECUTION_ID=${this.id}`, null, { headers: { Accept: 'application/json, text/plain, */*', 'Content-Type': 'application/json;charset=UTF-8' } })
.then((response: AxiosResponse<any>) => (this.olap = response.data))
.then((response: AxiosResponse<any>) => {
this.olap = response.data
if (this.olapDesigner && this.olapDesigner.template) this.updateOlapDesignerWithMDXFromOlap()
})
.catch(() => this.$store.commit('setError', { title: this.$t('common.toast.error'), msg: this.$t('documentExecution.olap.filterToolbar.swapAxisError') }))
this.formatOlapTable()
this.loading = false
Expand All @@ -568,6 +568,7 @@ export default defineComponent({
.post(process.env.VUE_APP_OLAP_PATH + `1.0/axis/moveHierarchy?SBI_EXECUTION_ID=${this.id}`, toSend, { headers: { Accept: 'application/json, text/plain, */*', 'Content-Type': 'application/json;charset=UTF-8' } })
.then((response: AxiosResponse<any>) => {
this.olap = response.data
if (this.olapDesigner && this.olapDesigner.template) this.updateOlapDesignerWithMDXFromOlap()
})
.catch(() => this.$store.commit('setError', { title: this.$t('common.toast.error'), msg: this.$t('documentExecution.olap.filterToolbar.hierarchyMoveError') }))
this.formatOlapTable()
Expand All @@ -589,7 +590,10 @@ export default defineComponent({
this.loading = true
await this.$http
.post(process.env.VUE_APP_OLAP_PATH + `1.0/axis/updateHierarchyOnDimension?SBI_EXECUTION_ID=${this.id}`, toSend, { headers: { Accept: 'application/json, text/plain, */*', 'Content-Type': 'application/json;charset=UTF-8' } })
.then((response: AxiosResponse<any>) => (this.olap = response.data))
.then((response: AxiosResponse<any>) => {
this.olap = response.data
if (this.olapDesigner && this.olapDesigner.template) this.updateOlapDesignerWithMDXFromOlap()
})
.catch(() => this.$store.commit('setError', { title: this.$t('common.toast.error'), msg: this.$t('documentExecution.olap.filterToolbar.hierarchyUpdateError') }))
.finally(() => {
this.formatOlapTable()
Expand Down Expand Up @@ -618,7 +622,10 @@ export default defineComponent({
this.olap.modelConfig.crossNavigation.buttonClicked = crossNavigation
await this.$http
.get(process.env.VUE_APP_OLAP_PATH + `1.0/crossnavigation/initialize/?SBI_EXECUTION_ID=${this.id}`, { headers: { Accept: 'application/json, text/plain, */*', 'Content-Type': 'application/json;charset=UTF-8' } })
.then((response: AxiosResponse<any>) => (this.olap = response.data))
.then((response: AxiosResponse<any>) => {
this.olap = response.data
if (this.olapDesigner && this.olapDesigner.template) this.updateOlapDesignerWithMDXFromOlap()
})
.catch(() => {})
this.formatOlapTable()
this.loading = false
Expand Down Expand Up @@ -867,6 +874,7 @@ export default defineComponent({
await this.drillThrough(event)
break
}
if (this.olapDesigner && this.olapDesigner.template) this.updateOlapDesignerWithMDXFromOlap()
}
},
openFilterDialog(filter: any) {
Expand Down Expand Up @@ -1072,7 +1080,7 @@ export default defineComponent({
group = ''

// separators
parts_local.forEach(function(i) {
parts_local.forEach(function (i) {
switch (i.type) {
case 'group':
group = i.value
Expand Down Expand Up @@ -1138,6 +1146,10 @@ export default defineComponent({
this.formatOlapTable()
this.loadVersions()
this.saveVersionDialogVisible = false
},
updateOlapDesignerWithMDXFromOlap() {
this.olapDesigner.template.wrappedObject.olap.MDXMondrianQuery.XML_TAG_TEXT_CONTENT = this.olap.MDXWITHOUTCF
this.olapDesigner.template.wrappedObject.olap.MDXQUERY.XML_TAG_TEXT_CONTENT = this.olap.MDXWITHOUTCF
}
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</Dropdown>
</div>

<div v-show="filter.operator === 'SPATIAL_NN'" class=" p-ml-2">
<div v-show="filter.operator === 'SPATIAL_NN'" class="p-ml-2">
<label class="kn-material-input-label"> {{ $t('common.parameter') }} </label>
<InputText class="kn-material-input" v-model="filter.operatorParameter" />
</div>
Expand Down Expand Up @@ -121,6 +121,7 @@ import Dropdown from 'primevue/dropdown'
import QBEFilterDialogDescriptor from './QBEFilterDialogDescriptor.json'
import QBEFilterValuesTable from './QBEFilterValuesTable.vue'
import moment from 'moment'
import { localeDate } from '@/helpers/commons/localeHelper'

export default defineComponent({
name: 'qbe-filter-card',
Expand Down Expand Up @@ -179,11 +180,11 @@ export default defineComponent({
loadFilter() {
this.filter = this.propFilter as iFilter

let isEncrypted = false;
let isEncrypted = false
if (this.field.attributes) {
isEncrypted = this.field.attributes.decrypt;
isEncrypted = this.field.attributes.decrypt
} else {
isEncrypted = this.field.decrypt;
isEncrypted = this.field.decrypt
}

if (this.subqueries?.length > 0) {
Expand All @@ -196,9 +197,9 @@ export default defineComponent({
this.formatFilter()

if (isEncrypted) {
this.filterOperatorOptions = this.QBEFilterDialogDescriptor.operatorValues.filter((operator) => operator.allowedWithDecrypt);
this.filterOperatorOptions = this.QBEFilterDialogDescriptor.operatorValues.filter((operator) => operator.allowedWithDecrypt)
} else {
this.filterOperatorOptions = this.QBEFilterDialogDescriptor.operatorValues;
this.filterOperatorOptions = this.QBEFilterDialogDescriptor.operatorValues
}

const tempEntity = this.getEntity() as any
Expand Down Expand Up @@ -307,9 +308,23 @@ export default defineComponent({
},
onManualValueChange() {
if (this.filter) {
const isDateOrTimestamp = ['DATE', 'TIMESTAMP'].includes(this.field?.id?.type)
if (isDateOrTimestamp) this.formatManualDate()
this.filter.rightOperandValue = [this.filter.rightOperandDescription]
}
},
formatManualDate() {
if (!this.filter) return

const serverFormat = 'DD/MM/YYYY hh:mm'
const format = localeDate().replace(/yyyy/g, 'YYYY').replace(/dd/g, 'DD').replace(/d/g, 'D').replace(/MM/g, 'MM').replace(/M/g, 'M').replace(/hh/g, 'HH').replace(/mm/g, 'mm').replace(/ss/g, 'ss').replace(/SSS/g, 'SSS')
const momentDate = moment(this.filter.rightOperandDescription, format, true)

if (momentDate.isValid()) {
const formattedDate = momentDate.format(serverFormat)
this.filter.rightOperandDescription = formattedDate
}
},
onManualBetweenChange() {
if (this.filter) {
this.filter.rightOperandValue = [this.firstOperand, this.secondOperand]
Expand Down
Loading