mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2025-12-13 13:11:43 +00:00
fix: patch data to avoid status overwrite
Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
This commit is contained in:
parent
b7b259c699
commit
e5d4d0556d
@ -245,6 +245,8 @@ export default {
|
||||
async saveImage(buttonCb) {
|
||||
this.value.spec.displayName = (this.value.spec.displayName || '').trim();
|
||||
|
||||
if (this.isEdit) return await this.handleEditImage(buttonCb);
|
||||
|
||||
if (this.value.spec.sourceType === UPLOAD && this.isCreate) {
|
||||
try {
|
||||
this.value.spec.url = '';
|
||||
@ -269,6 +271,23 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
async handleEditImage(buttonCb) {
|
||||
try {
|
||||
const data = [{
|
||||
op: 'replace', path: '/metadata/labels', value: this.value.metadata.labels
|
||||
}, {
|
||||
op: 'replace', path: '/metadata/annotations', value: this.value.metadata.annotations
|
||||
}];
|
||||
|
||||
await this.value.patch(data);
|
||||
buttonCb(true);
|
||||
this.done();
|
||||
} catch (e) {
|
||||
this.errors = exceptionToErrorsArray(e);
|
||||
buttonCb(false);
|
||||
}
|
||||
},
|
||||
|
||||
setImageLabels(str) {
|
||||
const suffixName = str?.split('/')?.pop() || str;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user