Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Commit

Permalink
Initial Import
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent99 committed Apr 19, 2016
0 parents commit e8f34b6
Show file tree
Hide file tree
Showing 11 changed files with 461 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true


[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2

[*.js]
indent_style = space
indent_size = 2

[*.hbs]
insert_final_newline = false
indent_style = space
indent_size = 2

[*.css]
indent_style = space
indent_size = 2

[*.html]
indent_style = space
indent_size = 2

[*.{diff,md}]
trim_trailing_whitespace = false
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
/tmp

# dependencies
/node_modules
/bower_components

# misc
/.sass-cache
/connect.lock
/coverage/*
/libpeerconnection.log
npm-debug.log
testem.log
.DS_Store
.tern-port
47 changes: 47 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"predef": [
"document",
"window",
"-Promise",
"jQuery",
"$",
"moment",
"c3","d3",
"Terminal",
"Prism",
"Ui",
"dagreD3",
"async",
"AWS",
"Identicon",
"md5",
"_",
"NoVNC",
"commonmark"
],
"browser" : true,
"boss" : true,
"curly": true,
"debug": false,
"devel": true,
"eqeqeq": true,
"evil": true,
"forin": false,
"immed": false,
"laxbreak": false,
"newcap": true,
"noarg": true,
"noempty": false,
"nonew": false,
"nomen": false,
"onevar": false,
"plusplus": false,
"regexp": false,
"undef": true,
"sub": true,
"strict": false,
"white": false,
"eqnull": true,
"esnext": true,
"unused": true
}
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# ui-driver-skel
Skeleton Rancher UI driver for custom docker-machine drivers

## Setup

* Fork this repository into your own account as `ui-driver-DRIVERNAME`
* DRIVERNAME should be the name of the driver that you would give to `docker-machine create --driver`, e.g. "mycompany", "digitalocean", "vultr", etc.
* Update the "name" in package.json to match
* You should also update description, URLs, etc, but these aren't strictly required.
* `npm install`
* `bower install`

## Development

This package contains a small web-server that will serve up the custom driver UI at `https://localhost:3000/component.js`. You can run this while developing and point the Rancher settings there.
* `npm start`
* The driver name can be optionally overridden: `npm start -- --name=DRIVERNAME`
* The compiled files are viewable at `https://localhost:3000`.
* **Note:** The development server does not currently automatically restart when files are changed.

## Building

For other users to see your driver, you need to build it and host the output on a server accessible from their browsers.

* `npm build`
* Copy the contents of the `dist` directory onto a webserver.
* If your Rancher is configured to use HA or SSL, the server must also be available via HTTPS.
* If your driver is public, [GitHub release binaries](https://help.github.com/articles/about-releases/) are a simple hosting choice.

## Using

* Add a Machine Driver in Rancher (Admin tab -> Settings -> Machine Drivers)
* Name: Your `DRIVERNAME` (see above).
* Download URL: The URL for the driver binary (e.g. `https://github.com/mycompany/docker-machine-mycompany/releases/download/v1.0.0/docker-machine-driver-mycompany-v1.0.0-linux-amd64.tar.gz`)
* Custom UI URL: The URL you uploaded the `dist` folder to, e.g. `https://github.com/mycompany/ui-driver-mycompany/releases/download/v1.0.0/component.js`)
* Wait for the driver to become "Active"
* Go to Infrastructure -> Hosts -> Add Host, your driver and custom UI should show up.
76 changes: 76 additions & 0 deletions assets/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "ui-driver-rackhd",
"description": "Rancher UI driver for RackHD",
"main": "",
"authors": [
"Rancher Labs, Inc."
],
"license": "Apache-2.0",
"homepage": "https://github.com/rancher/ui-driver-rackhd",
"moduleType": [],
"private": true,
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"ember": "^2.5.0"
}
}
3 changes: 3 additions & 0 deletions component/component.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.machine-driver.%%DRIVERNAME%% {
background-image: url('logo.svg');
}
32 changes: 32 additions & 0 deletions component/component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
define('ui/components/drivers/driver-%%DRIVERNAME%%/component', ['exports', 'ember', 'ui/mixins/driver'], function (exports, _ember, _uiMixinsDriver) {
var Ember = _ember.default;
var DriverMixin = _uiMixinsDriver.default;

exports['default'] = Ember.Component.extend(DriverMixin, {
driverName: 'driver-%%DRIVERNAME%%',
config: Ember.computed.alias('model.%%DRIVERNAME%%Config'),

actions: {
setTransport(str) {
this.set('config.transport', str);
},
},

bootstrap: function() {
let config = this.get('store').createRecord({
type: '%%DRIVERNAME%%Config',
transport: 'http',
endpoint: '',
nodeId: '',
sshUser: 'root',
sshPassword: '',
sshPort: '22',
});

this.set('model', this.get('store').createRecord({
type: 'machine',
'%%DRIVERNAME%%Config': config,
}));
}.on('init'),
});
});
67 changes: 67 additions & 0 deletions component/template.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<section class="horizontal-form">
<div class="container-fluid">
{{!-- This partial contains the quantity, name, and description fields --}}
{{partial "host/add-common"}}

<div class="over-hr r-mt20 r-mb20">
<span>RackHD</span>
</div>

<div class="row form-group">
<div class="col-sm-12 col-md-2 form-label">
<label class="form-control-static">Endpoint*</label>
</div>
<div class="col-sm-12 col-md-8">
<div class="input-group">
<div class="input-group-btn">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span class="caret"></span> {{config.transport}}://</button>
<ul class="dropdown-menu">
<li><a href="#" {{action "setTransport" "https"}}>https://</a></li>
<li><a href="#" {{action "setTransport" "http"}}>http://</a></li>
</ul>
</div>
{{input type="text" class="form-control" value=config.endpoint}}
</div>
</div>
</div>

<div class="row form-group">
<div class="col-sm-12 col-md-2 form-label">
<label class="form-control-static">Node*</label>
</div>
<div class="col-sm-12 col-md-8">
{{input type="text" class="form-control" value=config.nodeId}}
<p class="help-block">This can be ths ID, MAC Address, or IP Address of a Node.</p>
</div>
</div>

<div class="row form-group">
<div class="col-sm-12 col-md-2 form-label">
<label class="form-control-static">SSH User</label>
</div>
<div class="col-sm-12 col-md-3">
{{input type="text" class="form-control" value=config.sshUser}}
</div>
<div class="col-sm-12 col-md-2 form-label">
<label class="form-control-static">SSH Password</label>
</div>
<div class="col-sm-12 col-md-3">
{{input type="text" class="form-control" value=config.sshPassword}}
</div>
</div>

<div class="row form-group">
<div class="col-sm-12 col-md-2 form-label">
<label class="form-control-static">SSH Port</label>
</div>
<div class="col-sm-12 col-md-3">
{{input type="number" min=1 max=65535 class="form-control" value=config.sshPort}}
</div>
</div>

{{partial "host/add-options"}}
</div>

{{top-errors errors=errors}}
{{save-cancel save="save" cancel="cancel"}}
</section>
Loading

0 comments on commit e8f34b6

Please sign in to comment.