Skip to content

Commit

Permalink
feat: display operating system as new card in instance detail view
Browse files Browse the repository at this point in the history
Co-authored-by: Julian Geywitz <[email protected]>
  • Loading branch information
rbott and geigi committed Aug 5, 2022
1 parent 8c72aee commit 0141f3f
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions api/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type GntInstance struct {
Disks []GntDisk `json:"disks"`
Nics []GntNic `json:"nics"`
Tags []string `json:"tags"`
OS string `json:"OS"`
}

type GntCluster struct {
Expand Down
1 change: 1 addition & 0 deletions api/repository/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func (repo *InstanceRepository) Get(clusterName string, instanceName string) (mo
Disks: extractDisks(parsedInstance),
Nics: extractNics(parsedInstance),
Tags: parsedInstance.Tags,
OS: parsedInstance.OS,
},
}, nil
}
Expand Down
1 change: 1 addition & 0 deletions api/repository/instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ func TestInstanceRepoGetFuncReturnsSuccessfulResult_OnValidResponse(t *testing.T
Nics: []model.GntNic{},
Disks: []model.GntDisk{},
Tags: []string{"tag1"},
OS: "noop",
}, result.Instance)
}

Expand Down
2 changes: 1 addition & 1 deletion api/repository/instance_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ type rapiInstanceResponse struct {
NicUuids []string `json:"nic.uuids"`
OperRAM interface{} `json:"oper_ram"`
OperVcpus interface{} `json:"oper_vcpus"`
Os string `json:"os"`
OS string `json:"os"`
SerialNo int `json:"serial_no"`
Tags []string `json:"tags"`
UUID string `json:"uuid"`
Expand Down
2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@
"last 1 safari version"
]
}
}
}
1 change: 1 addition & 0 deletions web/src/api/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export type GntInstance = {
disks: GntDisk[];
nics: GntNic[];
tags: string[];
OS: string;
};

export type GntNode = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ function createMockInstance(overrideParams: Partial<GntInstance>): GntInstance {
primaryNode: "",
secondaryNodes: [],
tags: [],
OS: "noop",
...overrideParams,
};
}
Expand Down
8 changes: 8 additions & 0 deletions web/src/views/InstanceDetail/InstanceDetail.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
faComputer,
faHdd,
faMemory,
faMicrochip,
Expand Down Expand Up @@ -80,6 +81,10 @@ type InstanceResponse = {
instance: GntInstance;
};

function OSCard({ os }: { os: string }): ReactElement {
return <Card icon={faComputer} title={os} />;
}

const InstanceDetail = (): ReactElement => {
const { instanceName } = useParams<{ instanceName: string }>();
const clusterName = useClusterName();
Expand Down Expand Up @@ -161,6 +166,9 @@ const InstanceDetail = (): ReactElement => {
<TagCard key={tag} tag={tag} />
))}
</CardGrid.Section>
<CardGrid.Section headline="Operating System">
<OSCard os={instance.OS} />
</CardGrid.Section>
</CardGrid>
</>
);
Expand Down

0 comments on commit 0141f3f

Please sign in to comment.