Skip to content

Commit

Permalink
fix(ui): Dashboard Promote-Full is doing normal promotion (#1139)
Browse files Browse the repository at this point in the history
Signed-off-by: Remington Breeze <[email protected]>
  • Loading branch information
rbreeze authored May 6, 2021
1 parent 53da8b4 commit 32d37d8
Show file tree
Hide file tree
Showing 9 changed files with 185 additions and 121 deletions.
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ require (
google.golang.org/genproto v0.0.0-20201110150050-8816d57aaa9a
google.golang.org/grpc v1.33.1
google.golang.org/grpc/examples v0.0.0-20210331235824-f6bb3972ed15 // indirect
google.golang.org/protobuf v1.25.0
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
k8s.io/api v0.20.4
Expand Down
262 changes: 152 additions & 110 deletions pkg/apiclient/rollout/rollout.pb.go

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions pkg/apiclient/rollout/rollout.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pkg/apiclient/rollout/rollout.proto
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ message RestartRolloutRequest {
message PromoteRolloutRequest {
string name = 1;
string namespace = 2;
bool full = 3;
}

message AbortRolloutRequest {
Expand Down
3 changes: 3 additions & 0 deletions pkg/apiclient/rollout/rollout.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -4154,6 +4154,9 @@
},
"namespace": {
"type": "string"
},
"full": {
"type": "boolean"
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ func (s *ArgoRolloutsServer) GetNamespace(ctx context.Context, e *empty.Empty) (

func (s *ArgoRolloutsServer) PromoteRollout(ctx context.Context, q *rollout.PromoteRolloutRequest) (*v1alpha1.Rollout, error) {
rolloutIf := s.Options.RolloutsClientset.ArgoprojV1alpha1().Rollouts(q.GetNamespace())
return promote.PromoteRollout(rolloutIf, q.GetName(), false, false, false)
return promote.PromoteRollout(rolloutIf, q.GetName(), false, false, q.GetFull())
}

func (s *ArgoRolloutsServer) AbortRollout(ctx context.Context, q *rollout.AbortRolloutRequest) (*v1alpha1.Rollout, error) {
Expand Down
19 changes: 16 additions & 3 deletions ui/src/app/components/rollout-actions/rollout-actions.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {faArrowCircleUp, faExclamationCircle, faRedoAlt, faSync} from '@fortawesome/free-solid-svg-icons';
import {faArrowCircleUp, faChevronCircleUp, faExclamationCircle, faRedoAlt, faSync} from '@fortawesome/free-solid-svg-icons';
import * as React from 'react';
import {RolloutInfo} from '../../../models/rollout/rollout';
import {NamespaceContext, RolloutAPIContext} from '../../shared/context/api';
Expand All @@ -10,6 +10,7 @@ export enum RolloutAction {
Restart = 'Restart',
Retry = 'Retry',
Abort = 'Abort',
Promote = 'Promote',
PromoteFull = 'PromoteFull',
}

Expand All @@ -19,7 +20,7 @@ export const RolloutActionButton = (props: {action: RolloutAction; rollout: Roll

const restartedAt = formatTimestamp(props.rollout.restartedAt || '');

const actionMap = new Map<RolloutAction, ActionButtonProps>([
const actionMap = new Map<RolloutAction, ActionButtonProps & {body?: any}>([
[
RolloutAction.Restart,
{
Expand Down Expand Up @@ -48,11 +49,23 @@ export const RolloutActionButton = (props: {action: RolloutAction; rollout: Roll
shouldConfirm: true,
},
],
[
RolloutAction.Promote,
{
label: 'PROMOTE',
icon: faChevronCircleUp,
action: api.rolloutServicePromoteRollout,
body: {full: false},
disabled: props.rollout.status !== RolloutStatus.Paused,
shouldConfirm: true,
},
],
[
RolloutAction.PromoteFull,
{
label: 'PROMOTE-FULL',
icon: faArrowCircleUp,
body: {full: true},
action: api.rolloutServicePromoteRollout,
disabled: props.rollout.status !== RolloutStatus.Paused,
shouldConfirm: true,
Expand All @@ -66,7 +79,7 @@ export const RolloutActionButton = (props: {action: RolloutAction; rollout: Roll
<ActionButton
{...ap}
action={() => {
ap.action({}, namespace, props.rollout.objectMeta?.name || '');
ap.action(ap.body || {}, namespace, props.rollout.objectMeta?.name || '');
if (props.callback) {
props.callback();
}
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/components/rollouts-list/rollouts-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export const RolloutWidget = (props: {rollout: RolloutInfo; deselect: () => void
</WaitFor>
<div className='rollouts-list__widget__actions'>
<RolloutActionButton action={RolloutAction.Restart} rollout={rollout} callback={() => subscribe(true)} indicateLoading />
<RolloutActionButton action={RolloutAction.PromoteFull} rollout={rollout} callback={() => subscribe(true)} indicateLoading />
<RolloutActionButton action={RolloutAction.Promote} rollout={rollout} callback={() => subscribe(true)} indicateLoading />
</div>
</Link>
</EffectDiv>
Expand Down
6 changes: 6 additions & 0 deletions ui/src/models/rollout/generated/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4878,6 +4878,12 @@ export interface RolloutPromoteRolloutRequest {
* @memberof RolloutPromoteRolloutRequest
*/
namespace?: string;
/**
*
* @type {boolean}
* @memberof RolloutPromoteRolloutRequest
*/
full?: boolean;
}
/**
*
Expand Down

0 comments on commit 32d37d8

Please sign in to comment.