|
|
@@ -3,32 +3,26 @@
|
|
|
<div class="title">部署管理</div>
|
|
|
<div class="body">
|
|
|
<el-table
|
|
|
- :data="deployments.filter(data => !search || data.namespace.includes(search))"
|
|
|
+ :data="
|
|
|
+ deployments.filter(
|
|
|
+ (data) => !search || data.namespace.includes(search),
|
|
|
+ )
|
|
|
+ "
|
|
|
:height="'70vh'"
|
|
|
- :header-cell-style="{'text-align':'center'}"
|
|
|
- :cell-style="{'text-align':'center', 'cursor': 'pointer'}"
|
|
|
- :default-sort = "{prop: 'deployedTime', order: 'descending'}"
|
|
|
- @row-click="viewDetails">
|
|
|
- <el-table-column
|
|
|
- prop="id"
|
|
|
- label="ID"
|
|
|
- width="120">
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- prop="pipelineId"
|
|
|
- label="流水线ID"
|
|
|
- width="120">
|
|
|
+ :header-cell-style="{ 'text-align': 'center' }"
|
|
|
+ :cell-style="{ 'text-align': 'center', cursor: 'pointer' }"
|
|
|
+ :default-sort="{ prop: 'deployedTime', order: 'descending' }"
|
|
|
+ @row-click="viewDetails"
|
|
|
+ >
|
|
|
+ <el-table-column prop="id" label="ID" width="120"> </el-table-column>
|
|
|
+ <el-table-column prop="pipelineId" label="流水线ID" width="120">
|
|
|
</el-table-column>
|
|
|
- <el-table-column
|
|
|
- label="namespace"
|
|
|
- width="auto">
|
|
|
+ <el-table-column label="namespace" width="auto">
|
|
|
<template slot-scope="scope">
|
|
|
<el-tag>{{ scope.row.namespace }}</el-tag>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column
|
|
|
- label="deployName"
|
|
|
- width="auto">
|
|
|
+ <el-table-column label="deployName" width="auto">
|
|
|
<template slot-scope="scope">
|
|
|
<el-tag type="success">{{ scope.row.deployName }}</el-tag>
|
|
|
</template>
|
|
|
@@ -37,21 +31,24 @@
|
|
|
prop="deployedTime"
|
|
|
label="部署时间"
|
|
|
width="250"
|
|
|
- sortable>
|
|
|
+ sortable
|
|
|
+ >
|
|
|
</el-table-column>
|
|
|
- <el-table-column
|
|
|
- align="right">
|
|
|
+ <el-table-column align="right">
|
|
|
<template slot="header">
|
|
|
<el-input
|
|
|
v-model="search"
|
|
|
size="mini"
|
|
|
- placeholder="输入关键字搜索"/>
|
|
|
+ placeholder="输入关键字搜索"
|
|
|
+ />
|
|
|
</template>
|
|
|
<template slot-scope="scope">
|
|
|
<el-button
|
|
|
size="mini"
|
|
|
type="primary"
|
|
|
- @click="viewDetails(scope.row)">查看详情</el-button>
|
|
|
+ @click="viewDetails(scope.row)"
|
|
|
+ >查看详情</el-button
|
|
|
+ >
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
@@ -65,15 +62,18 @@
|
|
|
:page-sizes="[5, 10, 20]"
|
|
|
:page-size="pageSize"
|
|
|
layout="sizes, prev, pager, next"
|
|
|
- :total="totalItems">
|
|
|
+ :total="totalItems"
|
|
|
+ >
|
|
|
</el-pagination>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { getTotalDeployments,
|
|
|
- getDeploymentsByCurrentAndSize} from '@/api/deployment'
|
|
|
+import {
|
|
|
+ getTotalDeployments,
|
|
|
+ getDeploymentsByCurrentAndSize,
|
|
|
+} from '@/api/deployment'
|
|
|
export default {
|
|
|
name: 'DeploymentManage',
|
|
|
data() {
|
|
|
@@ -82,68 +82,72 @@ export default {
|
|
|
pageSize: 10,
|
|
|
currentPage: 1,
|
|
|
deployments: [],
|
|
|
- search: ''
|
|
|
+ search: '',
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
totalItems() {
|
|
|
return this.pageSize * this.pageTotal
|
|
|
- }
|
|
|
+ },
|
|
|
},
|
|
|
async mounted() {
|
|
|
- await this.getTotalPages(this.pageSize);
|
|
|
- await this.getDataByCurrentAndPageSize(this.currentPage, this.pageSize);
|
|
|
+ await this.getTotalPages(this.pageSize)
|
|
|
+ await this.getDataByCurrentAndPageSize(this.currentPage, this.pageSize)
|
|
|
},
|
|
|
methods: {
|
|
|
getTotalPages(pageSize) {
|
|
|
const config = {
|
|
|
params: {
|
|
|
- pageSize: pageSize
|
|
|
- }
|
|
|
- };
|
|
|
- getTotalDeployments(config).then(res => {
|
|
|
- this.pageTotal = res.data.data;
|
|
|
- }).catch(err => {
|
|
|
- console.log(err);
|
|
|
- })
|
|
|
+ pageSize: pageSize,
|
|
|
+ },
|
|
|
+ }
|
|
|
+ getTotalDeployments(config)
|
|
|
+ .then((res) => {
|
|
|
+ this.pageTotal = res.data.data
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ console.log(err)
|
|
|
+ })
|
|
|
},
|
|
|
getDataByCurrentAndPageSize(current, pageSize) {
|
|
|
const config = {
|
|
|
params: {
|
|
|
pageNo: current - 1,
|
|
|
- pageSize: pageSize
|
|
|
- }
|
|
|
- };
|
|
|
- getDeploymentsByCurrentAndSize(config).then(res => {
|
|
|
- this.deployments = res.data.data;
|
|
|
- }).catch(err => {
|
|
|
- console.log(err);
|
|
|
- })
|
|
|
+ pageSize: pageSize,
|
|
|
+ },
|
|
|
+ }
|
|
|
+ getDeploymentsByCurrentAndSize(config)
|
|
|
+ .then((res) => {
|
|
|
+ this.deployments = res.data.data
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ console.log(err)
|
|
|
+ })
|
|
|
},
|
|
|
// 切换每页大小
|
|
|
async handleSizeChange(val) {
|
|
|
- this.pageSize = val;
|
|
|
- this.currentPage = 1;
|
|
|
- await this.getTotalPages(this.pageSize);
|
|
|
- await this.getDataByCurrentAndPageSize(this.currentPage, this.pageSize);
|
|
|
+ this.pageSize = val
|
|
|
+ this.currentPage = 1
|
|
|
+ await this.getTotalPages(this.pageSize)
|
|
|
+ await this.getDataByCurrentAndPageSize(this.currentPage, this.pageSize)
|
|
|
},
|
|
|
// 切换页数
|
|
|
async handleCurrentChange(val) {
|
|
|
- this.currentPage = val;
|
|
|
- await this.getDataByCurrentAndPageSize(this.currentPage, this.pageSize);
|
|
|
+ this.currentPage = val
|
|
|
+ await this.getDataByCurrentAndPageSize(this.currentPage, this.pageSize)
|
|
|
},
|
|
|
// 查看详情
|
|
|
viewDetails(row) {
|
|
|
- console.log(row, row.deployName, row.namespace);
|
|
|
+ console.log(row, row.deployName, row.namespace)
|
|
|
this.$router.push({
|
|
|
path: '/deploymentDetail',
|
|
|
query: {
|
|
|
namespace: row.namespace,
|
|
|
- deployName: row.deployName
|
|
|
- }
|
|
|
+ deployName: row.deployName,
|
|
|
+ },
|
|
|
})
|
|
|
- }
|
|
|
- }
|
|
|
+ },
|
|
|
+ },
|
|
|
}
|
|
|
</script>
|
|
|
|