-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UI: Fix enabling replication capabilities bug (#28371)
* add capabilities service to replication engine * fix capabilities paths in route file * pass updated capabilities using getters * add changelog * fix logic so default is based on undefined capabilities (not no mode)
- Loading branch information
1 parent
2b4e99f
commit 49b46ea
Showing
10 changed files
with
150 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:bug | ||
ui: Fix UI improperly checking capabilities for enabling performance and dr replication | ||
``` |
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 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,40 @@ | ||
/** | ||
* Copyright (c) HashiCorp, Inc. | ||
* SPDX-License-Identifier: BUSL-1.1 | ||
*/ | ||
|
||
import Component from '@glimmer/component'; | ||
|
||
/** | ||
* @module PageModeIndex | ||
* | ||
* @example | ||
* <Page::ModeIndex | ||
* @cluster={{this.model}} | ||
* @onEnableSuccess={{this.onEnableSuccess}} | ||
* @replicationDisabled={{this.replicationForMode.replicationDisabled} | ||
* @replicationMode={{this.replicationMode}} | ||
* /> | ||
* | ||
* @param {model} cluster - cluster route model | ||
* @param {function} onEnableSuccess - callback after enabling is successful, handles transition if enabled from the top-level index route | ||
* @param {boolean} replicationDisabled - whether or not replication is enabled | ||
* @param {string} replicationMode - should be "dr" or "performance" | ||
*/ | ||
export default class PageModeIndex extends Component { | ||
canEnable = (type) => { | ||
const { cluster, replicationMode } = this.args; | ||
let perm; | ||
if (replicationMode === 'dr') { | ||
// returns canEnablePrimaryDr or canEnableSecondaryDr | ||
perm = `canEnable${type}Dr`; | ||
} | ||
if (replicationMode === 'performance') { | ||
// returns canEnablePrimaryPerformance or canEnableSecondaryPerformance | ||
perm = `canEnable${type}Performance`; | ||
} | ||
// if there's a problem checking capabilities, default to true | ||
// since the backend can gate as a fallback | ||
return cluster[perm] ?? true; | ||
}; | ||
} |
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 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