Welcome splash

This commit is contained in:
Vincent Fiduccia 2015-06-12 17:52:54 -07:00
parent 10c0753a06
commit cd7092451b
8 changed files with 98 additions and 3 deletions

View File

@ -88,7 +88,7 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
// Then the default project ID from the session
return this.activeProjectFromId(this.get('prefs').get(C.PREFS.PROJECT_DEFAULT)).then(select)
.catch(() => {
this.get('prefs').set(C.PREFS.PROJECT_DEFAULT, undefined);
this.get('prefs').set(C.PREFS.PROJECT_DEFAULT, "");
// Then the first active project
var project = active.get('firstObject');

View File

@ -112,6 +112,7 @@ Router.map(function() {
// Services
this.resource('services', function() {
this.resource('splash', {path: '/welcome'});
this.resource('service.new', {path: '/projects/add-service'});
this.resource('service.new-balancer', {path: '/projects/add-balancer'});
this.resource('service.new-alias', {path: '/projects/add-alias'});

View File

@ -2,6 +2,14 @@ import Ember from 'ember';
export default Ember.Route.extend({
beforeModel: function() {
this.transitionTo('environments');
var main = this.modelFor('services');
if ( main.get('services.length') )
{
this.transitionTo('environments');
}
else
{
this.transitionTo('splash');
}
}
});

View File

@ -7,6 +7,14 @@ export default Ember.Route.extend({
store.findAllUnremoved('environment'),
store.findAllUnremoved('service'),
store.findAllUnremoved('serviceconsumemap'),
]);
store.findAllUnremoved('host'),
]).then((results) => {
return Ember.Object.create({
environments: results[0],
services: results[1],
consumeMaps: results[2],
hosts: results[3],
});
});
}
});

24
app/splash/route.js Normal file
View File

@ -0,0 +1,24 @@
import Ember from 'ember';
export default Ember.Route.extend({
model: function() {
var main = this.modelFor('services');
if ( main.get('environments.length') === 0 )
{
var env = this.get('store').createRecord({
type: 'environment',
name: 'Default',
});
return env.save().then(() => {
main.set('environmentId', env.get('id'));
return main;
});
}
else
{
main.set('environmentId', main.get('environments.firstObject.id'));
return main;
}
}
});

25
app/splash/template.hbs Normal file
View File

@ -0,0 +1,25 @@
{{#unless hosts.length}}
<section class="welcome">
<i class="ss-share"></i>
<h2>Adding your first Host</h2>
<p>
Before adding your first service or launching a container, you must add at least a single Linux host that supports Docker 1.6+ and be able to reach the Rancher server via HTTP.
Rancher supports adding Linux hosts in the form of a virtual or physical machine from any public cloud providers, privately hosted clouds, or even baremetal servers.
<a href="http://rancherio.github.io/rancher/docs/infrastructure/hosts/" target="_blank">Learn More</a>
</p>
{{#link-to "hosts.new" class="btn btn-default"}}Add Host{{/link-to}}
</section>
{{/unless}}
{{#unless services.length}}
<section class="welcome alt">
<i class="ss-globe"></i>
<h2>Adding your first Service</h2>
<p>
A service is simply a group of containers created from the same Docker image but extends Docker's &quot;link&quot; concept to leverage Rancher's lightweight distributed DNS service for service discovery.
A service also is also capable of leveraging other Rancher built-in services such as load balancers, health monitoring, upgrade support, and high-availability.
<a href="http://rancherio.github.io/rancher/docs/services/projects/adding-services/" target="_blank">Learn More</a>
</p>
{{#link-to "service.new" (query-params environmentId=environmentId) class="btn btn-default"}}Get Started{{/link-to}}
</section>
{{/unless}}

View File

@ -23,3 +23,4 @@
@import "app/styles/zero-clipboard";
@import "app/styles/prism-theme";
@import "app/styles/about";
@import "app/styles/welcome";

28
app/styles/welcome.scss Normal file
View File

@ -0,0 +1,28 @@
SECTION.welcome {
margin: 30px;
background-color: #58c2f6;
color: white;
padding: 30px 50px;
border-radius: 6px;
&.alt {
background-color: #49b6a2;
}
H2 {
font-weight: 600;
margin-bottom: 20px;
}
P {
margin-bottom: 20px;
}
I {
float: right;
font-size: 150px;
width: 200px;
text-align: center;
display: inline-block;
}
}