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:
parent
ae0fb5c2fa
commit
9b510f14a2
@ -15,6 +15,7 @@
|
|||||||
import { action, observable } from 'mobx';
|
import { action, observable } from 'mobx';
|
||||||
import client from 'client';
|
import client from 'client';
|
||||||
import Base from 'stores/base';
|
import Base from 'stores/base';
|
||||||
|
import { imageOS } from 'resources/image';
|
||||||
|
|
||||||
export class ImageStore extends Base {
|
export class ImageStore extends Base {
|
||||||
@observable
|
@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
|
@action
|
||||||
async uploadImage(imageId, file, conf) {
|
async uploadImage(imageId, file, conf) {
|
||||||
return this.client.uploadFile(imageId, file, conf);
|
return this.client.uploadFile(imageId, file, conf);
|
||||||
|
Loading…
Reference in New Issue
Block a user