Commit b64d2e94 authored by Noelle Daley's avatar Noelle Daley
Browse files

show error in state card using the same state map in the cluster model

parent 3ddb24ba
Showing with 7 additions and 7 deletions
+7 -7
......@@ -15,7 +15,8 @@ import { computed } from '@ember/object';
* ```
* @param {string} [title=null] - The title to be displayed on the top left corner of the card.
* @param {string} [description=null] - Helper text to describe the metric on the card.
* @param {object} [glyph=null] - The glyph to display beside the metric.
* @param {string} [glyph=null] - The glyph to display beside the metric.
* @param {boolean} [hasOkState=true] - Whether or not the cluster is in an okay state. This comes from the cluster model.
* @param {string} metric=null - The main metric to highlight on the card.
*/
......@@ -25,11 +26,9 @@ export default Component.extend({
description: null,
metric: null,
glyph: null,
hasError: computed('title', 'metric', function() {
// TODO: can we make a map somewhere in the cluster that keeps track of all the good and bad states
// as well as their glyphs? this could replace the cluster StateDiplay and StateGlyph
// TODO: then add tests to ensure we show the correct error msg
return this.title === 'State' && this.metric !== 'running';
hasOkState: true,
hasError: computed('hasOkState', 'title', 'metric', function() {
return this.title === 'State' && !this.hasOkState;
}),
errorMessage: computed('hasError', function() {
// TODO figure out if we need another error message
......
......@@ -9,7 +9,7 @@
</span>
<h3 class="title is-3">
{{metric}}
{{#if glyph}}
{{#if (and glyph (not hasError))}}
<Icon @glyph={{glyph}} class="has-text-success" />
{{/if}}
</h3>
......
......@@ -349,6 +349,7 @@
@title='State'
@description='Updated every ten seconds.'
@glyph={{get cluster (concat replicationMode 'StateGlyph')}}
@hasOkState={{get cluster (concat replicationMode 'HasOkState')}}
@metric={{replicationAttrs.state}}/>
<ReplicationPrimaryCard
@title='Last WAL entry'
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment