YUKI Hiroshi
null+****@clear*****
Fri Sep 23 13:05:52 JST 2016
YUKI Hiroshi 2016-09-23 13:05:52 +0900 (Fri, 23 Sep 2016) New Revision: a17caa07145a0faeab547c8d1beff8f0f8075494 https://github.com/groonga/groonga-admin/commit/a17caa07145a0faeab547c8d1beff8f0f8075494 Merged ec78f51: Merge pull request #13 from groonga/features/build-schema-from-schema-result Message: Build types from schema response Modified files: app/scripts/groonga-client/response/schema.js app/scripts/services/schema-loader.js Modified: app/scripts/groonga-client/response/schema.js (+4 -0) =================================================================== --- app/scripts/groonga-client/response/schema.js 2016-09-23 13:01:50 +0900 (950cb9d) +++ app/scripts/groonga-client/response/schema.js 2016-09-23 13:05:52 +0900 (70f9787) @@ -9,6 +9,10 @@ Schema.prototype = Object.create(GroongaClient.Response.Base.prototype); Schema.prototype.constructor = Schema; + Schema.prototype.types = function() { + return this.body().types; + }; + Schema.prototype.tables = function() { return this.body().tables; }; Modified: app/scripts/services/schema-loader.js (+9 -55) =================================================================== --- app/scripts/services/schema-loader.js 2016-09-23 13:01:50 +0900 (3c075b5) +++ app/scripts/services/schema-loader.js 2016-09-23 13:05:52 +0900 (c24e2cd) @@ -19,65 +19,17 @@ angular.module('groongaAdminApp') function createSchema() { var newSchema = {}; - fillTypes(newSchema); return newSchema; } - function fillTypes(schema) { - var builtinTypes = [ - { - name: 'Bool' - }, - { - name: 'Int8' - }, - { - name: 'UInt8' - }, - { - name: 'Int16' - }, - { - name: 'UInt16' - }, - { - name: 'Int32' - }, - { - name: 'UInt32' - }, - { - name: 'Int64' - }, - { - name: 'UInt64' - }, - { - name: 'Float' - }, - { - name: 'Time' - }, - { - name: 'ShortText' - }, - { - name: 'Text' - }, - { - name: 'LongText' - }, - { - name: 'TokyoGeoPoint' - }, - { - name: 'WGS84GeoPoint' - } - ]; - schema.types = {}; - angular.forEach(builtinTypes, function(type) { - schema.types[type.name] = type; + function buildTypes(rawTypes) { + var types = {}; + angular.forEach(rawTypes, function(rawType, name) { + types[name] = { + name: rawType.name + }; }); + return types; } function isTextType(typeName) { @@ -249,6 +201,8 @@ angular.module('groongaAdminApp') schema.tables = {}; return client.execute('schema') .success(function(response) { + schema.types = buildTypes(response.types()); + var rawTables = response.tables(); schema.tables = buildTables(rawTables); -------------- next part -------------- HTML����������������������������...下载