Skip to content

Commit

Permalink
Merge pull request maestrano#125 from clemthenem/improvment/purchase_…
Browse files Browse the repository at this point in the history
…workflow

[MNOE-170] - Purchase Workflow
  • Loading branch information
ouranos authored Oct 20, 2016
2 parents 9102c4d + bd7ec97 commit e7f74b1
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@ class Jpi::V1::AppInstancesController < Jpi::V1::BaseResourceController

# GET /mnoe/jpi/v1/organization/1/apps.json?timestamp=151452452345
def index
@app_instances = parent_organization.app_instances.select do |i|
@app_instances = parent_organization.app_instances.select do |i|
i.active? && i.updated_at > Time.at(timestamp) && can?(:access,i)
end
end


# POST /mnoe/jpi/v1/organization/1/app_instances
def create
authorize! :manage_app_instances, parent_organization
app_instance = parent_organization.app_instances.create(product: params[:nid])
head :created
end

# DELETE /mnoe/jpi/v1/app_instances/1
def destroy
app_instance = MnoEnterprise::AppInstance.find(params[:id])
Expand All @@ -17,7 +24,7 @@ def destroy
MnoEnterprise::EventLogger.info('app_destroy', current_user.id, "App destroyed", app_instance.name,app_instance)
app_instance.terminate
end

head :accepted
end
end
Expand Down
2 changes: 1 addition & 1 deletion api/config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
end

# AppInstances
resources :app_instances, only: [:index, :destroy], shallow: true
resources :app_instances, only: [:index, :create, :destroy], shallow: true

# Teams
resources :teams, only: [:index, :show, :create, :update, :destroy], shallow: true do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,17 @@
module MnoEnterprise
RSpec.describe Jpi::V1::AppInstancesController, type: :routing do
routes { MnoEnterprise::Engine.routes }

it 'routes to #index' do
expect(get('/jpi/v1/organizations/1/app_instances')).to route_to("mno_enterprise/jpi/v1/app_instances#index", organization_id: '1')
end

it 'routes to #create' do
expect(post('/jpi/v1/organizations/1/app_instances')).to route_to("mno_enterprise/jpi/v1/app_instances#create", organization_id: '1' )
end

it 'routes to #destroy' do
expect(delete('/jpi/v1/app_instances/1')).to route_to("mno_enterprise/jpi/v1/app_instances#destroy", id: '1' )
end
end
end

7 changes: 5 additions & 2 deletions frontend/app/assets/stylesheets/mno_enterprise/variables.less
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@
/*-----------------------------------------------------------------------*/
/* Login Page */
/*-----------------------------------------------------------------------*/
@login-bg-color: @bg-main-color;
@login-box-grid-position: { margin-top: 80px; .make-sm-column(4); .make-sm-column-offset(4); };

@login-bg-img: "mno_enterprise/login-background.jpg";
@login-bg-color: @bg-main-color;
@login-box-grid-position: { margin-top: 80px; .make-sm-column(4); .make-sm-column-offset(4); };

@login-box-corners: 0px;
@login-box-title-color: @decorator-main-color;
@login-box-title: { text-transform: uppercase; };
@login-box-title-display-box-arrow: false;
Expand Down

0 comments on commit e7f74b1

Please sign in to comment.