Skip to content

Commit

Permalink
Merge pull request #2862 from travis-ci/mk-sort-available-plans
Browse files Browse the repository at this point in the history
[Hotfix] Sort available plans
  • Loading branch information
murtaza-swati authored Aug 2, 2024
2 parents 8b01716 + 09197c5 commit b6f317d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
11 changes: 10 additions & 1 deletion app/components/billing/select-plan.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { computed } from '@ember/object';
import { later } from '@ember/runloop';
import { or, reads, filterBy } from '@ember/object/computed';
import { isPresent } from '@ember/utils';
import { A } from '@ember/array';

export default Component.extend({
accounts: service(),
Expand Down Expand Up @@ -71,7 +72,7 @@ export default Component.extend({
if (this.availablePlans.every(plan => plan.isAnnual)) {
this.set('annualPlans', this.availablePlans);
}
return this.availablePlans;
return this.sortedPlans;
}
}),

Expand Down Expand Up @@ -133,6 +134,14 @@ export default Component.extend({
);
},

sortedPlans: computed('[email protected]', function () {
return this.sortByStartingPrice(this.availablePlans);
}),

sortByStartingPrice(plans) {
return A(plans).sortBy('startingPrice');
},

selectedPlan: computed('displayedPlans.[].name', 'defaultPlanName', {
get() {
if (isPresent(this._selectedPlan)) {
Expand Down
7 changes: 6 additions & 1 deletion app/templates/components/billing/select-plan.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<SvgImage @name="stage-passed" @class="icon icon-desc" /> {{pluralize plan.concurrencyLimit "concurrent job"}}
</p>
<p class='billing-plans__box-v2--desc' data-test-selected-plan-minutes="true">
<SvgImage @name="stage-passed" @class="icon icon-desc" /> Credits for {{plan.planMinutes}} Linux build minutes
<SvgImage @name="stage-passed" @class="icon icon-desc" /> Credits for {{plan.planMinutes}} Linux build mins
</p>
<p class='billing-plans__box-v2--desc' data-test-selected-plan-users="true">
{{#if (or plan.isFree plan.isTrial)}}
Expand All @@ -66,6 +66,11 @@
<SvgImage @name="stage-passed" @class="icon icon-desc" /> Use credits for builds &amp; users
{{/if}}
</p>
{{#if (or plan.isFree plan.isTrial)}}
<p class='billing-plans__box-v2--desc' data-test-selected-plan-repos="true">
<SvgImage @name="stage-passed" @class="icon icon-desc" /> Unlimited repositories
</p>
{{/if}}
{{#unless plan.isTrial}}
<p class='billing-plans__box-v2--desc' data-test-selected-plan-refill="true">
<SvgImage @name="stage-passed" @class="icon icon-desc" /> Auto-refill credits or buy bundle
Expand Down

0 comments on commit b6f317d

Please sign in to comment.