Skip to content

Commit 2922aaf

Browse files
GRL-bxy吹泡泡的团子
andauthored
Feature/console monitor (#1491)
* feat:add thread pool * fix: monitor * feat:monitor * feat:tenant style + thread pool query * feat:Monitor selection + search boxes for no items * feat:tenantList --------- Co-authored-by: 吹泡泡的团子 <[email protected]>
1 parent fa20697 commit 2922aaf

File tree

19 files changed

+429
-234
lines changed

19 files changed

+429
-234
lines changed

threadpool/console/src/App.vue

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,29 @@ export default {
1212
computed: {
1313
...mapGetters(['tenantInfo'])
1414
},
15-
mounted() {
15+
async mounted() {
1616
const userName = this.$cookie.get('userName');
17-
user
17+
await user
1818
.getCurrentUser(userName)
1919
.then((response) => {
2020
const { resources } = response;
21-
resources.map((item) => ({
22-
...item,
23-
tenantId: item.resource
24-
}))
2521
if (response.role == 'ROLE_ADMIN') {
2622
resources.unshift({
2723
action: "rw",
2824
resource: this.$t('common.allTenant'),
2925
username: userName,
3026
tenantId: this.$t('common.allTenant'),
27+
index: 0,
3128
})
3229
}
33-
this.$store.dispatch('tenant/setTenantList', resources)
30+
const resourcesRes = resources.map((item, index) => ({
31+
...item,
32+
tenantId: item.resource,
33+
index: index,
34+
}))
35+
this.$store.dispatch('tenant/setTenantList', resourcesRes)
3436
if (!this.tenantInfo.resource) {
35-
this.$store.dispatch('tenant/setTenantInfo', resources[0])
37+
this.$store.dispatch('tenant/setTenantInfo', resourcesRes[0])
3638
console.log("ssss", this.tenantInfo)
3739
}
3840
})

threadpool/console/src/layout/components/Navbar.vue

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
<!-- </el-tooltip>-->
1919

2020
</template>
21-
<el-select class="select-tenant" v-model="tenant.resource" filterable @change="changeTenant">
21+
<el-select class="select-tenant" v-model="tenant.index" filterable @change="changeTenant">
2222
<el-option
2323
v-for="(item, index) in tenantList"
2424
:key="index"
2525
:label="item.resource"
26-
:value="index">
26+
:value="item.index">
2727
</el-option>
2828
</el-select>
2929
<langChange />
@@ -65,7 +65,7 @@
6565
action: '',
6666
resource: '',
6767
username: ''
68-
}
68+
},
6969
}
7070
},
7171
components: {
@@ -87,7 +87,7 @@
8787
tenantInfo(newVal) {
8888
this.tenant.tenantId = newVal.tenantId
8989
this.tenant.resource = newVal.resource
90-
console.log("ischangLang", newVal)
90+
console.log("ischangLang", newVal, this.tenantList)
9191
}
9292
},
9393
methods: {
@@ -96,6 +96,7 @@
9696
},
9797
async logout() {
9898
this.$cookie.delete('userName')
99+
this.$cookie.delete('tenantInfo')
99100
await this.$store.dispatch('user/logout')
100101
this.$router.push(`/login?redirect=${this.$route.fullPath}`)
101102
},
@@ -105,22 +106,32 @@
105106
.getCurrentUser(userName)
106107
.then((response) => {
107108
const { resources } = response;
108-
resources.map((item) => ({
109-
...item,
110-
tenantId: item.resource
111-
}))
109+
console.log("isTenList1", resources, this.tenantList)
112110
if (response.role == 'ROLE_ADMIN') {
113111
resources.unshift({
114112
action: "rw",
115113
resource: this.$t('common.allTenant'),
116114
username: userName,
117115
tenantId: this.$t('common.allTenant'),
116+
index: 0,
118117
})
119118
}
120-
this.$store.dispatch('tenant/setTenantList', resources)
121-
this.$store.dispatch('tenant/setTenantInfo', this.tenantInfo || resources[0])
122-
this.tenant = this.tenantInfo || resources[0]
123-
console.log("isResour", resources[0], this.tenant)
119+
console.log("isTenList1111111", this.$t('common.allTenant'), resources, this.tenantList)
120+
const resourcesRes = resources.map((item, index) => {
121+
let query = {
122+
...item,
123+
tenantId: item.resource,
124+
index: index,
125+
}
126+
console.log("=============", index, query, item)
127+
return query
128+
})
129+
console.log("isTenList22222", resourcesRes, this.tenantList)
130+
this.$store.dispatch('tenant/setTenantList', resourcesRes)
131+
this.tenant = JSON.parse(this.$cookie.get('tenantInfo')) || resourcesRes[0]
132+
this.$store.dispatch('tenant/setTenantInfo', this.tenant || resourcesRes[0])
133+
this.$cookie.set('tenantInfo', JSON.stringify(this.tenant));
134+
console.log("isTenList2", this.tenantList)
124135
})
125136
.catch(() => {});
126137
@@ -130,11 +141,13 @@
130141
let tenant = {
131142
tenantId: this.tenantList[index].resource,
132143
resource: this.tenantList[index].resource,
144+
index: this.tenantList[index].index,
133145
current: 1,
134146
desc: true,
135147
size: 10,
136148
}
137149
this.$store.dispatch('tenant/setTenantInfo', tenant)
150+
this.$cookie.set('tenantInfo', JSON.stringify(tenant));
138151
let isAllTenant = tenant.tenantId == i18nConfig.messages.zh.common.allTenant || tenant.tenantId == i18nConfig.messages.en.common.allTenant
139152
tenant.tenantId = isAllTenant ? '' : tenant.tenantId
140153
await jobProjectApi.list(tenant).then((response) => {
@@ -199,6 +212,7 @@
199212
width: 150px;
200213
}
201214
215+
202216
.right-menu-item {
203217
display: inline-block;
204218
padding: 0 8px;

threadpool/console/src/locale/langChange.vue

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
:key="item.lang"
1212
:command="item.lang"
1313
>
14-
<span class="dropdown-item-text" :data-active="item.lang === currentLang">{{ item.name }}</span>
14+
<span :data-active="item.lang === currentLang" :class="{chooseItem: item.lang === currentLang}" >{{ item.name }}</span>
1515
</el-dropdown-item>
1616
</el-dropdown-menu>
1717
</el-dropdown>
@@ -53,11 +53,6 @@ export default {
5353
user.getCurrentUser(userName)
5454
.then((response) => {
5555
const { resources } = response;
56-
resources.map((item) => ({
57-
...item,
58-
tenantId: item.resource
59-
}))
60-
6156
//change lang =》 change global tenantInfo
6257
if (response.role == 'ROLE_ADMIN') {
6358
//判断tenantInfo是否为所有租户选项
@@ -66,18 +61,32 @@ export default {
6661
let alreadyHasAll = resources[0] == i18nConfig.messages.zh.common.allTenant || resources[0] == i18nConfig.messages.en.common.allTenant
6762
if (alreadyHasAll) {
6863
this.$set(resources[0], 'resource', this.$t('common.allTenant'))
69-
this.$store.dispatch('tenant/setTenantList', resources)
64+
const resourcesRes = resources.map((item, index) => ({
65+
...item,
66+
tenantId: item.resource,
67+
index: index,
68+
}))
69+
this.$store.dispatch('tenant/setTenantList', resourcesRes)
70+
if (isAllTenant) {
71+
this.$store.dispatch('tenant/setTenantInfo', resources[0])
72+
}
7073
} else {
7174
resources.unshift({
7275
action: "rw",
7376
resource: this.$t('common.allTenant'),
7477
username: userName,
7578
tenantId: this.$t('common.allTenant'),
79+
index: 0,
7680
})
77-
this.$store.dispatch('tenant/setTenantList', resources)
78-
}
79-
if (isAllTenant) {
80-
this.$store.dispatch('tenant/setTenantInfo', resources[0])
81+
const resourcesRes = resources.map((item, index) => ({
82+
...item,
83+
tenantId: item.resource,
84+
index: index,
85+
}))
86+
this.$store.dispatch('tenant/setTenantList', resourcesRes)
87+
if (isAllTenant) {
88+
this.$store.dispatch('tenant/setTenantInfo', resources[0])
89+
}
8190
}
8291
}
8392
})
@@ -93,9 +102,17 @@ export default {
93102
cursor: pointer;
94103
}
95104
}
96-
.dropdown-item-text{
97-
&[data-active=true] {
98-
color: var(--jjext-color-dropdown-text) !important;
99-
}
105+
::v-deep .el-dropdown-menu__item:not(.is-disabled):hover {
106+
background: #f5f7fa;
107+
color: #606266;
108+
}
109+
110+
.el-icon--right {
111+
color: #c0c4cc;
112+
}
113+
114+
.chooseItem {
115+
font-weight: bold;
116+
color: #1890ff;
100117
}
101118
</style>

threadpool/console/src/store/modules/tenant.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,26 @@ const actions = {
2626
if (response.role == 'ROLE_ADMIN') {
2727
resources.unshift({
2828
action: "rw",
29-
resource: "所有租户",
30-
username: userName
29+
resource: this.$t('common.allTenant'),
30+
username: userName,
31+
tenantId: this.$t('common.allTenant'),
32+
index: 0,
3133
})
3234
}
33-
commit('SET_TENANT_LIST', resources)
35+
const resourcesRes = resources.map((item, index) => ({
36+
...item,
37+
tenantId: item.resource,
38+
index: index,
39+
}))
40+
console.log("asasxasxas==========", resourcesRes)
41+
commit('SET_TENANT_LIST', resourcesRes)
3442
if (!state.tenantInfo) {
35-
commit('SET_GLOBAL_TENANT', resources[0])
43+
commit('SET_GLOBAL_TENANT', resourcesRes[0])
3644
}
3745
})
3846
.catch(() => {});
3947
},
48+
4049
setTenantList({commit}, log) {
4150
commit('SET_TENANT_LIST', log)
4251
},

threadpool/console/src/views/hippo4j/instance/index.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,10 @@ export default {
584584
created() {
585585
// this.fetchData()
586586
// 初始化项目
587-
this.initSelect();
587+
this.listQuery.tenantId = this?.tenantInfo?.tenantId || this.listQuery.tenantId
588+
let isAllTenant = this.listQuery.tenantId == i18nConfig.messages.zh.common.allTenant || this.listQuery.tenantId == i18nConfig.messages.en.common.allTenant
589+
this.listQuery.tenantId = isAllTenant ? '' : this.listQuery.tenantId
590+
this.tenantSelectList();
588591
},
589592
methods: {
590593
onInput() {
@@ -819,6 +822,7 @@ export default {
819822
this.itemOptions = [];
820823
this.threadPoolOptions = [];
821824
const tenantId = { tenantId: this.listQuery.tenantId, size: this.size };
825+
console.log("XXXXXXXXXXXXXXX", tenantId)
822826
itemApi
823827
.list(tenantId)
824828
.then((response) => {

0 commit comments

Comments
 (0)