2023-02-22 18:32:54 +08:00
< template >
< div class = "integration-tabs" >
< ul class = "integration-tabs-nav" >
< li class = "integration-tabs-nav-item" :class = "{active:tabId===item.id}" v-for = "item in tabs" :key="item.id" @click="tabChange(item.id)" > {{ item.name }} < / li >
< / ul >
< div class = "integration-tabs-content" >
2023-03-02 09:42:41 +08:00
<!-- internal -- >
< manual v-if = "tabId==='manual'" > < / manual >
< automatic v-if = "tabId==='automatic'" > < / automatic >
<!-- module -- >
2023-02-22 18:32:54 +08:00
< configuration v-if = "tabId==='configuration'" :configuration="detailsObj.configuration" > < / configuration >
< dashboard v-if = "tabId==='dashboard'" :dashboardTemplate="detailsObj.dashboardTemplate" > < / dashboard >
2023-02-23 14:48:03 +08:00
< alert v-if = "tabId==='alert'" :moduleId="detailsObj.id" > < / alert >
< metric v-if = "tabId==='metric'" :moduleId="detailsObj.id" > < / metric >
2023-02-22 18:32:54 +08:00
< / div >
< / div >
< / template >
< script >
2023-03-02 09:42:41 +08:00
import manual from './manual.vue'
import automatic from './automatic.vue'
2023-02-22 18:32:54 +08:00
import configuration from './configuration.vue'
import dashboard from './dashboard.vue'
import alert from './alert.vue'
import metric from './metric.vue'
export default {
name : 'integration-tabs' ,
props : {
2023-03-02 09:42:41 +08:00
detailsObj : Object ,
type : String
2023-02-22 18:32:54 +08:00
} ,
components : {
2023-03-02 09:42:41 +08:00
manual ,
automatic ,
2023-02-22 18:32:54 +08:00
configuration ,
dashboard ,
alert ,
metric
} ,
data ( ) {
return {
2023-03-02 09:42:41 +08:00
tabs : [ ] ,
tabId : ''
2023-02-22 18:32:54 +08:00
}
} ,
methods : {
tabChange ( id ) {
if ( this . tabId === id ) { return }
this . tabId = id
}
2023-03-02 09:42:41 +08:00
} ,
watch : {
type : {
immediate : true ,
handler ( val ) {
if ( val === 'internal' ) {
this . tabId = 'manual'
this . tabs = [
{ id : 'manual' , name : this . $t ( 'integration.manualInstallation' ) } ,
{ id : 'automatic' , name : this . $t ( 'integration.automaticInstallation' ) }
]
} else if ( val === 'module' ) {
this . tabId = 'configuration'
this . tabs = [
{ id : 'configuration' , name : this . $t ( 'project.module.configs' ) } ,
{ id : 'dashboard' , name : this . $t ( 'overall.dashboard' ) } ,
{ id : 'alert' , name : this . $t ( 'overall.alert' ) } ,
{ id : 'metric' , name : this . $t ( 'overall.metric' ) }
]
}
}
}
2023-02-22 18:32:54 +08:00
}
}
< / script >