Skip to content

Commit

Permalink
Merge branch 'feature/robust-template-selection'
Browse files Browse the repository at this point in the history
  • Loading branch information
alexwelch committed Feb 10, 2015
2 parents 0183097 + 244daeb commit 8b78425
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 14 deletions.
4 changes: 4 additions & 0 deletions app/assets/stylesheets/panamax.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1015,3 +1015,7 @@ pre.prettyprint {
:-ms-input-placeholder {
font-style: italic;
}

.plain-contents a:focus {
outline: none;
}
49 changes: 43 additions & 6 deletions app/assets/stylesheets/panamax/deployments.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,12 @@

.add-target {
margin-top: 30px;
overflow: auto;
&:after {
display: block;
content: " ";
clear: both;
height: 0;
}

h2 {
margin-bottom: 0;
Expand All @@ -458,18 +463,50 @@
.provider {
float: left;
margin: 0 10px 10px 0;
max-width: 200px;
overflow: hidden;
width: 200px;
text-align: center;
position: relative;

a {
span {
display: block;
padding: 0 10px;
background-color: $light_grey;
height: 60px;
line-height: 50px;
}

&:hover {
background-color: $white;
.job-templates {
display: none;
position: absolute;
padding: 20px;
text-align: left;
background-color: $dark_grey;

h6, a {
color: $white;
}

h6 {
font-size: 14px;
font-weight: bold;
margin-bottom: 10px;
}

a {
display: block;
line-height: 30px;
font-size: 14px;
text-decoration: none;

&:hover {
text-decoration: underline;
}
}
}

&:hover {
.job-templates {
display: block;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/deployment_targets_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def destroy

def hydrate_index_view
@deployment_targets = DeploymentTarget.all
@job_templates = JobTemplate.all
@job_templates_by_vendor = JobTemplate.all.group_by(&:vendor)
@jobs = Job.all
.map(&:with_template!)
.map(&:with_log!)
Expand Down
9 changes: 7 additions & 2 deletions app/views/deployment_targets/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,14 @@
= link_to 'Dray.', 'https://registry.hub.docker.com/u/centurylink/dray/', target: '_blank'

%ul
- @job_templates.each do |job_template|
- @job_templates_by_vendor.each do |vendor, templates|
%li.provider
= link_to provider_label(job_template.name), new_job_path(template_id: job_template.id), title: job_template.name
%span= provider_label(vendor)
.job-templates
%h6 Select Orchestrator
- templates.each do |job_template|
= link_to job_template.adapter, new_job_path(template_id: job_template.id), title: job_template.name

%p.alternative-provider
Don't see your favorite provider listed?
%br/
Expand Down
2 changes: 1 addition & 1 deletion app/views/jobs/new.html.haml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- content_for(:body_id, 'jobs_flow')
- content_for(:title, "New #{@template.name} Remote Deployment Target")
- content_for(:title, "New #{@template.name}")

%h1 create a new job
%p!= markdown_to_html(@template.description)
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/application.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,4 @@
.clear
%section.copyright
#logo
%small © 2014 CenturyLink — The Panamax project is provided under the Apache 2.0 license. All Rights Reserved.
%small!= "© #{Time.now.year} CenturyLink — The Panamax project is provided under the Apache 2.0 license. All Rights Reserved."
6 changes: 3 additions & 3 deletions spec/controllers/deployment_targets_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

describe DeploymentTargetsController do
let(:deployment_targets) { [double(:target1), double(:target2)] }
let(:job_templates) { [double(:template1), double(:template2)] }
let(:job_templates) { [double(:template1, vendor: 'CTL'), double(:template2, vendor: 'CTL')] }
let(:job1) { double(:job1) }
let(:job2) { double(:job2) }

Expand Down Expand Up @@ -32,7 +32,7 @@
end

it 'assigns the job templates' do
expect(assigns(:job_templates)).to eq job_templates
expect(assigns(:job_templates_by_vendor)).to eq('CTL' => job_templates)
end

it 'renders the view' do
Expand Down Expand Up @@ -120,7 +120,7 @@
end

it 'assigns the job templates' do
expect(assigns(:job_templates)).to eq job_templates
expect(assigns(:job_templates_by_vendor)).to eq('CTL' => job_templates)
end

it 'renders the index view' do
Expand Down
2 changes: 2 additions & 0 deletions spec/support/fixtures/job_templates_representation.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
{
"id": 1,
"name": "Amazon Web Services",
"vendor": "Amazon Cloud",
"adapter": "Kubernetes",
"description": "Short-description",
"documentation": "[![image](http://brightbox.com/images/misc/logo.png)[BrightBox](http://brightbox.com/) - **Serious Cloud Hosting.**\nCreate a CoreOS cluster on BrightBox, deployment ready from Panamax. Visit your BrightBox dashboard and create an API\nID and make note of your Secret ID. You will need these to launch your cluster.\n",
"environment": [
Expand Down

0 comments on commit 8b78425

Please sign in to comment.