Skip to content

Commit

Permalink
feat(core/pipeline): Add the ability to disable base os options (#8851)
Browse files Browse the repository at this point in the history
  • Loading branch information
caseyhebebrand committed Jan 20, 2021
1 parent dde8513 commit 5e45b85
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/scripts/modules/core/src/config/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export interface ISpinnakerSettings {
defaultProviders: string[];
defaultTimeZone: string; // see http://momentjs.com/timezone/docs/#/data-utilities/
dockerInsights: IDockerInsightSettings;
disabledImages?: string[];
entityTags?: {
maxUrlLength?: number;
maxResults?: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
<ui-select-match placeholder="Select a base OS">
<span ng-bind-html="$ctrl.getBaseOsDescription($select.selected)"></span>
</ui-select-match>
<ui-select-choices repeat="baseOsOption.id as baseOsOption in $ctrl.baseOsOptions | filter: $select.search">
<ui-select-choices
repeat="baseOsOption.id as baseOsOption in $ctrl.baseOsOptions | filter: $select.search"
ui-disable-choice="$ctrl.getBaseOsDisabled(baseOsOption)"
>
<strong ng-bind-html="$ctrl.getBaseOsDescription(baseOsOption)"></strong>
<div ng-bind-html="$ctrl.getBaseOsDetailedDescription(baseOsOption)"></div>
</ui-select-choices>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { IController, IComponentOptions, module } from 'angular';
import { SETTINGS } from 'core/config/settings';

export interface IBaseOsOption {
id: string;
Expand Down Expand Up @@ -29,6 +30,11 @@ export class BakeStageChooseOSController implements IController {
public getBaseOsDetailedDescription(baseOsOption: IBaseOsOption): string {
return baseOsOption.detailedDescription + (baseOsOption.isImageFamily ? ' (family)' : '');
}

public getBaseOsDisabled(baseOsOption: IBaseOsOption): boolean {
const disabledImages = SETTINGS.disabledImages || [];
return disabledImages.includes(baseOsOption.id);
}
}

const bakeStageChooseOsComponent: IComponentOptions = {
Expand Down
1 change: 1 addition & 0 deletions settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ window.spinnakerSettings = {
'tencentcloud',
],
defaultTimeZone: process.env.TIMEZONE || 'America/Los_Angeles', // see http://momentjs.com/timezone/docs/#/data-utilities/
disabledImages: [],
entityTags: {
maxResults: 5000,
},
Expand Down

0 comments on commit 5e45b85

Please sign in to comment.