Skip to content

Commit 081ed68

Browse files
committed
Fixed secret page, had to move code to parent component due to regression in Vue 2.6
The new v-slot directive, does not provide access to the slotProps to use in an v-if to overwrite the slot conditionally and have the default (fallback) slot content rendered otherwise. See also these related issues: vuejs/vue#10784 vuejs/vue#9725 vuejs/vue#9658
1 parent d2cace8 commit 081ed68

File tree

2 files changed

+24
-30
lines changed

2 files changed

+24
-30
lines changed

frontend/src/components/Secret.vue

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,28 @@ limitations under the License.
3838
<!-- List of the added secrets -->
3939
<v-list two-line v-else>
4040
<secret-row
41-
v-for="row in rows"
42-
:key="row.metadata.name"
43-
:secret="row"
41+
v-for="secret in rows"
42+
:key="secret.metadata.name"
43+
:secret="secret"
4444
:secretDescriptorKey="secretDescriptorKey"
4545
@update="onUpdate"
4646
@delete="onDelete"
4747
>
48-
<!-- forward slot -->
49-
<template v-slot:rowSubTitle>
50-
<slot name="rowSubTitle" :secret="row"></slot>
48+
<template v-if="infrastructureKey === 'openstack' && isOwnSecretBinding(secret)" v-slot:rowSubTitle>
49+
{{secret.data.domainName}} / {{secret.data.tenantName}}
50+
</template>
51+
<template v-else-if="infrastructureKey === 'vsphere' && isOwnSecretBinding(secret)" v-slot:rowSubTitle>
52+
<v-tooltip top>
53+
<template v-slot:activator="{ on }">
54+
<span v-on="on">{{secret.data.vsphereUsername}}</span>
55+
</template>
56+
<span>vSphere Username</span>
57+
</v-tooltip> / <v-tooltip top>
58+
<template v-slot:activator="{ on }">
59+
<span v-on="on">{{secret.data.nsxtUsername}}</span>
60+
</template>
61+
<span>NSX-T Username</span>
62+
</v-tooltip>
5163
</template>
5264
</secret-row>
5365
</v-list>
@@ -59,6 +71,7 @@ limitations under the License.
5971
import { mapGetters } from 'vuex'
6072
import SecretRow from '@/components/SecretRow'
6173
import InfraIcon from '@/components/VendorIcon'
74+
import { isOwnSecretBinding } from '@/utils'
6275

6376
export default {
6477
components: {
@@ -128,6 +141,9 @@ export default {
128141
},
129142
onDelete (row) {
130143
this.$emit('delete', row)
144+
},
145+
isOwnSecretBinding (secret) {
146+
return isOwnSecretBinding(secret)
131147
}
132148
}
133149
}

frontend/src/views/Secrets.vue

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,7 @@ limitations under the License.
7373
@toogleHelp="onToogleHelp"
7474
@update="onUpdate"
7575
@delete="onDelete"
76-
>
77-
<template v-if="isOwnSecretBinding(secret)" v-slot:rowSubTitle="{ secret }">
78-
{{secret.data.domainName}} / {{secret.data.tenantName}}
79-
</template>
80-
</secret>
76+
></secret>
8177

8278
<secret
8379
v-if="hasCloudProfileForCloudProviderKind('alicloud')"
@@ -122,21 +118,7 @@ limitations under the License.
122118
@toogleHelp="onToogleHelp"
123119
@update="onUpdate"
124120
@delete="onDelete"
125-
>
126-
<template v-if="isOwnSecretBinding(secret)" v-slot:rowSubTitle="{ secret }">
127-
<v-tooltip top>
128-
<template v-slot:activator="{ on }">
129-
<span v-on="on">{{secret.data.vsphereUsername}}</span>
130-
</template>
131-
<span>vSphere Username</span>
132-
</v-tooltip> / <v-tooltip top>
133-
<template v-slot:activator="{ on }">
134-
<span v-on="on">{{secret.data.nsxtUsername}}</span>
135-
</template>
136-
<span>NSX-T Username</span>
137-
</v-tooltip>
138-
</template>
139-
</secret>
121+
></secret>
140122

141123
<template v-if="showDisabledCloudProviders">
142124

@@ -206,7 +188,6 @@ limitations under the License.
206188
<script>
207189
import { mapGetters } from 'vuex'
208190
import get from 'lodash/get'
209-
import { isOwnSecretBinding } from '@/utils'
210191
import DeleteDialog from '@/components/dialogs/SecretDialogDelete'
211192
import SecretDialogWrapper from '@/components/dialogs/SecretDialogWrapper'
212193
import Secret from '@/components/Secret'
@@ -323,9 +304,6 @@ export default {
323304
},
324305
hideDialogs () {
325306
merge(this.dialogState, this.initialDialogState)
326-
},
327-
isOwnSecretBinding (secret) {
328-
return isOwnSecretBinding(secret)
329307
}
330308
},
331309
mounted () {

0 commit comments

Comments
 (0)