Skip to content

Commit a84fb02

Browse files
feat: 处理冲突
2 parents 847835f + c8f9439 commit a84fb02

File tree

12 files changed

+184
-28
lines changed

12 files changed

+184
-28
lines changed

go.mod

+4-3
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,18 @@ require (
1818
github.com/golang/snappy v0.0.4 // indirect
1919
github.com/google/go-cmp v0.5.6 // indirect
2020
github.com/google/uuid v1.2.0
21+
github.com/imdario/mergo v0.3.12 // indirect
2122
github.com/kataras/iris/v12 v12.2.0-alpha2.0.20210427211137-fa175eb84754
2223
github.com/klauspost/compress v1.13.5 // indirect
24+
github.com/onsi/gomega v1.15.0 // indirect
2325
github.com/pkg/errors v0.9.1
2426
github.com/prometheus/common v0.29.0 // indirect
2527
github.com/sirupsen/logrus v1.8.1
26-
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e // indirect
28+
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
2729
github.com/spf13/cobra v1.2.1
2830
github.com/spf13/viper v1.8.1
2931
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
30-
github.com/xlzd/gotp v0.0.0-20220110052318-fab697c03c2c // indirect
31-
go.uber.org/zap v1.19.1 // indirect
32+
github.com/xlzd/gotp v0.0.0-20220110052318-fab697c03c2c
3233
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a
3334
golang.org/x/net v0.0.0-20210825183410-e898025ed96a // indirect
3435
golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1 // indirect

go.sum

-17
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd3
145145
github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible h1:Ppm0npCCsmuR9oQaBtRuZcmILVE74aXE+AmrJj8L2ns=
146146
github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g=
147147
github.com/benbjohnson/clock v1.0.3/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM=
148-
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
149148
github.com/beorn7/perks v0.0.0-20160804104726-4c0e84591b9a/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
150149
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
151150
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
@@ -372,7 +371,6 @@ github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5y
372371
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
373372
github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
374373
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
375-
github.com/evanphx/json-patch v0.5.2/go.mod h1:ZWS5hhDbVDyob71nXKNL0+PWn6ToqBHMikGIFbs31qQ=
376374
github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
377375
github.com/evanphx/json-patch v4.11.0+incompatible h1:glyUF9yIYtMHzn8xaKw5rMhdWcwsYV8dZHIq5567/xs=
378376
github.com/evanphx/json-patch v4.11.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
@@ -420,8 +418,6 @@ github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7
420418
github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU=
421419
github.com/go-logr/logr v0.4.0 h1:K7/B1jt6fIBQVd4Owv2MqGQClcgf0R266+7C/QjRcLc=
422420
github.com/go-logr/logr v0.4.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU=
423-
github.com/go-logr/zapr v0.4.0 h1:uc1uML3hRYL9/ZZPdgHS/n8Nzo+eaYL/Efxkkamf7OM=
424-
github.com/go-logr/zapr v0.4.0/go.mod h1:tabnROwaDl0UNxkVeFRbY8bwB37GwRv0P8lg6aAiEnk=
425421
github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg=
426422
github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
427423
github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY=
@@ -632,7 +628,6 @@ github.com/iris-contrib/jade v1.1.4/go.mod h1:EDqR+ur9piDl6DUgs6qRrlfzmlx/D5Uybo
632628
github.com/iris-contrib/schema v0.0.6 h1:CPSBLyx2e91H2yJzPuhGuifVRnZBBJ3pCOMbOvPZaTw=
633629
github.com/iris-contrib/schema v0.0.6/go.mod h1:iYszG0IOsuIsfzjymw1kMzTL8YQcCWlm65f3wX8J5iA=
634630
github.com/j-keck/arping v0.0.0-20160618110441-2cf9dc699c56/go.mod h1:ymszkNOg6tORTn+6F6j+Jc8TOr5osrynvN6ivFWZ2GA=
635-
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
636631
github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
637632
github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
638633
github.com/jmespath/go-jmespath v0.3.0/go.mod h1:9QtRXoHjLGCJ5IBSaohpXITPlowMeeYCZ7fLUTSywik=
@@ -1107,18 +1102,12 @@ go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 h1:+FNtrFTmVw0YZGpBGX56XDee33
11071102
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5/go.mod h1:nmDLcffg48OtT/PSW0Hg7FvpRQsQh5OSqIylirxKC7o=
11081103
go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
11091104
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
1110-
go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw=
11111105
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
11121106
go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A=
1113-
go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
11141107
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
1115-
go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4=
11161108
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
11171109
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
11181110
go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo=
1119-
go.uber.org/zap v1.19.0/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI=
1120-
go.uber.org/zap v1.19.1 h1:ue41HOKd1vGURxrmeKIgELGb3jPW9DMUDGtsinblHwI=
1121-
go.uber.org/zap v1.19.1/go.mod h1:j3DNczoxDZroyBnOT1L/Q79cfUMGZxlv/9dzN7SM1rI=
11221111
golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
11231112
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
11241113
golang.org/x/crypto v0.0.0-20181009213950-7c1a557ab941/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
@@ -1356,7 +1345,6 @@ golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBc
13561345
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
13571346
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
13581347
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
1359-
golang.org/x/sys v0.0.0-20210817190340-bfb29a6856f2/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
13601348
golang.org/x/sys v0.0.0-20210927052749-1cf2251ac284 h1:lBPNCmq8u4zFP3huKCmUQ2Fx8kcY4X+O12UgGnyKsrg=
13611349
golang.org/x/sys v0.0.0-20210927052749-1cf2251ac284/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
13621350
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
@@ -1440,14 +1428,11 @@ golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4f
14401428
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
14411429
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
14421430
golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
1443-
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
14441431
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
14451432
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
14461433
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
14471434
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
14481435
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
1449-
gomodules.xyz/jsonpatch/v2 v2.2.0 h1:4pT439QV83L+G9FkcCriY6EkpcK6r6bK+A5FBUMI7qY=
1450-
gomodules.xyz/jsonpatch/v2 v2.2.0/go.mod h1:WXp+iVDkoLQqPudfQ9GBlwB2eZ5DKOnjQZCYdOS8GPY=
14511436
google.golang.org/api v0.0.0-20160322025152-9bf6e6e569ff/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
14521437
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
14531438
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
@@ -1699,8 +1684,6 @@ rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
16991684
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.14/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg=
17001685
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.15/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg=
17011686
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.22/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg=
1702-
sigs.k8s.io/controller-runtime v0.10.3 h1:s5Ttmw/B4AuIbwrXD3sfBkXwnPMMWrqpVj4WRt1dano=
1703-
sigs.k8s.io/controller-runtime v0.10.3/go.mod h1:CQp8eyUQZ/Q7PJvnIrB6/hgfTC1kBkGylwsLgOQi1WY=
17041687
sigs.k8s.io/kustomize/api v0.8.11 h1:LzQzlq6Z023b+mBtc6v72N2mSHYmN8x7ssgbf/hv0H8=
17051688
sigs.k8s.io/kustomize/api v0.8.11/go.mod h1:a77Ls36JdfCWojpUqR6m60pdGY1AYFix4AH83nJtY1g=
17061689
sigs.k8s.io/kustomize/cmd/config v0.9.13/go.mod h1:7547FLF8W/lTaDf0BDqFTbZxM9zqwEJqCKN9sSR0xSs=

web/dashboard/src/api/replicasets.js

+8
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,11 @@ export function listReplicaSets (cluster_name, search, keywords, pageNum, pageSi
2727
export function listNsReplicaSets (cluster_name, namespace) {
2828
return get(`${replicaSetNamespaceUrl(cluster_name, namespace)}`)
2929
}
30+
31+
const replicaWorkloadSetNamespaceUrl = (cluster_name, namespace, selector) => {
32+
return `/api/v1/proxy/${cluster_name}/k8s/apis/apps/v1/namespaces/${namespace}/replicasets?labelSelector=${selector}`
33+
}
34+
35+
export function listNsReplicaSetsWorkload (cluster_name, namespace, selector) {
36+
return get(`${replicaWorkloadSetNamespaceUrl(cluster_name, namespace, selector)}`)
37+
}

web/dashboard/src/business/cluster/nodes/index.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
</el-button>
1414
<el-button type="primary" size="small"
1515
v-has-permissions="{scope:'cluster',apiGroup:'',resource:'nodes',verb:'update'}"
16-
@click="drain()" icon="el-icon-refresh-right">
16+
@click="drain()" icon="el-icon-position">
1717
{{$t('business.node.drain')}}
1818
</el-button>
1919
</div>

web/dashboard/src/business/workloads/daemonsets/index.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export default {
9292
},
9393
{
9494
label: this.$t("commons.button.restart"),
95-
icon: "el-icon-refresh-right",
95+
icon: "el-icon-refresh",
9696
click: (row) => {
9797
this.onRestart(row)
9898
},

web/dashboard/src/business/workloads/deployments/detail/index.vue

+8-1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@
5151
<ko-detail-pods :cluster="clusterName" :namespace="namespace" :selector="selectors" />
5252
</el-card>
5353
</el-row>
54+
<el-row style="margin-top:20px" class="row-box">
55+
<el-card class="el-card">
56+
<h3>History</h3>
57+
<Ko-detail-replicasets :cluster="clusterName" :namespace="namespace" :name="name" :selector="selectors" />
58+
</el-card>
59+
</el-row>
5460
</div>
5561
<div v-if="yamlShow">
5662
<yaml-editor :value="form" :read-only="true" />
@@ -73,10 +79,11 @@ import KoDetailIngress from "@/components/detail/detail-ingress"
7379
import KoDetailPause from "@/components/detail/detail-pause"
7480
import KoDetailUpdate from "@/components/detail/detail-update"
7581
import KoDetailImage from "@/components/detail/detail-image"
82+
import KoDetailReplicasets from "@/components/detail/detail-replicasets"
7683
7784
export default {
7885
name: "DeploymentDetail",
79-
components: { KoDetailPods, KoDetailBasic, KoDetailConditions, KoDetailService, KoDetailIngress, KoDetailPause, KoDetailUpdate, KoDetailImage, LayoutContent, YamlEditor },
86+
components: { KoDetailPods, KoDetailBasic, KoDetailConditions, KoDetailService, KoDetailIngress, KoDetailPause, KoDetailUpdate, KoDetailImage, LayoutContent, YamlEditor, KoDetailReplicasets},
8087
props: {
8188
name: String,
8289
namespace: String,

web/dashboard/src/business/workloads/deployments/index.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export default {
125125
},
126126
{
127127
label: this.$t("commons.button.restart"),
128-
icon: "el-icon-refresh-right",
128+
icon: "el-icon-refresh",
129129
click: (row) => {
130130
this.onRestart(row)
131131
},

web/dashboard/src/business/workloads/statefulsets/index.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export default {
125125
},
126126
{
127127
label: this.$t("commons.button.restart"),
128-
icon: "el-icon-refresh-right",
128+
icon: "el-icon-refresh",
129129
click: (row) => {
130130
this.onRestart(row)
131131
},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
<template>
2+
<div>
3+
<complex-table :data="pods" v-loading="loading" @search="search">
4+
<el-table-column :label="$t('commons.table.version')" prop="name" min-width="80" show-overflow-tooltip>
5+
<template v-slot:default="{row}">
6+
<span>{{ row.metadata.annotations["deployment.kubernetes.io/revision"] }}</span>
7+
</template>
8+
</el-table-column>
9+
<el-table-column :label="$t('commons.table.image')" prop="image" min-width="80" show-overflow-tooltip>
10+
<template v-slot:default="{row}">
11+
<span v-for="(k, index) in row.spec.template.spec.containers" :key="index">
12+
<span class="label-custom wd" type="info">{{ k.image }}</span>
13+
</span>
14+
</template>
15+
</el-table-column>
16+
<el-table-column :label="$t('commons.table.time')" prop="time" min-width="80" show-overflow-tooltip>
17+
<template v-slot:default="{row}">
18+
<span>{{ row.metadata.creationTimestamp | datetimeFormat }}</span>
19+
</template>
20+
</el-table-column>
21+
<ko-table-operations :buttons="buttons" :label="$t('commons.table.action')"></ko-table-operations>
22+
</complex-table>
23+
24+
<el-dialog :title="$t('business.workload.specific_information')" width="70%" :close-on-click-modal="false" :visible.sync="dialogSpecificVisible">
25+
<yaml-editor :value="itemVerisonForm" :read-only="true" />
26+
<div slot="footer" class="dialog-footer">
27+
<el-button size="small" @click="dialogSpecificVisible = false">{{ $t("commons.button.cancel") }}</el-button>
28+
</div>
29+
</el-dialog>
30+
</div>
31+
</template>
32+
33+
<script>
34+
import ComplexTable from "@/components/complex-table"
35+
import KoTableOperations from "@/components/ko-table-operations"
36+
import { checkPermissions } from "@/utils/permission"
37+
import { listNsReplicaSetsWorkload } from "@/api/replicasets"
38+
import { patchDeployment } from "@/api/deployments"
39+
import YamlEditor from "@/components/yaml-editor"
40+
41+
export default {
42+
name: "KoDetailReplicasets",
43+
components: { ComplexTable, KoTableOperations, YamlEditor },
44+
props: {
45+
cluster: String,
46+
namespace: String,
47+
selector: String,
48+
fieldSelector: String,
49+
name: String,
50+
},
51+
watch: {
52+
selector: {
53+
handler(newSelector) {
54+
if (newSelector) {
55+
this.search()
56+
}
57+
},
58+
immediate: true,
59+
},
60+
fieldSelector: {
61+
handler(newSelector) {
62+
if (newSelector) {
63+
this.search()
64+
}
65+
},
66+
immediate: true,
67+
},
68+
},
69+
data() {
70+
return {
71+
buttons: [
72+
{
73+
label: this.$t("commons.button.rollback"),
74+
icon: "el-icon-refresh-left",
75+
click: (row) => {
76+
this.OptionRollback(row)
77+
},
78+
},
79+
{
80+
label: this.$t("business.workload.specific_information"),
81+
icon: "el-icon-tickets",
82+
click: (row) => {
83+
this.SpecificInformation(row)
84+
},
85+
},
86+
],
87+
loading: false,
88+
pods: [],
89+
podUsage: [],
90+
itemVerisonForm: {},
91+
dialogSpecificVisible: false,
92+
}
93+
},
94+
methods: {
95+
search(resetPage) {
96+
this.loading = true
97+
if (resetPage) {
98+
this.paginationConfig.currentPage = 1
99+
}
100+
if (!checkPermissions({ scope: "namespace", apiGroup: "", resource: "pods", verb: "list" })) {
101+
return
102+
}
103+
listNsReplicaSetsWorkload(this.cluster, this.namespace, this.selector, this.fieldSelector).then((res) => {
104+
this.loading = false
105+
res.items.sort((a, b) => b.metadata.annotations["deployment.kubernetes.io/revision"] - a.metadata.annotations["deployment.kubernetes.io/revision"])
106+
for (var i = 0; i < res.items.length; i++) {
107+
this.pods.push(res.items[i])
108+
}
109+
})
110+
},
111+
OptionRollback(row) {
112+
this.$confirm(this.$t("commons.confirm_message.rollback"), this.$t("commons.message_box.prompt"), {
113+
confirmButtonText: this.$t("commons.button.confirm"),
114+
cancelButtonText: this.$t("commons.button.cancel"),
115+
type: "warning",
116+
}).then(() => {
117+
patchDeployment(this.cluster, row.metadata.namespace, this.name, { spec: { template: row.spec.template } })
118+
.then(() => {
119+
this.dialogModifyVersionVisible = false
120+
this.loading = true
121+
this.$message({
122+
type: "success",
123+
message: this.$t("commons.msg.operation_success"),
124+
})
125+
})
126+
.finally(() => {
127+
this.loading = false
128+
})
129+
})
130+
},
131+
SpecificInformation(row) {
132+
this.itemVerisonForm = row
133+
this.dialogSpecificVisible = true
134+
},
135+
},
136+
mounted() {
137+
this.clusterName = this.$route.query.cluster
138+
},
139+
}
140+
</script>
141+
142+
<style scoped>
143+
.btnSize {
144+
width: 28px;
145+
height: 28px;
146+
}
147+
</style>

web/dashboard/src/i18n/lang/en-US.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ const message = {
5353
scale: "Scale",
5454
restart: "Restart",
5555
modifying_version: "Modifying version",
56-
sync: "Sync"
56+
sync: "Sync",
57+
rollback: "Roll Back"
5758
},
5859
table: {
5960
name: "Name",
@@ -67,6 +68,8 @@ const message = {
6768
type: "Type",
6869
resourceInformation: "Resource Information",
6970
empty_text: "There are no rows to show.",
71+
version: "Version",
72+
image: "Image",
7073
},
7174
status: {
7275
Running: "Running",
@@ -110,6 +113,7 @@ const message = {
110113
delete: "This operation cannot be undone, do you want to continue?",
111114
back_form: "Return form editing does not preserve all changes made to YAML",
112115
open_yaml: ", still want to open YAML edit?",
116+
rollback: "This action rolls back the current Deployment to the changed version, do you want to continue?",
113117
},
114118
login: {
115119
username: "Username",
@@ -256,6 +260,7 @@ const message = {
256260
container_type: "Container type",
257261
current_version: "Current version",
258262
new_version: "New version",
263+
specific_information: "Specific information",
259264
initContainer: "InitContainer",
260265
standardContainer: "StandardContainer",
261266
schedule: "Schedule",

0 commit comments

Comments
 (0)