Skip to content
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

Various UI improvements #431

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ before_script:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- sleep 5 # give xvfb some time to start
- "npm install karma-cli karma-ng-scenario karma-jasmine karma-phantomjs-launcher --quiet --global"
- "npm install --quiet"
script:
- "mvn clean verify -Pkarma"
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ docker-compose up
and open [http://localhost:8080/seyren](http://localhost:8080/seyren).
Graphite is available on [http://localhost:8081/](http://localhost:8081/) with Basic Auth guest/guest.

If you prefer to run only Seyren's dependencies within Docker, for example so that you can run Seyren from an IDE, use:

docker-compose -f docker-compose.yml up

## Init script

[Seyren-Init](https://github.com/wingZero21/Seyren-Init) is an init.d script which allows you to start the service.
Expand All @@ -180,13 +184,13 @@ To run the acceptance tests with Maven:
```
mvn clean verify
```
To run the integration tests with Maven:
To run the integration tests with Maven, install the necessary Node modules (Karma, etc.), then run tests with the
"karma" profile:

```
mvn clean verify -Pkarma
```
npm install
mvn clean verify -Pkarma

To fire-up the app using Maven and wait (meaning you can run the tests separately from your IDE):
To fire up the app using Maven and wait (meaning you can run the tests separately from your IDE):

```
mvn clean verify -Dwait
Expand Down
18 changes: 18 additions & 0 deletions docker-compose.override.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
web:
build: seyren-web
links:
- mongodb
- graphite
command: /bin/bash -c "mvn clean install -am -pl seyren-web -Dmaven.test.skip && /usr/share/maven/bin/mvn tomcat7:run-war -pl seyren-web"
environment:
MONGO_URL: mongodb://mongodb:27017/seyren
GRAPHITE_URL: http://graphite
GRAPHITE_USERNAME: guest
GRAPHITE_PASSWORD: guest
SEYREN_LOG_PATH: /root
volumes:
- ./:/data
- ~/.m2:/root/.m2
ports:
- 8080:8080
- 8000:8000
19 changes: 0 additions & 19 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,3 @@ collectd:
GRAPHITE_HOST: graphite
GRAPHITE_PORT: 2003
INSTANCE_ID: seyren

web:
build: seyren-web
links:
- mongodb
- graphite
command: /bin/bash -c "/usr/share/maven/bin/mvn clean install -am -pl seyren-web -Dmaven.test.skip && /usr/share/maven/bin/mvn tomcat7:run-war -pl seyren-web"
environment:
MONGO_URL: mongodb://mongodb:27017/seyren
GRAPHITE_URL: http://graphite
GRAPHITE_USERNAME: guest
GRAPHITE_PASSWORD: guest
SEYREN_LOG_PATH: /root
volumes:
- ./:/data
- ~/.m2:/root/.m2
ports:
- 8080:8080
- 8000:8000
15 changes: 15 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "seyren",
"version": "1.0.0",
"private": true,
"dependencies": {},
"devDependencies": {
"jasmine-core": "^2.5.2",
"karma": "^1.5.0",
"karma-jasmine": "^1.1.0",
"karma-ng-scenario": "^1.0.0",
"karma-phantomjs-launcher": "^1.0.4"
},
"scripts": {},
"license": "Apache-2.0"
}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
<plugin>
<groupId>com.github.joelittlejohn.embedmongo</groupId>
<artifactId>embedmongo-maven-plugin</artifactId>
<version>0.1.12</version>
<version>0.3.4</version>
</plugin>
<plugin>
<groupId>com.kelveden</groupId>
Expand Down
1 change: 1 addition & 0 deletions seyren-integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@
</goals>
<configuration>
<configFile>${basedir}/src/test/resources/karma-e2e.conf.js</configFile>
<karmaExecutable>${basedir}/../node_modules/.bin/karma</karmaExecutable>
</configuration>
</execution>
</executions>
Expand Down
32 changes: 16 additions & 16 deletions seyren-integration-tests/src/test/e2e/scenarios.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ describe('home page', function () {
expect(element('table:eq(0) thead tr').count()).toBe(1);
expect(element('table:eq(0) thead tr th:eq(0)').text()).toBe('Name');
expect(element('table:eq(0) thead tr th:eq(1)').text()).toBe('State');
expect(element('table:eq(0) thead tr th:eq(2)').text()).toBe('Warn');
expect(element('table:eq(0) thead tr th:eq(3)').text()).toBe('Error');
expect(element('table:eq(0) thead tr th:eq(2)').text()).toBe('Warn level');
expect(element('table:eq(0) thead tr th:eq(3)').text()).toBe('Error level');
expect(element('table:eq(0) thead tr th:eq(4)').text()).toBe('Enabled');

expect(element('table:eq(0) tbody tr').count()).toBe(1);
expect(element('table:eq(0) tbody tr td:eq(0) a').text()).toBe('load longterm usage');
expect(element('table:eq(0) tbody tr td:eq(1) span:visible').text()).toBe('WARN');
expect(element('table:eq(0) tbody tr td:eq(2)').text()).toBe('0.5');
expect(element('table:eq(0) tbody tr td:eq(3)').text()).toBe('2.0');
expect(element('table:eq(0) tbody tr td:eq(3)').text()).toBe('1,000');
expect(element('table:eq(0) tbody tr td:eq(4) input:checked').val()).toBe('on');
});

Expand All @@ -40,8 +40,8 @@ describe('home page', function () {
expect(element('table:eq(1) thead tr th:eq(1)').text()).toBe('Time ago');
expect(element('table:eq(1) thead tr th:eq(2)').text()).toBe('Name');
expect(element('table:eq(1) thead tr th:eq(3)').text()).toBe('Value');
expect(element('table:eq(1) thead tr th:eq(4)').text()).toBe('Warn');
expect(element('table:eq(1) thead tr th:eq(5)').text()).toBe('Error');
expect(element('table:eq(1) thead tr th:eq(4)').text()).toBe('Warn level');
expect(element('table:eq(1) thead tr th:eq(5)').text()).toBe('Error level');
expect(element('table:eq(1) thead tr th:eq(6)').text()).toBe('From');
expect(element('table:eq(1) thead tr th:eq(7)').text()).toBe('To');

Expand All @@ -51,7 +51,7 @@ describe('home page', function () {
expect(element('table:eq(1) tbody tr td:eq(2) a').text()).toBe('load longterm usage');
expect(element('table:eq(1) tbody tr td:eq(3)').text()).toBe('0.8');
expect(element('table:eq(1) tbody tr td:eq(4)').text()).toBe('0.5');
expect(element('table:eq(1) tbody tr td:eq(5)').text()).toBe('2');
expect(element('table:eq(1) tbody tr td:eq(5)').text()).toBe('1,000');
expect(element('table:eq(1) tbody tr td:eq(6) span:visible').text()).toBe('WARN');
expect(element('table:eq(1) tbody tr td:eq(7) span:visible').text()).toBe('OK');
});
Expand Down Expand Up @@ -94,15 +94,15 @@ describe('checks page', function () {
expect(element('table thead tr').count()).toBe(1);
expect(element('table thead tr th:eq(0)').text()).toBe('Name');
expect(element('table thead tr th:eq(1)').text()).toBe('State');
expect(element('table thead tr th:eq(2)').text()).toBe('Warn');
expect(element('table thead tr th:eq(3)').text()).toBe('Error');
expect(element('table thead tr th:eq(2)').text()).toBe('Warn level');
expect(element('table thead tr th:eq(3)').text()).toBe('Error level');
expect(element('table thead tr th:eq(4)').text()).toBe('Enabled');

expect(element('table tbody tr').count()).toBe(1);
expect(element('table tbody tr td:eq(0) a').text()).toBe('load longterm usage');
expect(element('table tbody tr td:eq(1) span:visible').text()).toBe('WARN');
expect(element('table tbody tr td:eq(2)').text()).toBe('0.5');
expect(element('table tbody tr td:eq(3)').text()).toBe('2.0');
expect(element('table tbody tr td:eq(3)').text()).toBe('1,000');
expect(element('table tbody tr td:eq(4) input:checked').val()).toBe('on');
});

Expand All @@ -125,7 +125,7 @@ describe('check page', function () {
it('should have a \'Subscriptions\' section', function () {
expect(element('h2:eq(1)').count()).toBe(1);
expect(element('h2:eq(1)').text()).toBe('Subscriptions');
expect(element('div.col-lg-12:eq(2) div').text()).toBe('This check has no subscriptions');
expect(element('#subscriptionsContent div').text()).toBe('This check has no subscriptions');
});

it('should have a \'Details\' informations', function () {
Expand All @@ -149,11 +149,11 @@ describe('check page', function () {
expect(element('div.col-lg-6 div.detail-form:eq(5) label').text()).toBe('Until:');
expect(element('div.col-lg-6 div.detail-form:eq(5) p').text()).toBe('');

expect(element('div.col-lg-6 div.detail-form:eq(6) label').text()).toBe('Warn:');
expect(element('div.col-lg-6 div.detail-form:eq(6) label').text()).toBe('Warn level:');
expect(element('div.col-lg-6 div.detail-form:eq(6) p').text()).toBe('0.5');

expect(element('div.col-lg-6 div.detail-form:eq(7) label').text()).toBe('Error:');
expect(element('div.col-lg-6 div.detail-form:eq(7) p').text()).toBe('2.0');
expect(element('div.col-lg-6 div.detail-form:eq(7) label').text()).toBe('Error level:');
expect(element('div.col-lg-6 div.detail-form:eq(7) p').text()).toBe('1,000');

expect(element('div.col-lg-6 div.detail-form:eq(8) label').text()).toBe('Enabled:');
expect(element('div.col-lg-6 div.detail-form:eq(8) p input:checked').val()).toBe('on');
Expand Down Expand Up @@ -207,7 +207,7 @@ describe('check page', function () {
expect(element('table:eq(1) tbody tr td:eq(2)').text()).toBe('prod.host1.load.longterm');
expect(element('table:eq(1) tbody tr td:eq(3)').text()).toBe('0.8');
expect(element('table:eq(1) tbody tr td:eq(4)').text()).toBe('0.5');
expect(element('table:eq(1) tbody tr td:eq(5)').text()).toBe('2');
expect(element('table:eq(1) tbody tr td:eq(5)').text()).toBe('1,000');
expect(element('table:eq(1) tbody tr td:eq(6) span:visible').text()).toBe('WARN');
expect(element('table:eq(1) tbody tr td:eq(7) span:visible').text()).toBe('OK');
});
Expand Down Expand Up @@ -376,10 +376,10 @@ describe('create new check', function () {
input('check\\.description').enter('Description of karma.metric');
input('check\\.target').enter('karma.metric');
input('check\\.warn').enter('2.0');
input('check\\.error').enter('4.0');
input('check\\.error').enter('1000');
input('check\\.enabled').check();

expect(element('div#editCheckModal img').attr('src')).toBe('./api/chart/karma.metric/?&width=365&height=70&from=-1day&warn=2.0&error=4.0&hideLegend=true');
expect(element('div#editCheckModal img').attr('src')).toBe('./api/chart/karma.metric/?&width=365&height=70&from=-1day&warn=2.0&error=1000&hideLegend=true');

expect(element('button#createCheckButton:visible:enabled').count()).toEqual(1);
expect(element('button#cancelCheckButton:visible:enabled').count()).toEqual(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"timestamp": { "$date": "2013-07-12T14:15:59.497Z"},
"warn" : "0.5",
"checkId" : "5205121fccf2a07eacba64da",
"error" : "2.0",
"error" : "1000",
"value" : "0.8",
"target" : "prod.host1.load.longterm",
"toType" : "OK",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
description: "Load longterm of host host1",
target: "prod.host1.load.longterm",
warn: "0.5",
error: "2.0",
error: "1000",
enabled: true,
state: "WARN",
"lastCheck": { "$date": "2013-07-12T10:10:00.000Z"},
Expand Down
5 changes: 3 additions & 2 deletions seyren-mongo/src/main/java/com/seyren/mongo/MongoStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,9 @@ private void removeOldIndices() {
try {
getAlertsCollection().dropIndex(new BasicDBObject("checkId", 1).append("target", 1));
} catch (MongoCommandException e) {
if (e.getCode() != 27) {
// 27 is the code which appears when the index doesn't exist (which we're happy with, anything else is bad news)
if (e.getCode() != 27 && e.getCode() != -1) {
// -1 is the code which appears when the index doesn't exist (which we're happy with, anything else is
// bad news)
throw e;
}
}
Expand Down
4 changes: 4 additions & 0 deletions seyren-web/src/main/webapp/css/override-bootstrap.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,7 @@ body {
padding-right: 10px;
padding-left: 10px;
}

.glyphicon-blue {
color: #0000bf;
}
42 changes: 24 additions & 18 deletions seyren-web/src/main/webapp/html/check.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
<div class="row" ng-show="graphsEnabled()">
<div class="row" ng-show="!checkExists">
<div class="col-lg-12">
<h1>Not Found</h1>
<p>Check was not found. Maybe it has been deleted?</p>
</div>
</div>
<div class="row" ng-show="checkExists && graphsEnabled()">
<div class="col-lg-12">
<div class="col-lg-3 graph" ng-repeat="graph in graphs">
<div class="thumbnail">
Expand All @@ -10,10 +16,10 @@ <h6 style="margin: 0px 0;"><strong>{{ graph.description }}</strong></h6>
</div>
</div>
</div>
<div class="row">
<div class="row" ng-show="checkExists && check != null">
<div class="col-lg-6">
<div class="row">
<div class="col-lg-7">
<div class="col-lg-12">
<h2><strong>Details</strong> <small>[<a class="" data-keyboard="true" data-toggle="modal" data-show="true" href="" ng-click="editCheck(check)">edit</a>]</small></h2>
</div>
</div>
Expand Down Expand Up @@ -61,15 +67,15 @@ <h2><strong>Details</strong> <small>[<a class="" data-keyboard="true" data-toggl
</div>
</div>
<div class="form-group detail-form">
<label class="col-lg-2 control-label">Warn:</label>
<label class="col-lg-2 control-label">Warn level:</label>
<div class="col-lg-10">
<p class="form-control-static">{{check.warn}}</p>
<p class="form-control-static">{{check.warn | number}}</p>
</div>
</div>
<div class="form-group detail-form">
<label class="col-lg-2 control-label">Error:</label>
<label class="col-lg-2 control-label">Error level:</label>
<div class="col-lg-10">
<p class="form-control-static">{{check.error}}</p>
<p class="form-control-static">{{check.error | number}}</p>
</div>
</div>
<div class="form-group detail-form">
Expand All @@ -93,7 +99,7 @@ <h2><strong>Details</strong> <small>[<a class="" data-keyboard="true" data-toggl
<div class="form-group detail-form">
<label class="col-lg-2 control-label">Last check:</label>
<div class="col-lg-10">
<p class="form-control-static">{{check.lastCheck | date: 'yyyy-MM-dd HH:mm:ss'}}</p>
<p class="form-control-static">{{check.lastCheck | date: 'yyyy-MM-dd HH:mm:ssZ'}}</p>
</div>
</div>
</form>
Expand All @@ -103,14 +109,14 @@ <h2><strong>Details</strong> <small>[<a class="" data-keyboard="true" data-toggl
<div class="col-lg-8">
<h2><strong>Subscriptions</strong></h2>
</div>
<div class="col-lg-2">
<div class="col-lg-4">
<p></p><p><button id="editSubscaddriptionButton" class="btn btn-success" data-keyboard="true" data-toggle="modal" data-show="true" href="#editSubscriptionModal" ng-click="editSubscription(check, 'new')"><i class="glyphicon glyphicon-volume-up glyphicon-white"></i>&nbsp;Add subscription</button></p>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="col-lg-12" id="subscriptionsContent">
<div ng-hide="check.subscriptions">This check has no subscriptions</div>
<table class="table table-bordered table-striped table-hover" ng-show="check.subscriptions" style="cursor: pointer;">
<table class="table table-bordered table-striped table-hover" ng-show="check.subscriptions">
<thead>
<tr>
<th>Target</th>
Expand Down Expand Up @@ -162,7 +168,7 @@ <h2><strong>Subscriptions</strong></h2>
</div>
</div>
</div>
<div class="row">
<div class="row" ng-show="checkExists && check != null">
<div class="col-lg-12">
<h2>
<strong>Alerts</strong> <small>( {{alerts.start}} of {{alerts.total}} )</small>
Expand Down Expand Up @@ -199,12 +205,12 @@ <h2>
</thead>
<tbody>
<tr ng-repeat="alert in alerts.values">
<td>{{ alert.timestamp | date: 'yyyy-MM-dd HH:mm:ss' }}</td>
<td>{{ alert.timestamp | date: 'yyyy-MM-dd HH:mm:ssZ' }}</td>
<td><span am-time-ago="alert.timestamp"></span></td>
<td>{{ alert.target }}</td>
<td>{{ alert.value }}</td>
<td>{{ alert.warn }}</td>
<td>{{ alert.error }}</td>
<td>{{ alert.value | number }}</td>
<td>{{ alert.warn | number }}</td>
<td>{{ alert.error | number }}</td>
<td>
<span ng-show="alert.fromType == 'UNKNOWN'" class="label label-default">{{ alert.fromType }}</span>
<span ng-show="alert.fromType == 'OK'" class="label label-success">{{ alert.fromType }}</span>
Expand All @@ -224,10 +230,10 @@ <h2>
</table>
</div>
</div>
<div class="row">
<div class="row" ng-show="checkExists && check != null">
<div class="col-lg-12">
<div class="pull-right">
<button class="btn btn-danger btn-sm" data-keyboard="true" data-toggle="modal" data-show="true" id="deleteCheckButton" href="#confirmCheckDeleteModal">Delete check</button>
<button class="btn btn-danger" data-keyboard="true" data-toggle="modal" data-show="true" id="deleteCheckButton" href="#confirmCheckDeleteModal">Delete check</button>
</div>
</div>
</div>
Expand Down
Loading