mirror of
https://github.com/weaveworks/scope.git
synced 2026-02-14 18:09:59 +00:00
fixup: from review feedback
Fix a logic error in ECS scale-down button, bad copy/paste in ActiveControls() and neaten the switch cases in container controls. Co-Authored-By: Filip Barl <filip@weave.works>
This commit is contained in:
committed by
Bryan Boreham
parent
635cea0b56
commit
1dcdfab05a
@@ -153,7 +153,7 @@ func (r Reporter) Tag(rpt report.Report) (report.Report, error) {
|
||||
activeControls := []string{ScaleUp}
|
||||
// Disable ScaleDown when only 1 task is desired, since
|
||||
// scaling down to 0 would cause the service to disappear (#2085)
|
||||
if service.DesiredCount < 1 {
|
||||
if service.DesiredCount > 1 {
|
||||
activeControls = append(activeControls, ScaleDown)
|
||||
}
|
||||
rpt.ECSService.AddNode(report.MakeNodeWith(serviceID, map[string]string{
|
||||
|
||||
@@ -391,13 +391,12 @@ func (c *container) getBaseNode() report.Node {
|
||||
|
||||
// Return a slice including all controls that should be shown on this container
|
||||
func (c *container) controls() []string {
|
||||
paused := c.container.State.Paused
|
||||
switch {
|
||||
case paused:
|
||||
case c.container.State.Paused:
|
||||
return []string{UnpauseContainer}
|
||||
case c.container.State.Running:
|
||||
return []string{RestartContainer, StopContainer, PauseContainer, AttachContainer, ExecContainer}
|
||||
case !c.container.State.Running:
|
||||
default:
|
||||
return []string{StartContainer, RemoveContainer}
|
||||
}
|
||||
return nil
|
||||
|
||||
@@ -124,7 +124,7 @@ func (n Node) WithLatestActiveControls(cs ...string) Node {
|
||||
}
|
||||
|
||||
// ActiveControls returns a string slice with the names of active controls.
|
||||
func (n Node) ActiveControls(cs ...string) []string {
|
||||
func (n Node) ActiveControls() []string {
|
||||
activeControls, _ := n.Latest.Lookup(NodeActiveControls)
|
||||
return strings.Split(activeControls, ScopeDelim)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user