Unverified Commit 3d17a84a authored by Alberto Nale's avatar Alberto Nale Committed by GitHub
Browse files

[KNOWAGE-7105][KNOWAGE-7112][KNOWAGE-7113]

Possible bugfix:
KNOWAGE-7105

Bugfixes:
KNOWAGE-7112
KNOWAGE-7113
parents c14e0eef 04b19303
......@@ -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 === 'No default role selected')">
<div class="p-field p-my-1 p-p-2" v-if="user && (!sessionRole || sessionRole === this.$t('role.defaultRolePlaceholder'))">
<div class="p-d-flex">
<label class="kn-material-input-label">{{ $t('common.roles') }}</label>
</div>
......
......@@ -79,7 +79,7 @@ export default defineComponent({
let id = this.$router.currentRoute.value.params.id ?? this.parseSelectedMenuItem()
if (id && id !== '/document-browser' && (this.$router.currentRoute.value.name === 'document-browser-document-execution' || this.$router.currentRoute.value.name === 'document-browser-document-details-edit' || this.$router.currentRoute.value.name === 'document-browser')) {
if (id && id !== 'document-browser' && (this.$router.currentRoute.value.name === 'document-browser-document-execution' || this.$router.currentRoute.value.name === 'document-browser-document-details-edit' || this.$router.currentRoute.value.name === 'document-browser')) {
let tempDocument = {} as any
await this.$http.get(process.env.VUE_APP_RESTFUL_SERVICES_PATH + `2.0/documents/${id}`).then((response: AxiosResponse<any>) => (tempDocument = response.data))
const tempItem = {
......
......@@ -182,7 +182,7 @@ export default defineComponent({
},
computed: {
sessionRole(): string {
return this.user.sessionRole !== 'No default role selected' ? this.user.sessionRole : null
return this.user.sessionRole !== this.$t('role.defaultRolePlaceholder') ? this.user.sessionRole : null
},
url(): string {
if (this.document) {
......@@ -215,7 +215,7 @@ export default defineComponent({
})
this.user = (this.$store.state as any).user
this.userRole = this.user.sessionRole !== 'No default role selected' ? this.user.sessionRole : null
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
......
......@@ -11,6 +11,7 @@
<Checkbox v-else-if="column.field === 'decrypt'" v-model="columnsDecrypt[slotProps.data.uniqueName]" :binary="true" @change="onChange(slotProps.data, 'decrypt')"></Checkbox>
<Checkbox v-else-if="column.field === 'subjectId'" v-model="columnsSubjectId[slotProps.data.uniqueName]" :binary="true" @change="onChange(slotProps.data, 'subjectId')"></Checkbox>
<Dropdown v-else-if="column.field === 'type'" class="kn-material-input" v-model="columnsType[slotProps.data.uniqueName]" :options="metawebAttributesTabDescriptor.typeOptions" @change="onChange(slotProps.data, 'type')" />
<InputText v-else-if="column.field === 'name'" v-model="slotProps.data[slotProps.column.props.field]" class="kn-material-input p-inputtext-sm p-p-2" @blur="$emit('metaUpdated')" />
<span v-else>{{ slotProps.data[slotProps.column.props.field] }}</span>
</div>
</template>
......
<template>
<Accordion v-if="businessModel" :multiple="true" :activeIndex="[0]">
<Accordion v-if="businessModel" :multiple="true" :activeIndex="[0, 1]">
<AccordionTab>
<template #header>
<span>{{ $t('metaweb.physicalModel.misc') }}</span>
......
......@@ -283,7 +283,7 @@ export default defineComponent({
async created() {
this.uniqueID = crypto.randomBytes(16).toString('hex')
this.user = (this.$store.state as any).user
this.userRole = this.user.sessionRole !== 'No default role selected' ? this.user.sessionRole : null
this.userRole = this.user.sessionRole && this.user.sessionRole !== this.$t('role.defaultRolePlaceholder') ? this.user.sessionRole : null
await this.loadPage()
},
methods: {
......
......@@ -105,423 +105,423 @@
<WorkspaceNewFolderDialog :visible="displayCreateFolderDialog" @close="displayCreateFolderDialog = false" @create="createNewFolder"></WorkspaceNewFolderDialog>
</template>
<script lang="ts">
import { defineComponent } from 'vue'
import { IDocument, IFolder } from '@/modules/workspace/Workspace'
import { AxiosResponse } from 'axios'
import Sidebar from 'primevue/sidebar'
import Accordion from 'primevue/accordion'
import AccordionTab from 'primevue/accordiontab'
import Listbox from 'primevue/listbox'
import WorkspaceDocumentTree from './genericComponents/WorkspaceDocumentTree.vue'
import workspaceDescriptor from './WorkspaceDescriptor.json'
import WorkspaceNewFolderDialog from './views/repositoryView/dialogs/WorkspaceNewFolderDialog.vue'
import Dialog from 'primevue/dialog'
import KnParameterSidebar from '@/components/UI/KnParameterSidebar/KnParameterSidebar.vue'
import moment from 'moment'
import { mapState } from 'vuex'
import { defineComponent } from 'vue'
import { IDocument, IFolder } from '@/modules/workspace/Workspace'
import { AxiosResponse } from 'axios'
import Sidebar from 'primevue/sidebar'
import Accordion from 'primevue/accordion'
import AccordionTab from 'primevue/accordiontab'
import Listbox from 'primevue/listbox'
import WorkspaceDocumentTree from './genericComponents/WorkspaceDocumentTree.vue'
import workspaceDescriptor from './WorkspaceDescriptor.json'
import WorkspaceNewFolderDialog from './views/repositoryView/dialogs/WorkspaceNewFolderDialog.vue'
import Dialog from 'primevue/dialog'
import KnParameterSidebar from '@/components/UI/KnParameterSidebar/KnParameterSidebar.vue'
import moment from 'moment'
import { mapState } from 'vuex'
const crypto = require('crypto')
const crypto = require('crypto')
export default defineComponent({
name: 'dataset-management',
components: { Sidebar, Listbox, Accordion, AccordionTab, WorkspaceDocumentTree, WorkspaceNewFolderDialog, Dialog, KnParameterSidebar },
computed: {
...mapState({
user: 'user'
}),
showRepository(): any {
return this.user.functionalities.includes('SaveIntoFolderFunctionality')
},
storeFunctionalitiesExist(): any {
this.createMenuItems()
return this.user.functionalities.length > 0
},
userRole(): any {
return this.user.sessionRole !== 'No default role selected' ? this.user.sessionRole : null
}
export default defineComponent({
name: 'dataset-management',
components: { Sidebar, Listbox, Accordion, AccordionTab, WorkspaceDocumentTree, WorkspaceNewFolderDialog, Dialog, KnParameterSidebar },
computed: {
...mapState({
user: 'user'
}),
showRepository(): any {
return this.user.functionalities.includes('SaveIntoFolderFunctionality')
},
data() {
return {
workspaceDescriptor,
sidebarVisible: false,
toggleCardDisplay: false,
allFolders: [] as IFolder[],
selectedFolder: {} as any,
allDocuments: [] as IDocument[],
items: [] as IFolder[],
displayMenu: false,
displayCreateFolderDialog: false,
breadcrumbs: [] as any[],
selectedBreadcrumb: null as any,
accordionIcon: true,
loading: false,
qbeIframeVisible: false,
qbeDialogVisible: false,
parameterSidebarVisible: false,
uniqueID: null as any,
qbeDataset: null as any,
datasetDrivers: null as any,
qbeParameters: [] as any,
menuItems: [] as any,
filtersData: null as any,
qbeUrl: ''
}
storeFunctionalitiesExist(): any {
this.createMenuItems()
return this.user.functionalities.length > 0
},
created() {
this.uniqueID = crypto.randomBytes(16).toString('hex')
this.getAllRepositoryData()
userRole(): any {
return this.user.sessionRole !== this.$t('role.defaultRolePlaceholder') ? this.user.sessionRole : null
}
},
data() {
return {
workspaceDescriptor,
sidebarVisible: false,
toggleCardDisplay: false,
allFolders: [] as IFolder[],
selectedFolder: {} as any,
allDocuments: [] as IDocument[],
items: [] as IFolder[],
displayMenu: false,
displayCreateFolderDialog: false,
breadcrumbs: [] as any[],
selectedBreadcrumb: null as any,
accordionIcon: true,
loading: false,
qbeIframeVisible: false,
qbeDialogVisible: false,
parameterSidebarVisible: false,
uniqueID: null as any,
qbeDataset: null as any,
datasetDrivers: null as any,
qbeParameters: [] as any,
menuItems: [] as any,
filtersData: null as any,
qbeUrl: ''
}
},
created() {
this.uniqueID = crypto.randomBytes(16).toString('hex')
this.getAllRepositoryData()
},
mounted() {
this.createMenuItems()
},
methods: {
closeSidebar() {
this.sidebarVisible = false
},
mounted() {
this.createMenuItems()
async getAllRepositoryData() {
this.loading = true
await this.getAllFolders()
await this.getAllDocuments()
this.loading = false
},
methods: {
closeSidebar() {
this.sidebarVisible = false
},
async getAllRepositoryData() {
this.loading = true
await this.getAllFolders()
await this.getAllDocuments()
this.loading = false
},
async getAllFolders() {
return this.$http.get(process.env.VUE_APP_RESTFUL_SERVICES_PATH + `2.0/organizer/folders/`).then((response: AxiosResponse<any>) => {
this.allFolders = [...response.data]
this.displayMenu = true
})
},
async getAllDocuments() {
return this.$http.get(process.env.VUE_APP_RESTFUL_SERVICES_PATH + `2.0/organizer/documents/`).then((response: AxiosResponse<any>) => {
this.allDocuments = [...response.data]
})
},
setActiveView(route) {
this.$router.push(route)
this.closeSidebar()
},
toggleDisplayView() {
this.toggleCardDisplay = this.toggleCardDisplay ? false : true
},
setSelectedFolder(folder: any) {
this.selectedFolder = folder
this.createBreadcrumbs()
this.$router.push(`/workspace/repository/${folder.id}`)
},
async deleteFolder(folder: any) {
this.loading = true
await this.$http
.delete(process.env.VUE_APP_RESTFUL_SERVICES_PATH + `2.0/organizer/foldersee/${folder.id}`, { headers: { 'X-Disable-Errors': 'true' } })
.then(() => {
this.$store.commit('setInfo', {
title: this.$t('common.toast.deleteTitle'),
msg: this.$t('common.toast.success')
})
this.getAllRepositoryData()
this.$router.push('/workspace')
})
.catch((response: any) => {
this.$store.commit('setError', {
title: this.$t('common.toast.deleteTitle'),
msg: response.message === 'sbi.workspace.organizer.folder.error.delete' ? this.$t('workspace.myRepository.folderDeleteError') : response.message
})
})
this.loading = false
},
showCreateFolderDialog(folder: any) {
this.selectedFolder = folder
this.displayCreateFolderDialog = true
},
async createNewFolder(newFolder: any) {
newFolder.parentFunct = this.selectedFolder?.id
newFolder.path = this.selectedFolder?.path + `/` + encodeURIComponent(newFolder.code)
newFolder.prog = this.selectedFolder?.prog
await this.$http
.post(process.env.VUE_APP_RESTFUL_SERVICES_PATH + '2.0/organizer/foldersee/', newFolder, { headers: { 'X-Disable-Errors': 'true' } })
.then(() => {
this.$store.commit('setInfo', { title: this.$t('workspace.myRepository.folderCreatedMessage') })
this.getAllFolders()
async getAllFolders() {
return this.$http.get(process.env.VUE_APP_RESTFUL_SERVICES_PATH + `2.0/organizer/folders/`).then((response: AxiosResponse<any>) => {
this.allFolders = [...response.data]
this.displayMenu = true
})
},
async getAllDocuments() {
return this.$http.get(process.env.VUE_APP_RESTFUL_SERVICES_PATH + `2.0/organizer/documents/`).then((response: AxiosResponse<any>) => {
this.allDocuments = [...response.data]
})
},
setActiveView(route) {
this.$router.push(route)
this.closeSidebar()
},
toggleDisplayView() {
this.toggleCardDisplay = this.toggleCardDisplay ? false : true
},
setSelectedFolder(folder: any) {
this.selectedFolder = folder
this.createBreadcrumbs()
this.$router.push(`/workspace/repository/${folder.id}`)
},
async deleteFolder(folder: any) {
this.loading = true
await this.$http
.delete(process.env.VUE_APP_RESTFUL_SERVICES_PATH + `2.0/organizer/foldersee/${folder.id}`, { headers: { 'X-Disable-Errors': 'true' } })
.then(() => {
this.$store.commit('setInfo', {
title: this.$t('common.toast.deleteTitle'),
msg: this.$t('common.toast.success')
})
.catch((response: any) => {
this.$store.commit('setError', {
title: this.$t('common.error.generic'),
msg: response
})
this.getAllRepositoryData()
this.$router.push('/workspace')
})
.catch((response: any) => {
this.$store.commit('setError', {
title: this.$t('common.toast.deleteTitle'),
msg: response.message === 'sbi.workspace.organizer.folder.error.delete' ? this.$t('workspace.myRepository.folderDeleteError') : response.message
})
.finally(() => (this.displayCreateFolderDialog = false))
},
createBreadcrumbs() {
let currentFolder = this.selectedFolder as any
this.breadcrumbs = [] as any[]
do {
this.breadcrumbs.unshift({ label: currentFolder.data.name, node: currentFolder })
currentFolder = currentFolder.data.parentFolder
} while (currentFolder)
},
async setSelectedBreadcrumb(breadcrumb: any) {
this.selectedBreadcrumb = breadcrumb
this.$router.push(`/workspace/repository/${this.selectedBreadcrumb.node.id}`)
},
createMenuItems() {
this.menuItems = []
this.menuItems.push({ icon: 'fas fa-history', key: '0', label: 'workspace.menuLabels.recent', value: 'recent' }, { icon: 'fas fa-folder', key: '1', label: 'workspace.menuLabels.myRepository', value: 'repository' })
if (this.user?.functionalities.includes('SeeMyData')) {
this.menuItems.push({ icon: 'fas fa-database', key: '2', label: 'workspace.menuLabels.myData', value: 'data' })
}
if (this.user?.isSuperadmin || this.user?.functionalities.includes('BuildQbeQueriesFunctionality')) {
this.menuItems.push({ icon: 'fas fa-table', key: '3', label: 'workspace.menuLabels.myModels', value: 'models' })
}
if (this.user?.functionalities.includes('CreateDocument')) {
this.menuItems.push({ icon: 'fas fa-th-large', key: '4', label: 'workspace.menuLabels.myAnalysis', value: 'analysis' })
}
if (this.user?.functionalities.includes('SeeSnapshotsFunctionality') && this.user?.functionalities.includes('ViewScheduledWorkspace')) {
this.menuItems.push({
icon: 'fas fa-stopwatch',
key: '5',
label: 'workspace.menuLabels.schedulation',
value: 'schedulation'
})
this.loading = false
},
showCreateFolderDialog(folder: any) {
this.selectedFolder = folder
this.displayCreateFolderDialog = true
},
async createNewFolder(newFolder: any) {
newFolder.parentFunct = this.selectedFolder?.id
newFolder.path = this.selectedFolder?.path + `/` + encodeURIComponent(newFolder.code)
newFolder.prog = this.selectedFolder?.prog
await this.$http
.post(process.env.VUE_APP_RESTFUL_SERVICES_PATH + '2.0/organizer/foldersee/', newFolder, { headers: { 'X-Disable-Errors': 'true' } })
.then(() => {
this.$store.commit('setInfo', { title: this.$t('workspace.myRepository.folderCreatedMessage') })
this.getAllFolders()
})
.catch((response: any) => {
this.$store.commit('setError', {
title: this.$t('common.error.generic'),
msg: response
})
}
if (this.user?.functionalities.includes('DataPreparation')) {
this.menuItems.push({ icon: 'fas fa-cogs', key: '6', label: 'workspace.menuLabels.advanced', value: 'advanced' })
}
},
executeDocument(document: any) {
const routeType = this.getRouteDocumentType(document)
const label = document.label ? document.label : document.documentLabel
this.$router.push(`/workspace/${routeType}/${label}`)
},
getRouteDocumentType(item: any) {
let routeDocumentType = ''
})
.finally(() => (this.displayCreateFolderDialog = false))
},
createBreadcrumbs() {
let currentFolder = this.selectedFolder as any
this.breadcrumbs = [] as any[]
do {
this.breadcrumbs.unshift({ label: currentFolder.data.name, node: currentFolder })
currentFolder = currentFolder.data.parentFolder
} while (currentFolder)
},
async setSelectedBreadcrumb(breadcrumb: any) {
this.selectedBreadcrumb = breadcrumb
this.$router.push(`/workspace/repository/${this.selectedBreadcrumb.node.id}`)
},
createMenuItems() {
this.menuItems = []
this.menuItems.push({ icon: 'fas fa-history', key: '0', label: 'workspace.menuLabels.recent', value: 'recent' }, { icon: 'fas fa-folder', key: '1', label: 'workspace.menuLabels.myRepository', value: 'repository' })
if (this.user?.functionalities.includes('SeeMyData')) {
this.menuItems.push({ icon: 'fas fa-database', key: '2', label: 'workspace.menuLabels.myData', value: 'data' })
}
if (this.user?.isSuperadmin || this.user?.functionalities.includes('BuildQbeQueriesFunctionality')) {
this.menuItems.push({ icon: 'fas fa-table', key: '3', label: 'workspace.menuLabels.myModels', value: 'models' })
}
if (this.user?.functionalities.includes('CreateDocument')) {
this.menuItems.push({ icon: 'fas fa-th-large', key: '4', label: 'workspace.menuLabels.myAnalysis', value: 'analysis' })
}
if (this.user?.functionalities.includes('SeeSnapshotsFunctionality') && this.user?.functionalities.includes('ViewScheduledWorkspace')) {
this.menuItems.push({
icon: 'fas fa-stopwatch',
key: '5',
label: 'workspace.menuLabels.schedulation',
value: 'schedulation'
})
}
if (this.user?.functionalities.includes('DataPreparation')) {
this.menuItems.push({ icon: 'fas fa-cogs', key: '6', label: 'workspace.menuLabels.advanced', value: 'advanced' })
}
},
executeDocument(document: any) {
const routeType = this.getRouteDocumentType(document)
const label = document.label ? document.label : document.documentLabel
this.$router.push(`/workspace/${routeType}/${label}`)
},
getRouteDocumentType(item: any) {
let routeDocumentType = ''
const type = item.typeCode ? item.typeCode : item.documentType
const type = item.typeCode ? item.typeCode : item.documentType
switch (type) {
case 'DATAMART':
routeDocumentType = 'registry'
break
case 'DOCUMENT_COMPOSITE':
routeDocumentType = 'document-composite'
break
case 'OFFICE_DOC':
routeDocumentType = 'office-doc'
break
case 'OLAP':
routeDocumentType = 'olap'
break
case 'MAP':
routeDocumentType = 'map'
break
case 'REPORT':
routeDocumentType = 'report'
break
case 'KPI':
routeDocumentType = 'kpi'
break
case 'DOSSIER':
routeDocumentType = 'dossier'
break
case 'ETL':
routeDocumentType = 'etl'
break
}
switch (type) {
case 'DATAMART':
routeDocumentType = 'registry'
break
case 'DOCUMENT_COMPOSITE':
routeDocumentType = 'document-composite'
break
case 'OFFICE_DOC':
routeDocumentType = 'office-doc'
break
case 'OLAP':
routeDocumentType = 'olap'
break
case 'MAP':
routeDocumentType = 'map'
break
case 'REPORT':
routeDocumentType = 'report'
break
case 'KPI':
routeDocumentType = 'kpi'
break
case 'DOSSIER':
routeDocumentType = 'dossier'
break
case 'ETL':
routeDocumentType = 'etl'
break
}
return routeDocumentType
},
async loadQBEDataset(dataset) {
await this.$http
.get(process.env.VUE_APP_RESTFUL_SERVICES_PATH + `1.0/datasets/${dataset.label}`)
.then((response: AxiosResponse<any>) => {
this.qbeDataset = response.data
})
.catch(() => {})
},
async loadDatasetDrivers(dataset) {
await this.$http
.post(process.env.VUE_APP_RESTFUL_SERVICES_PATH + `1.0/businessmodel/${dataset.name}/filters`, { name: dataset.name, role: this.userRole })
.then((response: AxiosResponse<any>) => {
this.filtersData = response.data
this.formatDrivers()
if (response.data.isReadyForExecution) {
this.parameterSidebarVisible = false
this.initiateQbeIframe()
} else {
this.parameterSidebarVisible = true
}
})
.catch(() => {})
},
formatDrivers() {
this.filtersData?.filterStatus?.forEach((el: any) => {
el.parameterValue = el.multivalue ? [] : [{ value: '', description: '' }]
if (el.driverDefaultValue?.length > 0) {
let valueIndex = '_col0'
let descriptionIndex = 'col1'
if (el.metadata?.colsMap) {
valueIndex = Object.keys(el.metadata?.colsMap).find((key: string) => el.metadata.colsMap[key] === el.metadata.valueColumn) as any
descriptionIndex = Object.keys(el.metadata?.colsMap).find((key: string) => el.metadata.colsMap[key] === el.metadata.descriptionColumn) as any
}
return routeDocumentType
},
async loadQBEDataset(dataset) {
await this.$http
.get(process.env.VUE_APP_RESTFUL_SERVICES_PATH + `1.0/datasets/${dataset.label}`)
.then((response: AxiosResponse<any>) => {
this.qbeDataset = response.data
})
.catch(() => {})
},
async loadDatasetDrivers(dataset) {
await this.$http
.post(process.env.VUE_APP_RESTFUL_SERVICES_PATH + `1.0/businessmodel/${dataset.name}/filters`, { name: dataset.name, role: this.userRole })
.then((response: AxiosResponse<any>) => {
this.filtersData = response.data
this.formatDrivers()
if (response.data.isReadyForExecution) {
this.parameterSidebarVisible = false
this.initiateQbeIframe()
} else {
this.parameterSidebarVisible = true
}
})
.catch(() => {})
},
formatDrivers() {
this.filtersData?.filterStatus?.forEach((el: any) => {
el.parameterValue = el.multivalue ? [] : [{ value: '', description: '' }]