-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Ui/summary dashboard #9079
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
Ui/summary dashboard #9079
Changes from 28 commits
befb629
05e52ca
a912311
01fd5b2
c890cdc
0121803
a1dd392
1cd1fc8
e71f023
536a9a8
ee43fcb
a0f4fca
59e29e3
68f34fb
59df88c
fe2ebc6
e00460f
ca03f9f
716de2e
38846bc
fc17ec7
b81dce9
eefc064
3dff903
1b42499
bb2b4c8
df1464e
d092a01
901ad25
2f58e27
54d578a
74ddb0e
38e67d4
e29493b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.replication-header { | ||
.tabs-container { | ||
margin-bottom: $spacing-l; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ const MODE = { | |
export default Component.extend({ | ||
layout, | ||
store: service(), | ||
router: service(), | ||
reindexingDetails: null, | ||
didReceiveAttrs() { | ||
this._super(arguments); | ||
|
@@ -29,22 +30,45 @@ export default Component.extend({ | |
} | ||
this.set('reindexingDetails', resp); | ||
}), | ||
isSummaryDashboard: computed('model.dr.{mode}', 'model.performance.{mode}', function() { | ||
const router = this.router; | ||
const currentRoute = router.get('currentRouteName'); | ||
|
||
// we only show the summary dashboard in the replication index route | ||
if (currentRoute === 'vault.cluster.replication.index') { | ||
const drMode = this.model.dr.mode; | ||
const performanceMode = this.model.performance.mode; | ||
return drMode && performanceMode === 'primary'; | ||
|
||
} | ||
}), | ||
formattedReplicationMode: computed('model.{replicationMode}', function() { | ||
Monkeychip marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
// dr or performance 🤯 | ||
const { isSummaryDashboard } = this; | ||
if (isSummaryDashboard) { | ||
return 'Disaster Recovery & Performance'; | ||
} | ||
const mode = this.model.replicationMode; | ||
return MODE[mode]; | ||
}), | ||
clusterMode: computed('model.{replicationAttrs}', function() { | ||
clusterMode: computed('model.{replicationAttrs}', 'isSummaryDashboard', function() { | ||
Monkeychip marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// primary or secondary | ||
const { model } = this; | ||
const { isSummaryDashboard } = this; | ||
if (isSummaryDashboard) { | ||
// replicationAttrs does not exist when summaryDashboard | ||
return 'primary'; | ||
} | ||
return model.replicationAttrs.mode; | ||
}), | ||
isLoadingData: computed('clusterMode', 'model.{replicationAttrs}', function() { | ||
const { clusterMode } = this; | ||
const { model } = this; | ||
const { isSummaryDashboard } = this; | ||
if (isSummaryDashboard) { | ||
return false; | ||
} | ||
const clusterId = model.replicationAttrs.clusterId; | ||
const replicationDisabled = model.replicationAttrs.replicationDisabled; | ||
|
||
if (clusterMode === 'bootstrapping' || (!clusterId && !replicationDisabled)) { | ||
// if clusterMode is bootstrapping | ||
// if no clusterId, the data hasn't loaded yet, wait for another status endpoint to be called | ||
|
@@ -56,8 +80,26 @@ export default Component.extend({ | |
const { clusterMode } = this; | ||
return clusterMode === 'secondary'; | ||
}), | ||
replicationDetails: computed('model.{replicationMode}', function() { | ||
replicationDetailsSummary: computed('isSummaryDashboard', function() { | ||
const { model } = this; | ||
const { isSummaryDashboard } = this; | ||
if (!isSummaryDashboard) { | ||
return; | ||
} | ||
if (isSummaryDashboard) { | ||
let combinedObject = {}; | ||
combinedObject.dr = model['dr']; | ||
combinedObject.performance = model['performance']; | ||
return combinedObject; | ||
} | ||
}), | ||
replicationDetails: computed('model.{replicationMode}', 'isSummaryDashboard', function() { | ||
const { model } = this; | ||
const { isSummaryDashboard } = this; | ||
if (isSummaryDashboard) { | ||
// Cannot return null | ||
return {}; | ||
} | ||
const replicationMode = model.replicationMode; | ||
return model[replicationMode]; | ||
}), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import Component from '@ember/component'; | ||
import { computed } from '@ember/object'; | ||
import layout from '../templates/components/replication-summary-card'; | ||
|
||
/** | ||
* @module ReplicationSummaryCard | ||
* ReplicationSummaryCard components | ||
Monkeychip marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
* | ||
* @example | ||
* ```js | ||
* <ReplicationSummaryCard | ||
@title='States' | ||
@replicationDetails=replicationDetails | ||
/> | ||
* ``` | ||
* @param {string} [title=null] - The title to be displayed on the top left corner of the card. | ||
* @param replicationDetails=null{DS.Model.replicationDetails} - An Ember data object off the Ember data model. It is computed at the parent component and passed through to this component. | ||
Monkeychip marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
*/ | ||
|
||
export default Component.extend({ | ||
layout, | ||
title: null, | ||
replicationDetails: null, | ||
lastDrWAL: computed('replicationDetails.dr.{lastWAL}', function() { | ||
Monkeychip marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return this.replicationDetails.dr && this.replicationDetails.dr.lastWAL | ||
Monkeychip marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
? this.replicationDetails.dr.lastWAL | ||
: 0; | ||
}), | ||
lastPerformanceWAL: computed('replicationDetails.performance.{lastWAL}', function() { | ||
return this.replicationDetails.performance && this.replicationDetails.performance.lastWAL | ||
? this.replicationDetails.performance.lastWAL | ||
: 0; | ||
}), | ||
merkleRootDr: computed('replicationDetails.dr.{merkleRoot}', function() { | ||
return this.replicationDetails.dr && this.replicationDetails.dr.merkleRoot | ||
? this.replicationDetails.dr.merkleRoot | ||
: ''; | ||
}), | ||
merkleRootPerformance: computed('replicationDetails.performance.{merkleRoot}', function() { | ||
return this.replicationDetails.performance && this.replicationDetails.performance.merkleRoot | ||
? this.replicationDetails.performance.merkleRoot | ||
: ''; | ||
}), | ||
knownSecondariesDr: computed('replicationDetails.dr.{knownSecondaries}', function() { | ||
const knownSecondaries = this.replicationDetails.dr.knownSecondaries; | ||
return knownSecondaries.length; | ||
}), | ||
knownSecondariesPerformance: computed('replicationDetails.performance.{knownSecondaries}', function() { | ||
const knownSecondaries = this.replicationDetails.performance.knownSecondaries; | ||
return knownSecondaries.length; | ||
}), | ||
}); |
Uh oh!
There was an error while loading. Please reload this page.