-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added new ping system, also a federation dashboard
- Loading branch information
1 parent
e6c8816
commit 28e9abf
Showing
18 changed files
with
503 additions
and
95 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,141 @@ | ||
.status { | ||
flex: 0 0 auto; | ||
|
||
width: 6px; | ||
height: 6px; | ||
margin: 0 7px; | ||
|
||
border-radius: 50%; | ||
} | ||
|
||
.status.stable { | ||
background-color: #2de0a5; | ||
} | ||
|
||
.status.unstable { | ||
background-color: #ffd21f; | ||
} | ||
|
||
.status.failing { | ||
background-color: #f5455c; | ||
} | ||
|
||
.frame { | ||
display: flex; | ||
flex-direction: row; | ||
} | ||
|
||
.group { | ||
display: flex; | ||
flex-direction: row; | ||
flex: 100%; | ||
|
||
max-width: 100%; | ||
margin: 10px; | ||
|
||
border-width: 1px; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
|
||
.group.left { | ||
justify-content: flex-start; | ||
} | ||
|
||
.group.wrap { | ||
flex-wrap: wrap; | ||
} | ||
|
||
.overview-column { | ||
flex: 100%; | ||
|
||
min-height: 20px; | ||
margin: 15px 0; | ||
} | ||
|
||
.overview-column.small { | ||
max-width: 20%; | ||
} | ||
|
||
.group .overview-column:not(:last-child) { | ||
border-right: 1px solid #e9e9e9; | ||
} | ||
|
||
.group .overview-column:nth-child(5n) { | ||
border-right: 0; | ||
} | ||
|
||
.overview-pill { | ||
display: flex; | ||
|
||
width: 100%; | ||
padding: 0 10px; | ||
|
||
user-select: text; | ||
text-align: center; | ||
align-items: center; | ||
} | ||
|
||
.overview-item { | ||
width: 100%; | ||
|
||
user-select: text; | ||
text-align: center; | ||
} | ||
|
||
.overview-item > .title { | ||
display: inline-block; | ||
|
||
margin-top: 8px; | ||
|
||
text-transform: uppercase; | ||
|
||
color: #9ea2a8; | ||
|
||
font-size: 0.875rem; | ||
font-weight: 300; | ||
} | ||
|
||
.overview-item > .value { | ||
display: inline-block; | ||
|
||
width: 100%; | ||
|
||
text-transform: capitalize; | ||
|
||
color: #383838; | ||
|
||
font-size: 1.75rem; | ||
font-weight: 400; | ||
line-height: 1; | ||
} | ||
|
||
@media screen and (max-width: 925px) { | ||
.overview-item > .title { | ||
font-size: 0.5rem; | ||
} | ||
|
||
.overview-item > .value { | ||
font-size: 1rem; | ||
} | ||
} | ||
|
||
@media screen and (max-width: 800px) { | ||
.overview-item > .title { | ||
font-size: 0.875rem; | ||
} | ||
|
||
.overview-item > .value { | ||
font-size: 1.75rem; | ||
} | ||
} | ||
|
||
@media screen and (max-width: 600px) { | ||
.overview-item > .title { | ||
font-size: 0.5rem; | ||
} | ||
|
||
.overview-item > .value { | ||
font-size: 1rem; | ||
} | ||
} |
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,33 @@ | ||
<template name="dashboard"> | ||
<div class="main-content-flex"> | ||
<section class="page-container page-list flex-tab-main-content"> | ||
{{> header sectionName="Federation_Dashboard"}} | ||
<div class="content"> | ||
<div class="section"> | ||
<div class="section-content"> | ||
<div class="group border-component-color"> | ||
{{#each federationOverviewData}} | ||
<div class="overview-column"> | ||
<div class="overview-item"> | ||
<span class="value">{{value}}</span> | ||
<span class="title">{{_ title}}</span> | ||
</div> | ||
</div> | ||
{{/each}} | ||
</div> | ||
<div class="group left wrap border-component-color"> | ||
{{#each federationPeerStatuses}} | ||
<div class="overview-column small"> | ||
<div class="overview-pill" title="{{status}} - {{statusAt}}"> | ||
<div class="status {{status}}"></div> | ||
<span class="title">{{peer}}</span> | ||
</div> | ||
</div> | ||
{{/each}} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
</div> | ||
</template> |
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,92 @@ | ||
import { Meteor } from 'meteor/meteor'; | ||
import { Tracker } from 'meteor/tracker'; | ||
import { Template } from 'meteor/templating'; | ||
import { ReactiveVar } from 'meteor/reactive-var'; | ||
|
||
import { BlazeLayout } from 'meteor/kadira:blaze-layout'; | ||
import { FlowRouter } from 'meteor/kadira:flow-router'; | ||
import { AdminBox } from '../../../ui-utils'; | ||
import { hasRole } from '../../../authorization'; | ||
|
||
import './dashboard.html'; | ||
import './dashboard.css'; | ||
|
||
// Template controller | ||
let templateInstance; // current template instance/context | ||
|
||
// Methods | ||
const updateOverviewData = () => { | ||
Meteor.call('federation:getOverviewData', (error, result) => { | ||
if (error) { | ||
console.log(error); | ||
|
||
return; | ||
// return handleError(error); | ||
} | ||
|
||
const { data } = result; | ||
|
||
templateInstance.federationOverviewData.set(data); | ||
}); | ||
}; | ||
|
||
const updatePeerStatuses = () => { | ||
Meteor.call('federation:getPeerStatuses', (error, result) => { | ||
if (error) { | ||
console.log(error); | ||
|
||
return; | ||
// return handleError(error); | ||
} | ||
|
||
const { data } = result; | ||
|
||
templateInstance.federationPeerStatuses.set(data); | ||
}); | ||
}; | ||
|
||
const updateData = () => { | ||
updateOverviewData(); | ||
updatePeerStatuses(); | ||
}; | ||
|
||
Template.dashboard.helpers({ | ||
federationOverviewData() { | ||
return templateInstance.federationOverviewData.get(); | ||
}, | ||
federationPeerStatuses() { | ||
return templateInstance.federationPeerStatuses.get(); | ||
}, | ||
}); | ||
|
||
// Events | ||
Template.dashboard.onCreated(function() { | ||
templateInstance = Template.instance(); | ||
|
||
this.federationOverviewData = new ReactiveVar(); | ||
this.federationPeerStatuses = new ReactiveVar(); | ||
}); | ||
|
||
Template.dashboard.onRendered(() => { | ||
Tracker.autorun(updateData); | ||
|
||
setInterval(updateData, 10000); | ||
}); | ||
|
||
// Route setup | ||
|
||
FlowRouter.route('/admin/federation-dashboard', { | ||
name: 'federation-dashboard', | ||
action() { | ||
BlazeLayout.render('main', { center: 'dashboard', old: true }); | ||
}, | ||
}); | ||
|
||
AdminBox.addOption({ | ||
icon: 'discover', | ||
href: 'admin/federation-dashboard', | ||
i18nLabel: 'Federation Dashboard', | ||
permissionGranted() { | ||
return hasRole(Meteor.userId(), 'admin'); | ||
}, | ||
}); |
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,23 +1,2 @@ | ||
import { MessageTypes } from '../../ui-utils/client'; | ||
|
||
// Register message types | ||
MessageTypes.registerType({ | ||
id: 'rejected-message-by-peer', | ||
system: true, | ||
message: 'This_message_was_rejected_by__peer__peer', | ||
data(message) { | ||
return { | ||
peer: message.peer, | ||
}; | ||
}, | ||
}); | ||
MessageTypes.registerType({ | ||
id: 'peer-does-not-exist', | ||
system: true, | ||
message: 'The_peer__peer__does_not_exist', | ||
data(message) { | ||
return { | ||
peer: message.peer, | ||
}; | ||
}, | ||
}); | ||
import './messageTypes'; | ||
import './admin/dashboard'; |
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,23 @@ | ||
import { MessageTypes } from '../../ui-utils/client'; | ||
|
||
// Register message types | ||
MessageTypes.registerType({ | ||
id: 'rejected-message-by-peer', | ||
system: true, | ||
message: 'This_message_was_rejected_by__peer__peer', | ||
data(message) { | ||
return { | ||
peer: message.peer, | ||
}; | ||
}, | ||
}); | ||
MessageTypes.registerType({ | ||
id: 'peer-does-not-exist', | ||
system: true, | ||
message: 'The_peer__peer__does_not_exist', | ||
data(message) { | ||
return { | ||
peer: message.peer, | ||
}; | ||
}, | ||
}); |
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
Oops, something went wrong.