-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replication Primary Dashboard: handle errors #8845
Merged
Merged
Changes from 21 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
74a7fbe
use h3 instead of code elements
andaley b23c1b4
use correct property names for StateDisplay
andaley 4553a30
WIP
andaley 0e39b9c
remove todo
andaley 3ddb24b
move cluster states into a map; make status menu icon match cluster s…
andaley b64d2e9
show error in state card using the same state map in the cluster model
andaley 83c50ad
whitespace
andaley ae02971
move cluster-states into a helper and update usage
andaley 92fb513
use circle success icon for stream-wals because that is the ideal state
andaley b25ce17
more refactoring of cluster state display
andaley 927c508
use new cluster-states helper
andaley 448b1f0
whitespace
andaley 502064c
use clusterStates helper in replication secondary card
andaley def71a1
remove extra import
andaley f672ae3
add default values for when state isn't recognized
andaley 246fd51
make sure that state exists before getting state details from cluster…
andaley acb3d06
be more strict when state cannot be found
andaley d8ddb95
use brace expansion to fix linting error
andaley d5b07f3
add tests for error states
andaley 83e3003
fix text wrapping issue on secondary cards; make titles match mocks
andaley 11842b1
Merge branch 'ui/replication-status-discoverability' of https://githu…
andaley 3e496da
use unknown if metric isn't foudn
andaley 98f7527
remove extra border on selectable card when there is an error
andaley d20029a
use outline square in status menu for error
andaley File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 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 |
---|---|---|
@@ -1,15 +1,20 @@ | ||
import Component from '@ember/component'; | ||
import { computed } from '@ember/object'; | ||
import { clusterStates } from 'core/helpers/cluster-states'; | ||
import layout from '../templates/components/replication-dashboard'; | ||
|
||
const MERKLE_STATES = { sync: 'merkle-sync', diff: 'merkle-diff' }; | ||
|
||
export default Component.extend({ | ||
layout, | ||
data: null, | ||
isSyncing: computed('data', function() { | ||
if (this.dr.state === MERKLE_STATES.sync || this.dr.state === MERKLE_STATES.diff) { | ||
return true; | ||
dr: computed('data', function() { | ||
let dr = this.data.dr; | ||
if (!dr) { | ||
return false; | ||
} | ||
return dr; | ||
}), | ||
isSyncing: computed('dr', function() { | ||
const { state } = this.dr; | ||
return state && clusterStates([state]).isSyncing; | ||
}), | ||
}); |
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 |
---|---|---|
@@ -1,13 +1,7 @@ | ||
import Component from '@ember/component'; | ||
import { computed } from '@ember/object'; | ||
import layout from '../templates/components/replication-secondary-card'; | ||
|
||
const STATES = { | ||
streamWals: 'stream-wals', | ||
idle: 'idle', | ||
transientFailure: 'transient_failure', | ||
shutdown: 'shutdown', | ||
}; | ||
import { clusterStates } from 'core/helpers/cluster-states'; | ||
|
||
export default Component.extend({ | ||
layout, | ||
|
@@ -28,19 +22,20 @@ export default Component.extend({ | |
return Math.abs(this.get('lastWAL') - this.get('lastRemoteWAL')); | ||
}), | ||
inSyncState: computed('state', function() { | ||
if (this.state === STATES.streamWals) { | ||
return true; | ||
} | ||
// if our definition of what is considered 'synced' changes, | ||
// we should use the clusterStates helper instead | ||
return this.state === 'stream-wals'; | ||
}), | ||
|
||
hasErrorClass: computed('data', 'title', 'state', 'connection', function() { | ||
if (this.title === 'States') { | ||
if ( | ||
this.state === STATES.idle || | ||
this.connection === STATES.transientFailure || | ||
this.connection === STATES.shutdown | ||
) { | ||
return true; | ||
} | ||
const { title, state, connection } = this; | ||
|
||
// only show errors on the state card | ||
if (title === 'States') { | ||
const currentClusterisOk = clusterStates([state]).isOk; | ||
const primaryIsOk = clusterStates([connection]).isOk; | ||
return !(currentClusterisOk && primaryIsOk); | ||
} | ||
return false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like you're missing the red border around the selectable card when they're in an error state. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ooh good catch, thanks! |
||
}), | ||
}); |
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,69 @@ | ||
import { helper as buildHelper } from '@ember/component/helper'; | ||
|
||
// A hash of cluster states to ensure that the status menu and replication dashboards | ||
// display states and glyphs consistently | ||
// this includes states for the primary vault cluster and the connection_state | ||
|
||
export const CLUSTER_STATES = { | ||
running: { | ||
glyph: 'check-circle-outline', | ||
isOk: true, | ||
isSyncing: false, | ||
}, | ||
ready: { | ||
glyph: 'check-circle-outline', | ||
isOk: true, | ||
isSyncing: false, | ||
}, | ||
'stream-wals': { | ||
glyph: 'check-circle-outline', | ||
display: 'Streaming', | ||
isOk: true, | ||
isSyncing: false, | ||
}, | ||
'merkle-diff': { | ||
glyph: 'android-sync', | ||
display: 'Determining sync status', | ||
isOk: true, | ||
isSyncing: true, | ||
}, | ||
connecting: { | ||
glyph: 'android-sync', | ||
display: 'Streaming', | ||
isOk: true, | ||
isSyncing: true, | ||
}, | ||
'merkle-sync': { | ||
glyph: 'android-sync', | ||
display: 'Syncing', | ||
isOk: true, | ||
isSyncing: true, | ||
}, | ||
idle: { | ||
glyph: 'cancel-circle-fill', | ||
isOk: false, | ||
isSyncing: false, | ||
}, | ||
transient_failure: { | ||
glyph: 'cancel-circle-fill', | ||
isOk: false, | ||
isSyncing: false, | ||
}, | ||
shutdown: { | ||
glyph: 'cancel-circle-fill', | ||
isOk: false, | ||
isSyncing: false, | ||
}, | ||
}; | ||
|
||
export function clusterStates([state]) { | ||
const defaultDisplay = { | ||
glyph: '', | ||
display: '', | ||
isOk: null, | ||
isSyncing: null, | ||
}; | ||
return CLUSTER_STATES[state] || defaultDisplay; | ||
} | ||
|
||
export default buildHelper(clusterStates); |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since only
replicationMode
is accessed for the value, I don't thinkdr{...}
andperformance{...}
are necessary. Also I've never seen thatthing.{foo,bar}
pattern before 🤯There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
glad you brought this up! i think we still need all of these properties here because
modeState
is dependent on all of their values. that is, when thedr.state
orperformance.state
changes, we want to update our cache so that the next timemodeState
is accessed in the template, the new computed value is shown. i know it's wonky since we're only usingreplicationMode
on line 54, but behind the scenes we want thedrOrPerf.mode
to affect this property. i found this blurb on the ember guides that talks about this process:that being said i am not 100% positive about this, so if you think i've misunderstood definitely let me know!
regarding the
thing.{stuff, yay}
syntax, my linter showed me that! there's more about using object properties as dependent keys and using that syntax here:https://guides.emberjs.com/v3.8.0/object-model/computed-properties-and-aggregate-data/