| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258 |
- <template>
- <detail
- :data="data"
- :base-info="baseInfo"
- :extra-info="extraInfo"
- :on-manager="onManager"
- :resource="resource"
- status-module="image" />
- </template>
- <script>
- import {
- getUserTagColumn,
- getExtTagColumn,
- } from '@/utils/common/detailColumn'
- import { sizestr } from '@/utils/utils'
- import {
- getStatusTableColumn,
- getCopyWithContentTableColumn,
- getSwitchTableColumn,
- getPublicScopeTableColumn,
- getTagTableColumn,
- getOsArch,
- } from '@/utils/common/tableColumn'
- import WindowsMixin from '@/mixins/windows'
- const isStandard = status => status === true || status === 'true'
- export default {
- name: 'SystemImageDetail',
- mixins: [WindowsMixin],
- props: {
- data: {
- type: Object,
- required: true,
- },
- onManager: {
- type: Function,
- required: true,
- },
- resource: String,
- columns: Array,
- },
- data () {
- return {
- baseInfo: [
- getUserTagColumn({ onManager: this.onManager, resource: 'image', columns: () => this.columns, tipName: this.$t('compute.text_97') }),
- getExtTagColumn({ onManager: this.onManager, resource: 'image', columns: () => this.columns, tipName: this.$t('compute.text_97') }),
- getTagTableColumn({ onManager: this.onManager, resource: 'image', columns: () => this.columns }),
- {
- field: 'project_domain',
- title: this.$t('dictionary.domain'),
- formatter: ({ row }) => {
- if (!row.domain_id) return '-'
- return <side-page-trigger permission="domains_get" name="DomainSidePage" id={row.domain_id} vm={this}>{ row.project_domain }</side-page-trigger>
- },
- },
- {
- field: 'tenant',
- title: this.$t('dictionary.project'),
- formatter: ({ row }) => {
- if (!row.tenant_id) return '-'
- return <side-page-trigger permission="projects_get" name="ProjectSidePage" id={row.tenant_id} vm={this}>{ row.tenant }</side-page-trigger>
- },
- },
- getPublicScopeTableColumn({ vm: this, resource: 'images' }),
- {
- field: 'type',
- title: this.$t('compute.text_175'),
- formatter: ({ cellValue, row }) => {
- return isStandard(row.is_standard) ? this.$t('compute.text_620') : this.$t('compute.text_621')
- },
- },
- {
- field: 'size',
- title: this.$t('compute.text_377'),
- formatter: ({ cellValue, row }) => {
- return sizestr(cellValue, 'B', 1024)
- },
- },
- ],
- extraInfo: [
- {
- title: this.$t('compute.text_629'),
- items: [
- getOsArch({ field: 'properties.os_arch' }),
- {
- field: 'disk_format',
- title: this.$t('compute.text_630'),
- },
- {
- field: 'os_lang',
- title: this.$t('compute.text_631'),
- formatter: ({ cellValue, row }) => {
- return (row.properties && row.properties.os_lang) || '-'
- },
- },
- {
- field: 'min_ram',
- title: this.$t('compute.text_632'),
- formatter: ({ cellValue, row }) => {
- return sizestr(cellValue, 'M', 1024)
- },
- },
- {
- field: 'min_disk',
- title: this.$t('compute.text_633'),
- formatter: ({ cellValue, row }) => {
- return sizestr(cellValue, 'M', 1024)
- },
- },
- {
- field: 'disk_driver',
- title: this.$t('compute.text_634'),
- formatter: ({ cellValue, row }) => {
- return (row.properties && row.properties.disk_driver) || '-'
- },
- },
- {
- field: 'net_driver',
- title: this.$t('compute.text_635'),
- formatter: ({ cellValue, row }) => {
- return (row.properties && row.properties.net_driver) || '-'
- },
- },
- {
- field: 'uefi_support',
- title: this.$t('compute.text_1155'),
- formatter: ({ cellValue, row }) => {
- const { properties = {} } = row
- const { uefi_support, bios_support } = properties
- if (uefi_support === 'true' && bios_support === 'true') {
- return 'BIOS & UEFI'
- } else if (uefi_support === 'true' && bios_support !== 'true') {
- return 'UEFI'
- }
- return 'BIOS'
- },
- },
- {
- field: 'vdi_protocol',
- title: this.$t('compute.vdi_protocol'),
- formatter: ({ cellValue, row }) => {
- return (row.properties && row.properties.vdi_protocol) || '-'
- },
- },
- {
- field: 'hypervisor',
- title: this.$t('compute.text_636'),
- },
- ],
- },
- {
- title: this.$t('compute.title.encryption'),
- items: [
- {
- field: 'encrypt_key_id',
- title: this.$t('compute.title.encryption_key'),
- formatter: ({ callValue, row }) => {
- if (row.encrypt_key_id) {
- if (row.encrypt_key && row.encrypt_alg) {
- return row.encrypt_key + ' (' + row.encrypt_key_id + ')'
- } else {
- return row.encrypt_key_id
- }
- } else {
- return this.$t('compute.no_encryption')
- }
- },
- },
- {
- field: 'encrypt_alg',
- title: this.$t('compute.title.encrypt_alg'),
- formatter: ({ callValue, row }) => {
- if (row.encrypt_alg) {
- return row.encrypt_alg.toUpperCase()
- } else {
- return '-'
- }
- },
- },
- {
- field: 'encrypt_key_user',
- title: this.$t('compute.title.encrypt_key_user'),
- formatter: ({ callValue, row }) => {
- if (row.encrypt_key_user) {
- return row.encrypt_key_user + ' / ' + row.encrypt_key_user_domain
- } else {
- return '-'
- }
- },
- },
- ],
- },
- {
- title: this.$t('compute.text_637'),
- field: 'cloudy_mirroring',
- slots: {
- default: ({ row }, h) => {
- return [
- <vxe-grid class="mb-2" data={ this.imgSubformat } columns={ this.imageColumns } />,
- ]
- },
- },
- },
- {
- title: this.$t('compute.text_497'),
- items: [
- getSwitchTableColumn({
- field: 'protected',
- title: this.$t('common.text00076'),
- change: val => {
- this.onManager('update', {
- id: this.data.id,
- managerArgs: {
- data: { protected: val },
- },
- })
- },
- }),
- ],
- },
- ],
- imageColumns: [
- getCopyWithContentTableColumn({
- field: 'checksum',
- title: this.$t('compute.text_638'),
- }),
- {
- field: 'format',
- title: this.$t('compute.text_398'),
- },
- {
- field: 'size',
- title: this.$t('compute.text_377'),
- formatter: ({ cellValue, row }) => {
- return sizestr(cellValue, 'B', 1024)
- },
- },
- getStatusTableColumn({ statusModule: 'image' }),
- ],
- imgSubformat: [],
- }
- },
- created () {
- this.updateDetailData()
- },
- methods: {
- updateDetailData () {
- new this.$Manager('images', 'v1').getSpecific({
- id: this.data.id,
- spec: 'subformats',
- }).then(({ data }) => {
- this.imgSubformat = data
- })
- },
- },
- }
- </script>
|