Skip to content

Commit

Permalink
fix(): show correct data when new tag is pushed
Browse files Browse the repository at this point in the history
  • Loading branch information
Izak88 committed Oct 12, 2017
1 parent 256dcbe commit 5170aa4
Show file tree
Hide file tree
Showing 7 changed files with 465 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -269,12 +269,13 @@ export class AppBuildDetailsComponent implements OnInit, OnDestroy {
this.dateTime = data.pull_request && data.pull_request.updated_at ||
data.commit && data.commit.author && data.commit.author.date ||
data.commits && data.commits[data.commits.length - 1] && data.commits[data.commits.length - 1].timestamp ||
data.head_commit && data.head_commit.timestamp ||
null;

if (this.build.repository.repository_provider === 'github') {
if (this.build.data.commit) {
this.commitMessage = this.build.data.commit.message;
} else if (this.build.data.commits) {
} else if (this.build.data.commits && this.build.data.commits.length > 0) {
const len = this.build.data.commits.length - 1;
this.commitMessage = this.build.data.commits[len].message;
} else if (this.build.data.pull_request && this.build.data.pull_request.title) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<span *ngIf="name && !tag">{{ name }}</span>
<span *ngIf="!build?.data?.user_name && !build?.data?.commits && build?.data?.actor?.display_name && !tag">{{ build?.data?.actor?.display_name }}</span>
<span *ngIf="!build?.data?.user_name && !build?.data?.commits && !build?.data?.actor?.display_name && !build?.data?.sender?.login && build?.data?.user?.name && !tag">{{ build?.data?.user?.name }}</span>
<span *ngIf="tag">{{ build?.data?.head_commit?.comitter?.name }}</span>
<span *ngIf="tag">{{ build?.data?.head_commit?.committer?.name }}</span>
<span *ngIf="build?.data?.user_name">{{ build?.data?.user_name }}</span>
<span *ngIf="build?.data?.pusher">{{ build?.data?.pusher?.username }}</span>
<span *ngIf="build?.data?.pull_request">{{ build?.data?.pull_request?.user?.username }}</span>
Expand Down Expand Up @@ -72,7 +72,7 @@
<span class="name" *ngIf="name && !tag">{{ name }}</span>
<span class="name" *ngIf="!build?.data?.user_name && !build?.data?.commits && build?.data?.actor?.display_name && !tag">{{ build?.data?.actor?.display_name }}</span>
<span class="name" *ngIf="!build?.data?.user_name && !build?.data?.commits && !build?.data?.actor?.display_name && !build?.data?.sender?.login && build?.data?.user?.name && !tag">{{ build?.data?.user?.name }}</span>
<span class="name" *ngIf="tag">{{ build?.data?.head_commit?.comitter?.name }}</span>
<span class="name" *ngIf="tag">{{ build?.data?.head_commit?.committer?.name }}</span>

<span class="bold" *ngIf="build?.repository?.full_name">{{ build?.repository?.full_name }}</span>
<span class="bold" *ngIf="!build?.repository?.full_name">{{ build?.data?.repository?.full_name }}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,13 @@ export class AppBuildItemComponent implements OnInit {
this.dateTime = data.pull_request && data.pull_request.updated_at ||
data.commit && data.commit.author && data.commit.author.date ||
data.commits && data.commits[data.commits.length - 1] && data.commits[data.commits.length - 1].timestamp ||
data.head_commit && data.head_commit.timestamp ||
null;

if (this.build.repository.repository_provider === 'github') {
if (this.build.data.commit) {
this.commitMessage = this.build.data.commit.message;
} else if (this.build.data.commits) {
} else if (this.build.data.commits && this.build.data.commits.length > 0) {
const len = this.build.data.commits.length - 1;
this.commitMessage = this.build.data.commits[len].message;
} else if (this.build.data.pull_request && this.build.data.pull_request.title) {
Expand Down
3 changes: 2 additions & 1 deletion src/app/components/app-job/app-job.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,13 @@ export class AppJobComponent implements OnInit, OnDestroy {
this.dateTime = data.pull_request && data.pull_request.updated_at ||
data.commit && data.commit.author && data.commit.author.date ||
data.commits && data.commits[data.commits.length - 1] && data.commits[data.commits.length - 1].timestamp ||
data.head_commit && data.head_commit.timestamp ||
null;

if (this.job.build.repository.repository_provider === 'github') {
if (this.job.build.data.commit) {
this.commitMessage = this.job.build.data.commit.message;
} else if (this.job.build.data.commits) {
} else if (this.job.build.data.commits && this.job.build.data.commits.length > 0) {
const len = this.job.build.data.commits.length - 1;
this.commitMessage = this.job.build.data.commits[len].message;
} else if (this.job.build.data.pull_request && this.job.build.data.pull_request.title) {
Expand Down
278 changes: 278 additions & 0 deletions src/app/testing/xhr-data/build-tag.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,278 @@
{
"data": {
"id": 500,
"branch": "0.0.1",
"pr": null,
"head_id": null,
"data": {
"ref": "refs/tags/0.0.1",
"before": "0000000000000000000000000000000000000000",
"after": "1f3e9ce9bae91202f7186644b7038405865b92bb",
"created": true,
"deleted": false,
"forced": false,
"base_ref": "refs/heads/master",
"compare": "https://github.com/Izak88/d3-bundle/compare/0.0.1",
"commits": [],
"head_commit": {
"id": "1f3e9ce9bae91202f7186644b7038405865b92bb",
"tree_id": "88ed9c20b1ac9e7438fef1348ae971c71b0cee74",
"distinct": true,
"message": "add jenkins file",
"timestamp": "2017-09-13T08:04:46+02:00",
"url": "https://github.com/Izak88/d3-bundle/commit/1f3e9ce9bae91202f7186644b7038405865b92bb",
"author": {
"name": "Izak Lipnik",
"email": "[email protected]",
"username": "Izak88"
},
"committer": {
"name": "Izak Lipnik",
"email": "[email protected]",
"username": "Izak88"
},
"added": [
"jenkinsfile"
],
"removed": [],
"modified": []
},
"repository": {
"id": 99934351,
"name": "d3-bundle",
"full_name": "Izak88/d3-bundle",
"owner": {
"name": "Izak88",
"email": "[email protected]",
"login": "Izak88",
"id": 8555269,
"avatar_url": "https://avatars0.githubusercontent.com/u/8555269?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/Izak88",
"html_url": "https://github.com/Izak88",
"followers_url": "https://api.github.com/users/Izak88/followers",
"following_url": "https://api.github.com/users/Izak88/following{/other_user}",
"gists_url": "https://api.github.com/users/Izak88/gists{/gist_id}",
"starred_url": "https://api.github.com/users/Izak88/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/Izak88/subscriptions",
"organizations_url": "https://api.github.com/users/Izak88/orgs",
"repos_url": "https://api.github.com/users/Izak88/repos",
"events_url": "https://api.github.com/users/Izak88/events{/privacy}",
"received_events_url": "https://api.github.com/users/Izak88/received_events",
"type": "User",
"site_admin": false
},
"private": false,
"html_url": "https://github.com/Izak88/d3-bundle",
"description": null,
"fork": true,
"url": "https://github.com/Izak88/d3-bundle",
"forks_url": "https://api.github.com/repos/Izak88/d3-bundle/forks",
"keys_url": "https://api.github.com/repos/Izak88/d3-bundle/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/Izak88/d3-bundle/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/Izak88/d3-bundle/teams",
"hooks_url": "https://api.github.com/repos/Izak88/d3-bundle/hooks",
"issue_events_url": "https://api.github.com/repos/Izak88/d3-bundle/issues/events{/number}",
"events_url": "https://api.github.com/repos/Izak88/d3-bundle/events",
"assignees_url": "https://api.github.com/repos/Izak88/d3-bundle/assignees{/user}",
"branches_url": "https://api.github.com/repos/Izak88/d3-bundle/branches{/branch}",
"tags_url": "https://api.github.com/repos/Izak88/d3-bundle/tags",
"blobs_url": "https://api.github.com/repos/Izak88/d3-bundle/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/Izak88/d3-bundle/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/Izak88/d3-bundle/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/Izak88/d3-bundle/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/Izak88/d3-bundle/statuses/{sha}",
"languages_url": "https://api.github.com/repos/Izak88/d3-bundle/languages",
"stargazers_url": "https://api.github.com/repos/Izak88/d3-bundle/stargazers",
"contributors_url": "https://api.github.com/repos/Izak88/d3-bundle/contributors",
"subscribers_url": "https://api.github.com/repos/Izak88/d3-bundle/subscribers",
"subscription_url": "https://api.github.com/repos/Izak88/d3-bundle/subscription",
"commits_url": "https://api.github.com/repos/Izak88/d3-bundle/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/Izak88/d3-bundle/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/Izak88/d3-bundle/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/Izak88/d3-bundle/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/Izak88/d3-bundle/contents/{+path}",
"compare_url": "https://api.github.com/repos/Izak88/d3-bundle/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/Izak88/d3-bundle/merges",
"archive_url": "https://api.github.com/repos/Izak88/d3-bundle/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/Izak88/d3-bundle/downloads",
"issues_url": "https://api.github.com/repos/Izak88/d3-bundle/issues{/number}",
"pulls_url": "https://api.github.com/repos/Izak88/d3-bundle/pulls{/number}",
"milestones_url": "https://api.github.com/repos/Izak88/d3-bundle/milestones{/number}",
"notifications_url": "https://api.github.com/repos/Izak88/d3-bundle/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/Izak88/d3-bundle/labels{/name}",
"releases_url": "https://api.github.com/repos/Izak88/d3-bundle/releases{/id}",
"deployments_url": "https://api.github.com/repos/Izak88/d3-bundle/deployments",
"created_at": 1502376699,
"updated_at": "2017-08-10T14:51:46Z",
"pushed_at": 1507800333,
"git_url": "git://github.com/Izak88/d3-bundle.git",
"ssh_url": "[email protected]:Izak88/d3-bundle.git",
"clone_url": "https://github.com/Izak88/d3-bundle.git",
"svn_url": "https://github.com/Izak88/d3-bundle",
"homepage": null,
"size": 34622,
"stargazers_count": 0,
"watchers_count": 0,
"language": "JavaScript",
"has_issues": false,
"has_projects": true,
"has_downloads": true,
"has_wiki": true,
"has_pages": false,
"forks_count": 0,
"mirror_url": null,
"open_issues_count": 0,
"forks": 0,
"open_issues": 0,
"watchers": 0,
"default_branch": "master",
"stargazers": 0,
"master_branch": "master"
},
"pusher": {
"name": "Izak88",
"email": "[email protected]"
},
"sender": {
"login": "Izak88",
"id": 8555269,
"avatar_url": "https://avatars0.githubusercontent.com/u/8555269?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/Izak88",
"html_url": "https://github.com/Izak88",
"followers_url": "https://api.github.com/users/Izak88/followers",
"following_url": "https://api.github.com/users/Izak88/following{/other_user}",
"gists_url": "https://api.github.com/users/Izak88/gists{/gist_id}",
"starred_url": "https://api.github.com/users/Izak88/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/Izak88/subscriptions",
"organizations_url": "https://api.github.com/users/Izak88/orgs",
"repos_url": "https://api.github.com/users/Izak88/repos",
"events_url": "https://api.github.com/users/Izak88/events{/privacy}",
"received_events_url": "https://api.github.com/users/Izak88/received_events",
"type": "User",
"site_admin": false
}
},
"parsed_config": "[{\"commands\":[{\"command\":\"git clone -q https://github.com/Izak88/d3-bundle.git -b 0.0.1 .\",\"type\":\"git\"},{\"command\":\"git fetch origin 0.0.1\",\"type\":\"git\"},{\"command\":\"git checkout 1f3e9ce9bae91202f7186644b7038405865b92bb .\",\"type\":\"git\"},{\"command\":\"npm install\",\"type\":\"install\"}],\"env\":[\"SCRIPT=test\"],\"stage\":\"test\",\"image\":null,\"cache\":null}]",
"start_time": 1507800334520,
"end_time": 1507800338929,
"repositories_id": 9,
"created_at": 1507800338403,
"updated_at": 1507800339106,
"repository": {
"id": 9,
"github_id": 99934351,
"bitbucket_id": null,
"gitlab_id": null,
"gogs_id": null,
"clone_url": "https://github.com/Izak88/d3-bundle.git",
"html_url": "https://github.com/Izak88/d3-bundle",
"default_branch": "master",
"name": "d3-bundle",
"full_name": "Izak88/d3-bundle",
"description": null,
"private": 0,
"fork": 1,
"user_login": "Izak88",
"user_id": "8555269",
"user_avatar_url": "https://avatars0.githubusercontent.com/u/8555269?v=4",
"user_url": "https://api.github.com/users/Izak88",
"user_html_url": "https://github.com/Izak88",
"access_tokens_id": null,
"public": 1,
"data": null,
"created_at": 1507800334380,
"updated_at": 1507800334380,
"repository_provider": "github",
"api_url": "https://api.github.com",
"permissions": [
{
"id": 31,
"repositories_id": 9,
"users_id": 1,
"permission": 1,
"created_at": 1507800334417,
"updated_at": 1507800334417
}
],
"access_token": null
},
"jobs": [
{
"id": 2121,
"data": {
"commands": [
{
"command": "git clone -q https://github.com/Izak88/d3-bundle.git -b 0.0.1 .",
"type": "git"
},
{
"command": "git fetch origin 0.0.1",
"type": "git"
},
{
"command": "git checkout 1f3e9ce9bae91202f7186644b7038405865b92bb .",
"type": "git"
},
{
"command": "npm install",
"type": "install"
}
],
"env": [
"SCRIPT=test"
],
"stage": "test",
"image": null,
"cache": null
},
"builds_id": 500,
"created_at": 1507800338743,
"updated_at": 1507800338743,
"runs": [
{
"id": 3351,
"start_time": 1507800338970,
"end_time": 1507800338929,
"status": "failed",
"log": "",
"job_id": 2121,
"build_run_id": 718,
"created_at": 1507800338816,
"updated_at": 1507800339056
}
],
"end_time": 1507800338929,
"start_time": 1507800338970,
"status": "failed"
}
],
"runs": [
{
"id": 718,
"head_id": 99934351,
"start_time": 1507800334520,
"end_time": null,
"build_id": 500,
"created_at": 1507800338403,
"updated_at": 1507800338403,
"job_runs": [
{
"id": 3351,
"start_time": 1507800338970,
"end_time": 1507800338929,
"status": "failed",
"log": "",
"job_id": 2121,
"build_run_id": 718,
"created_at": 1507800338816,
"updated_at": 1507800339056
}
],
"status": "failed"
}
],
"hasPermission": true
}
}
Loading

0 comments on commit 5170aa4

Please sign in to comment.