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

Possible bugfix KNOWAGE-8543 #922

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
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
Loading