Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Feature/37108 improve design of GitHub tab (#9329)

Wieland Lindenthale72d940b5b20
diff --git a/frontend/karma.conf.js b/frontend/karma.conf.js
index 015f0f7b18f..3fc4a06f275 100644
--- a/frontend/karma.conf.js
+++ b/frontend/karma.conf.js
@@ -39,6 +39,10 @@ module.exports = function (config) {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
flags: ['--no-sandbox']
+ },
+ ChromeWithDebug: {
+ base: 'Chrome',
+ flags: ['--no-sandbox', '--debug', '--auto-open-devtools-for-tabs']
}
},
singleRun: false
diff --git a/modules/github_integration/config/locales/js-en.yml b/modules/github_integration/config/locales/js-en.yml
index c108307984e..9ae0f23b8f4 100644
--- a/modules/github_integration/config/locales/js-en.yml
+++ b/modules/github_integration/config/locales/js-en.yml
@@ -32,19 +32,15 @@ en:
work_packages:
tab_name: "GitHub"
tab_header:
- title: "Pull Requests"
+ title: "Pull requests"
copy_menu:
- label: Git
- description: Copy important git content to clipboard
+ label: Git snippets
+ description: Copy git snippets to clipboard
git_actions:
- branch: Branch
- branch_help: Copy the default branch name.
- message: Message
- message_help: Copy the default commit message.
- cmd: Command
- cmd_help: Copy a shell command which creates a new branch and an empty commit using the default branch name and commit message.
- title: Copy to Clipboard
- copy_button_help: Copy to clipboard
+ branch_name: Branch name
+ commit_message: Commit message
+ cmd: Create branch with empty commit
+ title: Quick snippets for Git
copy_success: ✅ Copied!
copy_error: ❌ Copy failed!
tab_prs:
diff --git a/modules/github_integration/frontend/module/git-actions-menu/git-actions-menu.component.spec.ts b/modules/github_integration/frontend/module/git-actions-menu/git-actions-menu.component.spec.ts
index 8632febd0dc..14414715ea0 100644
--- a/modules/github_integration/frontend/module/git-actions-menu/git-actions-menu.component.spec.ts
+++ b/modules/github_integration/frontend/module/git-actions-menu/git-actions-menu.component.spec.ts
@@ -64,21 +64,10 @@ describe('GitActionsMenuComponent', () => {
expect(component).toBeTruthy();
});
- it('should select tab', () => {
- const tabToSelect = component.tabs[0];
- component.selectedTab = tabToSelect;
-
- fixture.detectChanges();
-
- expect(component.selectedTab).toBe(tabToSelect);
- });
-
- it('should select tab', () => {
- const tabToSelect = component.tabs[0];
- const copyButton = fixture.debugElement.query(By.css('button')).nativeElement;
+ it('should generate the branch name on copy button click', () => {
+ const copyButton = fixture.debugElement.query(By.css('.copy-button')).nativeElement;
gitActionsService.branchName.and.returnValue('test branch');
- component.selectedTab = tabToSelect;
copyButton.click();
fixture.detectChanges();
diff --git a/modules/github_integration/frontend/module/git-actions-menu/git-actions-menu.component.ts b/modules/github_integration/frontend/module/git-actions-menu/git-actions-menu.component.ts
index 30cbc93322f..c5cf02bb835 100644
--- a/modules/github_integration/frontend/module/git-actions-menu/git-actions-menu.component.ts
+++ b/modules/github_integration/frontend/module/git-actions-menu/git-actions-menu.component.ts
@@ -36,7 +36,7 @@ import {
OpContextMenuLocalsMap,
OpContextMenuLocalsToken
} from 'core-app/components/op-context-menu/op-context-menu.types';
-import { ITab } from "core-app/modules/plugins/linked/openproject-github_integration/typings";
+import { ISnippet} from "core-app/modules/plugins/linked/openproject-github_integration/typings";
@Component({
@@ -60,33 +60,26 @@ export class GitActionsMenuComponent extends OPContextMenuComponent {
public lastCopyResult:string = this.text.copyResult.success;
public showCopyResult:boolean = false;
+ public copiedSnippetId:string = '';
- public tabs:ITab[] = [
+ public snippets:ISnippet[] = [
{
id: 'branch',
- name: this.I18n.t('js.github_integration.tab_header.git_actions.branch'),
- help: this.I18n.t('js.github_integration.tab_header.git_actions.branch_help'),
- lines: 1,
+ name: this.I18n.t('js.github_integration.tab_header.git_actions.branch_name'),
textToCopy: () => this.gitActions.branchName(this.workPackage)
},
{
id: 'message',
- name: this.I18n.t('js.github_integration.tab_header.git_actions.message'),
- help: this.I18n.t('js.github_integration.tab_header.git_actions.message_help'),
- lines: 6,
+ name: this.I18n.t('js.github_integration.tab_header.git_actions.commit_message'),
textToCopy: () => this.gitActions.commitMessage(this.workPackage)
},
{
id: 'command',
name: this.I18n.t('js.github_integration.tab_header.git_actions.cmd'),
- help: this.I18n.t('js.github_integration.tab_header.git_actions.cmd_help'),
- lines: 6,
textToCopy: () => this.gitActions.gitCommand(this.workPackage)
},
];
- public selectedTab:ITab = this.tabs[0];
-
constructor(@Inject(OpContextMenuLocalsToken)
public locals:OpContextMenuLocalsMap,
readonly I18n:I18nService,
@@ -95,21 +88,18 @@ export class GitActionsMenuComponent extends OPContextMenuComponent {
this.workPackage = this.locals.workPackage;
}
- public onCopyButtonClick():void {
- const success = this.copySelectedTabText();
+ public onCopyButtonClick(snippet:ISnippet):void {
+ const success = copy(snippet.textToCopy());
if (success) {
this.lastCopyResult = this.text.copyResult.success;
} else {
this.lastCopyResult = this.text.copyResult.error;
}
+ this.copiedSnippetId = snippet.id;
this.showCopyResult = true;
window.setTimeout(() => {
this.showCopyResult = false;
}, 2000);
}
-
- public copySelectedTabText():boolean {
- return copy(this.selectedTab.textToCopy());
- }
}
diff --git a/modules/github_integration/frontend/module/git-actions-menu/git-actions-menu.template.html b/modules/github_integration/frontend/module/git-actions-menu/git-actions-menu.template.html
index b710272c7f8..0c242188553 100644
--- a/modules/github_integration/frontend/module/git-actions-menu/git-actions-menu.template.html
+++ b/modules/github_integration/frontend/module/git-actions-menu/git-actions-menu.template.html
@@ -1,23 +1,22 @@
<div class="git-actions-menu dropdown-relative dropdown -overflow-in-view dropdown-anchor-right">
- <h3 class="title">
- <op-icon icon-classes="button--icon icon-console-light"></op-icon>
- {{text.title}}
- </h3>
- <op-scrollable-tabs
- [tabs]="tabs"
- [currentTabId]="selectedTab.id"
- (tabSelected)="selectedTab = $event"
- >
- </op-scrollable-tabs>
- <div class="copy-wrapper">
- <textarea class="copy-content" [textContent]="selectedTab.textToCopy()" [style.height.em]="selectedTab.lines" readonly="true"></textarea>
- <button class="button copy-button"
- type="button"
- [attr.aria-label]="text.copyButtonHelpText"
- (click)="onCopyButtonClick()">
- <op-icon icon-classes="button--icon icon-copy"></op-icon>
- </button>
- <div class="copy-result-message" *ngIf="showCopyResult" [textContent]="lastCopyResult"></div>
+ <h3 class="title">{{text.title}}</h3>
+
+ <div class="copy-wrapper op-form-field" *ngFor="let snippet of snippets">
+ <label class="op-form-field--label-wrap">
+ <div class="op-form-field--label">{{ snippet.name }}</div>
+ <div class="op-form-field--input">
+ <input type="text" class="copy-content op-input" readonly="true" [value]="snippet.textToCopy()">
+ <button class="button copy-button"
+ type="button"
+ [attr.aria-label]="text.copyButtonHelpText"
+ (click)="onCopyButtonClick(snippet)">
+ <op-icon icon-classes="button--icon icon-copy"></op-icon>
+ </button>
+ <div class="copy-result-message" *ngIf="showCopyResult && snippet.id === copiedSnippetId" [textContent]="lastCopyResult"></div>
+ </div>
+ </label>
</div>
- <div class="help-text" [textContent]="selectedTab.help"></div>
+
</div>
+
+
diff --git a/modules/github_integration/frontend/module/git-actions-menu/styles/git-actions-menu.sass b/modules/github_integration/frontend/module/git-actions-menu/styles/git-actions-menu.sass
index e1d044c1ee2..11ab5d8ba44 100644
--- a/modules/github_integration/frontend/module/git-actions-menu/styles/git-actions-menu.sass
+++ b/modules/github_integration/frontend/module/git-actions-menu/styles/git-actions-menu.sass
@@ -1,7 +1,7 @@
.git-actions-menu
background-color: var(--body-background)
border: var(--content-default-border-width) solid var(--content-default-border-color)
- padding: 1rem
+ padding: 1rem 1rem 2rem 1rem
min-width: 25rem
box-shadow: .1em .1em .4em rgba(0,0,0,0.1)
@@ -11,7 +11,7 @@
margin-bottom: 1rem
.copy-content
- width: calc(100% - 2.2em)
+ width: calc(100% - 3em)
// the min-height should be the size of the copy-icon, which is the sum of:
// 2 * button padding (0.65em)
// font-size of the icon (0.9em)
@@ -22,7 +22,7 @@
color: var(--gray-dark)
white-space: pre
resize: none
- font-size: 1rem
+ font-size: 0.9rem
display: inline-block
.copy-button
@@ -32,6 +32,7 @@
vertical-align: top
left: -1px
position: relative
+ font-size: 0.9rem
&:hover
border-color: #999
@@ -46,6 +47,7 @@
right: 0
top: calc(2 * 0.65em + 0.9em + 1px + 9px)
box-shadow: 1px 1px 4px var(--gray-dark)
+ z-index: 1
&:before
content: ""
@@ -58,8 +60,3 @@
border-left: 0.3em solid transparent
border-right: 0.3em solid transparent
- .help-text
- color: var(--gray-dark)
- margin-bottom: 1rem
- display: inline-block
- max-width: 20em
diff --git a/modules/github_integration/frontend/module/git-actions/git-actions.service.spec.ts b/modules/github_integration/frontend/module/git-actions/git-actions.service.spec.ts
index a6621ba6784..68a5a6dc71b 100644
--- a/modules/github_integration/frontend/module/git-actions/git-actions.service.spec.ts
+++ b/modules/github_integration/frontend/module/git-actions/git-actions.service.spec.ts
@@ -71,25 +71,17 @@ describe('GitActionsService', function() {
expect(service.branchName(wp)).toEqual('user-story/42-find-the-question');
expect(service.commitMessage(wp)).toEqual(`[#42] Find the question
-I recently found the answer is 42. We need to compute the correct
-question.
-
http://localhost:9876/work_packages/42
`);
expect(service.gitCommand(wp)).toEqual(`git checkout -b 'user-story/42-find-the-question' && git commit --allow-empty -m '[#42] Find the question
-I recently found the answer is 42. We need to compute the correct
-question.
-
http://localhost:9876/work_packages/42
'`);
});
it('shell-escapes output for the git-command', () => {
- const wp = createWorkPackage({description: { raw: "' && rm -rf / #"}});
- expect(service.gitCommand(wp)).toEqual(`git checkout -b 'user-story/42-find-the-question' && git commit --allow-empty -m '[#42] Find the question
-
-'\\'' && rm -rf / #
+ const wp = createWorkPackage({ subject: "' && rm -rf / #" });
+ expect(service.gitCommand(wp)).toEqual(`git checkout -b 'user-story/42-and-and-rm-rf' && git commit --allow-empty -m '[#42] '\\'' && Rm -rf / #
http://localhost:9876/work_packages/42
'`);
diff --git a/modules/github_integration/frontend/module/git-actions/git-actions.service.ts b/modules/github_integration/frontend/module/git-actions/git-actions.service.ts
index bd2c88bbdbd..852879d30ad 100644
--- a/modules/github_integration/frontend/module/git-actions/git-actions.service.ts
+++ b/modules/github_integration/frontend/module/git-actions/git-actions.service.ts
@@ -54,10 +54,10 @@ export class GitActionsService {
const id = workPackage.id || '';
const title = workPackage.subject;
const url = window.location.origin + workPackage.pathHelper.workPackagePath(id);
- const description = workPackage.description.raw || '';
+ const description = '';
return({
id, type, title, url, description
});
}
-}
+}
\ No newline at end of file
diff --git a/modules/github_integration/frontend/module/pull-request/pr-check.component.sass b/modules/github_integration/frontend/module/pull-request/pr-check.component.sass
new file mode 100644
index 00000000000..cf86afaf690
--- /dev/null
+++ b/modules/github_integration/frontend/module/pull-request/pr-check.component.sass
@@ -0,0 +1,62 @@
+.op-pr-check
+ display: grid
+ grid-row: span 4
+ grid-template-columns: 28px 33px 1fr auto
+ grid-template-areas: "check-state-icon check-avatar check-info check-details"
+ list-style-type: none
+ border: 1px solid #dddddd
+ padding: 0.3rem 1rem
+ background: rgba(0, 0, 0, 0.05)
+ font-size: 0.9rem
+
+ &:first-child
+ border-top-right-radius: 5px
+ border-top-left-radius: 5px
+
+ &:last-child
+ border-bottom-right-radius: 5px
+ border-bottom-left-radius: 5px
+
+ &--avatar img
+ grid-area: check-avatar
+ display: inline-block
+ width: 22px
+ height: 22px
+ margin-right: 5px
+ border-radius: var(--user-avatar-border-radius)
+
+ &--info
+ grid-area: check-info
+
+ &--state
+ color: var(--gray-dark)
+ font-style: italic
+ margin-left: 1em
+
+ &--state-icon
+ grid-area: check-state-icon
+
+ &_queued
+ color: cadetblue
+
+ &_in_progress
+ color: orange
+
+ &_success
+ color: green
+
+ &_failure,
+ &_timed_out,
+ &_action_required,
+ &_stale
+ color: red
+
+ &_skipped,
+ &_neutral,
+ &_cancelled
+ color: gray
+ color: gray
+ color: gray
+
+ &--details
+ grid-area: check-details
diff --git a/modules/github_integration/frontend/module/pull-request/pull-request.component.html b/modules/github_integration/frontend/module/pull-request/pull-request.component.html
new file mode 100644
index 00000000000..880b08290cc
--- /dev/null
+++ b/modules/github_integration/frontend/module/pull-request/pull-request.component.html
@@ -0,0 +1,61 @@
+<a
+ class='op-pull-request--link'
+ [href]="pullRequest.htmlUrl"
+ target="blank"
+ [textContent]="pullRequest.repository + '#' + pullRequest.number"
+></a>
+
+<div
+ class='op-pull-request--title'
+ [textContent]="pullRequest.title"
+></div>
+
+<div class="op-pull-request--info">
+ {{ text.label_created_by }}
+ <img
+ alt='PR author avatar'
+ class='op-pull-request--avatar op-avatar op-avatar_mini'
+ [src]="pullRequest.githubUser.avatarUrl"
+ *ngIf="pullRequest.githubUser"
+ />
+ <span class='op-pull-request--user'>
+ <a
+ [href]="pullRequest.githubUser.htmlUrl"
+ [textContent]="pullRequest.githubUser.login"
+ *ngIf="pullRequest.githubUser"
+ ></a>.
+ </span>
+
+ <span class='op-pull-request--date'>
+ {{ text.label_last_updated_on }}
+ <op-date-time [dateTimeValue]="pullRequest.githubUpdatedAt"></op-date-time>
+ </span>.
+</div>
+
+<span class='op-pull-request--state' [ngClass]="'op-pull-request--state_' + state">
+ <op-icon icon-classes="button--icon icon-merge-branch"></op-icon>
+ {{state}}
+</span>
+
+<span class="op-pull-request--checks-label" *ngIf="pullRequest.checkRuns?.length">{{ text.label_actions }}</span>
+
+<ul [attr.aria-label]="text.label_actions" class='op-pull-request--checks' *ngIf="pullRequest.checkRuns?.length">
+ <li class='op-pr-check' *ngFor="let checkRun of pullRequest.checkRuns">
+ <span class='op-pr-check--state-icon' [ngClass]="'op-pr-check--state-icon_' + checkRunState(checkRun)">
+ <op-icon icon-classes="icon-{{ checkRunStateIcon(checkRun) }}"
+ [icon-title]="checkRunStateText(checkRun)"></op-icon>
+ </span>
+ <span class='op-pr-check--avatar'><img alt='app owner avatar' [src]="checkRun.appOwnerAvatarUrl" /></span>
+
+ <span class='op-pr-check--info'>
+ <span class='op-pr-check--name' [textContent]="checkRun.name"></span>
+ <span class='op-pr-check--state' [textContent]="checkRunStateText(checkRun)"></span>
+ </span>
+
+ <span class='op-pr-check--details'>
+ <a [href]="checkRun.detailsUrl">
+ {{ text.label_details }}
+ </a>
+ </span>
+ </li>
+</ul>
diff --git a/modules/github_integration/frontend/module/pull-request/pull-request.component.sass b/modules/github_integration/frontend/module/pull-request/pull-request.component.sass
index fc2c3b8ba60..e6b4e264ca2 100644
--- a/modules/github_integration/frontend/module/pull-request/pull-request.component.sass
+++ b/modules/github_integration/frontend/module/pull-request/pull-request.component.sass
@@ -28,82 +28,76 @@
@import "helpers"
-.op-pr-pull-request
+:host,
+.op-pull-request
display: grid
grid-template-columns: auto 1fr auto auto
- grid-template-areas: "title title title state" "avatar user link link" "avatar date link link" "avatar checks checks checks"
- margin-bottom: 24px
+ grid-template-areas: "link link link link" "title title title state" "info info info info" "checks-label checks-label checks-label checks-label" "checks checks checks checks"
+ margin-bottom: 11px
+ padding-bottom: 11px
+ border-bottom: 1px solid #dddddd
-.op-pr-title
- @include text-shortener
- font-weight: bold
- grid-area: title
- // have the same line height as the status "button" next to it
- line-height: 34px
- margin-right: 20px
+ &:last-child
+ border-bottom: none
-.op-avatar
- grid-area: avatar
+ &--title
+ @include text-shortener
+ font-weight: bold
+ grid-area: title
+ // have the same line height as the status "button" next to it
+ line-height: 32px
+ margin-right: 20px
-.op-pr-user
- display: block
- font-weight: bold
- line-height: 16px
- margin-bottom: 3px
- grid-area: user
+ &--avatar
+ grid-area: info
-.op-pr-date
- display: block
- font-size: 0.8rem
- color: var(--gray-dark)
- grid-area: date
+ &--info
+ display: block
+ grid-area: info
+ margin-bottom: 3px
+ font-size: 0.9rem
+ grid-area: info
+ color: var(--gray-dark)
+ // The mini avatar is much higher than the text line. Compensate it.
+ margin-top: -4px
-.op-pr-link
- grid-area: link
- margin-top: 6px
+ &--date
+ grid-area: info
-.op-pr-state
- grid-area: state
- display: inline-block
- padding: 8px
- border-radius: 6px
- border: 1px solid #fff
- color: #fff
-.op-pr-state_draft
- background-color: #6a737d
-.op-pr-state_open
- background-color: #28a745
-.op-pr-state_merged
- background-color: #6f42c1
-.op-pr-state_closed
- background-color: #d73a49
+ &--link
+ grid-area: link
+ margin-top: 6px
+ font-size: 0.9rem
-.op-pr-checks
- margin-top: 12px
- grid-area: checks
- margin-left: 0
+ &--state
+ grid-area: state
+ display: inline-block
+ padding: 8px 11px
+ border-radius: 16px
+ border: 1px solid #fff
+ color: #fff
+ font-size: 0.9rem
+ text-transform: capitalize
- &:before
- content: attr(aria-label)
+ &_draft
+ background-color: #6a737d
-.op-pr-check
- list-style-type: none
- padding-top: 8px
- margin-left: 5px
+ &_open
+ background-color: #28a745
-.op-pr-check-avatar img
- width: 1.4em
- height: 1.4em
- margin-right: 5px
- border-radius: var(--user-avatar-border-radius)
+ &_merged
+ background-color: #6f42c1
-.op-pr-check-state
- margin-left: 1em
- color: var(--gray-dark)
- font-style: italic
+ &_closed
+ background-color: #d73a49
-.op-pr-check-details
- float: right
- top: 10px
- line-height: 16px
- text-align: right
+ &--checks-label
+ grid-area: checks-label
+ margin-top: 12px
+ font-size: 0.9rem
+ font-weight: bold
+
+ &--checks
+ margin-top: 12px
+ margin-left: 0
+ grid-area: checks
diff --git a/modules/github_integration/frontend/module/pull-request/pull-request.component.spec.ts b/modules/github_integration/frontend/module/pull-request/pull-request.component.spec.ts
index 5784af8ed96..33c39ad36e1 100644
--- a/modules/github_integration/frontend/module/pull-request/pull-request.component.spec.ts
+++ b/modules/github_integration/frontend/module/pull-request/pull-request.component.spec.ts
@@ -90,10 +90,10 @@ describe('PullRequestComponent', () => {
});
it('should render pull request data', () => {
- const titleElement = fixture.debugElement.query(By.css('.op-pr-title')).nativeElement;
+ const titleElement = fixture.debugElement.query(By.css('.op-pull-request--title')).nativeElement;
const avatarElement = fixture.debugElement.query(By.css('.op-avatar')).nativeElement;
- const userElement = fixture.debugElement.query(By.css('.op-pr-user')).nativeElement;
- const detailsElement = fixture.debugElement.query(By.css('.op-pr-link')).nativeElement;
+ const userElement = fixture.debugElement.query(By.css('.op-pull-request--user')).nativeElement;
+ const detailsElement = fixture.debugElement.query(By.css('.op-pull-request--link')).nativeElement;
const checkRuns = fixture.debugElement.queryAll(By.css('.op-pr-check'));
const checkRunElement = checkRuns[0].nativeElement;
const checkRunLinkElement = checkRuns[0].query(By.css('a')).nativeElement;
diff --git a/modules/github_integration/frontend/module/pull-request/pull-request.component.ts b/modules/github_integration/frontend/module/pull-request/pull-request.component.ts
index 56e83f066d2..587558af20a 100644
--- a/modules/github_integration/frontend/module/pull-request/pull-request.component.ts
+++ b/modules/github_integration/frontend/module/pull-request/pull-request.component.ts
@@ -34,14 +34,20 @@ import { IGithubPullRequestResource } from "../../../../../../../../modules/gith
@Component({
selector: 'github-pull-request',
- templateUrl: './pull-request.template.html',
- styleUrls: ['./pull-request.component.sass']
+ templateUrl: './pull-request.component.html',
+ styleUrls: [
+ './pull-request.component.sass',
+ './pr-check.component.sass',
+ ],
+ host: { class: 'op-pull-request' }
})
+
export class PullRequestComponent {
@Input() public pullRequest:IGithubPullRequestResource;
public text = {
- label_updated_on: this.I18n.t('js.label_updated_on'),
+ label_created_by: this.I18n.t('js.label_created_by'),
+ label_last_updated_on: this.I18n.t('js.label_last_updated_on'),
label_details: this.I18n.t('js.label_details'),
label_actions: this.I18n.t('js.github_integration.github_actions'),
};
@@ -58,10 +64,52 @@ export class PullRequestComponent {
}
}
- public checkRunState(checkRun:GithubCheckRunResource) {
+ public checkRunStateText(checkRun:GithubCheckRunResource) {
/* Github apps can *optionally* add an output object (and a title) which is the most relevant information to display.
If that is not present, we can display the conclusion (which is present only on finished runs).
If that is not present, we can always fall back to the status. */
return(checkRun.outputTitle || checkRun.conclusion || checkRun.status);
}
+
+ public checkRunState(checkRun:GithubCheckRunResource) {
+ return(checkRun.conclusion || checkRun.status);
+ }
+
+ public checkRunStateIcon(checkRun:GithubCheckRunResource) {
+ switch (this.checkRunState(checkRun)) {
+ case 'success': {
+ return 'checkmark'
+ }
+ case 'queued': {
+ return 'getting-started'
+ }
+ case 'in_progress': {
+ return 'loading1'
+ }
+ case 'failure': {
+ return 'cancel'
+ }
+ case 'timed_out': {
+ return 'reminder'
+ }
+ case 'action_required': {
+ return 'warning'
+ }
+ case 'stale': {
+ return 'not-supported'
+ }
+ case 'skipped': {
+ return 'redo'
+ }
+ case 'neutral': {
+ return 'minus1'
+ }
+ case 'cancelled': {
+ return 'minus1'
+ }
+ default: {
+ return 'not-supported'
+ }
+ }
+ }
}
diff --git a/modules/github_integration/frontend/module/pull-request/pull-request.template.html b/modules/github_integration/frontend/module/pull-request/pull-request.template.html
deleted file mode 100644
index 52fc8de356a..00000000000
--- a/modules/github_integration/frontend/module/pull-request/pull-request.template.html
+++ /dev/null
@@ -1,42 +0,0 @@
-<div class='op-pr-pull-request'>
- <div class='op-pr-title'
- [textContent]="pullRequest.title">
- </div>
-
- <img alt='PR author avatar'
- class='op-avatar'
- [src]="pullRequest.githubUser.avatarUrl"
- *ngIf="pullRequest.githubUser"
- />
- <span class='op-pr-user'>
- <a [href]="pullRequest.githubUser.htmlUrl"
- [textContent]="pullRequest.githubUser.login"
- *ngIf="pullRequest.githubUser"
- >
- </a>
- </span>
-
- <span class='op-pr-date'>
- {{ text.label_updated_on }}
- <op-date-time [dateTimeValue]="pullRequest.githubUpdatedAt"></op-date-time>
- </span>
-
- <span class='op-pr-state' [ngClass]="'op-pr-state_' + state">{{state}}</span>
- <a class='op-pr-link' [href]="pullRequest.htmlUrl" [textContent]="pullRequest.repository + '#' + pullRequest.number"></a>
-
- <ul [attr.aria-label]="text.label_actions" class='op-pr-checks' *ngIf="pullRequest.checkRuns?.length">
- <li class='op-pr-check' *ngFor="let checkRun of pullRequest.checkRuns">
- <span class='op-pr-check-avatar'><img alt='app owner avatar' [src]="checkRun.appOwnerAvatarUrl" /></span>
-
- <span class='op-pr-check-name' [textContent]="checkRun.name"></span>
-
- <span class='op-pr-check-state' [textContent]="checkRunState(checkRun)"></span>
-
- <div class='op-pr-check-details'>
- <a [href]="checkRun.detailsUrl">
- {{ text.label_details }}
- </a>
- </div>
- </li>
- </ul>
-</div>
diff --git a/modules/github_integration/frontend/module/tab-header/styles/tab-header.sass b/modules/github_integration/frontend/module/tab-header/styles/tab-header.sass
index 38f056801f7..a1b5834607c 100644
--- a/modules/github_integration/frontend/module/tab-header/styles/tab-header.sass
+++ b/modules/github_integration/frontend/module/tab-header/styles/tab-header.sass
@@ -34,10 +34,13 @@
border-bottom: 1px solid #ddd
margin: 1.5rem 0 0.8rem 0
- padding: 0 0 0.5rem 0
.title
flex: 1 1 auto
border-bottom: 0
margin: 0
padding: 0
+ font-weight: bold
+ font-size: 1rem
+ line-height: 32px
+ text-transform: uppercase
\ No newline at end of file
diff --git a/modules/github_integration/frontend/module/tab-prs/tab-prs.component.ts b/modules/github_integration/frontend/module/tab-prs/tab-prs.component.ts
index d1c9ef99aa8..d897a2e2148 100644
--- a/modules/github_integration/frontend/module/tab-prs/tab-prs.component.ts
+++ b/modules/github_integration/frontend/module/tab-prs/tab-prs.component.ts
@@ -37,7 +37,8 @@ import { IGithubPullRequestResource } from "../../../../../../../../modules/gith
@Component({
selector: 'tab-prs',
- templateUrl: './tab-prs.template.html'
+ templateUrl: './tab-prs.template.html',
+ host: { class: 'op-prs' }
})
export class TabPrsComponent implements OnInit {
@Input() public workPackage:WorkPackageResource;
diff --git a/modules/github_integration/frontend/module/tab-prs/tab-prs.template.html b/modules/github_integration/frontend/module/tab-prs/tab-prs.template.html
index 3484eebecdc..ae42ed1c226 100644
--- a/modules/github_integration/frontend/module/tab-prs/tab-prs.template.html
+++ b/modules/github_integration/frontend/module/tab-prs/tab-prs.template.html
@@ -2,6 +2,4 @@
<p [innerHTML]="getEmptyText()"></p>
</ng-container>
-<div *ngFor="let pullRequest of pullRequests">
- <github-pull-request [pullRequest]="pullRequest"></github-pull-request>
-</div>
+<github-pull-request [pullRequest]="pullRequest" *ngFor="let pullRequest of pullRequests"></github-pull-request>
diff --git a/modules/github_integration/frontend/module/typings.d.ts b/modules/github_integration/frontend/module/typings.d.ts
index bd18c280e86..1bc6d6688f3 100644
--- a/modules/github_integration/frontend/module/typings.d.ts
+++ b/modules/github_integration/frontend/module/typings.d.ts
@@ -1,9 +1,9 @@
import { TabDefinition } from "core-app/modules/common/tabs/tab.interface";
import { HalResourceClass } from "core-app/modules/hal/resources/hal-resource";
-export interface ITab extends TabDefinition {
- help:string,
- lines:number,
+export interface ISnippet {
+ id: string;
+ name: string;
textToCopy: ()=>string
}
diff --git a/modules/github_integration/spec/features/work_package_github_tab_spec.rb b/modules/github_integration/spec/features/work_package_github_tab_spec.rb
index 2f9c7651e04..f0f3e763283 100644
--- a/modules/github_integration/spec/features/work_package_github_tab_spec.rb
+++ b/modules/github_integration/spec/features/work_package_github_tab_spec.rb
@@ -71,7 +71,7 @@ describe 'Open the GitHub tab', type: :feature, js: true do
work_package_page.switch_to_tab(tab: 'github')
github_tab.git_actions_menu_button.click
- github_tab.git_actions_copy_button.click
+ github_tab.git_actions_copy_branch_name_button.click
expect(page).to have_text('Copied!')
expect_clipboard_content("#{work_package.type.name.downcase}/#{work_package.id}-a-test-work_package")
diff --git a/modules/github_integration/spec/support/pages/work_package_github_tab.rb b/modules/github_integration/spec/support/pages/work_package_github_tab.rb
index 503267ec648..c1aca976c08 100644
--- a/modules/github_integration/spec/support/pages/work_package_github_tab.rb
+++ b/modules/github_integration/spec/support/pages/work_package_github_tab.rb
@@ -46,8 +46,8 @@ module Pages
find('.github-git-copy:not([disabled])', text: 'Git')
end
- def git_actions_copy_button
- find('.git-actions-menu .copy-button:not([disabled])')
+ def git_actions_copy_branch_name_button
+ find('.git-actions-menu .copy-button:not([disabled])', match: :first)
end
def paste_clipboard_content