Skip to content

Commit

Permalink
Merge branch 'release/0.4.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
yosukehara committed Apr 23, 2014
2 parents 6f47417 + 5d8e6b8 commit f7b6570
Show file tree
Hide file tree
Showing 254 changed files with 1,897 additions and 94,868 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Expand Up @@ -12,4 +12,4 @@ gem "sinatra", "~> 1.4.3"
gem "sinatra-contrib"
gem "haml"
gem "thin"
gem "leo_manager_client", "~> 0.4.9"
gem "leo_manager_client", "~> 0.4.10"
2 changes: 1 addition & 1 deletion app.rb
Expand Up @@ -36,7 +36,7 @@ class LoggerEx < Logger
end

class LeoCenter < Sinatra::Base
Version = "0.4.5"
Version = "0.4.6"
set :environment, :production
Config = CenterHelpers.load_config
SessionKey = "leofs_console_session"
Expand Down
4 changes: 3 additions & 1 deletion lib/bucket_status.rb
Expand Up @@ -21,11 +21,12 @@
#======================================================================
class LeoCenter
namespace "/bucket_status" do
## GET
get "/list.json" do
begin
buckets = @@manager.get_buckets
rescue RuntimeError => ex
return { data: [] }.to_json if ex.message == "not found" # empty
return { data: [] }.to_json if ex.message == "not found"
raise ex
end

Expand All @@ -35,6 +36,7 @@ class LeoCenter
{
name: bucket.name,
owner: bucket.owner,
permissions: bucket.permissions,
created_at: Integer(bucket.created_at)
}
end
Expand Down
5 changes: 4 additions & 1 deletion lib/buckets.rb
Expand Up @@ -21,27 +21,30 @@
#======================================================================
class LeoCenter
namespace "/buckets" do
## GET
get "/list.json" do
check_admin

begin
buckets = @@manager.get_buckets
rescue RuntimeError => ex
return { data: [] }.to_json if ex.message == "not found" # empty
return { data: [] }.to_json if ex.message == "not found"
raise ex
end

result = buckets.map do |bucket|
{
name: bucket.name,
owner: bucket.owner,
permissions: bucket.permissions,
created_at: Integer(bucket.created_at)
}
end

{ data: result }.to_json
end

## POST
post "/add_bucket" do
bucket_name = required_params(:bucket)
access_key = required_sessions(:access_key_id)
Expand Down
4 changes: 2 additions & 2 deletions public/css/leofs_console.css
Expand Up @@ -4,7 +4,7 @@
vertical-align: middle;
}

#viewport_header-innerCt {
#viewport_user_info-innerCt {
background-color: #5682AD;
}

Expand Down Expand Up @@ -41,7 +41,7 @@
font-size: 13px;
}

#admin_grid .x-grid-row td {
#menu_container .x-grid-row td {
height: 20px;
padding: 5px;
}
Expand Down
116 changes: 0 additions & 116 deletions public/js/admin.js

This file was deleted.

130 changes: 130 additions & 0 deletions public/js/admin_view.js
@@ -0,0 +1,130 @@
//======================================================================
//
// LeoFS
//
// Copyright (c) 2012-2014 Rakuten, Inc.
//
// This file is provided to you under the Apache License,
// Version 2.0 (the "License"); you may not use this file
// except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
//
//======================================================================
var SUB_MENU_SYSTEM_CONF = "System Conf";
var SUB_MENU_USERS = "Users";
var SUB_MENU_BUCKETS = "Buckets";
var SUB_MENU_ENDPOINTS = "Endpoints";
var SUB_MENU_ASSIGNED_FILE = "Assigned File";

var IMG_SYSTEM_CONF = "<img src='images/system_conf.png'/>";
var IMG_USERS = "<img src='images/users.png'/>";
var IMG_BUCKETS = "<img src='images/bucket.png'/>";
var IMG_ENDPOINTS = "<img src='images/endpoint.png'/>";
var IMG_ASSIGNED_FILE = "<img src='images/whereis.png'/>";
var NBSP = "&nbsp";
var SUB_MENU_INDEX = "item";
var SUB_MENU_ITEMS = [SUB_MENU_INDEX];


(function() {
Ext.define(PANE_ADMIN_VIEW, {
extend: "Ext.panel.Panel",
id: "admin_view",
title: "Admin Tools",
layout: "border",

system_conf_sub_view: Ext.create(PANE_SUB_SYSTEM_CONF),
user_sub_view: Ext.create(PANE_SUB_USERS),
bucket_sub_view: Ext.create(PANE_SUB_BUCKETS),
endpoint_sub_view: Ext.create(PANE_SUB_ENDPOINTS),
assigned_file_sub_view: Ext.create(PANE_SUB_ASSIGNED_FILE),

//
// Set up the menu
//
admin_store: Ext.create("Ext.data.Store", {
fields: SUB_MENU_ITEMS,
data: [ { item: SUB_MENU_SYSTEM_CONF},
{ item: SUB_MENU_USERS},
{ item: SUB_MENU_BUCKETS},
{ item: SUB_MENU_ENDPOINTS},
{ item: SUB_MENU_ASSIGNED_FILE}
]
}),

// initialize
initComponent: function() {
// Right Pane: Sub Item Container
var sub_item_container = Ext.create("Ext.panel.Panel", {
region: "center",
layout: "card",
activeItem: 0,
items: [
this.system_conf_sub_view,
this.user_sub_view,
this.bucket_sub_view,
this.endpoint_sub_view,
this.assigned_file_sub_view
]
});

// Left Pane: Menu Container
var menu_container = Ext.create("Ext.grid.Panel", {
title: "Menu",
region: "west",
id: "menu_container",
width: 200,
forceFit: true,
hideHeaders: true,
store: this.admin_store,
columns: [{
dataIndex: SUB_MENU_INDEX,
renderer:
function(value) {
var img;
switch(value) {
case SUB_MENU_SYSTEM_CONF:
img = IMG_SYSTEM_CONF + NBSP;
break;
case SUB_MENU_USERS:
img = IMG_USERS + NBSP;
break;
case SUB_MENU_BUCKETS:
img = IMG_BUCKETS + NBSP;
break;
case SUB_MENU_ENDPOINTS:
img = IMG_ENDPOINTS + NBSP;
break;
case SUB_MENU_ASSIGNED_FILE:
img = IMG_ASSIGNED_FILE + NBSP;
break;
}
return img + value;
}
}],
listeners: {
select: function(grid, record, index) {
sub_item_container.getLayout().setActiveItem(index);
},
afterrender: function(grid) {
grid.getSelectionModel().select(0);
}
}
});

Ext.apply(this, {
items: [sub_item_container, menu_container]
});
return this.callParent(arguments);
}
});
}).call(this);

0 comments on commit f7b6570

Please sign in to comment.