mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-10-04 21:26:08 +08:00
Latest changes from harvester/master
Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
This commit is contained in:
@@ -48,6 +48,13 @@ export default {
|
||||
customName() {
|
||||
return this.value.metadata?.annotations?.[HCI_ANNOTATIONS.HOST_CUSTOM_NAME];
|
||||
},
|
||||
cpuManagerStatus() {
|
||||
if (this.value.isCPUManagerEnableInProgress) {
|
||||
return this.t('generic.loading');
|
||||
}
|
||||
|
||||
return this.t(`generic.${ this.value.isCPUManagerEnabled ? 'enabled' : 'disabled' }`);
|
||||
},
|
||||
|
||||
consoleUrl() {
|
||||
const consoleUrl = this.value.metadata?.annotations?.[HCI_ANNOTATIONS.HOST_CONSOLE_URL];
|
||||
@@ -224,6 +231,9 @@ export default {
|
||||
</div>
|
||||
|
||||
<div class="row mb-20">
|
||||
<div v-if="!value.isEtcd" class="col span-6">
|
||||
<LabelValue :name="t('harvester.host.detail.cpuManager')" :value="cpuManagerStatus" />
|
||||
</div>
|
||||
<div class="col span-6">
|
||||
<LabelValue :name="t('harvester.host.detail.consoleUrl')" :value="consoleUrl.value">
|
||||
<a slot="value" :href="consoleUrl.value" target="_blank">{{ consoleUrl.display }}</a>
|
||||
@@ -268,7 +278,7 @@ export default {
|
||||
<HarvesterStorageUsed
|
||||
:row="value"
|
||||
:resource-name="t('harvester.host.detail.storage')"
|
||||
:show-reserved="true"
|
||||
:show-allocated="true"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -4,13 +4,15 @@ import LabelValue from '@shell/components/LabelValue';
|
||||
import { BadgeState } from '@components/BadgeState';
|
||||
import { Banner } from '@components/Banner';
|
||||
import HarvesterDisk from '../../mixins/harvester-disk';
|
||||
import { RadioGroup } from '@components/Form/Radio';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
LabelValue,
|
||||
BadgeState,
|
||||
Banner,
|
||||
Tag
|
||||
Tag,
|
||||
RadioGroup
|
||||
},
|
||||
|
||||
mixins: [
|
||||
@@ -37,6 +39,18 @@ export default {
|
||||
return {};
|
||||
},
|
||||
computed: {
|
||||
targetDisk() {
|
||||
return this.disks.find(disk => disk.name === this.value.name);
|
||||
},
|
||||
schedulableTooltipMessage() {
|
||||
const { name, path } = this.value;
|
||||
|
||||
if (this.targetDisk && !this.targetDisk.allowScheduling && name && path) {
|
||||
return this.t('harvester.host.disk.allowScheduling.tooltip', { name, path });
|
||||
} else {
|
||||
return this.schedulableCondition.message;
|
||||
}
|
||||
},
|
||||
allowSchedulingOptions() {
|
||||
return [{
|
||||
label: this.t('generic.enabled'),
|
||||
@@ -117,6 +131,16 @@ export default {
|
||||
</div>
|
||||
<div class="row mt-10">
|
||||
<div class="col span-12">
|
||||
<div class="pull-left">
|
||||
<RadioGroup
|
||||
v-model:value="value.allowScheduling"
|
||||
name="diskScheduling"
|
||||
:label="t('harvester.host.disk.allowScheduling.label')"
|
||||
:mode="mode"
|
||||
:options="allowSchedulingOptions"
|
||||
:row="true"
|
||||
/>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
{{ t('harvester.host.disk.conditions') }}:
|
||||
<BadgeState
|
||||
@@ -127,9 +151,9 @@ export default {
|
||||
class="mr-10 ml-10 state"
|
||||
/>
|
||||
<BadgeState
|
||||
v-clean-tooltip="schedulableCondition.message"
|
||||
:color="schedulableCondition.status === 'True' ? 'bg-success' : 'bg-error' "
|
||||
:icon="schedulableCondition.status === 'True' ? 'icon-checkmark' : 'icon-warning' "
|
||||
v-clean-tooltip="schedulableTooltipMessage"
|
||||
:color="schedulableCondition.status === 'True' && targetDisk?.allowScheduling ? 'bg-success' : 'bg-error' "
|
||||
:icon="schedulableCondition.status === 'True' && targetDisk?.allowScheduling ? 'icon-checkmark' : 'icon-warning' "
|
||||
label="Schedulable"
|
||||
class="mr-10 state"
|
||||
/>
|
||||
|
||||
@@ -104,7 +104,7 @@ export default {
|
||||
key-field="_key"
|
||||
|
||||
>
|
||||
<template cell:state="scope">
|
||||
<template cell:state="scope" class="state-col">
|
||||
<div class="state">
|
||||
<HarvesterVmState class="vmstate" :row="scope.row" :all-cluster-network="allClusterNetwork" />
|
||||
</div>
|
||||
|
||||
@@ -311,14 +311,12 @@ export default {
|
||||
};
|
||||
}
|
||||
|
||||
const current = this.ntpSync?.currentNtpServers || '';
|
||||
|
||||
if (status === 'unsynced') {
|
||||
return {
|
||||
status: 'unsynced',
|
||||
warning: {
|
||||
key: 'harvester.host.ntp.ntpSyncStatus.isUnsynced',
|
||||
current
|
||||
key: 'harvester.host.ntp.ntpSyncStatus.isUnsynced',
|
||||
current: this.ntpSync?.currentNtpServers ? `<code>${ this.ntpSync.currentNtpServers }</code>` : '',
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -35,6 +35,10 @@ export default {
|
||||
return this.value?.downSize;
|
||||
},
|
||||
|
||||
virtualSize() {
|
||||
return this.value?.virtualSize;
|
||||
},
|
||||
|
||||
url() {
|
||||
return this.value?.spec?.url || '-';
|
||||
},
|
||||
@@ -100,6 +104,12 @@ export default {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col span-12">
|
||||
<LabelValue :name="t('harvester.image.virtualSize')" :value="virtualSize" class="mb-20" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col span-12">
|
||||
<LabelValue :name="t('nameNsDescription.description.label')" :value="description" class="mb-20" />
|
||||
|
||||
@@ -11,6 +11,7 @@ import NodeScheduling from '@shell/components/form/NodeScheduling';
|
||||
import PodAffinity from '@shell/components/form/PodAffinity';
|
||||
import KeyValue from '@shell/components/form/KeyValue';
|
||||
import Labels from '@shell/components/form/Labels';
|
||||
import LabelValue from '@shell/components/LabelValue';
|
||||
import { HCI } from '../../types';
|
||||
import VM_MIXIN from '../../mixins/harvester-vm';
|
||||
|
||||
@@ -22,6 +23,7 @@ import Events from './VirtualMachineTabs/VirtualMachineEvents';
|
||||
import Migration from './VirtualMachineTabs/VirtualMachineMigration';
|
||||
import OverviewBasics from './VirtualMachineTabs/VirtualMachineBasics';
|
||||
import OverviewKeypairs from './VirtualMachineTabs/VirtualMachineKeypairs';
|
||||
import { formatSi } from '@shell/utils/units';
|
||||
|
||||
const VM_METRICS_DETAIL_URL = '/api/v1/namespaces/cattle-monitoring-system/services/http:rancher-monitoring-grafana:80/proxy/d/harvester-vm-detail-1/vm-info-detail?orgId=1';
|
||||
|
||||
@@ -33,6 +35,7 @@ export default {
|
||||
Tabbed,
|
||||
Events,
|
||||
OverviewBasics,
|
||||
LabelValue,
|
||||
Volume,
|
||||
Network,
|
||||
OverviewKeypairs,
|
||||
@@ -57,15 +60,18 @@ export default {
|
||||
|
||||
data() {
|
||||
return {
|
||||
switchToCloud: false,
|
||||
hasResourceQuotaSchema: false,
|
||||
switchToCloud: false,
|
||||
VM_METRICS_DETAIL_URL,
|
||||
showVmMetrics: false,
|
||||
showVmMetrics: false,
|
||||
};
|
||||
},
|
||||
|
||||
async created() {
|
||||
const inStore = this.$store.getters['currentProduct'].inStore;
|
||||
|
||||
this.hasResourceQuotaSchema = !!this.$store.getters[`${ inStore }/schemaFor`](HCI.RESOURCE_QUOTA);
|
||||
|
||||
const hash = {
|
||||
pods: this.$store.dispatch(`${ inStore }/findAll`, { type: POD }),
|
||||
services: this.$store.dispatch(`${ inStore }/findAll`, { type: SERVICE }),
|
||||
@@ -75,6 +81,10 @@ export default {
|
||||
restore: this.$store.dispatch(`${ inStore }/findAll`, { type: HCI.RESTORE }),
|
||||
};
|
||||
|
||||
if (this.hasResourceQuotaSchema) {
|
||||
hash.resourceQuotas = this.$store.dispatch(`${ inStore }/findAll`, { type: HCI.RESOURCE_QUOTA });
|
||||
}
|
||||
|
||||
await allHash(hash);
|
||||
|
||||
setPromiseResult(
|
||||
@@ -88,6 +98,22 @@ export default {
|
||||
computed: {
|
||||
...mapGetters(['currentCluster']),
|
||||
|
||||
totalSnapshotSize() {
|
||||
if (this.value.snapshotSizeQuota === undefined || this.value.snapshotSizeQuota === null) {
|
||||
return ' - ';
|
||||
}
|
||||
|
||||
if (this.value.snapshotSizeQuota === 0) {
|
||||
return '0';
|
||||
}
|
||||
|
||||
return formatSi(this.value.snapshotSizeQuota, {
|
||||
increment: 1024,
|
||||
addSuffix: true,
|
||||
suffix: 'i',
|
||||
});
|
||||
},
|
||||
|
||||
vmi() {
|
||||
const inStore = this.$store.getters['currentProduct'].inStore;
|
||||
|
||||
@@ -175,10 +201,17 @@ export default {
|
||||
<Network v-model:value="networkRows" mode="view" />
|
||||
</Tab>
|
||||
|
||||
<Tab name="keypairs" :label="t('harvester.virtualMachine.detail.tabs.keypairs')" class="bordered-table" :weight="3">
|
||||
<Tab name="keypairs" :label="t('harvester.virtualMachine.detail.tabs.keypairs')" class="bordered-table" :weight="4">
|
||||
<OverviewKeypairs :value="value" />
|
||||
</Tab>
|
||||
|
||||
<Tab v-if="hasResourceQuotaSchema" name="quotas" :label="t('harvester.tab.quotas')" :weight="3">
|
||||
<LabelValue
|
||||
:name="t('harvester.snapshot.totalSnapshotSize')"
|
||||
:value="totalSnapshotSize"
|
||||
/>
|
||||
</Tab>
|
||||
|
||||
<Tab
|
||||
v-if="showVmMetrics"
|
||||
name="vm-metrics"
|
||||
|
||||
@@ -8,6 +8,7 @@ import { STATE, NAME, AGE } from '@shell/config/table-headers';
|
||||
import { matching } from '@shell/utils/selector';
|
||||
import { NODE } from '@shell/config/types';
|
||||
import { isEmpty } from '@shell/utils/object';
|
||||
import { HCI } from '@pkg/harvester/config/labels-annotations';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -55,10 +56,13 @@ export default {
|
||||
const inStore = this.$store.getters['currentProduct'].inStore;
|
||||
|
||||
const nodes = this.$store.getters[`${ inStore }/all`](NODE);
|
||||
const matchedNodes = this.value?.metadata?.annotations?.[HCI.MATCHED_NODES];
|
||||
const selector = this.value?.spec?.nodeSelector;
|
||||
|
||||
if (!isEmpty(selector)) {
|
||||
return matching(nodes, selector);
|
||||
} else if (matchedNodes && matchedNodes.length > 0) {
|
||||
return nodes.filter(node => matchedNodes.includes(node.id));
|
||||
} else {
|
||||
return nodes;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user