Unverified Commit 38694d0a authored by Alberto Nale's avatar Alberto Nale Committed by GitHub
Browse files

[KNOWAGE-7103][KNOWAGE-7105]

Possible bugfix: KNOWAGE-7103

Bugfix: KNOWAGE-7105
parents 47d798d8 4902b774
......@@ -11,7 +11,7 @@
</Toolbar>
<div class="p-fluid kn-parameter-sidebar-content kn-alternated-rows">
<div class="p-field p-my-1 p-p-2" v-if="user && (!sessionRole || sessionRole === this.$t('role.defaultRolePlaceholder'))">
<div class="p-field p-my-1 p-p-2" v-if="user && (!sessionRole || sessionRole === $t('role.defaultRolePlaceholder'))">
<div class="p-d-flex">
<label class="kn-material-input-label">{{ $t('common.roles') }}</label>
</div>
......
......@@ -7,12 +7,14 @@ const routes = [
{
path: 'new/:folderId',
component: () => import('@/modules/documentExecution/documentDetails/DocumentDetails.vue'),
props: true
props: true,
name: 'document-details-new-document'
},
{
path: ':docId',
component: () => import('@/modules/documentExecution/documentDetails/DocumentDetails.vue'),
props: true
props: true,
name: 'document-details-edit-document'
}
]
}
......
<template>
<div v-if="viewMode === 'document-detail'" id="document-details-container" class="p-d-flex p-flex-column kn-flex kn-height-full">
<div v-if="viewMode === 'document-detail' || $route.name === 'document-details-new-document' || $route.name === 'document-details-edit-document'" id="document-details-container" class="p-d-flex p-flex-column kn-flex kn-height-full">
<Toolbar class="kn-toolbar kn-toolbar--primary p-p-0 p-m-0 p-col-12">
<template #start>
{{ $t('documentExecution.documentDetails.title') }}
......@@ -159,7 +159,7 @@ export default defineComponent({
}
},
async created() {
if (this.viewMode !== 'document-detail') return
if (this.viewMode !== 'document-detail' && this.$route.name !== 'document-details-new-document' && this.$route.name !== 'document-details-edit-document') return
this.isForEdit()
await this.loadPage(this.docId)
},
......
......@@ -181,7 +181,8 @@ export default defineComponent({
this.parameterSidebarVisible = false
},
computed: {
sessionRole(): string {
sessionRole(): string | null {
if (!this.user) return null
return this.user.sessionRole !== this.$t('role.defaultRolePlaceholder') ? this.user.sessionRole : null
},
url(): string {
......@@ -214,9 +215,6 @@ export default defineComponent({
}
})
this.user = (this.$store.state as any).user
this.userRole = this.user.sessionRole !== this.$t('role.defaultRolePlaceholder') ? this.user.sessionRole : null
if (this.propMode !== 'document-execution' && !this.$route.path.includes('olap-designer') && this.$route.name !== 'document-execution') return
await this.loadUserConfig()
......@@ -230,6 +228,9 @@ export default defineComponent({
await this.loadDocument()
this.user = (this.$store.state as any).user
this.userRole = this.user.sessionRole !== this.$t('role.defaultRolePlaceholder') ? this.user.sessionRole : null
if (this.userRole) {
await this.loadPage(true)
} else {
......
......@@ -105,7 +105,7 @@
</div>
</div>
</div>
<KnParameterSidebar v-if="parameterSidebarVisible" :filtersData="filtersData" :propDocument="dataset" :userRole="userRole" :propMode="'qbeView'" :propQBEParameters="qbe.pars" @execute="onExecute"></KnParameterSidebar>
<KnParameterSidebar v-if="parameterSidebarVisible" :filtersData="filtersData" :propDocument="dataset" :userRole="userRole" :propMode="'qbeView'" :propQBEParameters="qbe?.pars" @execute="onExecute" @roleChanged="onRoleChange"></KnParameterSidebar>
</div>
<QBEPreviewDialog v-show="!loading && qbePreviewDialogVisible" :id="uniqueID" :queryPreviewData="queryPreviewData" :pagination="pagination" :entities="entities?.entities" @close="closePreview" @pageChanged="updatePagination($event)"></QBEPreviewDialog>
......@@ -284,7 +284,11 @@ export default defineComponent({
this.uniqueID = crypto.randomBytes(16).toString('hex')
this.user = (this.$store.state as any).user
this.userRole = this.user.sessionRole && this.user.sessionRole !== this.$t('role.defaultRolePlaceholder') ? this.user.sessionRole : null
await this.loadPage()
if (this.userRole) {
await this.loadPage()
} else {
this.parameterSidebarVisible = true
}
},
methods: {
async loadPage() {
......@@ -354,12 +358,15 @@ export default defineComponent({
const label = this.qbe.label ? this.qbe.label : this.qbe.qbeDatamarts
const url = this.qbe.label ? `3.0/datasets/${label}/filters` : `1.0/businessmodel/${this.qbe.qbeDatamarts}/filters`
await this.$http.post(process.env.VUE_APP_RESTFUL_SERVICES_PATH + url, { role: this.userRole }).then((response: AxiosResponse<any>) => {
this.filtersData = response.data
if (this.filtersData.filterStatus) {
this.filtersData.filterStatus = this.filtersData.filterStatus.filter((filter: any) => filter.id)
}
})
await this.$http
.post(process.env.VUE_APP_RESTFUL_SERVICES_PATH + url, { role: this.userRole })
.then((response: AxiosResponse<any>) => {
this.filtersData = response.data
if (this.filtersData.filterStatus) {
this.filtersData.filterStatus = this.filtersData.filterStatus.filter((filter: any) => filter.id)
}
})
.catch(() => {})
formatDrivers(this.filtersData)
},
......@@ -828,6 +835,11 @@ export default defineComponent({
if (this.selectedQuery.expression.childNodes?.length === 0) this.selectedQuery.expression = {}
this.updateSmartView()
},
async onRoleChange(role: string) {
this.userRole = role as any
this.filtersData = {}
await this.loadPage()
}
}
})
......
......@@ -222,7 +222,7 @@ export default defineComponent({
}
},
setEndUserScope() {
if (!this.selectedDataset.id && !(this.$store.state as any).user.functionalities.includes('QbeAdvancedSaving')) {
if (this.selectedDataset && !this.selectedDataset.id && !(this.$store.state as any).user.functionalities.includes('QbeAdvancedSaving')) {
let userScope = this.scopeTypes.find((scope) => scope.VALUE_CD === 'USER')
this.selectedDataset.scopeCd = userScope.VALUE_CD
this.selectedDataset.scopeId = userScope.VALUE_ID
......
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