Skip to content

Commit

Permalink
Display provisioner information too (for kernel specs)
Browse files Browse the repository at this point in the history
  • Loading branch information
Scusemua committed Mar 1, 2024
1 parent 7be8a22 commit b408dd0
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 9 deletions.
11 changes: 6 additions & 5 deletions server/domain/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ type NodeProvider interface {
type KubernetesNode struct {
NodeId string `json:"NodeId"`
Pods []*KubernetesPod `json:"Pods"`
Age string `json:"Age"` // Convert the time.Duration to a string
Age string `json:"Age"` // Convert the time.Duration to a string
IP string `json:"IP"`
CapacityCPU float64 `json:"CapacityCPU"`
CapacityMemory float64 `json:"CapacityMemory"`
Expand All @@ -100,11 +100,11 @@ func (kn *KubernetesNode) String() string {
return string(out)
}

type KubernetesPod struct {
PodName string `json:"PodName"`
PodPhase string `json:"PodPhase"`
type KubernetesPod struct {
PodName string `json:"PodName"`
PodPhase string `json:"PodPhase"`
PodAge string `json:"PodAge"` // Convert the time.Duration to a string
PodIP string `json:"PodIP"`
PodIP string `json:"PodIP"`

Valid bool `json:"Valid"` // Used to determine if the struct was sent/received correctly over the network.
}
Expand Down Expand Up @@ -171,6 +171,7 @@ func (ks *KernelSpec) String() string {
type KernelProvisioner struct {
Name string `json:"name"`
Gateway string `json:"display_name"`
Valid bool `json:"valid"`
}

func (kp *KernelProvisioner) String() string {
Expand Down
7 changes: 7 additions & 0 deletions server/handlers/kernel_spec_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,13 @@ func (h *KernelSpecHttpHandler) getKernelSpecsFromJupyter() []*domain.KernelSpec
Name: kernelProvisioner["provisioner_name"].(string),
// TODO(Ben): Handle errors here gracefully.
Gateway: kernelProvisioner["config"].(map[string]interface{})["gateway"].(string),
Valid: true,
}
} else {
kernelSpec.KernelProvisioner = &domain.KernelProvisioner{
Name: "",
Gateway: "",
Valid: false,
}
}

Expand Down
20 changes: 16 additions & 4 deletions src/app/Components/KernelSpecList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,20 +147,32 @@ export const KernelSpecList: React.FunctionComponent = () => {
<DescriptionList columnModifier={{ lg: '2Col' }}>
<DescriptionListGroup>
<DescriptionListTerm>Name</DescriptionListTerm>
<DescriptionListDescription>{kernelSpecs[tabIndex].name}</DescriptionListDescription>
<DescriptionListDescription>{kernelSpec.name}</DescriptionListDescription>
</DescriptionListGroup>
<DescriptionListGroup>
<DescriptionListTerm>Display Name</DescriptionListTerm>
<DescriptionListDescription>{kernelSpecs[tabIndex].displayName}</DescriptionListDescription>
<DescriptionListDescription>{kernelSpec.displayName}</DescriptionListDescription>
</DescriptionListGroup>
<DescriptionListGroup>
<DescriptionListTerm>Language</DescriptionListTerm>
<DescriptionListDescription>{kernelSpecs[tabIndex].language}</DescriptionListDescription>
<DescriptionListDescription>{kernelSpec.language}</DescriptionListDescription>
</DescriptionListGroup>
<DescriptionListGroup>
<DescriptionListTerm>Interrupt Mode</DescriptionListTerm>
<DescriptionListDescription>{kernelSpecs[tabIndex].interruptMode}</DescriptionListDescription>
<DescriptionListDescription>{kernelSpec.interruptMode}</DescriptionListDescription>
</DescriptionListGroup>
{kernelSpec.kernelProvisioner.valid && (
<React.Fragment>
<DescriptionListGroup>
<DescriptionListTerm>Provisioner</DescriptionListTerm>
<DescriptionListDescription>{kernelSpec.kernelProvisioner.name}</DescriptionListDescription>
</DescriptionListGroup>
<DescriptionListGroup>
<DescriptionListTerm>Provisioner Gateway</DescriptionListTerm>
<DescriptionListDescription>{kernelSpec.kernelProvisioner.gateway}</DescriptionListDescription>
</DescriptionListGroup>
</React.Fragment>
)}
</DescriptionList>
</TabContent>
))}
Expand Down

0 comments on commit b408dd0

Please sign in to comment.