summaryrefslogtreecommitdiff
path: root/opendc-web/opendc-web-ui/src/util
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2022-03-07 18:19:21 +0100
committerFabian Mastenbroek <mail.fabianm@gmail.com>2022-04-04 12:48:05 +0200
commit3d1c02e50ee619598bcd7fad4368be8b4a039e84 (patch)
tree89baaf3250eb0495295616a9945c681f5e1ccdb8 /opendc-web/opendc-web-ui/src/util
parentd12efc754a1611a624d170b4d1fa6085e6bb177b (diff)
refactor(web/ui): Fix compatibility with new API
This change updates the web interface in React to be compatible with the new API written in Kotlin. Several changes have been made in the new API to ensure consistency.
Diffstat (limited to 'opendc-web/opendc-web-ui/src/util')
-rw-r--r--opendc-web/opendc-web-ui/src/util/authorizations.js12
-rw-r--r--opendc-web/opendc-web-ui/src/util/topology-schema.js18
-rw-r--r--opendc-web/opendc-web-ui/src/util/unit-specifications.js26
3 files changed, 28 insertions, 28 deletions
diff --git a/opendc-web/opendc-web-ui/src/util/authorizations.js b/opendc-web/opendc-web-ui/src/util/authorizations.js
index ce5d34b6..fffcefeb 100644
--- a/opendc-web/opendc-web-ui/src/util/authorizations.js
+++ b/opendc-web/opendc-web-ui/src/util/authorizations.js
@@ -3,13 +3,13 @@ import EditIcon from '@patternfly/react-icons/dist/js/icons/edit-icon'
import EyeIcon from '@patternfly/react-icons/dist/js/icons/eye-icon'
export const AUTH_ICON_MAP = {
- OWN: HomeIcon,
- EDIT: EditIcon,
- VIEW: EyeIcon,
+ OWNER: HomeIcon,
+ EDITOR: EditIcon,
+ VIEWER: EyeIcon,
}
export const AUTH_DESCRIPTION_MAP = {
- OWN: 'Own',
- EDIT: 'Can Edit',
- VIEW: 'Can View',
+ OWNER: 'Own',
+ EDITOR: 'Can Edit',
+ VIEWER: 'Can View',
}
diff --git a/opendc-web/opendc-web-ui/src/util/topology-schema.js b/opendc-web/opendc-web-ui/src/util/topology-schema.js
index 7779ccfe..ff672dd6 100644
--- a/opendc-web/opendc-web-ui/src/util/topology-schema.js
+++ b/opendc-web/opendc-web-ui/src/util/topology-schema.js
@@ -22,10 +22,10 @@
import { schema } from 'normalizr'
-const Cpu = new schema.Entity('cpus', {}, { idAttribute: '_id' })
-const Gpu = new schema.Entity('gpus', {}, { idAttribute: '_id' })
-const Memory = new schema.Entity('memories', {}, { idAttribute: '_id' })
-const Storage = new schema.Entity('storages', {}, { idAttribute: '_id' })
+const Cpu = new schema.Entity('cpus', {}, { idAttribute: 'id' })
+const Gpu = new schema.Entity('gpus', {}, { idAttribute: 'id' })
+const Memory = new schema.Entity('memories', {}, { idAttribute: 'id' })
+const Storage = new schema.Entity('storages', {}, { idAttribute: 'id' })
export const Machine = new schema.Entity(
'machines',
@@ -35,13 +35,13 @@ export const Machine = new schema.Entity(
memories: [Memory],
storages: [Storage],
},
- { idAttribute: '_id' }
+ { idAttribute: 'id' }
)
-export const Rack = new schema.Entity('racks', { machines: [Machine] }, { idAttribute: '_id' })
+export const Rack = new schema.Entity('racks', { machines: [Machine] }, { idAttribute: 'id' })
-export const Tile = new schema.Entity('tiles', { rack: Rack }, { idAttribute: '_id' })
+export const Tile = new schema.Entity('tiles', { rack: Rack }, { idAttribute: 'id' })
-export const Room = new schema.Entity('rooms', { tiles: [Tile] }, { idAttribute: '_id' })
+export const Room = new schema.Entity('rooms', { tiles: [Tile] }, { idAttribute: 'id' })
-export const Topology = new schema.Entity('topologies', { rooms: [Room] }, { idAttribute: '_id' })
+export const Topology = new schema.Entity('topologies', { rooms: [Room] }, { idAttribute: 'id' })
diff --git a/opendc-web/opendc-web-ui/src/util/unit-specifications.js b/opendc-web/opendc-web-ui/src/util/unit-specifications.js
index 28479edd..3e3671cd 100644
--- a/opendc-web/opendc-web-ui/src/util/unit-specifications.js
+++ b/opendc-web/opendc-web-ui/src/util/unit-specifications.js
@@ -1,34 +1,34 @@
export const CPU_UNITS = {
'cpu-1': {
- _id: 'cpu-1',
+ id: 'cpu-1',
name: 'Intel i7 v6 6700k',
clockRateMhz: 4100,
numberOfCores: 4,
energyConsumptionW: 70,
},
'cpu-2': {
- _id: 'cpu-2',
+ id: 'cpu-2',
name: 'Intel i5 v6 6700k',
clockRateMhz: 3500,
numberOfCores: 2,
energyConsumptionW: 50,
},
'cpu-3': {
- _id: 'cpu-3',
+ id: 'cpu-3',
name: 'Intel® Xeon® E-2224G',
clockRateMhz: 3500,
numberOfCores: 4,
energyConsumptionW: 71,
},
'cpu-4': {
- _id: 'cpu-4',
+ id: 'cpu-4',
name: 'Intel® Xeon® E-2244G',
clockRateMhz: 3800,
numberOfCores: 8,
energyConsumptionW: 71,
},
'cpu-5': {
- _id: 'cpu-5',
+ id: 'cpu-5',
name: 'Intel® Xeon® E-2246G',
clockRateMhz: 3600,
numberOfCores: 12,
@@ -38,14 +38,14 @@ export const CPU_UNITS = {
export const GPU_UNITS = {
'gpu-1': {
- _id: 'gpu-1',
+ id: 'gpu-1',
name: 'NVIDIA GTX 4 1080',
clockRateMhz: 1200,
numberOfCores: 200,
energyConsumptionW: 250,
},
'gpu-2': {
- _id: 'gpu-2',
+ id: 'gpu-2',
name: 'NVIDIA Tesla V100',
clockRateMhz: 1200,
numberOfCores: 5120,
@@ -55,28 +55,28 @@ export const GPU_UNITS = {
export const MEMORY_UNITS = {
'memory-1': {
- _id: 'memory-1',
+ id: 'memory-1',
name: 'Samsung PC DRAM K4A4G045WD',
speedMbPerS: 16000,
sizeMb: 4000,
energyConsumptionW: 10,
},
'memory-2': {
- _id: 'memory-2',
+ id: 'memory-2',
name: 'Samsung PC DRAM M393A2K43BB1-CRC',
speedMbPerS: 2400,
sizeMb: 16000,
energyConsumptionW: 10,
},
'memory-3': {
- _id: 'memory-3',
+ id: 'memory-3',
name: 'Crucial MTA18ASF4G72PDZ-3G2E1',
speedMbPerS: 3200,
sizeMb: 32000,
energyConsumptionW: 10,
},
'memory-4': {
- _id: 'memory-4',
+ id: 'memory-4',
name: 'Crucial MTA9ASF2G72PZ-3G2E1',
speedMbPerS: 3200,
sizeMb: 16000,
@@ -86,14 +86,14 @@ export const MEMORY_UNITS = {
export const STORAGE_UNITS = {
'storage-1': {
- _id: 'storage-1',
+ id: 'storage-1',
name: 'Samsung EVO 2016 SATA III',
speedMbPerS: 6000,
sizeMb: 250000,
energyConsumptionW: 10,
},
'storage-2': {
- _id: 'storage-2',
+ id: 'storage-2',
name: 'Western Digital MTA9ASF2G72PZ-3G2E1',
speedMbPerS: 6000,
sizeMb: 4000000,