-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- vm 모델 추가 - stat 모델 추가 추가 된 모델들은 리스트의 개별 객체를 할당받아 메인 모델 배열에 추가 하기 위한 용도의 개벌 모델임. (GET) 기준 - 대시보드 연동 완료 - CloudPC 연동 진행 중
- Loading branch information
Showing
9 changed files
with
153 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { factory, primaryKey, nullable, manyOf } from '@mswjs/data' | ||
import { faker } from '@faker-js/faker' | ||
import resourceList from '../json/resourceList.json' | ||
import userResourceImage from '../json/userResourceImage.json' | ||
import userResourceUse from '../json/userResourceUse.json' | ||
|
||
export const db_resource = factory({ | ||
resources: { | ||
id: primaryKey(faker.datatype.uuid), | ||
data: manyOf('vm') | ||
}, | ||
vm: { | ||
id: primaryKey(faker.datatype.uuid), | ||
vm_ip: String, | ||
vm_nm: String, | ||
vm_auth_id: String, | ||
vm_als: String, | ||
vm_state: String, | ||
vcpu_cnt: String, | ||
vmm_capa: String, | ||
vhd_capa: String, | ||
img_id: String, | ||
acct_conn_id: String, | ||
acct_id: String, | ||
usr_vm_ctrl_tm: String, | ||
os_typ_cd_nm: String, | ||
vm_on_ctrl_tm: String, | ||
vm_vlid_stt_dt: String, | ||
vm_vlid_end_dt: String, | ||
tnt_mtd_cd_nm: String, | ||
secu_plcy_id: String | ||
}, | ||
images: { | ||
id: primaryKey(faker.datatype.uuid), | ||
img_id: String, | ||
img_nm: String, | ||
img_descp: nullable(String), | ||
sw_nm: String | ||
}, | ||
monitor: { | ||
id: primaryKey(faker.datatype.uuid), | ||
data: manyOf('stat') | ||
}, | ||
stat: { | ||
id: primaryKey(faker.datatype.uuid), | ||
cpu_usage: Number, | ||
mem_total: Number, | ||
mem_used: Number, | ||
disk_total: Number, | ||
disk_used: Number, | ||
vm_auth_id: String, | ||
reason: nullable(String) | ||
} | ||
}) | ||
|
||
const vm_list_init = [ | ||
db_resource.vm.create({ ...resourceList['data'][0] }), | ||
db_resource.vm.create({ ...resourceList['data'][1] }), | ||
db_resource.vm.create({ ...resourceList['data'][2] }) | ||
] | ||
|
||
const stat_init = [ | ||
db_resource.stat.create({ ...userResourceUse['data'][0] }), | ||
db_resource.stat.create({ ...userResourceUse['data'][1] }), | ||
db_resource.stat.create({ ...userResourceUse['data'][2] }) | ||
] | ||
|
||
export const resourceInit = () => { | ||
db_resource.resources.create({ data: vm_list_init }) | ||
db_resource.images.create(userResourceImage['data']) | ||
db_resource.monitor.create({ data: stat_init }) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,34 @@ | ||
{ | ||
"data": { | ||
"time": "2022-05-30 17:33:38", | ||
"cpu_usage": 0.0, | ||
"mem_total": 8191.0, | ||
"mem_used": 1535.0, | ||
"disk_total": 40408.0, | ||
"disk_used": 12894.0, | ||
"vm_auth_id": "DEE-303540", | ||
"reason": null | ||
} | ||
"data": [ | ||
{ | ||
"time": "2022-05-30 17:33:38", | ||
"cpu_usage": 15.0, | ||
"mem_total": 8191.0, | ||
"mem_used": 1535.0, | ||
"disk_total": 40408.0, | ||
"disk_used": 12894.0, | ||
"vm_auth_id": "DEE-303540", | ||
"reason": null | ||
}, | ||
{ | ||
"time": "2022-05-30 17:33:38", | ||
"cpu_usage": 35.0, | ||
"mem_total": 8191.0, | ||
"mem_used": 3735.0, | ||
"disk_total": 40408.0, | ||
"disk_used": 22000.0, | ||
"vm_auth_id": "DEE-319869", | ||
"reason": null | ||
}, | ||
{ | ||
"time": "2022-05-30 17:33:38", | ||
"cpu_usage": 70.0, | ||
"mem_total": 8191.0, | ||
"mem_used": 4002.0, | ||
"disk_total": 40408.0, | ||
"disk_used": 15000.0, | ||
"vm_auth_id": "DEE-332989", | ||
"reason": null | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
import { setupWorker } from 'msw' | ||
import module from './handlers' | ||
import { init } from './db/user' | ||
|
||
import { userInit } from './db/user' | ||
import { resourceInit } from './db/resource' | ||
|
||
export function setupBrowserMock() { | ||
init() | ||
userInit() | ||
resourceInit() | ||
setupWorker(...module).start() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters