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

[KNOWAGE-6971]

Sprint 14 bugfix
parents 3a44915e ba7027fa
......@@ -10,6 +10,18 @@ const routes = [
component: () => import('@/modules/documentBrowser/DocumentBrowserCockpitContainer.vue'),
props: true
},
{
path: 'document-details/new/:folderId',
name: 'document-browser-document-details-new',
component: () => import('@/modules/documentBrowser/DocumentBrowserCockpitContainer.vue'),
props: true
},
{
path: 'document-details/:id',
name: 'document-browser-document-details-edit',
component: () => import('@/modules/documentBrowser/DocumentBrowserCockpitContainer.vue'),
props: true
},
{
path: ':mode(registry|document-composite|report|office-doc|olap|map|report|kpi|dossier|etl)/:id',
name: 'document-browser-document-execution',
......
......@@ -12,12 +12,21 @@
<TabPanel v-for="(tab, index) in tabs" :key="index">
<template #header>
<span>{{ tab.item?.name ? tab.item?.name : 'new dashboard' }}</span>
<span>{{ getTabName(tab) }}</span>
</template>
</TabPanel>
</TabView>
<DocumentBrowserTab v-show="selectedItem" :item="selectedItem?.item" :mode="selectedItem?.mode" :functionalityId="selectedItem?.functionalityId" @close="closeDocument('current')" @iframeCreated="onIFrameCreated" @closeIframe="closeIframe"></DocumentBrowserTab>
<DocumentBrowserTab
v-show="selectedItem"
:item="selectedItem?.item"
:mode="selectedItem?.mode"
:functionalityId="selectedItem?.functionalityId"
@close="closeDocument('current')"
@iframeCreated="onIFrameCreated"
@closeIframe="closeIframe"
@documentSaved="onDocumentSaved"
></DocumentBrowserTab>
<div v-for="(iframe, index) in iFrameContainers" :key="index">
<iframe v-show="iframe.item?.routerId === selectedItem?.item.routerId" ref="iframe" class="document-browser-cockpit-iframe" :src="iframe.iframe"></iframe>
</div>
......@@ -55,15 +64,18 @@ export default defineComponent({
},
async created() {
window.addEventListener('message', (event) => {
if (event.data.type === 'saveCockpit' && this.$route.name === 'new-dashboard') {
if (event.data.type === 'saveCockpit' && this.$router.currentRoute.value.name === 'new-dashboard') {
this.loadSavedCockpit(event.data.model)
}
})
if (this.$route.params.id && this.$route.name === 'document-browser-document-execution') {
if (this.$router.currentRoute.value.params.id && (this.$router.currentRoute.value.name === 'document-browser-document-execution' || this.$router.currentRoute.value.name === 'document-browser-document-details-edit')) {
let tempDocument = {} as any
await this.$http.get(process.env.VUE_APP_RESTFUL_SERVICES_PATH + `2.0/documents/${this.$route.params.id}`).then((response: AxiosResponse<any>) => (tempDocument = response.data))
const tempItem = { item: { name: tempDocument.name, label: this.$route.params.id, mode: this.$route.params.mode, routerId: crypto.randomBytes(16).toString('hex') }, mode: 'execute' }
await this.$http.get(process.env.VUE_APP_RESTFUL_SERVICES_PATH + `2.0/documents/${this.$router.currentRoute.value.params.id}`).then((response: AxiosResponse<any>) => (tempDocument = response.data))
const tempItem = {
item: { name: tempDocument.name, label: this.$router.currentRoute.value.params.id, mode: this.$router.currentRoute.value.params.mode, routerId: crypto.randomBytes(16).toString('hex'), id: this.$router.currentRoute.value.params.id },
mode: this.$router.currentRoute.value.name === 'document-browser-document-execution' ? 'execute' : 'documentDetail'
}
this.tabs.push(tempItem)
this.activeIndex = 1
......@@ -82,8 +94,13 @@ export default defineComponent({
this.selectedItem = this.tabs[this.activeIndex - 1]
let routeDocumentType = this.tabs[this.activeIndex - 1].item.mode ? this.tabs[this.activeIndex - 1].item.mode : this.getRouteDocumentType(this.tabs[this.activeIndex - 1].item)
routeDocumentType ? this.$router.push(`/document-browser/${routeDocumentType}/` + id) : this.$router.push('/document-browser/new-dashboard')
if (this.selectedItem.mode === 'documentDetail') {
const path = this.selectedItem.functionalityId ? `/document-browser/document-details/new/${this.selectedItem.functionalityId}` : `/document-browser/document-details/${this.selectedItem.item.id}`
this.$router.push(path)
} else {
let routeDocumentType = this.tabs[this.activeIndex - 1].item.mode ? this.tabs[this.activeIndex - 1].item.mode : this.getRouteDocumentType(this.tabs[this.activeIndex - 1].item)
routeDocumentType ? this.$router.push(`/document-browser/${routeDocumentType}/` + id) : this.$router.push('/document-browser/new-dashboard')
}
},
onItemSelect(payload: any) {
if (payload.item) {
......@@ -91,18 +108,24 @@ export default defineComponent({
}
const tempItem = { ...payload, item: { ...payload.item } }
if (payload.mode === 'documentDetail') tempItem.mode = 'documentDetail'
this.tabs.push(tempItem)
this.selectedItem = tempItem
const id = payload.item ? payload.item.label : 'new-dashboard'
if (payload.item) {
let routeDocumentType = this.getRouteDocumentType(payload.item)
this.$router.push(`/document-browser/${routeDocumentType}/` + id)
if (payload.mode === 'documentDetail') {
const path = payload.functionalityId ? `/document-browser/document-details/new/${payload.functionalityId}` : `/document-browser/document-details/${payload.item.id}`
this.$router.push(path)
} else {
this.selectedItem.item = { routerId: crypto.randomBytes(16).toString('hex') }
this.$router.push(`/document-browser/new-dashboard`)
const id = payload.item ? payload.item.label : 'new-dashboard'
if (payload.item) {
let routeDocumentType = this.getRouteDocumentType(payload.item)
this.$router.push(`/document-browser/${routeDocumentType}/` + id)
} else {
this.selectedItem.item = { routerId: crypto.randomBytes(16).toString('hex') }
this.$router.push(`/document-browser/new-dashboard`)
}
}
this.activeIndex = this.tabs.length
......@@ -213,6 +236,18 @@ export default defineComponent({
this.selectedItem = { item: { ...cockpit, routerId: crypto.randomBytes(16).toString('hex'), name: cockpit.DOCUMENT_NAME, label: cockpit.DOCUMENT_LABEL, mode: 'document-composite' } }
this.tabs[this.activeIndex - 1] = this.selectedItem
this.$router.push(`/document-browser/document-composite/${cockpit.DOCUMENT_LABEL}`)
},
getTabName(tab: any) {
if (tab.item && tab.item.name) {
return tab.item.name
} else {
return tab.mode === 'documentDetail' ? 'new document' : 'new dashboard'
}
},
onDocumentSaved(document: any) {
this.selectedItem.functionalityId = null
this.selectedItem.item = { name: document.name, label: document.id, routerId: crypto.randomBytes(16).toString('hex'), id: document.id }
this.$router.push(`/document-browser/document-details/${document.id}`)
}
}
})
......
<template>
<DocumentExecution :id="name" v-if="mode === 'document-execution'" :parameterValuesMap="parameterValuesMap" :tabKey="tabKey" @parametersChanged="$emit('parametersChanged', $event)"></DocumentExecution>
<div id="cockpit-container" class="kn-height-full">
<DocumentExecution
:id="name"
v-show="mode === 'document-execution'"
:propMode="mode"
v-bind:style="[mode === 'document-execution' ? '' : 'display: none !important; ']"
:parameterValuesMap="parameterValuesMap"
:tabKey="tabKey"
@parametersChanged="$emit('parametersChanged', $event)"
></DocumentExecution>
<DocumentDetails
v-show="mode === 'document-detail'"
v-bind:style="[mode === 'document-detail' ? '' : 'display: none !important;']"
:propMode="'execution'"
:propDocId="item?.id"
:propFolderId="functionalityId"
@closeDetails="$emit('closeDetails', item)"
@documentSaved="onDocumentsSaved"
></DocumentDetails>
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue'
import DocumentExecution from '@/modules/documentExecution/main/DocumentExecution.vue'
import DocumentDetails from '@/modules/documentExecution/documentDetails/DocumentDetails.vue'
export default defineComponent({
name: 'document-browser-cockpit-container',
components: {
DocumentExecution
DocumentExecution,
DocumentDetails
},
props: { id: { type: String }, functionalityId: { type: String }, item: { type: Object }, parameterValuesMap: { type: Object }, tabKey: { type: String } },
emits: ['iframeCreated', 'closeIframe', 'parametersChanged'],
props: { id: { type: String }, functionalityId: { type: String }, item: { type: Object }, parameterValuesMap: { type: Object }, tabKey: { type: String }, propMode: { type: String } },
emits: ['iframeCreated', 'closeIframe', 'parametersChanged', 'closeDetails', 'documentSaved'],
data() {
return {
url: '',
......@@ -48,12 +69,17 @@ export default defineComponent({
this.url = process.env.VUE_APP_HOST_URL + `/knowagecockpitengine/api/1.0/pages/edit?NEW_SESSION=TRUE&SBI_LANGUAGE=${language}&user_id=${uniqueID}&SBI_COUNTRY=${country}&SBI_ENVIRONMENT=DOCBROWSER&IS_TECHNICAL_USER=true&documentMode=EDIT&FUNCTIONALITY_ID=${this.functionalityId}`
},
setMode() {
if (this.item?.name) {
if (this.propMode === 'documentDetail') {
this.mode = 'document-detail'
} else if (this.propMode === 'execute') {
this.mode = 'document-execution'
} else {
} else if (this.propMode === 'createCockpit') {
this.mode = 'cockpit'
this.$emit('iframeCreated', { iframe: this.url, item: this.item })
}
},
onDocumentsSaved(document: any) {
this.$emit('documentSaved', document)
}
}
})
......
<template>
<router-view v-if="item" v-slot="{ Component }" :functionalityId="functionalityId" :item="item" :parameterValuesMap="parameterValuesMap" :tabKey="key" @close="$emit('close', item)" @parametersChanged="onParametersChange" @iframeCreated="onIframeCreated" @closeIframe="$emit('closeIframe')">
<router-view
v-show="item"
v-slot="{ Component }"
:functionalityId="functionalityId"
:item="item"
:parameterValuesMap="parameterValuesMap"
:tabKey="key"
:propMode="mode"
@close="$emit('close', item)"
@parametersChanged="onParametersChange"
@iframeCreated="onIframeCreated"
@closeIframe="$emit('closeIframe')"
@closeDetails="$emit('close', item)"
@documentSaved="$emit('documentSaved', $event)"
>
<keep-alive>
<component :is="Component" :key="key"></component>
</keep-alive>
......@@ -12,7 +26,7 @@ import { defineComponent } from 'vue'
export default defineComponent({
name: 'document-browser-tab',
components: {},
emits: ['close', 'iframeCreated', 'closeIframe'],
emits: ['close', 'iframeCreated', 'closeIframe', 'documentSaved'],
props: { item: { type: Object }, mode: { type: String }, functionalityId: { type: String } },
data() {
return {
......
......@@ -179,13 +179,15 @@ export default defineComponent({
},
createNewDocument() {
this.documentId = null
const path = `/document-details/new/${this.selectedFolder.id}`
this.$router.push(path)
// const path = `/document-browser/document-details/new/${this.selectedFolder.id}`
// this.$router.push(path)
this.$emit('itemSelected', { item: null, mode: 'documentDetail', functionalityId: this.selectedFolder.id })
},
async openDocumentDetails(event) {
this.documentId = event.id
const path = `/document-details/${event.id}`
this.$router.push(path)
// const path = `/document-browser/document-details/${event.id}`
// this.$router.push(path)
this.$emit('itemSelected', { item: event, mode: 'documentDetail', functionalityId: null })
},
createNewCockpit() {
this.$emit('itemSelected', { item: null, mode: 'createCockpit', functionalityId: this.selectedFolder.id })
......
<template>
<Dialog class="document-details-dialog remove-padding p-fluid kn-dialog--toolbar--primary" :contentStyle="mainDescriptor.style.flex" :visible="true" :modal="false" :closable="false" :draggable="false" position="right" :baseZIndex="1" :autoZIndex="true">
<template #header>
<Toolbar class="kn-toolbar kn-toolbar--primary p-p-0 p-m-0 p-col-12">
<template #start>
{{ $t('documentExecution.documentDetails.title') }}
</template>
<template #end>
<Button icon="pi pi-save" class="p-button-text p-button-rounded p-button-plain" v-tooltip.bottom="$t('common.save')" @click="saveDocument" :disabled="invalidDrivers > 0 || invalidOutputParams > 0 || v$.$invalid" />
<Button icon="pi pi-times" class="p-button-text p-button-rounded p-button-plain" v-tooltip.bottom="$t('common.close')" @click="closeDocument" />
</template>
</Toolbar>
</template>
<div 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') }}
</template>
<template #end>
<Button icon="pi pi-save" class="p-button-text p-button-rounded p-button-plain" v-tooltip.bottom="$t('common.save')" @click="saveDocument" :disabled="invalidDrivers > 0 || invalidOutputParams > 0 || v$.$invalid" />
<Button v-if="propMode === 'execution'" icon="pi pi-times" class="p-button-text p-button-rounded p-button-plain" v-tooltip.bottom="$t('common.close')" @click="closeDocument" />
</template>
</Toolbar>
<ProgressSpinner v-if="loading" class="doc-details-spinner" :style="mainDescriptor.style.spinnerStyle" />
<div class="document-details-tab-container p-d-flex p-flex-column kn-flex">
......@@ -71,7 +69,9 @@
</TabPanel>
</TabView>
</div>
</Dialog>
</div>
<!-- </Dialog> -->
</template>
<script lang="ts">
......@@ -85,7 +85,7 @@ import OutputParamsTab from './tabs/outputParams/DocumentDetailsOutputParameters
import DataLineageTab from './tabs/dataLineage/DocumentDetailsDataLineage.vue'
import HistoryTab from './tabs/history/DocumentDetailsHistory.vue'
import SubreportsTab from './tabs/subreports/DocumentDetailsSubreports.vue'
import Dialog from 'primevue/dialog'
// import Dialog from 'primevue/dialog'
import TabView from 'primevue/tabview'
import Badge from 'primevue/badge'
import TabPanel from 'primevue/tabpanel'
......@@ -94,9 +94,21 @@ import { iDataSource, iAnalyticalDriver, iDriver, iEngine, iTemplate, iAttribute
export default defineComponent({
name: 'document-details',
components: { InformationsTab, DriversTab, OutputParamsTab, DataLineageTab, HistoryTab, SubreportsTab, TabView, TabPanel, Dialog, Badge, ProgressSpinner },
props: {},
emits: ['closeDetails'],
components: {
InformationsTab,
DriversTab,
OutputParamsTab,
DataLineageTab,
HistoryTab,
SubreportsTab,
TabView,
TabPanel,
// Dialog,
Badge,
ProgressSpinner
},
props: { propDocId: { type: String }, propFolderId: { type: String }, propMode: { type: String } },
emits: ['closeDetails', 'documentSaved'],
data() {
return {
v$: useValidate() as any,
......@@ -140,12 +152,29 @@ export default defineComponent({
return 0
}
},
watch: {
async propDocId() {
this.isForEdit()
await this.loadPage(this.docId)
}
},
async created() {
this.isForEdit()
await this.loadPage(this.docId)
},
methods: {
isForEdit() {
if (this.propMode === 'execution') {
this.loadAsExecution()
} else {
this.loadAsDetail()
}
},
loadAsExecution() {
this.docId = this.propDocId
this.folderId = this.propFolderId
},
loadAsDetail() {
this.$route.params.docId ? (this.docId = this.$route.params.docId) : (this.folderId = this.$route.params.folderId)
},
async loadPage(id) {
......@@ -344,14 +373,14 @@ export default defineComponent({
setTimeout(() => {
const path = `/document-details/${response.data.id}`
!this.selectedDocument.id ? this.$router.push(path) : ''
if (!docToSave.id) this.$emit('documentSaved', response.data)
this.loadPage(response.data.id)
}, 200)
})
.catch((error) => this.$store.commit('setError', { title: this.$t('common.toast.errorTitle'), msg: error.message }))
},
closeDocument() {
const path = `/document-browser`
this.$router.push(path)
this.$emit('closeDetails')
},
onTabChange(event) {
event.index === 5 ? this.getAllSubreports() : ''
......@@ -367,9 +396,10 @@ export default defineComponent({
.document-details-tabview .p-tabview-panels {
padding: 0 !important;
}
.document-details-dialog.p-dialog {
max-height: 100%;
height: 100vh;
height: 80vh;
width: calc(100vw - var(--kn-mainmenu-width));
margin: 0;
}
......
......@@ -18,15 +18,15 @@
<template #content>
<div class="p-field p-col-12">
<span class="p-float-label ">
<Dropdown id="dataSource" class="kn-material-input" v-model="dataSource" :options="metaSourceResource" @change="getTablesBySourceID" optionLabel="name" />
<Dropdown id="dataSource" class="kn-material-input kn-width-full" v-model="dataSource" :options="metaSourceResource" @change="getTablesBySourceID" optionLabel="name" />
<label for="dataSource" class="kn-material-input-label"> {{ $t('documentExecution.documentDetails.dataLineage.selectSource') }} </label>
</span>
</div>
<div v-if="metaSourceResource.length == 0">
<InlineMessage severity="info">{{ $t('documentExecution.documentDetails.dataLineage.noDatasources') }}</InlineMessage>
<InlineMessage severity="info" class="kn-width-full">{{ $t('documentExecution.documentDetails.dataLineage.noDatasources') }}</InlineMessage>
</div>
<div v-if="dataSource && tablesList.length == 0 && metaSourceResource.length != 0">
<InlineMessage severity="info">{{ $t('documentExecution.documentDetails.dataLineage.noTables') }}</InlineMessage>
<InlineMessage severity="info" class="kn-width-full">{{ $t('documentExecution.documentDetails.dataLineage.noTables') }}</InlineMessage>
</div>
<ProgressBar v-if="loading" class="kn-progress-bar" mode="indeterminate" data-test="progress-bar" />
<DataTable
......
......@@ -36,7 +36,7 @@
<div :style="mainDescriptor.style.absoluteScroll">
<div class="p-m-2">
<div v-if="Object.keys(selectedDriver).length === 0">
<InlineMessage severity="info">{{ $t('documentExecution.documentDetails.drivers.noDriverSelected') }}</InlineMessage>
<InlineMessage severity="info" class="kn-width-full">{{ $t('documentExecution.documentDetails.drivers.noDriverSelected') }}</InlineMessage>
</div>
<Card v-else>
<template #content>
......
......@@ -39,7 +39,7 @@
<div :style="mainDescriptor.style.absoluteScroll">
<VCodeMirror v-if="showTemplateContent" ref="codeMirrorScriptType" class="kn-height-full" v-model:value="selectedTemplateContent" :options="scriptOptions" @keyup="$emit('touched')" />
<div v-else>
<InlineMessage severity="info" class="p-m-2"> {{ $t('documentExecution.documentDetails.history.templateHint') }}</InlineMessage>
<InlineMessage severity="info" class="p-m-2 kn-width-full"> {{ $t('documentExecution.documentDetails.history.templateHint') }}</InlineMessage>
</div>
</div>
</div>
......
......@@ -13,11 +13,11 @@
<div :style="mainDescriptor.style.absoluteScroll">
<Card class="p-m-2">
<template #content>
<div id="upload-template-container" v-if="templates.length == 0">
<div v-if="templates.length == 0">
<div class="p-field p-col-12 p-d-flex">
<div class="kn-flex">
<span class="p-float-label">
<InputText id="fileName" class="kn-material-input" v-model="templateToUpload.name" :disabled="true" />
<InputText id="fileName" class="kn-material-input kn-width-full" v-model="templateToUpload.name" :disabled="true" />
<label for="fileName" class="kn-material-input-label"> {{ $t('documentExecution.documentDetails.info.uploadTemplate') }} </label>
</span>
</div>
......@@ -214,7 +214,7 @@
<Card>
<template #content>
<span class="p-field p-float-label p-col-12">
<Dropdown id="attributes" class="kn-material-input" v-model="document.parametersRegion" :options="driversPositions" :optionLabel="translatedLabel" optionValue="value">
<Dropdown id="attributes" class="kn-material-input kn-width-full" v-model="document.parametersRegion" :options="driversPositions" :optionLabel="translatedLabel" optionValue="value">
<template #option="slotProps">
<div class="p-dropdown-option">
<span class="kn-capitalize">{{ $t(slotProps.option.label) }}</span>
......@@ -236,7 +236,7 @@
<template #content>
<form class="p-formgrid p-grid p-mb-3">
<span class="p-float-label p-col-10">
<Textarea id="profiledVisibility" class="kn-material-input" rows="1" :autoResize="true" v-model="document.profiledVisibility" :disabled="true" />
<Textarea id="profiledVisibility" class="kn-material-input kn-width-full" rows="1" :autoResize="true" v-model="document.profiledVisibility" :disabled="true" />
<label for="profiledVisibility" class="kn-material-input-label"> {{ $t('documentExecution.documentDetails.info.profiledVisibility') }} </label>
</span>
<Button icon="fas fa-plus-circle fa-1x" class="p-button-text p-button-plain p-ml-2 p-col-1" :disabled="!visibilityAttribute" @click="addRestriction" />
......@@ -244,12 +244,12 @@
</form>
<form class="p-formgrid p-grid">
<span class="p-field p-float-label p-col-12 p-lg-5">
<Dropdown id="attributes" class="kn-material-input" v-model="visibilityAttribute" :options="availableAttributes" optionLabel="attributeName" optionValue="attributeName" />
<Dropdown id="attributes" class="kn-material-input kn-width-full" v-model="visibilityAttribute" :options="availableAttributes" optionLabel="attributeName" optionValue="attributeName" />
<label for="attributes" class="kn-material-input-label"> {{ $t('documentExecution.documentDetails.info.attribute') }} </label>
</span>
<span class="p-col-12 p-lg-1" :style="infoDescriptor.style.center">=</span>
<span class="p-field p-float-label p-col-12 p-lg-6">
<InputText id="restrictionValue" class="kn-material-input" v-model="restrictionValue" />
<InputText id="restrictionValue" class="kn-material-input kn-width-full" v-model="restrictionValue" />
<label for="restrictionValue" class="kn-material-input-label"> {{ $t('documentExecution.documentDetails.info.restrictionValueHint') }} </label>
</span>
</form>
......
......@@ -23,7 +23,7 @@
</Toolbar>
<div id="driver-details-container" class="p-m-2 kn-flex kn-relative">
<div v-if="Object.keys(selectedParam).length === 0">
<InlineMessage severity="info"> {{ $t('documentExecution.documentDetails.outputParams.noParamSelected') }}</InlineMessage>
<InlineMessage severity="info" class="kn-width-full"> {{ $t('documentExecution.documentDetails.outputParams.noParamSelected') }}</InlineMessage>
</div>
<Card v-else>
<template #content>
......@@ -72,84 +72,84 @@
</template>
<script lang="ts">
import { iDocument, iParType, iDateFormat, iOutputParam } from '@/modules/documentExecution/documentDetails/DocumentDetails'
import { createValidations, ICustomValidatorMap } from '@/helpers/commons/validationHelper'
import { defineComponent, PropType } from 'vue'
import mainDescriptor from '@/modules/documentExecution/documentDetails/DocumentDetailsDescriptor.json'
import driversDescriptor from '@/modules/documentExecution/documentDetails/tabs/drivers/DocumentDetailsDriversDescriptor.json'
import outputParamDescriptor from './DocumentDetailsOutputParametersDescriptor.json'
import useValidate from '@vuelidate/core'
import KnListBox from '@/components/UI/KnListBox/KnListBox.vue'
import KnValidationMessages from '@/components/UI/KnValidatonMessages.vue'
import Dropdown from 'primevue/dropdown'
import InlineMessage from 'primevue/inlinemessage'
import { iDocument, iParType, iDateFormat, iOutputParam } from '@/modules/documentExecution/documentDetails/DocumentDetails'
import { createValidations, ICustomValidatorMap } from '@/helpers/commons/validationHelper'
import { defineComponent, PropType } from 'vue'
import mainDescriptor from '@/modules/documentExecution/documentDetails/DocumentDetailsDescriptor.json'
import driversDescriptor from '@/modules/documentExecution/documentDetails/tabs/drivers/DocumentDetailsDriversDescriptor.json'
import outputParamDescriptor from './DocumentDetailsOutputParametersDescriptor.json'
import useValidate from '@vuelidate/core'
import KnListBox from '@/components/UI/KnListBox/KnListBox.vue'
import KnValidationMessages from '@/components/UI/KnValidatonMessages.vue'
import Dropdown from 'primevue/dropdown'
import InlineMessage from 'primevue/inlinemessage'
export default defineComponent({
name: 'document-drivers',
components: { KnListBox, Dropdown, KnValidationMessages, InlineMessage },
props: { selectedDocument: { type: Object as PropType<iDocument>, required: true }, typeList: { type: Array as PropType<iParType[]>, required: true }, dateFormats: { type: Array as PropType<iDateFormat[]>, required: true } },
emits: ['driversChanged'],
data() {
return {
v$: useValidate() as any,
mainDescriptor,
driversDescriptor,
outputParamDescriptor,
selectedParam: {} as iOutputParam,
document: {} as any
}
export default defineComponent({
name: 'document-drivers',
components: { KnListBox, Dropdown, KnValidationMessages, InlineMessage },
props: { selectedDocument: { type: Object as PropType<iDocument>, required: true }, typeList: { type: Array as PropType<iParType[]>, required: true }, dateFormats: { type: Array as PropType<iDateFormat[]>, required: true } },
emits: ['driversChanged'],
data() {
return {
v$: useValidate() as any,
mainDescriptor,
driversDescriptor,
outputParamDescriptor,
selectedParam: {} as iOutputParam,
document: {} as any
}
},
created() {
this.document = this.selectedDocument
},
validations() {
const outputParamsValidator = (value) => {
return Object.keys(this.selectedParam).length === 0 || value
}
const customValidators: ICustomValidatorMap = { 'output-params-validator': outputParamsValidator }
const validationObject = { selectedParam: createValidations('selectedParam', outputParamDescriptor.validations.selectedParam, customValidators) }
return validationObject
},
methods: {
addParam() {
this.selectedParam = { numberOfErrors: 1, biObjectId: this.document.id, formatCode: null, formatValue: null, isUserDefined: true, type: this.typeList[0] ? this.typeList[0] : ({} as iParType), tempId: this.document.outputParameters.length + 1 } as iOutputParam
this.document.outputParameters.push(this.selectedParam)
},
created() {
this.document = this.selectedDocument
selectParam(event) {
this.selectedParam = event
},