Skip to content

Commit b3b01f2

Browse files
authored
Merge pull request #9249 from GuoLiBin6/feat/glb-to-4.0/src
feat: container image secret
2 parents 3a8dd80 + 93720c0 commit b3b01f2

File tree

9 files changed

+75
-10
lines changed

9 files changed

+75
-10
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<template>
2+
<list id="ContainerImageSecretList" type="container_image" :get-params="getParams" />
3+
</template>
4+
5+
<script>
6+
import List from '../../container-secret/components/List.vue'
7+
8+
export default {
9+
name: 'ContainerImageSecretList',
10+
components: {
11+
List,
12+
},
13+
props: {
14+
getParams: {
15+
type: Object,
16+
},
17+
},
18+
}
19+
</script>

containers/Ai/views/container-secret/components/List.vue

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import { getNameFilter } from '@/utils/common/tableFilter'
1919
import SingleActionsMixin from '../mixins/singleActions'
2020
import ColumnsMixin from '../mixins/columns'
2121
22+
const credentialIdFilterFormatter = (val) => `id.equals('${val}')`
23+
2224
export default {
2325
name: 'ContainerSecretList',
2426
mixins: [WindowsMixin, ListMixin, ColumnsMixin, SingleActionsMixin],
@@ -27,6 +29,10 @@ export default {
2729
getParams: {
2830
type: Object,
2931
},
32+
type: {
33+
type: String,
34+
default: 'container_secret',
35+
},
3036
},
3137
data () {
3238
return {
@@ -39,7 +45,7 @@ export default {
3945
id: {
4046
label: this.$t('table.title.id'),
4147
filter: true,
42-
formatter: val => `id.equals('${val}')`,
48+
formatter: credentialIdFilterFormatter,
4349
},
4450
name: getNameFilter(),
4551
},
@@ -62,6 +68,7 @@ export default {
6268
buttonType: 'primary',
6369
validate: true,
6470
}),
71+
hidden: this.type === 'container_image',
6572
},
6673
{
6774
label: this.$t('table.action.delete'),
@@ -84,13 +91,26 @@ export default {
8491
},
8592
created () {
8693
this.initSidePageTab('detail')
87-
this.list.fetchData()
94+
const q = this.$route.query || {}
95+
if (this.type === 'container_image' && q.type === 'container_image' && q.id) {
96+
const idStr = String(Array.isArray(q.id) ? q.id[0] : q.id).trim()
97+
if (idStr) {
98+
this.list.changeFilter({
99+
id: [idStr],
100+
__condition_id: 'equals',
101+
})
102+
} else {
103+
this.list.fetchData()
104+
}
105+
} else {
106+
this.list.fetchData()
107+
}
88108
},
89109
methods: {
90110
getParam () {
91111
const ret = {
92112
...this.getParams,
93-
'filter.0': 'type.equals(container_secret)',
113+
'filter.0': `type.equals(${this.type})`,
94114
}
95115
if (this.$store.getters.scope === 'project') {
96116
const uid = this.$store.getters.userInfo?.id

containers/Ai/views/container-secret/dialogs/Update.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<base-dialog :width="700" @cancel="cancelDialog">
3-
<div slot="header">{{ $t('table.action.modify') }} - {{ $t('aice.container_secret') }}</div>
3+
<div slot="header">{{ $t('table.action.modify') }} - {{ $t('dictionary.keypair') }}</div>
44
<div slot="body">
55
<a-spin :spinning="loadingDetail">
66
<a-form v-if="!loadingDetail" :form="form.fc" hideRequiredMark v-bind="formItemLayout">
@@ -9,7 +9,7 @@
99
v-decorator="decorators.name"
1010
:placeholder="$t('common.tips.input', [$t('common.name')])" />
1111
</a-form-item>
12-
<a-form-item :label="$t('aice.container_secret')" :extra="$t('aice.container_secret.env_hint') + ' ' + $t('aice.container_secret.add_pair')">
12+
<a-form-item :label="$t('dictionary.keypair')" :extra="$t('aice.container_secret.env_hint') + ' ' + $t('aice.container_secret.add_pair')">
1313
<div v-for="(item, index) in items" :key="item.id" class="d-flex align-items-start mb-2">
1414
<a-input
1515
v-model="item.key"

containers/Ai/views/container-secret/mixins/columns.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ export default {
2020
field: 'type',
2121
title: this.$t('table.title.type'),
2222
width: 140,
23+
formatter: ({ row }) => {
24+
if (row.type === 'container_image') {
25+
return this.$t('common.container_image_secret')
26+
} else if (row.type === 'container_secret') {
27+
return this.$t('common.container_secret')
28+
} else {
29+
return row.type || '-'
30+
}
31+
},
2332
},
2433
getTagTableColumn({
2534
onManager: this.onManager,

containers/Ai/views/credentials/index.vue

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,34 @@
1212
<script>
1313
import AccessKeyList from './components/AccessKeyList'
1414
import ContainerSecretList from '../container-secret/components/List'
15+
import ContainerImageSecretList from '../container-image-secret/components/List'
1516
1617
export default {
1718
name: 'CredentialIndex',
1819
components: {
1920
AccessKeyList,
2021
ContainerSecretList,
22+
ContainerImageSecretList,
2123
},
2224
data () {
25+
const type = this.$route.query.type
26+
let currentComponent = 'AccessKeyList'
27+
if (type === 'container_image') {
28+
currentComponent = 'ContainerImageSecretList'
29+
} else if (type === 'container_secret') {
30+
currentComponent = 'ContainerSecretList'
31+
}
2332
return {
24-
currentComponent: 'AccessKeyList',
33+
currentComponent,
2534
tabs: [
2635
{
2736
key: 'AccessKeyList',
2837
label: this.$t('scope.text_4'),
2938
},
39+
{
40+
key: 'ContainerImageSecretList',
41+
label: this.$t('common.container_image_secret'),
42+
},
3043
{
3144
key: 'ContainerSecretList',
3245
label: this.$t('common.container_secret'),

containers/K8S/views/repos/utils/columns.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import i18n from '@/locales'
2+
import router from '@/router'
23

34
export const getTypeTableColumn = () => {
45
return {
@@ -25,7 +26,7 @@ export const getCredentialTableColumn = () => {
2526
slots: {
2627
default: ({ row }, h) => {
2728
if (row.credential_id) {
28-
return [<a-tag color="green">{row.credential_id}</a-tag>]
29+
return [<a-tag color="green" style="cursor: pointer;" onClick={() => router.push(`/credentials/?type=container_image&id=${row.credential_id}`)}>{row.credential_id}</a-tag>]
2930
}
3031
return [<a-tag>{i18n.t('k8s.repo.credential.none')}</a-tag>]
3132
},

src/locales/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6472,5 +6472,6 @@
64726472
"common.application": "Application",
64736473
"common.inference": "Inference",
64746474
"common.image": "Image",
6475-
"common.container_secret": "Container Secret"
6475+
"common.container_secret": "Container Secret",
6476+
"common.container_image_secret": "Container Image Secret"
64766477
}

src/locales/ja-JP.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6492,5 +6492,6 @@
64926492
"common.application": "アプリケーション",
64936493
"common.inference": "推論",
64946494
"common.image": "イメージ",
6495-
"common.container_secret": "コンテナシークレット"
6495+
"common.container_secret": "コンテナシークレット",
6496+
"common.container_image_secret": "コンテナイメージレポジトリシークレット"
64966497
}

src/locales/zh-CN.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6503,5 +6503,6 @@
65036503
"common.application": "应用",
65046504
"common.inference": "推理",
65056505
"common.image": "镜像",
6506-
"common.container_secret": "容器密钥"
6506+
"common.container_secret": "容器密钥",
6507+
"common.container_image_secret": "容器镜像仓库密钥"
65076508
}

0 commit comments

Comments
 (0)