Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions packages/core/src/codewhisperer/ui/statusBarMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ function getAmazonQCodeWhispererNodes() {

// Amazon Q + others
createSeparator('Other Features'),
...(AuthUtil.instance.isValidEnterpriseSsoInUse() && AuthUtil.instance.isCustomizationFeatureEnabled
? [createSelectCustomization()]
: []),
...(AuthUtil.instance.isValidEnterpriseSsoInUse() ? [createSelectCustomization()] : []),
switchToAmazonQNode(),
]
}
Expand Down
15 changes: 0 additions & 15 deletions packages/core/src/codewhisperer/util/authUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,26 +77,11 @@ export class AuthUtil {
protected static readonly logIfChanged = onceChanged((s: string) => getLogger().info(s))

private reauthenticatePromptShown: boolean = false
private _isCustomizationFeatureEnabled: boolean = false

// user should only see that screen once.
// TODO: move to memento
public hasAlreadySeenMigrationAuthScreen: boolean = false

public get isCustomizationFeatureEnabled(): boolean {
return this._isCustomizationFeatureEnabled
}

// This boolean controls whether the Select Customization node will be visible. A change to this value
// means that the old UX was wrong and must refresh the devTool tree.
public set isCustomizationFeatureEnabled(value: boolean) {
if (this._isCustomizationFeatureEnabled === value) {
return
}
this._isCustomizationFeatureEnabled = value
void Commands.tryExecute('aws.amazonq.refreshStatusBar')
}

public readonly secondaryAuth = getSecondaryAuth(
this.auth,
'codewhisperer',
Expand Down
9 changes: 1 addition & 8 deletions packages/core/src/codewhisperer/util/customizationUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ export async function notifyNewCustomizations() {
let availableCustomizations: Customization[] = []
try {
availableCustomizations = await getAvailableCustomizationsList()
AuthUtil.instance.isCustomizationFeatureEnabled = true
} catch (error) {
// On receiving any error, we will disable the customization feature
AuthUtil.instance.isCustomizationFeatureEnabled = false
await setSelectedCustomization(baseCustomization)
getLogger().error(`Failed to fetch customizations: %O`, error)
return
Expand Down Expand Up @@ -94,11 +91,7 @@ export const baseCustomization = {
* @returns customization selected by users, `baseCustomization` if none is selected
*/
export const getSelectedCustomization = (): Customization => {
if (
!AuthUtil.instance.isCustomizationFeatureEnabled ||
!AuthUtil.instance.isValidEnterpriseSsoInUse() ||
!AuthUtil.instance.conn
) {
if (!AuthUtil.instance.isValidEnterpriseSsoInUse() || !AuthUtil.instance.conn) {
return baseCustomization
}

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/test/amazonq/customizationUtil.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ describe('CodeWhisperer-customizationUtils', function () {

sinon.stub(AuthUtil.instance, 'isConnectionExpired').returns(false)
sinon.stub(AuthUtil.instance, 'isConnected').returns(true)
sinon.stub(AuthUtil.instance, 'isCustomizationFeatureEnabled').value(true)
sinon.stub(AuthUtil.instance, 'conn').value(ssoConn)

await resetCodeWhispererGlobalVariables()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,6 @@ describe('CodeWhisperer-basicCommands', function () {
sinon.stub(AuthUtil.instance, 'isConnectionExpired').returns(false)
sinon.stub(AuthUtil.instance, 'isConnected').returns(true)
sinon.stub(AuthUtil.instance, 'isValidEnterpriseSsoInUse').returns(true)
sinon.stub(AuthUtil.instance, 'isCustomizationFeatureEnabled').value(true)
await CodeScansState.instance.setScansEnabled(false)

getTestWindow().onDidShowQuickPick(async (e) => {
Expand Down
Loading