Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Display commit information if available #2025

Merged
merged 3 commits into from
Aug 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/2025.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:improvement
ui: Add git commit SHAs to operations in the browser UI
```
1 change: 1 addition & 0 deletions ui/app/components/app-card/build.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<b class="badge badge--version">v{{@model.sequence}}</b>
</LinkTo>
<OperationStatusIndicator @status={{or @model.pushedArtifact.status @model.status}} />
<GitCommit @commit={{@model.preload.jobDataSourceRef.git.commit}}/>
</:meta-primary>

<:meta-secondary>
Expand Down
1 change: 1 addition & 0 deletions ui/app/components/app-card/deployment.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<b class="badge badge--version">v{{@model.sequence}}</b>
</LinkTo>
<OperationStatusIndicator @status={{@model.status}} />
<GitCommit @commit={{@model.preload.jobDataSourceRef.git.commit}}/>
</:meta-primary>

<:meta-secondary>
Expand Down
1 change: 1 addition & 0 deletions ui/app/components/app-card/release.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<b class="badge badge--version">v{{@model.sequence}}</b>
</LinkTo>
<OperationStatusIndicator @status={{@model.status}} />
<GitCommit @commit={{@model.preload.jobDataSourceRef.git.commit}}/>
</:meta-primary>

<:meta-secondary>
Expand Down
8 changes: 8 additions & 0 deletions ui/app/components/git-commit.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{{#if @commit}}
<span class="git-commit" title="Triggered by commit: {{@commit}}">
<CopyButton @clipboardText={{@commit}}>
<Pds::Icon @type="git-commit"/><span class="git-commit__sha">{{truncate-commit @commit}}</span>
</CopyButton>
</span>
{{/if}}

3 changes: 3 additions & 0 deletions ui/app/helpers/truncate-commit.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { helper } from '@ember/component/helper';

export default helper(([str]: string[]) => str?.substr(0, 7));
4 changes: 4 additions & 0 deletions ui/app/styles/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
@use 'pds/tokens/font';
@use 'pds/core/typography/config' as Typography;
@use 'utilities/animations';

@use 'utilities/focus-ring';

@import 'mixins/index';

@import './variables';
@import './layout';

Expand All @@ -22,6 +25,7 @@
@import './components/copyable-code';
@import './components/empty-state';
@import './components/flash';
@import './components/git-commit';
@import './components/navigation/footer';
@import './components/navigation/header';
@import './components/icon-tile';
Expand Down
19 changes: 19 additions & 0 deletions ui/app/styles/components/git-commit.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.git-commit {
display: flex;
align-items: center;
@include Typography.Interface(S);
background: rgb(var(--badge));
color: rgb(var(--text-muted));
border-radius: 2px;
padding: scale.$sm-4 scale.$sm-4;
&__sha {
padding: 0 scale.$sm-4;
}
.copy-btn {
@include button-reset;
cursor: pointer;
&:active {
color: rgb(var(--text));
}
}
}
1 change: 1 addition & 0 deletions ui/app/styles/mixins/_index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import "button-reset";
30 changes: 30 additions & 0 deletions ui/app/styles/mixins/button-reset.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
@mixin button-reset {
border: none;
margin: 0;
padding: 0;
width: auto;
overflow: visible;

background: transparent;

/* inherit font & color from ancestor */
color: inherit;
font: inherit;

/* Normalize `line-height`. Cannot be changed from `normal` in Firefox 4+. */
line-height: normal;

/* Corrects font smoothing for webkit */
-webkit-font-smoothing: inherit;
-moz-osx-font-smoothing: inherit;

/* Corrects inability to style clickable `input` types in iOS */
-webkit-appearance: none;

/* Remove excess padding and border in Firefox 4+ */
&::-moz-focus-inner {
border: 0;
padding: 0;
}

}
5 changes: 5 additions & 0 deletions ui/app/templates/workspace/projects/project/app/build.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
<b>{{component-name operation.component.name}}</b>
</span>
</small>
{{#if @model.preload.jobDataSourceRef.git.commit}}
<small>
<GitCommit @commit={{@model.preload.jobDataSourceRef.git.commit}}/>
</small>
{{/if}}
</div>
<div class="actions">
<Actions::Deploy @sequence={{@model.sequence}} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
<span>Deployed by <b>{{component-name @model.component.name}}</b>
{{date-format-distance-to-now @model.status.startTime.seconds }}</span>
</small>
{{#if @model.preload.jobDataSourceRef.git.commit}}
<small>
<GitCommit @commit={{@model.preload.jobDataSourceRef.git.commit}}/>
</small>
{{/if}}
</div>
<div class="actions">
<div class="button-group">
Expand Down
5 changes: 5 additions & 0 deletions ui/app/templates/workspace/projects/project/app/release.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
<span>Released on <b>{{component-name @model.component.name}}</b>
{{date-format-distance-to-now @model.status.startTime.seconds }}</span>
</small>
{{#if @model.preload.jobDataSourceRef.git.commit}}
<small>
<GitCommit @commit={{@model.preload.jobDataSourceRef.git.commit}}/>
</small>
{{/if}}
</div>
<div class="actions">
{{#if @isLatest}}
Expand Down