| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- <template>
- <detail
- :showDesc="false"
- :showName="false"
- :hiddenKeys="['project_domain', 'tenant', 'created_at', 'updated_at']"
- :onManager="onManager"
- :data="data"
- :base-info="baseInfo" />
- </template>
- <script>
- import { k8sStatusColumn, k8sLabelColumn } from '@K8S/utils/tableColumns'
- import expectStatus from '@/constants/expectStatus'
- import WindowsMixin from '@/mixins/windows'
- export default {
- name: 'K8sPersistentvolumeclaimDetail',
- mixins: [WindowsMixin],
- props: {
- data: {
- type: Object,
- required: true,
- },
- onManager: {
- type: Function,
- required: true,
- },
- },
- data () {
- return {
- baseInfo: [
- {
- field: 'name',
- title: this.$t('k8s.text_41'),
- slots: {
- default: ({ row }) => {
- return [
- <div class='text-truncate'>
- <list-body-cell-wrap copy row={ this.data } onManager={ this.onManager } field='name' title={ row.name } />
- </div>,
- ]
- },
- },
- },
- {
- field: 'mountedBy',
- title: this.$t('k8s.text_314'),
- slots: {
- default: ({ row }) => {
- const handleOpenSidepage = (name) => {
- this.sidePageTriggerHandle(this, 'K8SPodSidePage', {
- id: name,
- resource: 'pods',
- getParams: () => {
- const params = {
- scope: this.$store.getters.scope,
- details: true,
- cluster: row.cluster,
- namespace: row.namespace,
- }
- return params
- },
- apiVersion: 'v1',
- steadyStatus: {
- status: Object.values(expectStatus.k8s_resource).flat(),
- },
- }, {
- list: this.list,
- })
- }
- if (!row.mountedBy || !row.mountedBy.length) return '-'
- return row.mountedBy.map(val => {
- return (<side-page-trigger onTrigger={() => handleOpenSidepage(val)}>{ val }</side-page-trigger>)
- })
- },
- },
- },
- k8sStatusColumn(),
- {
- field: 'cluster',
- title: this.$t('k8s.text_19'),
- },
- {
- field: 'namespace',
- title: this.$t('k8s.text_23'),
- },
- {
- field: 'accessModes',
- title: this.$t('k8s.text_313'),
- formatter: ({ row }) => row.accessModes && (row.accessModes || []).join(', '),
- },
- {
- field: 'volume',
- title: this.$t('k8s.text_311'),
- },
- {
- field: 'storageClass',
- title: this.$t('k8s.text_22'),
- },
- {
- field: 'capacity.storage',
- title: this.$t('k8s.text_312'),
- width: 70,
- formatter: ({ row }) => {
- return row.capacity ? (row.capacity.storage || '0Gi') : '-'
- },
- },
- {
- field: 'unused',
- title: this.$t('k8s.text_301'),
- slots: {
- default: ({ row }, h) => {
- let text = this.$t('k8s.text_303')
- let className = 'success-color'
- if (row.mountedBy && row.mountedBy.length > 0) {
- text = this.$t('k8s.text_302')
- className = 'error-color'
- }
- return [<div class={className}>{text}</div>]
- },
- },
- },
- {
- field: 'creationTimestamp',
- title: this.$t('k8s.text_74'),
- formatter: ({ row }) => {
- return (row.creationTimestamp && this.$moment(row.creationTimestamp).format()) || '-'
- },
- },
- k8sLabelColumn({ field: 'annotations', title: this.$t('k8s.text_142') }),
- ],
- }
- },
- }
- </script>
|