Commit 4873384d authored by BojanSovticEngIT's avatar BojanSovticEngIT
Browse files

Bugfix KNOWAGE-7105

parent 778b1ffe
......@@ -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>
......
......@@ -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
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>) => {
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