mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2025-12-13 21:21:44 +00:00
Merge pull request #58 from houhoucoop/fix/issue-7183
fix: failed to add label to image on the Rancher managed Harvester, display 0% progress
This commit is contained in:
commit
8b35ea1eaa
@ -245,6 +245,8 @@ export default {
|
|||||||
async saveImage(buttonCb) {
|
async saveImage(buttonCb) {
|
||||||
this.value.spec.displayName = (this.value.spec.displayName || '').trim();
|
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) {
|
if (this.value.spec.sourceType === UPLOAD && this.isCreate) {
|
||||||
try {
|
try {
|
||||||
this.value.spec.url = '';
|
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) {
|
setImageLabels(str) {
|
||||||
const suffixName = str?.split('/')?.pop() || str;
|
const suffixName = str?.split('/')?.pop() || str;
|
||||||
|
|
||||||
@ -530,6 +549,7 @@ export default {
|
|||||||
:mode="mode"
|
:mode="mode"
|
||||||
:pad-left="false"
|
:pad-left="false"
|
||||||
:read-allowed="false"
|
:read-allowed="false"
|
||||||
|
:value-can-be-empty="true"
|
||||||
@focusKey="focusKey"
|
@focusKey="focusKey"
|
||||||
@update:value="value.setLabels($event)"
|
@update:value="value.setLabels($event)"
|
||||||
>
|
>
|
||||||
@ -552,7 +572,7 @@ export default {
|
|||||||
autocorrect="off"
|
autocorrect="off"
|
||||||
autocapitalize="off"
|
autocapitalize="off"
|
||||||
spellcheck="false"
|
spellcheck="false"
|
||||||
@update:value="queueUpdate"
|
@input="queueUpdate"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</KeyValue>
|
</KeyValue>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user