fix for scale option appearing on non-scalable resources (#3696)
* fix: simplify scaling key binding condition * fix: add ReplicaSet to scalable resource check * fix: update expected hints count in deployment and stateful set testsmine
parent
4c6df3975e
commit
e5cdf04e51
|
|
@ -356,7 +356,7 @@ func isStandardGroup(gv string) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func isScalable(gvr *client.GVR) bool {
|
func isScalable(gvr *client.GVR) bool {
|
||||||
ss := sets.New(client.DpGVR, client.StsGVR)
|
ss := sets.New(client.DpGVR, client.StsGVR, client.RsGVR)
|
||||||
|
|
||||||
return ss.Has(gvr)
|
return ss.Has(gvr)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,5 +17,5 @@ func TestDeploy(t *testing.T) {
|
||||||
|
|
||||||
require.NoError(t, v.Init(makeCtx(t)))
|
require.NoError(t, v.Init(makeCtx(t)))
|
||||||
assert.Equal(t, "Deployments", v.Name())
|
assert.Equal(t, "Deployments", v.Name())
|
||||||
assert.Len(t, v.Hints(), 18)
|
assert.Len(t, v.Hints(), 17)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ func (s *ScaleExtender) bindKeys(aa *ui.KeyActions) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !dao.IsCRD(meta) || dao.IsScalable(meta) {
|
if dao.IsScalable(meta) {
|
||||||
aa.Add(ui.KeyS, ui.NewKeyActionWithOpts("Scale", s.scaleCmd,
|
aa.Add(ui.KeyS, ui.NewKeyActionWithOpts("Scale", s.scaleCmd,
|
||||||
ui.ActionOpts{
|
ui.ActionOpts{
|
||||||
Visible: true,
|
Visible: true,
|
||||||
|
|
|
||||||
|
|
@ -17,5 +17,5 @@ func TestStatefulSetNew(t *testing.T) {
|
||||||
|
|
||||||
require.NoError(t, s.Init(makeCtx(t)))
|
require.NoError(t, s.Init(makeCtx(t)))
|
||||||
assert.Equal(t, "StatefulSets", s.Name())
|
assert.Equal(t, "StatefulSets", s.Name())
|
||||||
assert.Len(t, s.Hints(), 15)
|
assert.Len(t, s.Hints(), 14)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue