[Groonga-commit] groonga/gcs [ember] Move configurationEndpoint method into Domains

Back to archive index

Yoji SHIDARA null+****@clear*****
Tue Sep 25 19:14:04 JST 2012


Yoji SHIDARA	2012-09-25 19:14:04 +0900 (Tue, 25 Sep 2012)

  New Revision: dc3cce6bcc8ccfcadc6919d3db04e343386ec799
  https://github.com/groonga/gcs/commit/dc3cce6bcc8ccfcadc6919d3db04e343386ec799

  Log:
    Move configurationEndpoint method into Domains

  Modified files:
    public/js/gcs.js

  Modified: public/js/gcs.js (+10 -3)
===================================================================
--- public/js/gcs.js    2012-09-25 19:05:03 +0900 (3ed65c7)
+++ public/js/gcs.js    2012-09-25 19:14:04 +0900 (49161f8)
@@ -20,11 +20,16 @@ App.Domain = Ember.Object.extend({
 
 App.Domains = Ember.Object.extend({
   all: [],
+  host: location.host,
+  configurationEndpoint: function() {
+    return 'http://' + this.get('host') + '/';
+  }.property('host'),
   fetch: function() {
+    console.log(this.get('configurationEndpoint'));
     var self = this;
     $.ajax({
       type: 'GET',
-      url:  configurationEndpoint,
+      url:  self.get('configurationEndpoint'),
       data: {
         Version: '2011-02-01',
         Action:  'DescribeDomains'
@@ -39,7 +44,7 @@ App.Domains = Ember.Object.extend({
             var endpoint = domain.find('SearchService > Endpoint').text();
             $.ajax({
               type: 'GET',
-              url:  configurationEndpoint,
+              url:  self.get('configurationEndpoint'),
               data: {
                 Version:    '2011-02-01',
                 Action:     'DescribeIndexFields',
@@ -142,6 +147,9 @@ App.SearchController = Ember.ArrayController.extend({
   }.property('data'),
   urlForRawRequest: function() {
     var domain = this.get('domain');
+    if (!domain) {
+      return ''
+    }
     var searchEndpoint = domain.get('searchEndpoint');
     var params = this.get('paramsForRequest');
     var urlForRawRequest = searchEndpoint + '?' + jQuery.param(params);
@@ -241,7 +249,6 @@ App.Router = Ember.Router.extend({
   })
 });
 
-var configurationEndpoint = 'http://' + location.host + '/';
 var hostAndPort = getHostAndPort();
 
 function getHostAndPort() {
-------------- next part --------------
HTML����������������������������...
Descargar 



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