Kouhei Sutou
null+****@clear*****
Sat Jan 3 17:23:11 JST 2015
Kouhei Sutou 2015-01-03 17:23:11 +0900 (Sat, 03 Jan 2015) New Revision: 9a48e4e808954e5991de482261dc2a7658a16645 https://github.com/groonga/groonga-admin/commit/9a48e4e808954e5991de482261dc2a7658a16645 Message: column show: support removing the column Modified files: app/scripts/controllers/column-show-controller.js app/views/columns/show.html Modified: app/scripts/controllers/column-show-controller.js (+26 -2) =================================================================== --- app/scripts/controllers/column-show-controller.js 2015-01-03 17:22:11 +0900 (07b278e) +++ app/scripts/controllers/column-show-controller.js 2015-01-03 17:23:11 +0900 (a315b34) @@ -9,9 +9,10 @@ */ angular.module('groongaAdminApp') .controller('ColumnShowController', [ - '$scope', '$routeParams', '$filter', 'schemaLoader', - function ($scope, $routeParams, $filter, schemaLoader) { + '$scope', '$routeParams', '$location', '$http', 'schemaLoader', + function ($scope, $routeParams, $location, $http, schemaLoader) { var schema; + var client = new GroongaClient($http); function initialize() { $scope.column = { @@ -20,6 +21,29 @@ angular.module('groongaAdminApp') name: $routeParams.table } }; + $scope.remove = remove; + } + + function remove() { + if (!window.confirm('Really remove the column?')) { + return; + } + + var parameters = { + table: $scope.column.table.name, + name: $scope.column.name + }; + var request = client.execute('column_remove', parameters); + request.success(function(response) { + console.log(response); + if (response.isRemoved()) { + schemaLoader().reload(); + $location.url('/tables/' + $scope.column.table.name + '/'); + } else { + var errorMessage = response.errorMessage(); + $scope.message = 'Failed to remove the column: ' + errorMessage; + } + }); } initialize(); Modified: app/views/columns/show.html (+19 -1) =================================================================== --- app/views/columns/show.html 2015-01-03 17:22:11 +0900 (2ad63d4) +++ app/views/columns/show.html 2015-01-03 17:23:11 +0900 (8efbaa5) @@ -10,7 +10,25 @@ </li> </ol> - <div class="content"> + <div class="sidebar"> + <div class="panel panel-default"> + <div class="panel-heading"> + <h2 class="panel-title">Actions</h2> + </div> + <div class="panel-body"> + <ul class="list-group"> + <li class="list-group-item"> + <button type="button" ng-click="remove()"> + <span class="glyphicon glyphicon-remove"></span> + Remove + </button> + </li> + </ul> + </div> + </div> + </div> + + <div class="main-content"> <div class="alert alert-warning" ng-show="message.length > 0"> <p>{{message}}</p> </div> -------------- next part -------------- HTML����������������������������...ダウンロード