From 5ce600086afc178f4906fe105789cb69db57969f Mon Sep 17 00:00:00 2001 From: AndriiMysko Date: Mon, 13 May 2024 11:16:31 +0500 Subject: [PATCH 1/7] Implement release event --- app/components/build-header.js | 2 +- app/components/repo-build-list.js | 2 +- app/components/request-icon.js | 2 ++ app/models/repo.js | 39 +++++++++++++++++++++++++++++-- app/routes/dashboard/builds.js | 2 +- 5 files changed, 42 insertions(+), 5 deletions(-) diff --git a/app/components/build-header.js b/app/components/build-header.js index 9db8180148..cc4a4b3733 100644 --- a/app/components/build-header.js +++ b/app/components/build-header.js @@ -58,7 +58,7 @@ export default Component.extend({ displayCompare: computed('item.eventType', function () { let eventType = this.get('item.eventType'); - return !['api', 'cron'].includes(eventType); + return !['api', 'cron', 'release'].includes(eventType); }), commitUrl: computed('item.repo.{ownerName,vcsName,vcsType}', 'commit.sha', function () { diff --git a/app/components/repo-build-list.js b/app/components/repo-build-list.js index 3f3f6814d2..193d668549 100644 --- a/app/components/repo-build-list.js +++ b/app/components/repo-build-list.js @@ -7,7 +7,7 @@ import config from 'travis/config/environment'; import dynamicQuery from 'travis/utils/dynamic-query'; const { repoBuildsPerPage: limit } = config.pagination; -const MAIN_EVENT_TYPES = ['push', 'api', 'cron']; +const MAIN_EVENT_TYPES = ['push', 'api', 'cron', 'release']; const SORT_PROPS = ['number:desc']; export default Component.extend({ diff --git a/app/components/request-icon.js b/app/components/request-icon.js index 84c9df81ac..0e0941dc31 100644 --- a/app/components/request-icon.js +++ b/app/components/request-icon.js @@ -6,6 +6,7 @@ const eventToIcon = { pull_request: 'pullrequest', cron: 'cronjobs', api: 'api', + release: 'api', default: 'nobuilds' }; @@ -14,6 +15,7 @@ const eventToTitle = { pull_request: 'Triggered from a pull request', cron: 'Triggered by a cron job', api: 'Triggered via the API', + release: 'Triggered by a release', default: 'Triggered via unknown means' }; diff --git a/app/models/repo.js b/app/models/repo.js index ede0213912..39d3fc394f 100644 --- a/app/models/repo.js +++ b/app/models/repo.js @@ -147,12 +147,47 @@ const Repo = VcsEntity.extend({ builds: computed('id', function () { let id = this.id; const builds = this.store.filter('build', { - event_type: ['push', 'api', 'cron'], + event_type: ['push', 'api', 'cron', 'release'], repository_id: id, }, (b) => { - let eventTypes = ['push', 'api', 'cron']; + let eventTypes = ['push', 'api', 'cron', 'release']; return this._buildRepoMatches(b, id) && eventTypes.includes(b.get('eventType')); }); + + this.store.subscribe(builds, 'build', { + event_type: ['push', 'api', 'cron', 'release'], + repository_id: id, + }, (b) => { + let eventTypes = ['push', 'api', 'cron', 'release']; + return this._buildRepoMatches(b, id) && eventTypes.includes(b.get('eventType')); + }); + + return builds; + // return this._buildObservableArray(builds); + }), + + _requestRepoMatches(request, id) { + return `${request.get('repo.id')}` === `${id}`; + }, + + _requestObservableArray(requests) { + const array = ExpandableRecordArray.create({ + type: 'request', + content: [] + }); + array.load(requests); + return array.observe(requests); + }, + + requests: computed('id', function () { + let id = this.id; + const requests = this.store.filter( + 'request', + { repository_id: id }, + (b) => this._requestRepoMatches(b, id)); + this.store.subscribe(requests, 'request', {repository_id: id}, (b) => this._requestRepoMatches(b, id)); + + return requests; // this._requestObservableArray(requests); return this._buildObservableArray(builds); }), diff --git a/app/routes/dashboard/builds.js b/app/routes/dashboard/builds.js index bce6b1b078..19376c3557 100644 --- a/app/routes/dashboard/builds.js +++ b/app/routes/dashboard/builds.js @@ -6,7 +6,7 @@ export default TravisRoute.extend({ model(params) { let currentUserId = this.get('auth.currentUser.id'); - let eventTypes = ['api', 'pull_request', 'push']; + let eventTypes = ['api', 'pull_request', 'push', 'release']; let query = { limit: 30, event_type: eventTypes.join(','), From bba7f39a0db609badc05db3c81d92734011eb4ec Mon Sep 17 00:00:00 2001 From: AndriiMysko Date: Mon, 13 May 2024 17:10:29 +0500 Subject: [PATCH 2/7] Build releases setting --- app/templates/settings.hbs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/templates/settings.hbs b/app/templates/settings.hbs index e3e1ad4acb..8e7ad751b2 100644 --- a/app/templates/settings.hbs +++ b/app/templates/settings.hbs @@ -43,6 +43,14 @@ +
  • + +
  • From 2befaac903e529f7ea2a4ba488044ad8d07bc2ab Mon Sep 17 00:00:00 2001 From: AndriiMysko Date: Mon, 13 May 2024 18:16:46 +0500 Subject: [PATCH 3/7] Releases only for github --- app/templates/settings.hbs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/templates/settings.hbs b/app/templates/settings.hbs index 8e7ad751b2..a771bee2d8 100644 --- a/app/templates/settings.hbs +++ b/app/templates/settings.hbs @@ -43,6 +43,7 @@ + {{#if (eq this.repo.vcsType 'github')}}
  • + {{/if}} +
  • + +
  • From 69e35f52cd3bab88384889f10aef4175fed67379 Mon Sep 17 00:00:00 2001 From: AndriiMysko Date: Thu, 16 May 2024 10:38:08 +0300 Subject: [PATCH 4/7] Fix --- app/templates/settings.hbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/templates/settings.hbs b/app/templates/settings.hbs index a771bee2d8..54af605839 100644 --- a/app/templates/settings.hbs +++ b/app/templates/settings.hbs @@ -43,7 +43,7 @@ - {{#if (eq this.repo.vcsType 'github')}} + {{#if (eq this.repo.provider 'github')}}
  • Date: Fri, 17 May 2024 16:49:25 +0300 Subject: [PATCH 5/7] Placeholder release event icon --- app/components/request-icon.js | 2 +- public/images/stroke-icons/icon-release.svg | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100755 public/images/stroke-icons/icon-release.svg diff --git a/app/components/request-icon.js b/app/components/request-icon.js index 0e0941dc31..fe09274ad6 100644 --- a/app/components/request-icon.js +++ b/app/components/request-icon.js @@ -6,7 +6,7 @@ const eventToIcon = { pull_request: 'pullrequest', cron: 'cronjobs', api: 'api', - release: 'api', + release: 'release', default: 'nobuilds' }; diff --git a/public/images/stroke-icons/icon-release.svg b/public/images/stroke-icons/icon-release.svg new file mode 100755 index 0000000000..966c68b831 --- /dev/null +++ b/public/images/stroke-icons/icon-release.svg @@ -0,0 +1 @@ +Release event \ No newline at end of file From ecc037fae61c72e0c93253a0406ac10953e26721 Mon Sep 17 00:00:00 2001 From: piccadilly circus Date: Tue, 11 Jun 2024 12:14:21 +0500 Subject: [PATCH 6/7] Not available yet on enterprise --- app/templates/settings.hbs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/app/templates/settings.hbs b/app/templates/settings.hbs index 54af605839..64de4521c8 100644 --- a/app/templates/settings.hbs +++ b/app/templates/settings.hbs @@ -53,11 +53,6 @@ />
  • {{/if}} -
  • - -
  • From b9f088cd159580005fb7c3b4c42c8e138ffd6e10 Mon Sep 17 00:00:00 2001 From: piccadilly circus Date: Tue, 11 Jun 2024 12:24:07 +0500 Subject: [PATCH 7/7] Not available yet on enterprise --- app/models/repo.js | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/app/models/repo.js b/app/models/repo.js index 39d3fc394f..764cba2508 100644 --- a/app/models/repo.js +++ b/app/models/repo.js @@ -153,41 +153,6 @@ const Repo = VcsEntity.extend({ let eventTypes = ['push', 'api', 'cron', 'release']; return this._buildRepoMatches(b, id) && eventTypes.includes(b.get('eventType')); }); - - this.store.subscribe(builds, 'build', { - event_type: ['push', 'api', 'cron', 'release'], - repository_id: id, - }, (b) => { - let eventTypes = ['push', 'api', 'cron', 'release']; - return this._buildRepoMatches(b, id) && eventTypes.includes(b.get('eventType')); - }); - - return builds; - // return this._buildObservableArray(builds); - }), - - _requestRepoMatches(request, id) { - return `${request.get('repo.id')}` === `${id}`; - }, - - _requestObservableArray(requests) { - const array = ExpandableRecordArray.create({ - type: 'request', - content: [] - }); - array.load(requests); - return array.observe(requests); - }, - - requests: computed('id', function () { - let id = this.id; - const requests = this.store.filter( - 'request', - { repository_id: id }, - (b) => this._requestRepoMatches(b, id)); - this.store.subscribe(requests, 'request', {repository_id: id}, (b) => this._requestRepoMatches(b, id)); - - return requests; // this._requestObservableArray(requests); return this._buildObservableArray(builds); }),