-
Notifications
You must be signed in to change notification settings - Fork 593
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
disable web terminal when MCH flag is available
- Loading branch information
1 parent
bbdf5a3
commit 284ae5b
Showing
9 changed files
with
63 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
frontend/packages/console-app/src/utils/__tests__/isMultiClusterEnabled.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import isMultiClusterEnabled from '../isMultiClusterEnabled'; | ||
|
||
describe('isMultiClusterEnabled', () => { | ||
it('should return false when no flag data exists', () => { | ||
window.SERVER_FLAGS = {}; | ||
const isEnabled = isMultiClusterEnabled(); | ||
expect(isEnabled).toBe(false); | ||
}); | ||
it('should return false when flag is set to false', () => { | ||
window.SERVER_FLAGS = { isMultiClusterEnabled: 'false' }; | ||
const isEnabled = isMultiClusterEnabled(); | ||
expect(isEnabled).toBe(false); | ||
}); | ||
it('should return false when flag is set to true', () => { | ||
window.SERVER_FLAGS = { isMultiClusterEnabled: 'true' }; | ||
const isEnabled = isMultiClusterEnabled(); | ||
expect(isEnabled).toBe(true); | ||
}); | ||
}); |
44 changes: 0 additions & 44 deletions
44
frontend/packages/console-app/src/utils/__tests__/useMCHDetection.spec.ts
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
frontend/packages/console-app/src/utils/isMultiClusterEnabled.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const isMultiClusterEnabled = (): boolean => { | ||
let isAvailable = false; | ||
// Mock implementation. needs update | ||
const mchFlagData = window.SERVER_FLAGS.isMultiClusterEnabled; | ||
try { | ||
if (mchFlagData) { | ||
isAvailable = JSON.parse(mchFlagData) === true; // to-do: update logic/flag when finalised | ||
} | ||
} catch (e) { | ||
// eslint-disable-next-line no-console | ||
console.error('error while parsing SERVER_FLAG.isMultiClusterEnabled', e); | ||
} | ||
return isAvailable; | ||
}; | ||
|
||
export default isMultiClusterEnabled; |
15 changes: 0 additions & 15 deletions
15
frontend/packages/console-app/src/utils/useMCHDetection.ts
This file was deleted.
Oops, something went wrong.