feat(dashboard): Initial commit of frontend code

This commit is contained in:
Rob Szumski 2013-10-07 16:15:06 -07:00 committed by Brandon Philips
parent 84ea824b96
commit 52da2acffd
32 changed files with 15554 additions and 2 deletions

3
dashboard/.bowerrc Normal file
View File

@ -0,0 +1,3 @@
{
"directory": "app/bower_components"
}

21
dashboard/.editorconfig Normal file
View File

@ -0,0 +1,21 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org
root = true
[*]
# Change these settings to your own preference
indent_style = space
indent_size = 2
# We recommend you to keep these unchanged
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false

1
dashboard/.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
* text=auto

5
dashboard/.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
node_modules
dist
.tmp
.sass-cache
app/bower_components

3
dashboard/.jshintignore Normal file
View File

@ -0,0 +1,3 @@
app/scripts/vega.js
app/scripts/moment.min.js
app/scripts/ng-time-relative.min.js

27
dashboard/.jshintrc Normal file
View File

@ -0,0 +1,27 @@
{
"node": true,
"browser": true,
"esnext": true,
"bitwise": true,
"camelcase": true,
"curly": true,
"eqeqeq": true,
"immed": true,
"indent": 2,
"latedef": true,
"newcap": true,
"noarg": true,
"quotmark": "single",
"regexp": true,
"undef": true,
"unused": false,
"strict": true,
"trailing": true,
"smarttabs": true,
"globals": {
"angular": false,
"$": false,
"vg": false,
"moment": false
}
}

7
dashboard/.travis.yml Normal file
View File

@ -0,0 +1,7 @@
language: node_js
node_js:
- '0.8'
- '0.10'
before_script:
- 'npm install -g bower grunt-cli'
- 'bower install'

345
dashboard/Gruntfile.js Normal file
View File

@ -0,0 +1,345 @@
// Generated on 2013-10-07 using generator-webapp 0.4.3
'use strict';
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'
module.exports = function (grunt) {
// show elapsed time at the end
require('time-grunt')(grunt);
// load all grunt tasks
require('load-grunt-tasks')(grunt);
grunt.initConfig({
// configurable paths
uglify: {
options: {
mangle: false
},
},
yeoman: {
app: 'app',
dist: 'dist'
},
watch: {
compass: {
files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
tasks: ['compass:server', 'autoprefixer']
},
styles: {
files: ['<%= yeoman.app %>/styles/{,*/}*.css'],
tasks: ['copy:styles', 'autoprefixer']
},
livereload: {
options: {
livereload: '<%= connect.options.livereload %>'
},
files: [
'<%= yeoman.app %>/*.html',
'.tmp/styles/{,*/}*.css',
'{.tmp,<%= yeoman.app %>}/scripts/{,*/}*.js',
'<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
]
}
},
connect: {
options: {
port: 9000,
livereload: 35729,
// change this to '0.0.0.0' to access the server from outside
hostname: 'localhost'
},
livereload: {
options: {
open: true,
base: [
'.tmp',
'<%= yeoman.app %>'
]
}
},
test: {
options: {
base: [
'.tmp',
'test',
'<%= yeoman.app %>'
]
}
},
dist: {
options: {
open: true,
base: '<%= yeoman.dist %>'
}
}
},
clean: {
dist: {
files: [{
dot: true,
src: [
'.tmp',
'<%= yeoman.dist %>/*',
'!<%= yeoman.dist %>/.git*'
]
}]
},
server: '.tmp'
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
all: [
'<%= yeoman.app %>/scripts/{,*/}*.js',
'!<%= yeoman.app %>/scripts/vendor/*',
]
},
mocha: {
all: {
options: {
run: true,
urls: ['http://<%= connect.test.options.hostname %>:<%= connect.test.options.port %>/index.html']
}
}
},
compass: {
options: {
sassDir: '<%= yeoman.app %>/styles',
cssDir: '.tmp/styles',
generatedImagesDir: '.tmp/images/generated',
imagesDir: '<%= yeoman.app %>/images',
javascriptsDir: '<%= yeoman.app %>/scripts',
fontsDir: '<%= yeoman.app %>/styles/fonts',
importPath: '<%= yeoman.app %>/bower_components',
httpImagesPath: '/images',
httpGeneratedImagesPath: '/images/generated',
httpFontsPath: '/styles/fonts',
relativeAssets: false,
assetCacheBuster: false
},
dist: {
options: {
generatedImagesDir: '<%= yeoman.dist %>/images/generated'
}
},
server: {
options: {
debugInfo: true
}
}
},
autoprefixer: {
options: {
browsers: ['last 1 version']
},
dist: {
files: [{
expand: true,
cwd: '.tmp/styles/',
src: '{,*/}*.css',
dest: '.tmp/styles/'
}]
}
},
// not used since Uglify task does concat,
// but still available if needed
/*concat: {
dist: {}
},*/
requirejs: {
dist: {
// Options: https://github.com/jrburke/r.js/blob/master/build/example.build.js
options: {
// `name` and `out` is set by grunt-usemin
baseUrl: '<%= yeoman.app %>/scripts',
optimize: 'none',
// TODO: Figure out how to make sourcemaps work with grunt-usemin
// https://github.com/yeoman/grunt-usemin/issues/30
//generateSourceMaps: true,
// required to support SourceMaps
// http://requirejs.org/docs/errors.html#sourcemapcomments
preserveLicenseComments: false,
useStrict: true,
wrap: true
//uglify2: {} // https://github.com/mishoo/UglifyJS2
}
}
},
useminPrepare: {
options: {
dest: '<%= yeoman.dist %>'
},
html: ['<%= yeoman.app %>/**/*.html']
},
usemin: {
options: {
dirs: ['<%= yeoman.dist %>']
},
html: ['<%= yeoman.dist %>/{,*/}*.html'],
css: ['<%= yeoman.dist %>/styles/{,*/}*.css']
},
imagemin: {
dist: {
files: [{
expand: true,
cwd: '<%= yeoman.app %>/images',
src: '{,*/}*.{png,jpg,jpeg}',
dest: '<%= yeoman.dist %>/images'
}]
}
},
svgmin: {
dist: {
files: [{
expand: true,
cwd: '<%= yeoman.app %>/images',
src: '{,*/}*.svg',
dest: '<%= yeoman.dist %>/images'
}]
}
},
cssmin: {
// This task is pre-configured if you do not wish to use Usemin
// blocks for your CSS. By default, the Usemin block from your
// `index.html` will take care of minification, e.g.
//
// <!-- build:css({.tmp,app}) styles/main.css -->
//
// dist: {
// files: {
// '<%= yeoman.dist %>/styles/main.css': [
// '.tmp/styles/{,*/}*.css',
// '<%= yeoman.app %>/styles/{,*/}*.css'
// ]
// }
// }
},
htmlmin: {
dist: {
options: {
/*removeCommentsFromCDATA: true,
// https://github.com/yeoman/grunt-usemin/issues/44
//collapseWhitespace: true,
collapseBooleanAttributes: true,
removeAttributeQuotes: true,
removeRedundantAttributes: true,
useShortDoctype: true,
removeEmptyAttributes: true,
removeOptionalTags: true*/
},
files: [{
expand: true,
cwd: '<%= yeoman.app %>',
src: '*.html',
dest: '<%= yeoman.dist %>'
}]
}
},
// Put files not handled in other tasks here
copy: {
dist: {
files: [{
expand: true,
dot: true,
cwd: '<%= yeoman.app %>',
dest: '<%= yeoman.dist %>',
src: [
'*.{ico,png,txt}',
'.htaccess',
'images/{,*/}*.{webp,gif}',
'styles/fonts/{,*/}*.*',
'views/*.*',
'index.html',
'bower_components/sass-bootstrap/fonts/*.*'
]
}]
},
styles: {
expand: true,
dot: true,
cwd: '<%= yeoman.app %>/styles',
dest: '.tmp/styles/',
src: '{,*/}*.css'
}
},
modernizr: {
devFile: '<%= yeoman.app %>/bower_components/modernizr/modernizr.js',
outputFile: '<%= yeoman.dist %>/bower_components/modernizr/modernizr.js',
files: [
'<%= yeoman.dist %>/scripts/{,*/}*.js',
'<%= yeoman.dist %>/styles/{,*/}*.css',
'!<%= yeoman.dist %>/scripts/vendor/*'
],
uglify: true
},
concurrent: {
server: [
'compass',
'copy:styles'
],
test: [
'copy:styles'
],
dist: [
'compass',
'copy:styles',
'imagemin',
'svgmin',
'htmlmin'
]
},
bower: {
options: {
exclude: ['modernizr']
},
all: {
rjsConfig: '<%= yeoman.app %>/scripts/main.js'
}
}
});
grunt.registerTask('server', function (target) {
if (target === 'dist') {
return grunt.task.run(['build', 'connect:dist:keepalive']);
}
grunt.task.run([
'clean:server',
'concurrent:server',
'autoprefixer',
'connect:livereload',
'watch'
]);
});
grunt.registerTask('test', [
'clean:server',
'concurrent:test',
'autoprefixer',
'connect:test',
'mocha'
]);
grunt.registerTask('build', [
'clean:dist',
'useminPrepare',
'concurrent:dist',
'autoprefixer',
'concat',
'cssmin',
'uglify',
'usemin',
'copy:dist'
]);
grunt.registerTask('default', [
'jshint',
'test',
'build'
]);
};

202
dashboard/LICENSE Normal file
View File

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -1,5 +1,13 @@
This directory holds the frontend for the etcd dashboard. To have etcd serve from this directory run:
# etcd Dashboard
## Developing
### Install yeoman
http://yeoman.io/
### Hacking
```
ETCD_DASHBOARD_DIR=`pwd`/dashboard ./etcd
grunt server
```

View File

@ -0,0 +1 @@
*.coffee

View File

@ -0,0 +1,51 @@
<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>etcd Browser</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
<!-- build:css(.tmp) styles/main.css -->
<link rel="stylesheet" href="styles/etcd-widgets.css">
<link href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,400,400italic,600,700,900" rel="stylesheet" type="text/css">
<link href="http://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600,700" rel="stylesheet" type="text/css">
<!-- endbuild -->
</head>
<body ng-app="etcdBrowser">
<!--[if lt IE 7]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<!--[if lt IE 9]>
<script src="bower_components/es5-shim/es5-shim.js"></script>
<script src="bower_components/json3/lib/json3.min.js"></script>
<![endif]-->
<!-- Add your site or application content here -->
<div id="etd_browser" ng-view="etcd">
</div>
<!-- build:js scripts/browser-modules.js -->
<script src="bower_components/jquery/jquery.js"></script>
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/angular-resource/angular-resource.js"></script>
<script src="bower_components/angular-route/angular-route.js"></script>
<script src="bower_components/angular-cookies/angular-cookies.js"></script>
<script src="bower_components/angular-sanitize/angular-sanitize.js"></script>
<script src="bower_components/restangular/dist/restangular.js"></script>
<script src="bower_components/underscore/underscore.js"></script>
<script src="bower_components/moment/moment.js"></script>
<!-- endbuild -->
<!-- build:js({.tmp,app}) scripts/browser-scripts.js -->
<script src="scripts/ng-time-relative.min.js"></script>
<script src="scripts/common/services/etcd.js"></script>
<script src="scripts/controllers/browser.js"></script>
<!-- endbuild -->
</body>
</html>

134
dashboard/app/index.html Normal file
View File

@ -0,0 +1,134 @@
<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>etcd dashboard</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<link href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,400,400italic,600,700,900" rel="stylesheet" type="text/css">
<link href="http://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600,700" rel="stylesheet" type="text/css">
<style>
body {
padding: 30px;
margin: 0px;
}
h1 {
font-family: "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
font-weight: 400;
margin: 0px 0px 20px 0px;
padding: 0px;
}
iframe {
border: none;
}
a {
color: #1e6ec1;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
iframe {
margin-bottom: 30px;
}
iframe + iframe {
margin-bottom: 0px;
}
#footer {
width: 100%;
font-family: "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
margin-top: 20px;
}
#coreos-logo {
margin: 10px auto 0 auto;
height: 30px;
width: 80px;
}
#coreos-logo svg {
fill: #999;
max-width: 100px;
display: inline-block;
vertical-align: middle;
}
#powered-by {
font-size: 12px;
color: #333;
width: 100%;
display: inline-block;
vertical-align: middle;
line-height: 190%;
text-align: center;
}
</style>
</head>
<body>
<h1>etcd Dashboard</h1>
<iframe src="stats.html" style="width: 100%; height: 400px;"></iframe>
<iframe src="browser.html" style="width: 100%; height: 400px;"></iframe>
<div id="footer">
<div id="powered-by">Powered by <a href="https://github.com/coreos/etcd">etcd</a></div>
<div id="coreos-logo">
<a href="http://coreos.com">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
preserveAspectRatio="xMinYMin" viewBox="0 0 792 306" enable-background="new 0 0 792 306" xml:space="preserve">
<g>
<g>
<path fill="#53A3DA" d="M136.168,45.527C76.898,45.527,28.689,93.739,28.689,153c0,59.265,48.209,107.474,107.479,107.474
c59.252,0,107.465-48.209,107.465-107.474C243.633,93.739,195.42,45.527,136.168,45.527z"/>
<path fill="#F1606D" d="M136.168,55.389c-17.283,0-31.941,27.645-37.235,66.069c-0.169,1.236-0.333,2.487-0.478,3.746
c-0.723,6.047-1.213,12.335-1.458,18.808c-0.117,2.962-0.175,5.956-0.175,8.988c0,3.029,0.058,6.029,0.175,8.985
c0.245,6.472,0.735,12.764,1.458,18.811c8.104,1.049,16.769,1.761,25.807,2.099c3.907,0.146,7.872,0.233,11.907,0.233
c4.023,0,8-0.088,11.895-0.233c9.049-0.338,17.708-1.05,25.819-2.099c0.892-0.114,1.77-0.239,2.659-0.368
c33.754-4.74,57.235-15.232,57.235-27.428C233.776,99.088,190.071,55.389,136.168,55.389z"/>
<path fill="#FFFFFF" d="M176.541,125.569c-0.979-1.428-2.029-2.796-3.148-4.11c-8.956-10.557-22.297-17.265-37.224-17.265
c-4.839,0-9.148,7.407-11.907,18.909c-1.096,4.586-1.947,9.819-2.495,15.498c-0.432,4.551-0.665,9.391-0.665,14.399
s0.233,9.849,0.665,14.396c4.554,0.432,9.387,0.664,14.402,0.664c5.009,0,9.842-0.232,14.396-0.664
c10.011-0.95,18.653-2.875,24.775-5.411c6.046-2.501,9.624-5.615,9.624-8.985C184.963,142.832,181.858,133.388,176.541,125.569z"
/>
</g>
<g>
<path fill="#231F20" d="M344.891,100.053c12.585,0,22.816,6.138,29.262,13.062l-10.064,11.326
c-5.353-5.192-11.175-8.495-19.041-8.495c-16.839,0-28.953,14.16-28.953,37.291c0,23.448,11.169,37.608,28.32,37.608
c9.128,0,15.895-3.775,21.717-10.228l10.067,11.169c-8.335,9.598-19.038,14.95-32.099,14.95c-26.119,0-46.731-18.88-46.731-53.025
C297.37,120.036,318.454,100.053,344.891,100.053z"/>
<path fill="#231F20" d="M416.961,125.701c19.352,0,36.822,14.793,36.822,40.597c0,25.647-17.471,40.439-36.822,40.439
c-19.197,0-36.66-14.792-36.66-40.439C380.301,140.494,397.764,125.701,416.961,125.701z M416.961,191.945
c11.33,0,18.25-10.228,18.25-25.647c0-15.577-6.92-25.804-18.25-25.804s-18.094,10.227-18.094,25.804
C398.867,181.717,405.631,191.945,416.961,191.945z"/>
<path fill="#231F20" d="M459.771,127.589h14.943l1.26,13.688h0.629c5.506-10.07,13.691-15.577,21.871-15.577
c3.938,0,6.455,0.472,8.811,1.574l-3.148,15.734c-2.67-0.784-4.717-1.257-8.018-1.257c-6.139,0-13.539,4.245-18.256,15.893v47.203
h-18.092V127.589z"/>
<path fill="#231F20" d="M541.121,125.701c20.928,0,31.941,15.107,31.941,36.667c0,3.458-0.314,6.604-0.787,8.495h-49.09
c1.57,14.003,10.379,21.869,22.811,21.869c6.613,0,12.273-2.041,17.941-5.662l6.135,11.326
c-7.395,4.878-16.676,8.341-26.432,8.341c-21.404,0-38.08-14.95-38.08-40.439C505.561,141.12,523.023,125.701,541.121,125.701z
M557.326,159.376c0-12.277-5.189-19.671-15.732-19.671c-9.125,0-16.996,6.768-18.57,19.671H557.326z"/>
<path fill="#F1606D" d="M600.602,152.607c0-32.729,17.785-53.344,42.799-53.344c24.863,0,42.641,20.615,42.641,53.344
c0,32.889-17.777,54.13-42.641,54.13C618.387,206.737,600.602,185.496,600.602,152.607z M678.49,152.607
c0-28.639-14.158-46.731-35.09-46.731c-21.084,0-35.248,18.093-35.248,46.731c0,28.796,14.164,47.521,35.248,47.521
C664.332,200.128,678.49,181.403,678.49,152.607z"/>
<path fill="#53A4D9" d="M699.738,186.125c7.557,8.495,18.412,14.003,30.529,14.003c15.732,0,25.807-8.499,25.807-20.767
c0-12.904-8.494-17.154-18.723-21.717l-15.736-7.082c-8.969-3.936-20.934-10.385-20.934-25.808
c0-14.947,12.904-25.492,30.059-25.492c12.588,0,22.658,5.665,28.949,12.435l-4.244,4.878c-5.982-6.452-14.32-10.7-24.705-10.7
c-13.691,0-22.816,7.239-22.816,18.565c0,11.962,10.385,16.521,17.936,19.985l15.738,6.921
c11.486,5.195,21.713,11.647,21.713,27.539s-13.061,27.851-33.201,27.851c-15.107,0-26.75-6.451-34.932-15.576L699.738,186.125z"
/>
</g>
</g>
</svg>
</a>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,81 @@
'use strict';
angular.module('etcd', [])
.factory('EtcdV1', ['$http', function($http) {
var keyPrefix = '/v1/keys/'
var statsPrefix = '/v1/stats/'
var baseURL = '/v1/'
delete $http.defaults.headers.common['X-Requested-With'];
function cleanupPath(path) {
var parts = path.split('/');
if (parts.length === 0) {
return '';
}
parts = parts.filter(function(v){return v!=='';});
return parts.join('/');
}
function newKey(keyName) {
var self = {};
self.name = cleanupPath(keyName);
self.getParent = function() {
var parts = self.name.split('/');
if (parts.length === 0) {
return newKey('');
}
parts.pop();
return newKey(parts.join('/'));
};
self.path = function() {
return '/' + cleanupPath(keyPrefix + self.name);
};
self.get = function() {
return $http.get(self.path());
};
self.set = function(keyValue) {
return $http({
url: self.path(),
data: $.param({value: keyValue}),
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
});
};
self.deleteKey = function(keyValue) {
return $http({
url: self.path(),
method: 'DELETE',
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
});
};
return self;
}
function newStat(statName) {
var self = {};
self.name = cleanupPath(statName);
self.path = function() {
return '/' + cleanupPath(statsPrefix + self.name);
};
self.get = function() {
return $http.get(self.path());
};
return self
}
return {
getStat: newStat,
getKey: newKey
}
}]);

View File

@ -0,0 +1,191 @@
'use strict';
angular.module('etcdBrowser', ['ngRoute', 'etcd', 'timeRelative'])
.constant('keyPrefix', '/v1/keys')
.config(['$routeProvider', 'keyPrefix', function ($routeProvider, keyPrefix) {
//read localstorage
var previousPath = localStorage.getItem('etcd_path');
$routeProvider
.when('/', {
redirectTo: keyPrefix
})
.otherwise({
templateUrl: 'views/browser.html',
controller: 'MainCtrl'
});
}])
.controller('MainCtrl', ['$scope', '$location', 'EtcdV1', 'keyPrefix', function ($scope, $location, EtcdV1, keyPrefix) {
$scope.save = 'etcd-save-hide';
$scope.preview = 'etcd-preview-hide';
$scope.enableBack = true;
$scope.writingNew = false;
// etcdPath is the path to the key that is currenly being looked at.
$scope.etcdPath = $location.path();
$scope.$watch('etcdPath', function() {
function etcdPathKey() {
return pathKey($scope.etcdPath);
}
function pathKey(path) {
var parts = path.split(keyPrefix);
if (parts.length === 1) {
return '';
}
return parts[1];
}
// Notify everyone of the update
localStorage.setItem('etcdPath', $scope.etcdPath);
$scope.enableBack = true;
//disable back button if at root (/v1/keys/)
if($scope.etcdPath === '') {
$scope.enableBack = false;
}
$scope.key = EtcdV1.getKey(etcdPathKey($scope.etcdPath));
});
$scope.$watch('key', function() {
if ($scope.writingNew === true) {
return;
}
$scope.key.get().success(function (data, status, headers, config) {
//hide any errors
$('#etcd-browse-error').hide();
// Looking at a directory if we got an array
if (data.length) {
$scope.list = data;
$scope.preview = 'etcd-preview-hide';
} else {
$scope.singleValue = data.value;
$scope.preview = 'etcd-preview-reveal';
$scope.key.getParent().get().success(function(data) {
$scope.list = data;
});
}
$scope.previewMessage = 'No key selected.';
}).error(function (data, status, headers, config) {
$scope.previewMessage = 'Key does not exist.';
$scope.showBrowseError(data.message);
});
});
//back button click
$scope.back = function() {
$scope.etcdPath = $scope.key.getParent().path();
$scope.syncLocation();
$scope.preview = 'etcd-preview-hide';
$scope.writingNew = false;
};
$scope.syncLocation = function() {
$location.path($scope.etcdPath);
};
$scope.showSave = function() {
$scope.save = 'etcd-save-reveal';
};
$scope.saveData = function() {
// TODO: fixup etcd to allow for empty values
$scope.key.set($scope.singleValue || ' ').success(function (data, status, headers, config) {
$scope.save = 'etcd-save-hide';
$scope.preview = 'etcd-preview-hide';
$scope.back();
$scope.writingNew = false;
}).error(function (data, status, headers, config) {
$scope.showSaveError(data.message);
});
};
$scope.deleteKey = function() {
$scope.key.deleteKey().success(function (data, status, headers, config) {
//TODO: remove loader
$scope.save = 'etcd-save-hide';
$scope.preview = 'etcd-preview-hide';
$scope.back();
}).error(function (data, status, headers, config) {
//TODO: remove loader
//show errors
$scope.showBrowseError('Error: Could not delete the key');
});
};
$scope.add = function() {
$scope.save = 'etcd-save-reveal';
$scope.preview = 'etcd-preview-reveal';
$scope.singleValue = '';
$('.etcd-browser-path').find('input').focus();
$scope.writingNew = true;
};
$scope.showBrowseError = function(message) {
$('#etcd-browse-error').find('.etcd-popover-content').text('Error: ' + message);
$('#etcd-browse-error').addClass('etcd-popover-right').show();
};
$scope.showSaveError = function(message) {
$('#etcd-save-error').find('.etcd-popover-content').text('Error: ' + message);
$('#etcd-save-error').addClass('etcd-popover-left').show();
};
$scope.getHeight = function() {
return $(window).height();
};
$scope.$watch($scope.getHeight, function() {
$('.etcd-body').css('height', $scope.getHeight()-45);
});
window.onresize = function(){
$scope.$apply();
};
}])
.directive('ngEnter', function() {
return function(scope, element, attrs) {
element.bind('keydown keypress', function(event) {
if(event.which === 13) {
scope.$apply(function(){
scope.$eval(attrs.ngEnter);
});
event.preventDefault();
}
});
};
})
.directive('highlight', function() {
return {
restrict: 'A',
link: function(scope, element, attrs) {
if('#' + scope.etcdPath === attrs.href) {
element.parent().parent().addClass('etcd-selected');
}
}
};
});
moment.lang('en', {
relativeTime : {
future: 'Expires in %s',
past: 'Expired %s ago',
s: 'seconds',
m: 'a minute',
mm: '%d minutes',
h: 'an hour',
hh: '%d hours',
d: 'a day',
dd: '%d days',
M: 'a month',
MM: '%d months',
y: 'a year',
yy: '%d years'
}
});

View File

@ -0,0 +1,181 @@
'use strict';
angular.module('etcdStats', ['ngRoute', 'etcd'])
.config(['$routeProvider', function ($routeProvider) {
$routeProvider
.when('/', {
templateUrl: 'views/stats.html',
controller: 'StatsCtrl'
})
.otherwise({
templateUrl: 'views/stats.html',
controller: 'StatsCtrl'
});
}])
.controller('StatsCtrl', ['$scope', 'EtcdV1', 'statsVega', function ($scope, EtcdV1, statsVega) {
$scope.graphContainer = '#latency';
$scope.graphVisibility = 'etcd-graph-show';
$scope.tableVisibility = 'etcd-table-hide';
//make requests
function readStats() {
EtcdV1.getStat('leader').get().success(function(data) {
$scope.leaderStats = data;
$scope.followers = [];
$.each(data.followers, function(index, value) {
value.name = index;
$scope.followers.push(value);
});
drawGraph();
});
}
function drawGraph () {
//hardcoded padding from chart json
var vertPadding = 30;
var horzPadding = 15;
//fetch width and height of graph area
var width = $($scope.graphContainer).width() - horzPadding;
var height = $($scope.graphContainer).height() - vertPadding;
// parse a spec and create a visualization view
function parse(spec) {
vg.parse.spec(spec, function(chart) {
chart({
el: $scope.graphContainer,
data: {
'stats': $scope.followers
}
}).width(width).height(height).update();
});
}
parse(statsVega);
}
$scope.showTable = function() {
$scope.tableVisibility = 'etcd-table-reveal';
};
$scope.showGraph = function() {
$scope.tableVisibility = 'etcd-table-hide';
};
$scope.getHeight = function() {
return $(window).height();
};
$scope.getWidth = function() {
return $(window).width();
};
$scope.$watch($scope.getHeight, function() {
$('.etcd-body').css('height', $scope.getHeight()-5);
readStats();
});
$scope.$watch($scope.getWidth, function() {
readStats();
});
window.onresize = function(){
$scope.$apply();
};
// Update the graphs live
setInterval(function() {
readStats();
$scope.$apply();
}, 500);
}])
/* statsVega returns the vega configuration for the stats dashboard */
.factory('statsVega', function () {
return {
'padding': {'top': 10, 'left': 5, 'bottom': 40, 'right': 10},
'data': [
{
'name': 'stats'
},
{
'name': 'thresholds',
'values': [50, 100]
}
],
'scales': [
{
'name': 'y',
'type': 'ordinal',
'range': 'height',
'domain': {'data': 'stats', 'field': 'index'}
},
{
'name': 'x',
'range': 'width',
'domainMin': 0,
'domainMax': 100,
'nice': true,
'zero': true,
'domain': {'data': 'stats', 'field': 'data.latency.current'}
},
{
'name': 'color',
'type': 'linear',
'domain': [10, 50, 100, 1000000000],
'range': ['#00DB24', '#FFC000', '#c40022', '#c40022']
}
],
'axes': [
{
'type': 'x',
'scale': 'x',
'ticks': 6,
'name': 'Latency (ms)'
},
{
'type': 'y',
'scale': 'y',
'properties': {
'ticks': {
'stroke': {'value': 'transparent'}
},
'majorTicks': {
'stroke': {'value': 'transparent'}
},
'labels': {
'fill': {'value': 'transparent'}
},
'axis': {
'stroke': {'value': '#333'},
'strokeWidth': {'value': 1}
}
}
}
],
'marks': [
{
'type': 'rect',
'from': {'data': 'stats'},
'properties': {
'enter': {
'x': {'scale': 'x', 'value': 0},
'x2': {'scale': 'x', 'field': 'data.latency.current'},
'y': {'scale': 'y', 'field': 'index', 'offset': -1},
'height': {'value': 3},
'fill': {'scale':'color', 'field':'data.latency.current'}
}
}
},
{
'type': 'symbol',
'from': {'data': 'stats'},
'properties': {
'enter': {
'x': {'scale': 'x', 'field': 'data.latency.current'},
'y': {'scale': 'y', 'field': 'index'},
'size': {'value': 50},
'fill': {'value': '#000'}
}
}
}
]
};
});

View File

@ -0,0 +1 @@
(function(e){if("function"==typeof bootstrap)bootstrap("ng-time-relative",e);else if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeNgTimeRelative=e}else"undefined"!=typeof window?window.ngTimeRelative=e():global.ngTimeRelative=e()})(function(){var define,ses,bootstrap,module,exports;return function(e,t,n){function i(n,s){if(!t[n]){if(!e[n]){var o=typeof require=="function"&&require;if(!s&&o)return o(n,!0);if(r)return r(n,!0);throw new Error("Cannot find module '"+n+"'")}var u=t[n]={exports:{}};e[n][0](function(t){var r=e[n][1][t];return i(r?r:t)},u,u.exports)}return t[n].exports}var r=typeof require=="function"&&require;for(var s=0;s<n.length;s++)i(n[s]);return i}({1:[function(require,module,exports){"use strict";exports=module.exports=function(module){module.constant("timeRelativeConfig",{calendar:{en:{lastDay:"[Yesterday], LT",sameDay:"[Today], LT",nextDay:"[Tomorrow], LT",lastWeek:"dddd, LT",nextWeek:"Next dddd, LT",sameElse:"LL"}}}).directive("relative",["$timeout","moment",directive]).run(function(moment,timeRelativeConfig){angular.forEach(timeRelativeConfig.calendar,function(translation,lang){moment.lang(lang,{calendar:translation})})})};exports.directive=directive;if(angular){var mod=angular.module("timeRelative",[]);if(moment){mod.constant("moment",moment);moment.lang("en",{})}exports(mod)}function directive($timeout,moment){return{restrict:"AC",scope:{datetime:"@"},link:function(scope,element,attrs){var timeout;scope.$watch("datetime",function(dateString){$timeout.cancel(timeout);var date=moment(dateString);if(!date)return;var to=function(){return moment(attrs.to)};var withoutSuffix="withoutSuffix"in attrs;if(!attrs.title)element.attr("title",date.format("LLLL"));function updateTime(){element.text(diffString(date,to()))}function diffString(a,b){if(Math.abs(a.clone().startOf("day").diff(b,"days",true))<1)return a.from(b,withoutSuffix);else return a.calendar(b)}function updateLater(){updateTime();timeout=$timeout(function(){updateLater()},nextUpdateIn())}function nextUpdateIn(){var delta=Math.abs(moment().diff(date));if(delta<45e3)return 45e3-delta;if(delta<9e4)return 9e4-delta;if(delta<45*6e4)return 6e4-(delta+3e4)%6e4;return 366e4-delta%36e5}element.bind("$destroy",function(){$timeout.cancel(timeout)});updateLater()})}}}},{}]},{},[1])});

File diff suppressed because it is too large Load Diff

51
dashboard/app/stats.html Normal file
View File

@ -0,0 +1,51 @@
<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>etcd Browser</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
<!-- build:css(.tmp) styles/main.css -->
<link rel="stylesheet" href="styles/etcd-widgets.css">
<link href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,400,400italic,600,700,900" rel="stylesheet" type="text/css">
<link href="http://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600,700" rel="stylesheet" type="text/css">
<!-- endbuild -->
</head>
<body ng-app="etcdStats">
<!--[if lt IE 7]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<!--[if lt IE 9]>
<script src="bower_components/es5-shim/es5-shim.js"></script>
<script src="bower_components/json3/lib/json3.min.js"></script>
<![endif]-->
<!-- Add your site or application content here -->
<div id="etd_stats" ng-view="etcd">
</div>
<!-- build:js scripts/stats-modules.js -->
<script src="bower_components/jquery/jquery.js"></script>
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/angular-resource/angular-resource.js"></script>
<script src="bower_components/angular-route/angular-route.js"></script>
<script src="bower_components/angular-cookies/angular-cookies.js"></script>
<script src="bower_components/angular-sanitize/angular-sanitize.js"></script>
<script src="bower_components/d3/d3.js"></script>
<script src="bower_components/restangular/dist/restangular.js"></script>
<script src="bower_components/underscore/underscore.js"></script>
<!-- endbuild -->
<!-- build:js({.tmp,app}) scripts/stats-scripts.js -->
<script src="scripts/vega.js"></script>
<script src="scripts/common/services/etcd.js"></script>
<script src="scripts/controllers/stats.js"></script>
<!-- endbuild -->
</body>
</html>

6167
dashboard/app/styles/bootstrap.css vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,694 @@
body {
margin: 0px;
}
.etcd-container {
background-color: #fff;
border: 1px solid #ddd;
border-radius: 5px;
box-shadow: rgba(0, 0, 0, 0.14902) 0px 1px 3px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
overflow: hidden;
box-sizing: border-box;
-moz-box-sizing: border-box;
position: relative;
}
a {
color: #2176AC;
text-decoration: none;
}
a:hover, a:active {
text-decoration: underline;
}
input[type=text] {
box-shadow: inset 0 1px 2px rgba(0,0,0,.5);
border: none;
border-radius: 3px;
font-size: 13px;
padding-left: 5px;
padding-right: 5px;
height: 25px;
}
input[type=text]:focus {
}
h2 {
font-size: 22px;
font-family: "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
font-weight: 500;
margin: 0 0 20px 0;
padding: 0;
}
.etcd-button {
display:inline-block;
padding:6px 12px;
margin-bottom:0;
font-size:14px;
font-weight:normal;
line-height:1.428571429;
text-align:center;
white-space:nowrap;
vertical-align:middle;
cursor:pointer;
border:1px solid transparent;
border-radius:4px;
-webkit-user-select:none;
-moz-user-select:none;
-ms-user-select:none;
-o-user-select:none;
user-select:none;
margin: 0px;
border: none;
box-shadow: inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.25);
}
.etcd-button.etcd-button-small {
height: 25px;
padding: 0 10px;
font-size: 13px;
}
.etcd-button-primary {
background-color: #428BCA;
color: #fff;
text-shadow: 0 0 3px rgba(0,0,0,0.25);
}
.etcd-button-primary:active {
background-color: #2276ad;
}
.etcd-popover {
background: #333;
border-radius: 3px;
padding: 15px;
position: absolute;
top: 39px;
z-index: 9999;
color: #fff;
font-size: 13px;
box-shadow: 0px 2px 10px rgba(0,0,0,.5);
display: none;
}
.etcd-popover-error .etcd-popover-content {
color: #FF3C43;
font-weight: bold;
}
.etcd-popover-notch {
width: 14px;
height: 14px;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
position: absolute;
margin-top: -5px;
margin-left: 3px;
background: #333;
top: 0px;
right: 15px;
}
.etcd-popover.etcd-popover-right {
left: 77px;
}
.etcd-popover-right .etcd-popover-notch {
left: 15px;
}
.etcd-popover.etcd-popover-left {
right: 10px;
}
.etcd-popover-left .etcd-popover-notch {
right: 15px;
}
.etcd-popover-confirm {
margin-top: 10px;
}
.etcd-popover-confirm button {
}
.etcd-header {
width: 100%;
position: relative;
box-sizing: border-box;
-moz-box-sizing: border-box;
}
.etcd-header.solid {
background: #eeeeee;
background: -moz-linear-gradient(top, #eeeeee 0%, #dddddd 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#eeeeee), color-stop(100%,#dddddd));
background: -webkit-linear-gradient(top, #eeeeee 0%,#dddddd 100%);
background: -o-linear-gradient(top, #eeeeee 0%,#dddddd 100%);
background: -ms-linear-gradient(top, #eeeeee 0%,#dddddd 100%);
background: linear-gradient(to bottom, #eeeeee 0%,#dddddd 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#dddddd',GradientType=0 );
}
.etcd-body {
top: 0px;
left: 0px;
position: relative;
overflow-y: auto;
overflow-x: hidden;
height: 100%;
width: 100%;
box-sizing: border-box;
-moz-box-sizing: border-box;
}
.etcd-body table {
width: 100%;
box-sizing: border-box;
-moz-box-sizing: border-box;
}
.etcd-body table thead td {
text-transform: uppercase;
font-size: 11px;
line-height: 20px;
border-bottom: 1px solid #ddd;
padding-top: 0px;
padding-right: 10px;
padding-bottom: 0px;
padding-left: 0px;
color: #666;
}
.etcd-body table tbody td {
line-height: 18px;
border-bottom: 1px solid #ddd;
padding-top: 6px;
padding-right: 10px;
padding-bottom: 6px;
padding-left: 0px;
vertical-align: text-top;
}
.etcd-body table .etcd-ttl-header {
width: 33%;
}
.etcd-body table tbody .etcd-ttl {
font-size: 13px;
}
.etcd-body table tbody .etcd-ttl .etcd-ttl-none {
color: #999;
font-weight: 100;
}
.etcd-body table .etcd-actions-header {
width: 30px;
}
.etcd-body table thead td:first-child, .etcd-body table tbody td:first-child {
padding-left: 10px;
}
.etcd-body table thead td:last-child, .etcd-body table tbody td:last-child {
padding-right: 10px;
}
.etcd-container .etcd-preview .etcd-dialog {
background: #333;
position: absolute;
right: 0px;
left: 0px;
padding: 20px;
color: #fff;
font-size: 14px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
bottom: 0px;
opacity: 0;
min-height: 110px; /* REMOVE ME! */
transition-property: all;
transition-duration: 150ms;
transition-timing-function: ease-in-out;
}
.etcd-container .etcd-preview .etcd-dialog .etcd-dialog-message {
margin-bottom: 20px;
}
.etcd-container .etcd-preview .etcd-dialog .etcd-dialog-buttons a {
line-height: 34px;
color: #fff;
vertical-align: middle;
margin-left: 10px;
}
/*.etcd-container .etcd-preview .etcd-dialog.etcd-reveal {
opacity: 1;
}
.etcd-container .etcd-preview .etcd-dialog.etcd-hide {
opacity: 0;
}*/
.etcd-body .etcd-list {
padding: 20px;
box-sizing: border-box;
-moz-box-sizing: border-box;
overflow: auto;
height: 100%;
position: absolute;
}
.etcd-body .etcd-list .etcd-selected {
background-color: #EAF3FF;
}
.etcd-body .etcd-list a.directory {
font-weight: bold;
}
.etcd-body .etcd-list tr:hover .etcd-delete svg {
1visibility: visible;
fill: #ff0000;
}
.etcd-body .etcd-list .etcd-delete {
height: 20px;
width: 25px;
vertical-align: middle;
margin: 0px;
display: inline-block;
}
.etcd-body .etcd-list .etcd-delete svg {
height: 20px;
fill: #eee;
}
.etcd-body .etcd-list .etcd-selected .etcd-delete svg {
height: 20px;
fill: #ddd;
}
.etcd-body .etcd-list .etcd-delete:hover svg {
cursor: pointer;
fill: #ff0000;
}
.etcd-container.etcd-browser {
}
.etcd-container.etcd-browser .etcd-header {
height: 37px;
}
.etcd-back {
height: 37px;
width: 37px;
vertical-align: middle;
margin: 0px;
position: absolute;
top: 0px;
left: 3px;
display: none;
}
.etcd-container.etcd-browser.etcd-preview-reveal .etcd-back {
display: block;
}
.etcd-container.etcd-browser.etcd-preview-hide .etcd-back {
display: block;
}
.etcd-back svg {
height: 20px;
padding: 8px 6px;
}
.etcd-back:hover svg {
cursor: pointer;
fill: #428bca;
}
.etcd-back.etcd-disabled svg {
fill: #bbb;
}
.etcd-add {
height: 37px;
width: 37px;
vertical-align: middle;
margin: 0px;
position: absolute;
top: 0px;
left: 36px;
}
.etcd-container.etcd-browser.etcd-preview-reveal .etcd-add {
}
.etcd-container.etcd-browser.etcd-preview-hide .etcd-add {
}
.etcd-add svg {
height: 22px;
padding: 7px 6px;
}
.etcd-add:hover svg {
cursor: pointer;
fill: #428bca;
}
.etcd-add.etcd-disabled svg {
fill: #bbb;
}
.etcd-container.etcd-browser .etcd-header .etcd-browser-path {
position: absolute;
left: 72px;
right: 0px;
top: 0;
margin: 6px 5px 6px 5px;
}
.etcd-container.etcd-browser .etcd-header .etcd-browser-path input {
width: 100%;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
}
.etcd-container.etcd-browser .etcd-header .etcd-save {
position: absolute;
width: 54px;
right: -55px;
margin: 6px 0;
}
.etcd-container.etcd-browser.etcd-save-reveal .etcd-header .etcd-save {
right: 7px;
}
.etcd-container.etcd-browser.etcd-save-reveal .etcd-header .etcd-browser-path {
right: 62px;
}
.etcd-container.etcd-browser.etcd-save-hide .etcd-header .etcd-save {
right: -55px;
}
.etcd-container.etcd-browser.etcd-save-hide .etcd-header .etcd-browser-path {
right: 0px;
}
.etcd-container.etcd-browser .etcd-preview {
position: absolute;
left: 100%;
min-height: 100%;
overflow-y: auto;
overflow-x: hidden;
top: 0px;
box-sizing: border-box;
-moz-box-sizing: border-box;
background-color: #fff;
width: 100%;
border-left: 1px solid #ddd;
}
.etcd-container.etcd-browser .etcd-preview pre, .etcd-container.etcd-browser .etcd-preview textarea {
padding: 20px 20px 20px 20px;
margin: 0px;
font-family: Consolas, "Liberation Mono", Courier, monospace;
height: 100%;
width: 100%;
white-space: pre-wrap;
position: absolute;
font-size: 13px;
border: 1px;
outline: none;
box-sizing: border-box;
-moz-box-sizing: border-box;
}
.etcd-container.etcd-browser.etcd-preview-reveal .etcd-preview pre, .etcd-container.etcd-browser.etcd-preview-reveal .etcd-preview textarea {
display: block;
}
.etcd-container.etcd-browser .etcd-preview .etcd-empty {
top: 0px;
bottom: 0px;
width: 100%;
text-align: center;
position: absolute;
}
.etcd-container.etcd-browser.etcd-preview-reveal .etcd-empty {
display: none;
}
.etcd-container.etcd-browser .etcd-preview .etcd-empty-message {
margin-top: 25%;
color: #999;
}
/* Single Column Positioning */
@media (max-width: 700px) {
.etcd-container.etcd-browser .etcd-list {
width: 100%;
}
.etcd-container.etcd-browser.etcd-preview-reveal .etcd-list {
left: -100%;
transition-property: all;
transition-duration: 250ms;
transition-timing-function: ease-in-out;
}
.etcd-container.etcd-browser.etcd-preview-hide .etcd-list {
left: 0%;
transition-property: all;
transition-duration: 250ms;
transition-timing-function: ease-in-out;
}
.etcd-container.etcd-browser .etcd-preview {
left: 100%;
}
.etcd-container.etcd-browser.etcd-preview-reveal .etcd-preview {
left: -1px;
transition-property: all;
transition-duration: 250ms;
transition-timing-function: ease-in-out;
}
.etcd-container.etcd-browser.etcd-preview-hide .etcd-preview {
left: 100%;
transition-property: all;
transition-duration: 250ms;
transition-timing-function: ease-in-out;
}
}
/* Double Column Positioning */
@media (min-width: 700px) {
.etcd-container.etcd-browser .etcd-list {
width: 50%;
}
.etcd-container.etcd-browser .etcd-preview {
left: 50%;
width: 50%;
}
.etcd-container.etcd-browser.etcd-preview-reveal .etcd-preview {
left: 50%; /* does nothing */
}
.etcd-container.etcd-browser.etcd-preview-reveal .etcd-preview .etcd-empty {
display: none;
}
.etcd-container.etcd-browser.etcd-preview-hide .etcd-preview {
left: 50%; /* does nothing */
}
.etcd-container.etcd-browser.etcd-preview-hide .etcd-preview .etcd-empty {
display: block;
}
.etcd-container.etcd-browser.etcd-preview-hide .etcd-preview pre, .etcd-container.etcd-browser.etcd-preview-hide .etcd-preview textarea {
display: none;
}
}
.etcd-container.etcd-stats {
}
.etcd-container.etcd-stats h2 {
margin-top: -7px;
}
.etcd-format-selector {
position: absolute;
top: 12px;
right: 16px;
z-index: 999;
}
.etcd-format-selector .etcd-selector-item {
display: inline-block;
height: 12px;
width: 12px;
padding: 8px 4px;
}
.etcd-format-selector .etcd-selector-item:hover {
cursor: pointer;
}
.etcd-format-selector .etcd-selector-item svg {
fill: #333;
}
.etcd-container.etcd-stats .etcd-graph {
box-sizing: border-box;
-moz-box-sizing: border-box;
position: absolute;
top: 0px;
bottom: 0px;
left: 0px;
right: 0px;
padding: 20px;
}
.etcd-container.etcd-stats .etcd-graph .etcd-graph-container {
position: absolute;
top: 60px;
bottom: 20px;
left: 20px;
right: 20px;
box-sizing: border-box;
-moz-box-sizing: border-box;
}
.etcd-container.etcd-stats table .etcd-latency {
width: 50%;
}
.etcd-container.etcd-stats .etcd-list {
position: absolute;
left: 100%;
min-height: 100%;
overflow-y: auto;
overflow-x: hidden;
top: 0px;
box-sizing: border-box;
-moz-box-sizing: border-box;
background-color: #fff;
width: 100%;
border-left: 1px solid #ddd;
}
.etcd-container.etcd-stats .etcd-list .etcd-square {
height: 10px;
width: 10px;
display: inline-block;
margin-right: 5px;
}
.etcd-container.etcd-stats .etcd-list .etcd-square-red {
background-color: #c40022;
}
.etcd-container.etcd-stats .etcd-list .etcd-square-orange {
background-color: #FFC000;
}
.etcd-container.etcd-stats .etcd-list .etcd-square-green {
background-color: #00DB24;
}
.etcd-container.etcd-stats .etcd-list .etcd-latency-value {
display: inline-block;
}
/* Single Column Positioning */
@media (max-width: 700px) {
.etcd-container.etcd-stats .etcd-list {
width: 100%;
left: 100%;
}
.etcd-container.etcd-stats .etcd-graph {
left: 0%;
}
.etcd-container.etcd-stats.etcd-table-reveal .etcd-graph {
left: -100%;
transition-property: all;
transition-duration: 250ms;
transition-timing-function: ease-in-out;
}
.etcd-container.etcd-stats.etcd-table-hide .etcd-graph {
left: 0%;
transition-property: all;
transition-duration: 250ms;
transition-timing-function: ease-in-out;
}
.etcd-container.etcd-stats.etcd-table-hide .etcd-format-selector .etcd-selector-graph svg * {
fill: #428bca;
}
.etcd-container.etcd-stats.etcd-table-hide .etcd-list {
left: 100%;
transition-property: all;
transition-duration: 250ms;
transition-timing-function: ease-in-out;
}
.etcd-container.etcd-stats.etcd-table-reveal .etcd-list {
left: 0%;
transition-property: all;
transition-duration: 250ms;
transition-timing-function: ease-in-out;
}
.etcd-container.etcd-stats.etcd-table-reveal .etcd-format-selector .etcd-selector-table svg * {
fill: #428bca;
}
}
/* Double Column Positioning */
@media (min-width: 700px) {
.etcd-container.etcd-stats .etcd-list {
width: 50%;
left: 50%;
}
.etcd-container.etcd-stats .etcd-graph {
left: 0%;
width: 50%;
}
.etcd-container.etcd-stats .etcd-format-selector {
display: none;
}
}

View File

@ -0,0 +1,22 @@
body {
background: #fafafa;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #333;
}
.hero-unit {
margin: 50px auto 0 auto;
width: 300px;
font-size: 18px;
font-weight: 200;
line-height: 30px;
background-color: #eee;
border-radius: 6px;
padding: 60px;
}
.hero-unit h1 {
font-size: 60px;
line-height: 1;
letter-spacing: -1px;
}

View File

@ -0,0 +1,99 @@
<div class="etcd-container etcd-browser {{columns}} {{preview}} {{save}}">
<!--
<div class="etcd-popover etcd-popover-error">
<div class="etcd-popover-notch"></div>
<div class="etcd-popover-content">
Overwrite this value?
</div>
<div class="etcd-popover-confirm">
<button class="etcd-button etcd-button-small etcd-button-primary etcd-confirm">Overwrite</button>
</div>
</div>
-->
<div class="etcd-popover etcd-popover-error" id="etcd-save-error">
<div class="etcd-popover-notch"></div>
<div class="etcd-popover-content">
Error:
</div>
</div>
<div class="etcd-popover etcd-popover-error" id="etcd-browse-error">
<div class="etcd-popover-notch"></div>
<div class="etcd-popover-content">
Error:
</div>
</div>
<div class="etcd-header solid">
<a class="etcd-back" ng-click="back()" ng-class="{false:'etcd-disabled'}[enable_back]">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
preserveAspectRatio="xMinYMin" viewBox="0 0 73.356 61" enable-background="new 0 0 73.356 61" xml:space="preserve">
<path d="M5.27,33.226l22.428,22.428c1.562,1.562,4.095,1.562,5.657,0c1.562-1.562,1.562-4.095,0-5.657L17.77,34.413h48.514
c2.209,0,4-1.791,4-4s-1.791-4-4-4H17.749l15.604-15.582c1.563-1.561,1.565-4.094,0.004-5.657C32.576,4.391,31.552,4,30.527,4
c-1.023,0-2.046,0.39-2.827,1.169L5.272,27.567c-0.751,0.75-1.173,1.768-1.173,2.829C4.098,31.458,4.52,32.476,5.27,33.226z"/>
</svg>
</a>
<a class="etcd-add">
<svg version="1.1" ng-click="add()" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
preserveAspectRatio="xMinYMin" viewBox="0 0 72.556 61" enable-background="new 0 0 72.556 61" xml:space="preserve">
<path d="M34.521,8v11.088v23v10.737c0,2.209,1.791,4,4,4c2.209,0,4-1.791,4-4V42.067V19.109V8c0-2.209-1.791-4-4-4
C36.312,4,34.521,5.791,34.521,8z"/>
<path d="M16.109,34.412h11.088h23h10.737c2.209,0,4-1.791,4-4c0-2.209-1.791-4-4-4H50.175H27.217H16.109c-2.209,0-4,1.791-4,4
C12.109,32.621,13.9,34.412,16.109,34.412z"/>
</svg>
</a>
<div class="etcd-browser-path">
<input type="text" ng-model="etcdPath" ng-enter="syncLocation()" tabindex="888" />
</div>
<button class="etcd-button etcd-button-small etcd-button-primary etcd-save" ng-click="saveData()">Save</button>
</div>
<div class="etcd-body">
<div class="etcd-list">
<table cellpadding="0" cellspacing="0">
<thead>
<td class="etcd-name-header">Name</td>
<td class="etcd-ttl-header">TTL</td>
<td class="etcd-actions-header">&nbsp</td>
</thead>
<tbody>
<tr ng-repeat="key in list | orderBy:'key'">
<td><a ng-class="{true:'directory'}[key.dir]" href="#/v1/keys{{key.key}}" highlight>{{key.key}}</a></td>
<td ng-switch on="!!key.expiration" class="etcd-ttl">
<div ng-switch-when="true"><time relative datetime="{{key.expiration.substring(0, key.expiration.lastIndexOf('-'))}}"></time></div>
<div ng-switch-default class="etcd-ttl-none">&mdash;</div>
</td>
<td>
<div class="etcd-actions">
<div class="etcd-delete" ng-switch on="!!key.dir">
<svg ng-switch-when="false" ng-click="delete_key()" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
x="0px" y="0px" preserveAspectRatio="xMinYMin" viewBox="0 0 76.143 61" enable-background="new 0 0 76.143 61" xml:space="preserve">
<path d="M49.41,13.505l-6.035,6.035L27.112,35.803l-6.035,6.035c-1.562,1.562-1.562,4.095,0,5.657c1.562,1.562,4.095,1.562,5.657,0
l6.05-6.05l16.234-16.234l6.05-6.05c1.562-1.562,1.562-4.095,0-5.657C53.505,11.943,50.972,11.943,49.41,13.505z"/>
<path d="M21.077,19.162l6.035,6.035L43.375,41.46l6.035,6.035c1.562,1.562,4.095,1.562,5.657,0c1.562-1.562,1.562-4.095,0-5.657
l-6.05-6.05L32.783,19.555l-6.05-6.05c-1.562-1.562-4.095-1.562-5.657,0C19.515,15.067,19.515,17.6,21.077,19.162z"/>
</svg>
<div ng-switch-when="true"></div>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="etcd-preview">
<textarea placeholder="Enter a key name above and the value here" ng-model="singleValue" tabindex="888" ng-change="showSave()">
</textarea>
<div class="etcd-empty">
<div class="etcd-empty-message">{{preview_message}}</div>
</div>
<div class="etcd-dialog">
<div class="etcd-dialog-message">
Save and replicate this change?
</div>
<div class="etcd-dialog-buttons">
<button class="etcd-button etcd-button-primary">Save Changes</button>
<a href="javascript:void(0);">Cancel</a>
</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,46 @@
<div class="etcd-container etcd-stats {{columns}} {{tableVisibility}}">
<div class="etcd-body">
<div class="etcd-format-selector">
<div class="etcd-selector-item etcd-selector-graph" ng-click="show_graph()">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
preserveAspectRatio="xMinYMin" viewBox="0 0 60 60.007" enable-background="new 0 0 60 60.007" xml:space="preserve">
<path fill="#1D1D1B" d="M30-0.091c-16.621,0-30.094,13.474-30.094,30.094c0,16.621,13.474,30.094,30.094,30.094
s30.094-13.474,30.094-30.094C60.094,13.383,46.621-0.091,30-0.091z M30,47.239c-9.519,0-17.235-7.716-17.235-17.235
S20.481,12.768,30,12.768c9.519,0,17.235,7.716,17.235,17.235S39.519,47.239,30,47.239z"/>
</svg>
</div>
<div class="etcd-selector-item etcd-selector-table" ng-click="show_table()">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
preserveAspectRatio="xMinYMin" viewBox="0 0 59.496 59.503" enable-background="new 0 0 59.496 59.503" xml:space="preserve">
<rect x="0" y="0" fill="#1D1D1B" width="59.496" height="13.111"/>
<rect x="0" y="23.196" fill="#1D1D1B" width="59.496" height="13.111"/>
<rect x="0" y="46.392" fill="#1D1D1B" width="59.496" height="13.111"/>
</svg>
</div>
</div>
<div class="etcd-graph">
<h2>Follower Latency</h2>
<div class="etcd-graph-container" id="latency">
</div>
</div>
<div class="etcd-list">
<h2>Follower List</h2>
<table cellpadding="0" cellspacing="0">
<thead>
<td class="etcd-name-header">Machine Name</td>
<td class="etcd-latency">Latency</td>
</thead>
<tbody>
<tr ng-repeat="follower in followers">
<td>{{follower.name}}</td>
<td>
<div class="etcd-square ng-class: {'etcd-square-green': follower.latency.current < 2, 'etcd-square-orange': follower.latency.current < 5, 'etcd-square-red': follower.latency.current >= 10}"></div>
<div class="etcd-latency-value">{{follower.latency.current | number:1 }} ms</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>

20
dashboard/bower.json Normal file
View File

@ -0,0 +1,20 @@
{
"name": "etcdDashboard",
"version": "0.0.0",
"dependencies": {
"angular": "~1.2.0-rc.2",
"json3": "~3.2.4",
"jquery": "~1.9.1",
"bootstrap-sass": "~2.3.1",
"es5-shim": "~2.0.8",
"angular-route": "~1.2.0-rc.2",
"angular-resource": "~1.2.0-rc.2",
"angular-cookies": "~1.2.0-rc.2",
"angular-sanitize": "~1.2.0-rc.2"
},
"devDependencies": {
"angular-mocks": "~1.2.0-rc.2",
"angular-scenario": "~1.2.0-rc.2",
"underscore": "~1.5.2"
}
}

10
dashboard/build Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
grunt build
git clean -x -f dashboard/dist
for i in `find dashboard/dist -type f`; do
go build github.com/jteeuwen/go-bindata
./go-bindata -pkg "dist" -toc -prefix dashboard/dist $i
done

View File

@ -0,0 +1,54 @@
// Karma configuration
// http://karma-runner.github.io/0.10/config/configuration-file.html
module.exports = function(config) {
config.set({
// base path, that will be used to resolve files and exclude
basePath: '',
// testing framework to use (jasmine/mocha/qunit/...)
frameworks: ['ng-scenario'],
// list of files / patterns to load in the browser
files: [
'test/e2e/**/*.js'
],
// list of files / patterns to exclude
exclude: [],
// web server port
port: 8080,
// level of logging
// possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,
// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera
// - Safari (only Mac)
// - PhantomJS
// - IE (only Windows)
browsers: ['Chrome'],
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: false
// Uncomment the following lines if you are using grunt's server to run the tests
// proxies: {
// '/': 'http://localhost:9000/'
// },
// URL root prevent conflicts with the site root
// urlRoot: '_karma_'
});
};

52
dashboard/karma.conf.js Normal file
View File

@ -0,0 +1,52 @@
// Karma configuration
// http://karma-runner.github.io/0.10/config/configuration-file.html
module.exports = function(config) {
config.set({
// base path, that will be used to resolve files and exclude
basePath: '',
// testing framework to use (jasmine/mocha/qunit/...)
frameworks: ['jasmine'],
// list of files / patterns to load in the browser
files: [
'app/bower_components/angular/angular.js',
'app/bower_components/angular-mocks/angular-mocks.js',
'app/scripts/*.js',
'app/scripts/**/*.js',
'test/mock/**/*.js',
'test/spec/**/*.js'
],
// list of files / patterns to exclude
exclude: [],
// web server port
port: 8080,
// level of logging
// possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,
// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera
// - Safari (only Mac)
// - PhantomJS
// - IE (only Windows)
browsers: ['Chrome'],
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: false
});
};

38
dashboard/package.json Normal file
View File

@ -0,0 +1,38 @@
{
"name": "etcd-dashboard",
"version": "0.0.0",
"dependencies": {},
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-copy": "~0.4.1",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-coffee": "~0.7.0",
"grunt-contrib-uglify": "~0.2.0",
"grunt-contrib-compass": "~0.5.0",
"grunt-contrib-jshint": "~0.6.0",
"grunt-contrib-cssmin": "~0.6.0",
"grunt-contrib-connect": "~0.3.0",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-htmlmin": "~0.1.3",
"grunt-contrib-imagemin": "~0.2.0",
"grunt-contrib-watch": "~0.5.2",
"grunt-autoprefixer": "~0.2.0",
"grunt-usemin": "~0.1.11",
"grunt-svgmin": "~0.2.0",
"grunt-rev": "~0.1.0",
"grunt-open": "~0.2.0",
"grunt-concurrent": "~0.3.0",
"load-grunt-tasks": "~0.1.0",
"connect-livereload": "~0.2.0",
"grunt-google-cdn": "~0.2.0",
"grunt-ngmin": "~0.0.2",
"time-grunt": "~0.1.0",
"grunt-karma": "~0.6.2"
},
"engines": {
"node": ">=0.8.0"
},
"scripts": {
"test": "grunt test"
}
}

35
dashboard/test/.jshintrc Normal file
View File

@ -0,0 +1,35 @@
{
"node": true,
"browser": true,
"esnext": true,
"bitwise": true,
"camelcase": true,
"curly": true,
"eqeqeq": true,
"immed": true,
"indent": 2,
"latedef": true,
"newcap": true,
"noarg": true,
"quotmark": "single",
"regexp": true,
"undef": true,
"unused": true,
"strict": true,
"trailing": true,
"smarttabs": true,
"globals": {
"after": false,
"afterEach": false,
"angular": false,
"before": false,
"beforeEach": false,
"browser": false,
"describe": false,
"expect": false,
"inject": false,
"it": false,
"spyOn": false
}
}

View File

@ -0,0 +1,10 @@
<!doctype html>
<html lang="en">
<head>
<title>End2end Test Runner</title>
<script src="vendor/angular-scenario.js" ng-autotest></script>
<script src="scenarios.js"></script>
</head>
<body>
</body>
</html>

View File

@ -0,0 +1,22 @@
'use strict';
describe('Controller: MainCtrl', function () {
// load the controller's module
beforeEach(module('etcdDashboardApp'));
var MainCtrl,
scope;
// Initialize the controller and a mock scope
beforeEach(inject(function ($controller, $rootScope) {
scope = $rootScope.$new();
MainCtrl = $controller('MainCtrl', {
$scope: scope
});
}));
it('should attach a list of awesomeThings to the scope', function () {
expect(scope.awesomeThings.length).toBe(3);
});
});