Skip to content

Commit

Permalink
scan feature flag (#2776)
Browse files Browse the repository at this point in the history
  • Loading branch information
murtaza-swati authored Aug 2, 2023
1 parent e3a7015 commit e3e9542
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions app/components/dashboard-row.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export default Component.extend({
auth: service(),
api: service(),
flashes: service(),
features: service(),

tagName: '',

Expand All @@ -21,6 +22,7 @@ export default Component.extend({
userRoMode: reads('currentUser.roMode'),
ownerRoMode: reads('repo.owner.ro_mode'),
currentBuild: alias('repo.currentBuild'),
scansEnabled: reads('features.logScanner'),

displayMenuTofu: alias('repo.permissions.create_request'),

Expand Down
5 changes: 4 additions & 1 deletion app/components/repo-show-tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import Component from '@ember/component';
import config from 'travis/config/environment';
import { inject as service } from '@ember/service';
import { computed } from '@ember/object';
import { alias } from '@ember/object/computed';
import { alias, reads } from '@ember/object/computed';

export default Component.extend({
auth: service(),
tabStates: service(),
features: service(),

tagName: 'nav',
classNames: ['travistab-nav'],
Expand All @@ -15,6 +16,8 @@ export default Component.extend({

tab: alias('tabStates.mainTab'),

scansEnabled: reads('features.logScanner'),

classCurrent: computed('tab', function () {
let tab = this.tab;
if (tab === 'current') {
Expand Down
1 change: 1 addition & 0 deletions app/components/repository-layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default Component.extend({
isShowingStatusBadgeModal: false,
currentUser: alias('auth.currentUser'),
userRoMode: reads('currentUser.roMode'),
scansEnabled: reads('features.logScanner'),

repoUrl: computed('repo.{ownerName,vcsName,vcsType}', function () {
const owner = this.get('repo.ownerName');
Expand Down
1 change: 1 addition & 0 deletions app/instance-initializers/enterprise-environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export function initialize(appInstance) {
featureFlags['landing-page-cta'] = false;
featureFlags['show-running-jobs-in-sidebar'] = true;
featureFlags['debug-builds'] = false;
featureFlags['log-scanner'] = false;
featureFlags['broadcasts'] = false;
featureFlags['beta-features'] = false;
}
Expand Down
1 change: 1 addition & 0 deletions app/instance-initializers/pro-environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export function initialize(appInstance) {
featureFlags['landing-page-cta'] = false;
featureFlags['show-running-jobs-in-sidebar'] = true;
featureFlags['debug-builds'] = true;
featureFlags['log-scanner'] = true;
featureFlags['broadcasts'] = true;
featureFlags['beta-features'] = true;
}
Expand Down
2 changes: 2 additions & 0 deletions app/templates/components/dashboard-row.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
</LinkTo>
</p>
</section>
{{#if this.scansEnabled }}
<section class="dash-last {{this.repo.currentScan.icon}}">
<h3 class="label">
Log Scan
Expand All @@ -105,6 +106,7 @@
</LinkTo>
</p>
</section>
{{/if}}
<section class="dash-commit">
<h3 class="label">
Commit
Expand Down
2 changes: 2 additions & 0 deletions app/templates/components/repo-show-tabs.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
{{/if}}
</li>
{{#if this.auth.currentUser}}
{{#if this.scansEnabled}}
<li id="tab_scan_results" class={{this.classScanResults}}>
{{#if this.repo.slug}}
<LinkTo @route="scanResults" @model={{this.repo}}>
Expand All @@ -46,6 +47,7 @@
{{/if}}
</li>
{{/if}}
{{/if}}
<li id="tab_build" class={{this.classBuild}}>
{{#if this.build.id}}
{{#if this.repo.slug}}
Expand Down
2 changes: 2 additions & 0 deletions app/templates/components/repository-layout.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
<SvgImage @name={{vcs-icon this.repo.vcsType}} />
</ExternalLinkTo>
<RepoStatusBadge @repo={{this.repo}} @onClick={{action 'toggleStatusBadgeModal'}} />
{{#if this.scansEnabled}}
<LogScanStatusBadge @repo={{this.repo}} />
{{/if}}
</div>
</header>
<main class="repo-main">
Expand Down

0 comments on commit e3e9542

Please sign in to comment.