This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
nezha-nezha-fronted/nezha-fronted/src/components/page/integration/integration-tabs/integration-tabs.vue

76 lines
2.1 KiB
Vue
Raw Normal View History

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">
<!-- 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'" :tempId="detailsObj.tempId"></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>
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: {
detailsObj: Object,
type: String
2023-02-22 18:32:54 +08:00
},
components: {
manual,
automatic,
2023-02-22 18:32:54 +08:00
configuration,
dashboard,
alert,
metric
},
data () {
return {
tabs: [],
tabId: ''
2023-02-22 18:32:54 +08:00
}
},
methods: {
tabChange (id) {
if (this.tabId === id) { return }
this.tabId = id
}
},
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>