mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-11-22 00:27:38 +08:00
Compare commits
56
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d34279d98f | ||
|
|
efd93c5e52 | ||
|
|
8d338b5f72 | ||
|
|
f59c81da31 | ||
|
|
cf6d44601e | ||
|
|
89b43060df | ||
|
|
7194d52000 | ||
|
|
a8ea0645e4 | ||
|
|
713173b0e4 | ||
|
|
6ed13bcec1 | ||
|
|
02519820d7 | ||
|
|
2604101eb2 | ||
|
|
1cb16f0c74 | ||
|
|
752cf2e93a | ||
|
|
f4ea7b6ea0 | ||
|
|
a6405989e9 | ||
|
|
fb8a81fd0f | ||
|
|
3a5ead3c2c | ||
|
|
def4b64cd3 | ||
|
|
a191b845d8 | ||
|
|
32a57d791a | ||
|
|
2a7e51ef4c | ||
|
|
f726fb99e5 | ||
|
|
9c19ae1f9b | ||
|
|
6ece2d0284 | ||
|
|
aec424b007 | ||
|
|
ff80b91311 | ||
|
|
52252c16f7 | ||
|
|
19cf1e9302 | ||
|
|
ddb8e8106b | ||
|
|
9af5ff7b12 | ||
|
|
fff6153f15 | ||
|
|
1ecac7adf4 | ||
|
|
408818904a | ||
|
|
b96637e6d9 | ||
|
|
8bdaca777f | ||
|
|
d278687e75 | ||
|
|
3ea8edb824 | ||
|
|
e33302050b | ||
|
|
8fefb59802 | ||
|
|
872aec1c10 | ||
|
|
8814bd4cda | ||
|
|
72a17cd9c2 | ||
|
|
8d79b69748 | ||
|
|
47760a8426 | ||
|
|
e6fc641a29 | ||
|
|
90b85d2be7 | ||
|
|
ee9575f710 | ||
|
|
7d97e6821c | ||
|
|
42fc9d8fae | ||
|
|
0f03fc0805 | ||
|
|
6d4a7cd1b1 | ||
|
|
f69d445ef7 | ||
|
|
d358a0a618 | ||
|
|
47841e49b1 | ||
|
|
57c7f0f856 |
No files matched your search
@@ -70,7 +70,7 @@ For developers, after reading through the introduction on this page, head over t
|
|||||||
|
|
||||||
License
|
License
|
||||||
=======
|
=======
|
||||||
Copyright (c) 2014-2023 [Rancher Labs, Inc.](http://rancher.com)
|
Copyright (c) 2014-2025 [SUSE, LLC.](https://www.suse.com/)
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -0,0 +1,173 @@
|
|||||||
|
<script>
|
||||||
|
import { mapState } from 'vuex';
|
||||||
|
import { exceptionToErrorsArray } from '@shell/utils/error';
|
||||||
|
import { alternateLabel } from '@shell/utils/platform';
|
||||||
|
import AsyncButton from '@shell/components/AsyncButton';
|
||||||
|
import { Banner } from '@components/Banner';
|
||||||
|
import { Card } from '@components/Card';
|
||||||
|
import { escapeHtml } from '@shell/utils/string';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name ConfirmExecutionDialog
|
||||||
|
* @description Dialog component to confirm the related resources before executing the action.
|
||||||
|
*/
|
||||||
|
export default {
|
||||||
|
name: 'ConfirmExecutionDialog',
|
||||||
|
|
||||||
|
emits: ['close'],
|
||||||
|
|
||||||
|
components: {
|
||||||
|
AsyncButton,
|
||||||
|
Banner,
|
||||||
|
Card,
|
||||||
|
},
|
||||||
|
|
||||||
|
props: {
|
||||||
|
/**
|
||||||
|
* @property resources to be deleted.
|
||||||
|
* @type {Resource[]} Array of the resource model's instance
|
||||||
|
*/
|
||||||
|
resources: {
|
||||||
|
type: Array,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return { errors: [] };
|
||||||
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
...mapState('action-menu', ['modalData']),
|
||||||
|
|
||||||
|
warningMessageKey() {
|
||||||
|
return this.modalData.warningMessageKey;
|
||||||
|
},
|
||||||
|
|
||||||
|
names() {
|
||||||
|
return this.resources.map((obj) => obj.nameDisplay).slice(0, 5);
|
||||||
|
},
|
||||||
|
|
||||||
|
resourceNames() {
|
||||||
|
return this.names.reduce((res, name, i) => {
|
||||||
|
if (i >= 5) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
res += `<b>${ escapeHtml(name) }</b>`;
|
||||||
|
if (i === this.names.length - 1) {
|
||||||
|
res += this.plusMore;
|
||||||
|
} else {
|
||||||
|
res += i === this.resources.length - 2 ? ' and ' : ', ';
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}, '');
|
||||||
|
},
|
||||||
|
|
||||||
|
plusMore() {
|
||||||
|
const remaining = this.resources.length - this.names.length;
|
||||||
|
|
||||||
|
return this.t('dialog.confirmExecution.andOthers', { count: remaining });
|
||||||
|
},
|
||||||
|
|
||||||
|
type() {
|
||||||
|
const types = new Set(this.resources.reduce((array, each) => {
|
||||||
|
array.push(each.type);
|
||||||
|
|
||||||
|
return array;
|
||||||
|
}, []));
|
||||||
|
|
||||||
|
if (types.size > 1) {
|
||||||
|
return this.t('generic.resource', { count: this.resources.length });
|
||||||
|
}
|
||||||
|
|
||||||
|
const schema = this.resources[0]?.schema;
|
||||||
|
|
||||||
|
if ( !schema ) {
|
||||||
|
return `resource${ this.resources.length === 1 ? '' : 's' }`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.$store.getters['type-map/labelFor'](schema, this.resources.length);
|
||||||
|
},
|
||||||
|
|
||||||
|
protip() {
|
||||||
|
return this.t('dialog.confirmExecution.protip', { alternateLabel });
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
escapeHtml,
|
||||||
|
|
||||||
|
close() {
|
||||||
|
this.errors = [];
|
||||||
|
this.$emit('close');
|
||||||
|
},
|
||||||
|
|
||||||
|
async apply(buttonDone) {
|
||||||
|
try {
|
||||||
|
for (const resource of this.resources) {
|
||||||
|
await resource.doActionGrowl(this.modalData.action, {});
|
||||||
|
}
|
||||||
|
buttonDone(true);
|
||||||
|
this.close();
|
||||||
|
} catch (e) {
|
||||||
|
this.errors = exceptionToErrorsArray(e);
|
||||||
|
buttonDone(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Card :show-highlight-border="false">
|
||||||
|
<template #title>
|
||||||
|
<h4 class="text-default-text">
|
||||||
|
{{ t('dialog.confirmExecution.title') }}
|
||||||
|
</h4>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #body>
|
||||||
|
<div class="pl-10 pr-10">
|
||||||
|
<span
|
||||||
|
v-clean-html="t(warningMessageKey, { type, names: resourceNames }, true)"
|
||||||
|
></span>
|
||||||
|
<div class="text-info mt-20">
|
||||||
|
{{ protip }}
|
||||||
|
</div>
|
||||||
|
<Banner
|
||||||
|
v-for="(error, i) in errors"
|
||||||
|
:key="i"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #actions>
|
||||||
|
<div class="actions">
|
||||||
|
<button
|
||||||
|
class="btn role-secondary"
|
||||||
|
@click="close"
|
||||||
|
>
|
||||||
|
{{ t('generic.cancel') }}
|
||||||
|
</button>
|
||||||
|
<AsyncButton
|
||||||
|
mode="apply"
|
||||||
|
class="btn bg-primary ml-10"
|
||||||
|
:disabled="applyDisabled"
|
||||||
|
@click="apply"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</Card>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang='scss' scoped>
|
||||||
|
.modal-container {
|
||||||
|
max-width: 400px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.actions {
|
||||||
|
width: 100%;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -24,6 +24,7 @@ const CLONE = 'clone';
|
|||||||
const DOWNLOAD = 'download';
|
const DOWNLOAD = 'download';
|
||||||
const UPLOAD = 'upload';
|
const UPLOAD = 'upload';
|
||||||
const rawORqcow2 = 'raw_qcow2';
|
const rawORqcow2 = 'raw_qcow2';
|
||||||
|
const LONGHORN = 'longhorn';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'EditImage',
|
name: 'EditImage',
|
||||||
@@ -60,10 +61,7 @@ export default {
|
|||||||
images: this.$store.dispatch(`${ inStore }/findAll`, { type: HCI.IMAGE }),
|
images: this.$store.dispatch(`${ inStore }/findAll`, { type: HCI.IMAGE }),
|
||||||
storageClasses: this.$store.dispatch(`${ inStore }/findAll`, { type: STORAGE_CLASS }),
|
storageClasses: this.$store.dispatch(`${ inStore }/findAll`, { type: STORAGE_CLASS }),
|
||||||
});
|
});
|
||||||
|
this['storageClassName'] = this.storageClassName || this.defaultStorageClassName();
|
||||||
const defaultStorage = this.$store.getters[`${ inStore }/all`](STORAGE_CLASS).find((s) => s.isDefault);
|
|
||||||
|
|
||||||
this['storageClassName'] = this.storageClassName || defaultStorage?.metadata?.name || 'longhorn';
|
|
||||||
this.images = this.$store.getters[`${ inStore }/all`](HCI.IMAGE);
|
this.images = this.$store.getters[`${ inStore }/all`](HCI.IMAGE);
|
||||||
|
|
||||||
const { securityParameters } = this.value.spec;
|
const { securityParameters } = this.value.spec;
|
||||||
@@ -144,10 +142,23 @@ export default {
|
|||||||
];
|
];
|
||||||
},
|
},
|
||||||
|
|
||||||
storageClassOptions() {
|
encryptedStorageClasses() {
|
||||||
const inStore = this.$store.getters['currentProduct'].inStore;
|
const inStore = this.$store.getters['currentProduct'].inStore;
|
||||||
const storages = this.$store.getters[`${ inStore }/all`](STORAGE_CLASS);
|
const storages = this.$store.getters[`${ inStore }/all`](STORAGE_CLASS);
|
||||||
|
|
||||||
|
return storages.filter((s) => s.isEncrypted);
|
||||||
|
},
|
||||||
|
|
||||||
|
nonEncryptedStorageClasses() {
|
||||||
|
const inStore = this.$store.getters['currentProduct'].inStore;
|
||||||
|
const storages = this.$store.getters[`${ inStore }/all`](STORAGE_CLASS);
|
||||||
|
|
||||||
|
return storages.filter((s) => !s.isEncrypted);
|
||||||
|
},
|
||||||
|
|
||||||
|
storageClassOptions() {
|
||||||
|
const storages = this.value.spec?.securityParameters?.cryptoOperation === ENCRYPT ? this.encryptedStorageClasses : this.nonEncryptedStorageClasses;
|
||||||
|
|
||||||
return storages
|
return storages
|
||||||
.filter((s) => !s.parameters?.backingImage && s.provisioner !== LVM_DRIVER) // Lvm storage is not supported.
|
.filter((s) => !s.parameters?.backingImage && s.provisioner !== LVM_DRIVER) // Lvm storage is not supported.
|
||||||
.map((s) => {
|
.map((s) => {
|
||||||
@@ -239,6 +250,13 @@ export default {
|
|||||||
this.$refs.file.value = null;
|
this.$refs.file.value = null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
'value.spec.securityParameters.cryptoOperation'() {
|
||||||
|
if (this.value.spec?.securityParameters?.cryptoOperation === ENCRYPT) {
|
||||||
|
this.storageClassName = this.encryptedStorageClasses[0]?.name || '';
|
||||||
|
} else { // URL / FILE / DECRYPT should use default storage class
|
||||||
|
this.storageClassName = this.defaultStorageClassName();
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
@@ -385,6 +403,18 @@ export default {
|
|||||||
return str.toLowerCase().includes(os.value.toLowerCase()) ? os.value : false;
|
return str.toLowerCase().includes(os.value.toLowerCase()) ? os.value : false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
defaultStorageClassName() {
|
||||||
|
const inStore = this.$store.getters['currentProduct'].inStore;
|
||||||
|
const defaultStorage = this.$store.getters[`${ inStore }/all`](STORAGE_CLASS).find((s) => s.isDefault);
|
||||||
|
|
||||||
|
if (!defaultStorage) {
|
||||||
|
return LONGHORN;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if default sc is encrypted, use longhorn as default
|
||||||
|
return defaultStorage.isEncrypted ? LONGHORN : defaultStorage?.metadata?.name;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -38,6 +38,21 @@ asyncButton:
|
|||||||
success: Restarted
|
success: Restarted
|
||||||
waiting: Restarting…
|
waiting: Restarting…
|
||||||
|
|
||||||
|
dialog:
|
||||||
|
confirmExecution:
|
||||||
|
title: Are you sure?
|
||||||
|
andOthers: |-
|
||||||
|
{count, plural,
|
||||||
|
=0 {}
|
||||||
|
=1 { and <b>one other </b>}
|
||||||
|
other { and <b>{count} other </b>}
|
||||||
|
}
|
||||||
|
protip: "Tip: Hold the {alternateLabel} key while clicking action to bypass this confirmation"
|
||||||
|
stop:
|
||||||
|
message: "Are you sure you want to continue stop the {type} {names}?"
|
||||||
|
pause:
|
||||||
|
message: "Are you sure you want to continue pause the {type} {names}?"
|
||||||
|
|
||||||
harvester:
|
harvester:
|
||||||
productLabel: 'Harvester'
|
productLabel: 'Harvester'
|
||||||
modal:
|
modal:
|
||||||
@@ -861,14 +876,14 @@ harvester:
|
|||||||
doc: Read the <a href="{url}" target="_blank">documentation</a> before starting the upgrade process. Ensure that you complete procedures that are relevant to your environment and the version you are upgrading to.
|
doc: Read the <a href="{url}" target="_blank">documentation</a> before starting the upgrade process. Ensure that you complete procedures that are relevant to your environment and the version you are upgrading to.
|
||||||
tip: Unmet system requirements and incorrectly performed procedures may cause complete upgrade failure and other issues that require manual workarounds.
|
tip: Unmet system requirements and incorrectly performed procedures may cause complete upgrade failure and other issues that require manual workarounds.
|
||||||
moreNotes: For more details about the release notes, please visit -
|
moreNotes: For more details about the release notes, please visit -
|
||||||
|
|
||||||
schedule:
|
schedule:
|
||||||
label: Virtual Machine Schedules
|
label: Virtual Machine Schedules
|
||||||
createTitle: Create Schedule
|
createTitle: Create Schedule
|
||||||
createButtonText: Create Schedule
|
createButtonText: Create Schedule
|
||||||
scheduleType: Virtual Machine Schedule Type
|
scheduleType: Virtual Machine Schedule Type
|
||||||
cron: Cron Schedule
|
cron: Cron Schedule
|
||||||
detail:
|
detail:
|
||||||
namespace: Namespace
|
namespace: Namespace
|
||||||
sourceVM: Source Virtual Machine
|
sourceVM: Source Virtual Machine
|
||||||
tabs:
|
tabs:
|
||||||
@@ -878,12 +893,12 @@ harvester:
|
|||||||
message:
|
message:
|
||||||
noSetting:
|
noSetting:
|
||||||
suffix: before creating a backup schedule
|
suffix: before creating a backup schedule
|
||||||
retain:
|
retain:
|
||||||
label: Retain
|
label: Retain
|
||||||
count: Count
|
count: Count
|
||||||
tooltip: Number of up-to-date VM backups to retain. Maximum to 250, minimum to 2.
|
tooltip: Number of up-to-date VM backups to retain. Maximum to 250, minimum to 2.
|
||||||
maxFailure:
|
maxFailure:
|
||||||
label: Max Failure
|
label: Max Failure
|
||||||
count: Count
|
count: Count
|
||||||
tooltip: Max number of consecutive failed backups that could be tolerated. If reach this threshold, Harvester controller will suspend the schedule job. This value should less than retain count
|
tooltip: Max number of consecutive failed backups that could be tolerated. If reach this threshold, Harvester controller will suspend the schedule job. This value should less than retain count
|
||||||
virtualMachine:
|
virtualMachine:
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ export default {
|
|||||||
const selectedVMNetworks = networkNames.map((name) => vmNetworks.find((n) => n.id === name)).filter((n) => n?.id);
|
const selectedVMNetworks = networkNames.map((name) => vmNetworks.find((n) => n.id === name)).filter((n) => n?.id);
|
||||||
const clusterNetworks = uniq(selectedVMNetworks.map((n) => n.clusterNetworkResource?.id));
|
const clusterNetworks = uniq(selectedVMNetworks.map((n) => n.clusterNetworkResource?.id));
|
||||||
|
|
||||||
return nodes.filter((N) => !N.isUnSchedulable).map((node) => {
|
return nodes.filter((N) => !N.isUnSchedulable && N.isEtcd !== 'true').map((node) => {
|
||||||
const requireLabelKeys = [];
|
const requireLabelKeys = [];
|
||||||
let isNetworkSchedule = true;
|
let isNetworkSchedule = true;
|
||||||
|
|
||||||
|
|||||||
@@ -470,7 +470,7 @@ export default class HciNode extends HarvesterResource {
|
|||||||
get canDelete() {
|
get canDelete() {
|
||||||
const nodes = this.$rootGetters['harvester/all'](NODE) || [];
|
const nodes = this.$rootGetters['harvester/all'](NODE) || [];
|
||||||
|
|
||||||
return nodes.length > 1;
|
return nodes.length > 1 && super.canDelete;
|
||||||
}
|
}
|
||||||
|
|
||||||
get vlanStatuses() {
|
get vlanStatuses() {
|
||||||
|
|||||||
@@ -58,6 +58,10 @@ export default class HciStorageClass extends StorageClass {
|
|||||||
return key ? this.$rootGetters['i18n/t'](key) : this.provisioner;
|
return key ? this.$rootGetters['i18n/t'](key) : this.provisioner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get isEncrypted() {
|
||||||
|
return this.parameters?.encrypted === 'true';
|
||||||
|
}
|
||||||
|
|
||||||
get isLonghornV2() {
|
get isLonghornV2() {
|
||||||
return this.provisioner === LONGHORN_DRIVER && this.longhornVersion === DATA_ENGINE_V2;
|
return this.provisioner === LONGHORN_DRIVER && this.longhornVersion === DATA_ENGINE_V2;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ export default class HciVmBackup extends HarvesterResource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get sourceSchedule() {
|
get sourceSchedule() {
|
||||||
return this.metadata?.annotations[HCI_ANNOTATIONS.SVM_BACKUP_ID];
|
return this.metadata?.annotations?.[HCI_ANNOTATIONS.SVM_BACKUP_ID];
|
||||||
}
|
}
|
||||||
|
|
||||||
get attachVM() {
|
get attachVM() {
|
||||||
|
|||||||
@@ -102,11 +102,13 @@ export default class VirtVm extends HarvesterResource {
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
action: 'stopVM',
|
action: 'stopVM',
|
||||||
enabled: !!this.actions?.stop,
|
altAction: 'altStopVM',
|
||||||
icon: 'icon icon-close',
|
enabled: !!this.actions?.stop,
|
||||||
label: this.t('harvester.action.stop'),
|
icon: 'icon icon-close',
|
||||||
bulkable: true
|
label: this.t('harvester.action.stop'),
|
||||||
|
bulkable: true,
|
||||||
|
bulkAction: 'stopVM',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
action: 'forceStop',
|
action: 'forceStop',
|
||||||
@@ -116,10 +118,11 @@ export default class VirtVm extends HarvesterResource {
|
|||||||
bulkable: true
|
bulkable: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
action: 'pauseVM',
|
action: 'pauseVM',
|
||||||
enabled: !!this.actions?.pause,
|
altAction: 'altPauseVM',
|
||||||
icon: 'icon icon-pause',
|
enabled: !!this.actions?.pause,
|
||||||
label: this.t('harvester.action.pause')
|
icon: 'icon icon-pause',
|
||||||
|
label: this.t('harvester.action.pause')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
action: 'unpauseVM',
|
action: 'unpauseVM',
|
||||||
@@ -402,7 +405,16 @@ export default class VirtVm extends HarvesterResource {
|
|||||||
return node?.id;
|
return node?.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
pauseVM() {
|
pauseVM(resources = this) {
|
||||||
|
this.$dispatch('promptModal', {
|
||||||
|
resources,
|
||||||
|
action: 'pause',
|
||||||
|
warningMessageKey: 'dialog.confirmExecution.pause.message',
|
||||||
|
component: 'ConfirmExecutionDialog'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
altPauseVM() {
|
||||||
this.doActionGrowl('pause', {});
|
this.doActionGrowl('pause', {});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -417,7 +429,16 @@ export default class VirtVm extends HarvesterResource {
|
|||||||
this.doActionGrowl('unpause', {});
|
this.doActionGrowl('unpause', {});
|
||||||
}
|
}
|
||||||
|
|
||||||
stopVM() {
|
stopVM(resources = this) {
|
||||||
|
this.$dispatch('promptModal', {
|
||||||
|
resources,
|
||||||
|
action: 'stop',
|
||||||
|
warningMessageKey: 'dialog.confirmExecution.stop.message',
|
||||||
|
component: 'ConfirmExecutionDialog'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
altStopVM() {
|
||||||
this.doActionGrowl('stop', {});
|
this.doActionGrowl('stop', {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user