mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-10-07 22:56:07 +08:00
Add pkg/harvester components + shell portings - 1
Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
<script>
|
||||
import { STATE, AGE, SIMPLE_NAME } from '@shell/config/table-headers';
|
||||
import { NODE } from '@shell/config/types';
|
||||
import ResourceTable from '@shell/components/ResourceTable';
|
||||
|
||||
export default {
|
||||
name: 'ListHarvesterSRIOV',
|
||||
|
||||
components: { ResourceTable },
|
||||
|
||||
props: {
|
||||
schema: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
rows: {
|
||||
type: Array,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
data() {
|
||||
const inStore = this.$store.getters['currentProduct'].inStore;
|
||||
|
||||
return { hasNode: this.$store.getters[`${ inStore }/schemaFor`](NODE) };
|
||||
},
|
||||
|
||||
computed: {
|
||||
headers() {
|
||||
const nodeCol = {
|
||||
name: 'node',
|
||||
label: 'Node',
|
||||
value: 'realNodeName',
|
||||
sort: ['realNodeName'],
|
||||
formatter: 'CopyToClipboard',
|
||||
labelKey: 'tableHeaders.node'
|
||||
};
|
||||
|
||||
const cols = [
|
||||
STATE,
|
||||
SIMPLE_NAME,
|
||||
{
|
||||
name: 'numVFs',
|
||||
label: 'Num VFs',
|
||||
sort: ['numVFs'],
|
||||
value: 'numVFs',
|
||||
formatter: 'HarvesterVFsNum',
|
||||
align: 'center',
|
||||
labelKey: 'harvester.sriov.numVFs',
|
||||
dashIfEmpty: true,
|
||||
},
|
||||
{
|
||||
name: 'vfAddresses',
|
||||
label: 'VF Addresses',
|
||||
labelKey: 'harvester.sriov.vfAddresses',
|
||||
sort: ['status.vfAddresses'],
|
||||
value: 'status.vfAddresses',
|
||||
formatter: 'HarvesterVFAddress',
|
||||
align: 'center',
|
||||
dashIfEmpty: true,
|
||||
},
|
||||
{
|
||||
...AGE,
|
||||
sort: 'metadata.creationTimestamp:desc',
|
||||
}
|
||||
];
|
||||
|
||||
if (this.hasNode) {
|
||||
cols.splice(-1, 0, nodeCol);
|
||||
}
|
||||
|
||||
return cols;
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ResourceTable
|
||||
v-bind="$attrs"
|
||||
:groupable="false"
|
||||
:namespaced="false"
|
||||
:headers="headers"
|
||||
:schema="schema"
|
||||
:rows="rows"
|
||||
key-field="_key"
|
||||
/>
|
||||
</template>
|
||||
Reference in New Issue
Block a user