Skip to content

Commit

Permalink
feat(core): allow markdown in stage-level comments (#4988)
Browse files Browse the repository at this point in the history
  • Loading branch information
anotherchrisberry committed Mar 12, 2018
1 parent 524210b commit 7cc0a15
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ <h6 ng-if="stage.context.restartDetails">Restarted by {{stage.context.restartDet
</table>
<div ng-if="stageSummary.comments">
<strong>Comments</strong>
<p ng-bind-html="stageSummary.comments"></p>
<p ng-bind-html="$ctrl.getComments()"></p>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { module, IController, IComponentOptions, IScope } from 'angular';
import { StateParams, StateService } from '@uirouter/angularjs';
import { HtmlRenderer, Parser } from 'commonmark';

import { Application } from 'core/application';
import { IExecution, IExecutionStage, IExecutionStageSummary, IStage } from 'core/domain';
Expand All @@ -12,6 +13,9 @@ export class StageSummaryController implements IController {
public stage: IExecutionStage;
public stageSummary: IExecutionStageSummary;

private parser: Parser = new Parser();
private renderer: HtmlRenderer = new HtmlRenderer();

constructor(private $scope: IScope,
private $stateParams: StateParams,
private $state: StateService,
Expand Down Expand Up @@ -47,6 +51,11 @@ export class StageSummaryController implements IController {
}
}

public getComments(): string {
const parsed = this.parser.parse(this.stageSummary.comments);
return this.renderer.render(parsed);
}

public getCurrentStep() {
return parseInt(this.$stateParams.step, 10);
}
Expand Down

0 comments on commit 7cc0a15

Please sign in to comment.