fix: Fix the system classsification of image

Fix image os to be others when image has no os_distro metadata or the os_distro is is inconsistent with classification

Closes-Bug: #1945152
Change-Id: Ia9e0d3126732d931933cd1ef00281d971943b21f
This commit is contained in:
Jingwei.Zhang 2021-09-27 17:39:57 +08:00
parent ae0fb5c2fa
commit 9b510f14a2

View File

@ -15,6 +15,7 @@
import { action, observable } from 'mobx';
import client from 'client';
import Base from 'stores/base';
import { imageOS } from 'resources/image';
export class ImageStore extends Base {
@observable
@ -65,6 +66,17 @@ export class ImageStore extends Base {
};
}
get mapper() {
return (data) => {
const { os_distro } = data;
const os = imageOS[os_distro] ? os_distro : 'others';
return {
...data,
os_distro: os,
};
};
}
@action
async uploadImage(imageId, file, conf) {
return this.client.uploadFile(imageId, file, conf);