Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Lens
Commits
200061d3
Unverified
Commit
200061d3
authored
3 years ago
by
Sebastian Malton
Committed by
GitHub
3 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Use .status.phase instead of computing it for Pod.getStatusMessage (#4286)
parent
b52bd297
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/common/k8s-api/endpoints/pods.api.ts
+39
-46
src/common/k8s-api/endpoints/pods.api.ts
src/renderer/components/+workloads-pods/pods.tsx
+1
-1
src/renderer/components/+workloads-pods/pods.tsx
with
40 additions
and
47 deletions
+40
-47
src/common/k8s-api/endpoints/pods.api.ts
+
39
-
46
View file @
200061d3
...
...
@@ -165,40 +165,40 @@ interface IContainerProbe {
failureThreshold
?:
number
;
}
export
interface
ContainerStateRunning
{
startedAt
:
string
;
}
export
interface
ContainerStateWaiting
{
reason
:
string
;
message
:
string
;
}
export
interface
ContainerStateTerminated
{
startedAt
:
string
;
finishedAt
:
string
;
exitCode
:
number
;
reason
:
string
;
containerID
?:
string
;
message
?:
string
;
signal
?:
number
;
}
/**
* ContainerState holds a possible state of container. Only one of its members
* may be specified. If none of them is specified, the default one is
* `ContainerStateWaiting`.
*/
export
interface
ContainerState
{
running
?:
ContainerStateRunning
;
waiting
?:
ContainerStateWaiting
;
terminated
?:
ContainerStateTerminated
;
}
export
interface
IPodContainerStatus
{
name
:
string
;
state
?:
{
[
index
:
string
]:
object
;
running
?:
{
startedAt
:
string
;
};
waiting
?:
{
reason
:
string
;
message
:
string
;
};
terminated
?:
{
startedAt
:
string
;
finishedAt
:
string
;
exitCode
:
number
;
reason
:
string
;
};
};
lastState
?:
{
[
index
:
string
]:
object
;
running
?:
{
startedAt
:
string
;
};
waiting
?:
{
reason
:
string
;
message
:
string
;
};
terminated
?:
{
startedAt
:
string
;
finishedAt
:
string
;
exitCode
:
number
;
reason
:
string
;
};
};
state
?:
ContainerState
;
lastState
?:
ContainerState
;
ready
:
boolean
;
restartCount
:
number
;
image
:
string
;
...
...
@@ -373,23 +373,16 @@ export class Pod extends WorkloadKubeObject {
}
// Returns pod phase or container error if occurred
getStatusMessage
()
{
if
(
this
.
getReason
()
===
PodStatus
.
EVICTED
)
return
"
Evicted
"
;
if
(
this
.
metadata
.
deletionTimestamp
)
return
"
Terminating
"
;
const
statuses
=
this
.
getContainerStatuses
(
false
);
// not including initContainers
for
(
const
{
state
}
of
statuses
.
reverse
())
{
if
(
state
.
waiting
)
{
return
state
.
waiting
.
reason
||
"
Waiting
"
;
}
getStatusMessage
():
string
{
if
(
this
.
getReason
()
===
PodStatus
.
EVICTED
)
{
return
"
Evicted
"
;
}
if
(
state
.
terminated
)
{
return
state
.
terminated
.
reason
||
"
Terminated
"
;
}
if
(
this
.
metadata
.
deletionTimestamp
)
{
return
"
Terminating
"
;
}
return
this
.
getStatusPhase
();
return
this
.
getStatusPhase
()
||
"
Waiting
"
;
}
getStatusPhase
()
{
...
...
This diff is collapsed.
Click to expand it.
src/renderer/components/+workloads-pods/pods.tsx
+
1
-
1
View file @
200061d3
...
...
@@ -69,7 +69,7 @@ export class Pods extends React.Component<Props> {
formatters
:
{
tableView
:
true
,
},
children
:
Object
.
keys
(
state
).
map
(
status
=>
(
children
:
Object
.
keys
(
state
).
map
(
(
status
:
keyof
typeof
state
)
=>
(
<
Fragment
key
=
{
status
}
>
<
div
className
=
"title"
>
{
name
}
<
span
className
=
"text-secondary"
>
(
{
status
}{
ready
?
"
, ready
"
:
""
}
)
</
span
>
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment