-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #432 from CenturyLinkLabs/feature/deployment-targe…
…t-metadata Deployment target metadata
- Loading branch information
Showing
18 changed files
with
196 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
app/controllers/deployment_target_metadata_refreshes_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class DeploymentTargetMetadataRefreshesController < ApplicationController | ||
respond_to :html | ||
|
||
def create | ||
deployment_target_id = params[:deployment_target_id] | ||
|
||
DeploymentTargetMetadataRefresh.create( | ||
deployment_target_id: deployment_target_id | ||
) | ||
flash[:success] = I18n.t('deployment_targets.metadata_refresh.success') | ||
redirect_to deployment_targets_path | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class DeploymentTargetMetadataRefresh < BaseResource | ||
include ActiveResource::Singleton | ||
|
||
self.site = PanamaxApi::URL + "/deployment_targets/:deployment_target_id/metadata" | ||
self.singleton_name = "refresh" | ||
|
||
belongs_to :deployment_target | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
.deployment-target | ||
= link_to deployment_target.name, | ||
deployment_target_deployments_path(deployment_target), | ||
class: 'name' | ||
%em.status | ||
%span.last-updated | ||
Last Updated: | ||
- if deployment_target.metadata? | ||
= l(deployment_target.metadata.created_at, format: :informal) | ||
- else | ||
never | ||
= form_for [ deployment_target, DeploymentTargetMetadataRefresh.new ] do |f| | ||
= f.button "Refresh" | ||
.actions | ||
= link_to 'Delete Target', | ||
deployment_target_path(deployment_target), | ||
class: 'delete-action', | ||
title: 'delete', | ||
method: 'delete', | ||
data: { delete_confirm: 'Delete this Target?', delete_remove_at: '.deployment-target' } | ||
%dl.target-info | ||
%dt Endpoint: | ||
%dd= deployment_target.endpoint_url | ||
- if deployment_target.metadata? | ||
%dt Agent Version: | ||
%dd= deployment_target.metadata.agent_version | ||
%dt Adapter Type: | ||
%dd= deployment_target.metadata.adapter_type | ||
%dt Adapter Version: | ||
%dd= deployment_target.metadata.adapter_version | ||
%dl.token | ||
%dt{ data: { toggle: { class: 'expanded' } } } | ||
Target Token | ||
%dd.token-contents | ||
.token-container | ||
%div{ contenteditable: true }= deployment_target.auth_blob |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
en: | ||
time: | ||
formats: | ||
informal: "%m/%d/%Y at %l:%M%P" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
spec/controllers/deployment_target_metadata_refreshes_controller_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
require 'spec_helper' | ||
|
||
describe DeploymentTargetMetadataRefreshesController do | ||
describe '#create' do | ||
before do | ||
DeploymentTargetMetadataRefresh.stub(create: double) | ||
post :create, deployment_target_id: "19" | ||
end | ||
|
||
it 'creates a DeploymentTargetMetadataRefresh with the expected DeploymentTarget' do | ||
expect(DeploymentTargetMetadataRefresh).to( | ||
have_received(:create). | ||
with({ deployment_target_id: "19" }) | ||
) | ||
end | ||
|
||
context 'HTML format' do | ||
it 'redirects to the deployments list' do | ||
expect(response).to redirect_to(deployment_targets_path) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
require 'spec_helper' | ||
|
||
describe DeploymentTarget::Metadata do | ||
describe "#created_at" do | ||
let(:time) { Time.parse("2014-03-19") } | ||
let(:metadata) { DeploymentTarget::Metadata.new(created_at: time.to_json) } | ||
subject { metadata.created_at } | ||
|
||
it { should eq(time) } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
spec/support/fixtures/deployment_target_refresh_representation.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"meatdata": { | ||
"agent_version": "0.3.0", | ||
"adapter_type": "Test Orchestrator", | ||
"adapter_version": "0.4.0", | ||
"created_at": "2014-11-06T17:32:47.255+00:00" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters