Skip to content

Commit

Permalink
feat(pipeline): Custom alert for start manual execution dialog (#7406)
Browse files Browse the repository at this point in the history
  • Loading branch information
alanmquach committed Sep 15, 2019
1 parent ec1d32f commit 476ad62
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
6 changes: 6 additions & 0 deletions app/scripts/modules/core/src/domain/IPipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export interface IPipeline {
lastModifiedBy?: string;
locked?: IPipelineLock;
limitConcurrent: boolean;
manualStartAlert?: IPipelineManualStartAlert;
name: string;
notifications?: INotification[];
respectQuietPeriod?: boolean;
Expand All @@ -34,6 +35,11 @@ export interface IPipeline {
updateTs?: number;
}

export interface IPipelineManualStartAlert {
type: 'danger' | 'warning' | 'info';
message: string;
}

export interface IPipelineLock {
ui: boolean;
allowUnlockUi?: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { assign, clone, compact, extend, get, head, uniq, isArray, pickBy } from
import { SubmitButton, ModalClose } from 'core/modal';
import { Application } from 'core/application';
import { AuthenticationService } from 'core/authentication';
import { buildValidators, IModalComponentProps, ReactModal, SpinFormik } from 'core/presentation';
import { buildValidators, IModalComponentProps, ReactModal, SpinFormik, Markdown } from 'core/presentation';
import {
IExecution,
IExecutionTrigger,
Expand Down Expand Up @@ -325,6 +325,7 @@ export class ManualExecutionModal extends React.Component<IManualExecutionModalP
triggerComponent,
triggers,
} = this.state;
const { manualStartAlert } = pipeline;
const notifications = applicationNotifications.concat(pipelineNotifications);
const pipelineCommand = this.generateInitialValues(pipeline);
return (
Expand Down Expand Up @@ -365,6 +366,14 @@ export class ManualExecutionModal extends React.Component<IManualExecutionModalP
{currentPipelineExecutions.length > 0 && (
<CurrentlyRunningExecutions currentlyRunningExecutions={currentPipelineExecutions} />
)}
{manualStartAlert && (
<Markdown
className={`alert alert-${
['danger', 'warning', 'info'].includes(manualStartAlert.type) ? manualStartAlert.type : 'warning'
}`}
message={manualStartAlert.message}
/>
)}
{triggers && triggers.length > 0 && (
<Triggers
formik={formik}
Expand Down

0 comments on commit 476ad62

Please sign in to comment.