[Groonga-commit] groonga/groonga-admin at 176b435 [master] Build "table" for the schema object from scratch.

Back to archive index

YUKI Hiroshi null+****@clear*****
Wed Sep 21 16:32:27 JST 2016


YUKI Hiroshi	2016-09-21 16:32:27 +0900 (Wed, 21 Sep 2016)

  New Revision: 176b435f5ad52c4b54bdf98652a3903e70d5fd55
  https://github.com/groonga/groonga-admin/commit/176b435f5ad52c4b54bdf98652a3903e70d5fd55

  Merged eebf840: Merge pull request #10 from groonga/features/migrate-table_list-to-schema

  Message:
    Build "table" for the schema object from scratch.
    
    Because "table" in "schema" response is different from the schema object.
    To avoid confusion from similar but different name properties, we create
    "table" objects for "schema" response from scratch.

  Modified files:
    app/scripts/services/schema-loader.js

  Modified: app/scripts/services/schema-loader.js (+16 -12)
===================================================================
--- app/scripts/services/schema-loader.js    2016-09-21 16:18:33 +0900 (eef1371)
+++ app/scripts/services/schema-loader.js    2016-09-21 16:32:27 +0900 (9e0a75d)
@@ -95,19 +95,24 @@ angular.module('groongaAdminApp')
         return typeName in schema.tables;
       }
 
-      function resolveTable(table) {
-        if (!table.key_type)
-          return;
-        table.keyType = {
-          name: table.key_type.name,
-          isTextType: isTextType(table.key_type.name)
-        };
+      function buildTable(rawTable) {
+        var table = {};
+        if (table.key_type) {
+          table.keyType = {
+            name: rawTable.key_type.name,
+            isTextType: isTextType(rawTable.key_type.name)
+          };
+        }
+        return table;
       }
 
-      function resolveTables(schema) {
-        angular.forEach(schema.tables, function(table) {
-          resolveTable(table);
+      function buildTables(response) {
+        var rawTables = response.tables();
+        var tables = {};
+        angular.forEach(rawTables, function(table, name) {
+          tables[name] = buildTable(table);
         });
+        return tables;
       }
 
       function resolveColumn(schema, column) {
@@ -185,8 +190,7 @@ angular.module('groongaAdminApp')
         schema.tables = {};
         return client.execute('schema')
           .success(function(response) {
-            schema.tables = response.tables();
-            resolveTables(schema);
+            schema.tables = buildTables(response);
 
             var fetchColumnsTasks = [];
             angular.forEach(schema.tables, function(table) {
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index