Skip to content

Commit

Permalink
feat:op中客户端管理新增是否在线的筛选 #1478 (#1480)
Browse files Browse the repository at this point in the history
* feat:op中客户端管理新增是否在线的筛选 #1478

* feat:op中客户端管理新增是否在线的筛选 #1478
  • Loading branch information
lannoy0523 authored Nov 23, 2023
1 parent 598bfbf commit 2441241
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ interface FsClientClient {
@RequestParam projectId: String?,
@RequestParam repoName: String?,
@RequestParam pageNumber: Int?,
@RequestParam pageSize: Int?
@RequestParam pageSize: Int?,
@RequestParam online: Boolean?
): Response<Page<ClientDetail>>
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import com.tencent.bkrepo.common.api.constant.DEFAULT_PAGE_SIZE
data class ClientListRequest(
val projectId: String?,
val repoName: String?,
val online:Boolean?,
val pageNumber: Int = DEFAULT_PAGE_NUMBER,
val pageSize: Int = DEFAULT_PAGE_SIZE
)
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ class ClientHandler(
projectId = request.queryParamOrNull(ClientListRequest::projectId.name),
repoName = request.queryParamOrNull(ClientListRequest::repoName.name),
pageNumber = request.queryParamOrNull(ClientListRequest::pageNumber.name)?.toInt() ?: DEFAULT_PAGE_NUMBER,
pageSize = request.queryParamOrNull(ClientListRequest::pageSize.name)?.toInt() ?: DEFAULT_PAGE_SIZE
pageSize = request.queryParamOrNull(ClientListRequest::pageSize.name)?.toInt() ?: DEFAULT_PAGE_SIZE,
online = request.queryParamOrNull(ClientListRequest::online.name)?.toBoolean()
)
return ReactiveResponseBuilder.success(clientService.listClients(listRequest))
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class ClientService(
val criteria = Criteria()
request.projectId?.let { criteria.and(TClient::projectId.name).isEqualTo(request.projectId) }
request.repoName?.let { criteria.and(TClient::repoName.name).isEqualTo(request.repoName) }
request.online?.let { criteria.and(TClient::online.name).isEqualTo(request.online) }
val query = Query(criteria)
val count = clientRepository.count(query)
val data = clientRepository.find(query.with(pageRequest))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ class FsClientController(
request.projectId,
request.repoName,
request.pageNumber,
request.pageSize
request.pageSize,
request.online
)
}
}
5 changes: 3 additions & 2 deletions src/frontend/devops-op/src/api/fileSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ import request from '@/utils/request'
export const DEFAULT_PAGE_SIZE = 10
const PREFIX = '/opdata/api/fs-client'

export function queryFileSystemClient(projectId, repoName, pageNumber) {
export function queryFileSystemClient(projectId, repoName, pageNumber, online) {
return request({
url: `${PREFIX}/list/`,
method: 'get',
params: {
pageNumber: pageNumber,
pageSize: DEFAULT_PAGE_SIZE,
projectId: projectId === '' ? null : projectId,
repoName: repoName === '' ? null : repoName
repoName: repoName === '' ? null : repoName,
online: online === '' ? null : online
}
})
}
31 changes: 27 additions & 4 deletions src/frontend/devops-op/src/views/node/FileSystem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@
</template>
</el-autocomplete>
</el-form-item>
<el-form-item style="margin-left: 15px" label="是否在线" prop="online">
<el-select v-model="clientQuery.online" clearable placeholder="请选择">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button
size="mini"
Expand All @@ -52,7 +62,7 @@
<el-table-column prop="version" label="版本" />
<el-table-column prop="os" label="操作系统" />
<el-table-column prop="arch" label="架构" />
<el-table-column prop="online" label="是否在线">
<el-table-column prop="online" label="是否在线" :filters="[{ text: '是', value: true }, { text: '否', value: false }]" :filter-method="filterFunction">
<template slot-scope="scope">
{{ scope.row.online ? "是":"否" }}
</template>
Expand Down Expand Up @@ -92,9 +102,17 @@ export default {
clientQuery: {
projectId: '',
repoName: '',
pageNumber: 1
pageNumber: 1,
online: ''
},
clients: []
clients: [],
options: [{
value: 'true',
label: ''
}, {
value: 'false',
label: ''
}]
}
},
mounted() {
Expand Down Expand Up @@ -146,6 +164,7 @@ export default {
}
query.projectId = this.clientQuery.projectId
query.repoName = this.clientQuery.repoName
query.online = this.clientQuery.online
this.$router.push({ path: '/nodes/FileSystem', query: query })
},
onRouteUpdate(route) {
Expand All @@ -154,6 +173,7 @@ export default {
clientQuery.projectId = query.projectId ? query.projectId : ''
clientQuery.repoName = query.repoName ? query.repoName : ''
clientQuery.pageNumber = query.page ? Number(query.page) : 1
clientQuery.online = query.online ? query.online : ''
this.$nextTick(() => {
this.queryClients(clientQuery)
})
Expand All @@ -170,7 +190,7 @@ export default {
doQueryClients(clientQuery) {
this.loading = true
let promise = null
promise = queryFileSystemClient(clientQuery.projectId, clientQuery.repoName, clientQuery.pageNumber)
promise = queryFileSystemClient(clientQuery.projectId, clientQuery.repoName, clientQuery.pageNumber, clientQuery.online)
promise.then(res => {
this.clients = res.data.records
this.total = res.data.totalRecords
Expand All @@ -183,6 +203,9 @@ export default {
},
formatNormalDate(data) {
return formatNormalDate(data)
},
filterFunction(value, row) {
return row.online === value
}
}
}
Expand Down

0 comments on commit 2441241

Please sign in to comment.