{"action":"created","issue":{"url":"https://api.github.com/repos/hashicorp/consul/issues/694","labels_url":"https://api.github.com/repos/hashicorp/consul/issues/694/labels{/name}","comments_url":"https://api.github.com/repos/hashicorp/consul/issues/694/comments","events_url":"https://api.github.com/repos/hashicorp/consul/issues/694/events","html_url":"https://github.com/hashicorp/consul/issues/694","id":57441129,"number":694,"title":"Web UI datacenter switch issue","user":{"login":"bbc88ks","id":3134014,"avatar_url":"https://avatars.githubusercontent.com/u/3134014?v=3","gravatar_id":"","url":"https://api.github.com/users/bbc88ks","html_url":"https://github.com/bbc88ks","followers_url":"https://api.github.com/users/bbc88ks/followers","following_url":"https://api.github.com/users/bbc88ks/following{/other_user}","gists_url":"https://api.github.com/users/bbc88ks/gists{/gist_id}","starred_url":"https://api.github.com/users/bbc88ks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbc88ks/subscriptions","organizations_url":"https://api.github.com/users/bbc88ks/orgs","repos_url":"https://api.github.com/users/bbc88ks/repos","events_url":"https://api.github.com/users/bbc88ks/events{/privacy}","received_events_url":"https://api.github.com/users/bbc88ks/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/hashicorp/consul/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-02-12T10:17:30Z","updated_at":"2015-02-19T19:49:08Z","closed_at":"2015-02-19T19:49:00Z","body":"Datacenter switching doesn't work properly in ui for updates. For instance at demo.consul,io if we pick **\"ams2\"** first and then create a key, it works as expected.\r\n![1](https://cloud.githubusercontent.com/assets/3134014/6165375/2b1144fe-b2b0-11e4-9404-6f68f256cb15.png)\r\n\r\nIf we switch to another dc from the drop down menu (or from the home page within the same browser session) and create another key, it actually is created at ***\"amc2\"*** and the view fails to render due to a missing key.\r\n![2](https://cloud.githubusercontent.com/assets/3134014/6165410/641152c6-b2b0-11e4-918e-d9c46debc1f8.png)\r\nCheck different DCs in URLs for PUT and GET at the screenshot above.\r\n\r\nIt's actually the same for deregistering nodes and probably something else which is updated from the code snippet similar to:\r\n```\r\nneeds: [\"dc\"],\r\n  dc: Ember.computed.alias(\"controllers.dc\"),\r\n  isLoading: false,\r\n\r\n  actions: {\r\n    // Creates the key from the newKey model\r\n    // set on the route.\r\n    createKey: function() {\r\n      this.set('isLoading', true);\r\n\r\n      var controller = this;\r\n      var newKey = controller.get('newKey');\r\n      var parentKey = controller.get('parentKey');\r\n      var grandParentKey = controller.get('grandParentKey');\r\n      var dc = controller.get('dc').get('datacenter');\r\n      var token = App.get('settings.token');\r\n\r\n      // If we don't have a previous model to base\r\n      // on our parent, or we're not at the root level,\r\n      // add the prefix\r\n      if (parentKey !== undefined && parentKey !== \"/\") {\r\n        newKey.set('Key', (parentKey + newKey.get('Key')));\r\n      }\r\n\r\n      // Put the Key and the Value retrieved from the form\r\n      Ember.$.ajax({\r\n          url: (formatUrl(\"/v1/kv/\" + newKey.get('Key'), dc, token)),\r\n          type: 'PUT',\r\n          data: newKey.get('Value')\r\n      }).then(function(response) {\r\n        // transition to the right place\r\n        if (newKey.get('isFolder') === true) {\r\n          controller.transitionToRoute('kv.show', newKey.get('Key'));\r\n        } else {\r\n          controller.transitionToRoute('kv.edit', newKey.get('Key'));\r\n        }\r\n        controller.set('isLoading', false);\r\n      }).fail(function(response) {\r\n        // Render the error message on the form if the request failed\r\n        controller.set('errorMessage', 'Received error while processing: ' + response.statusText);\r\n      });\r\n    },\r\n```\r\nI am not very familiar with Ember, but it seems that\r\n```\r\ndc: Ember.computed.alias(\"controllers.dc\")\r\n```\r\nis initialized only once per session."},"comment":{"url":"https://api.github.com/repos/hashicorp/consul/issues/comments/75122569","html_url":"https://github.com/hashicorp/consul/issues/694#issuecomment-75122569","issue_url":"https://api.github.com/repos/hashicorp/consul/issues/694","id":75122569,"user":{"login":"pearkes","id":846194,"avatar_url":"https://avatars.githubusercontent.com/u/846194?v=3","gravatar_id":"","url":"https://api.github.com/users/pearkes","html_url":"https://github.com/pearkes","followers_url":"https://api.github.com/users/pearkes/followers","following_url":"https://api.github.com/users/pearkes/following{/other_user}","gists_url":"https://api.github.com/users/pearkes/gists{/gist_id}","starred_url":"https://api.github.com/users/pearkes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pearkes/subscriptions","organizations_url":"https://api.github.com/users/pearkes/orgs","repos_url":"https://api.github.com/users/pearkes/repos","events_url":"https://api.github.com/users/pearkes/events{/privacy}","received_events_url":"https://api.github.com/users/pearkes/received_events","type":"User","site_admin":false},"created_at":"2015-02-19T19:49:08Z","updated_at":"2015-02-19T19:49:08Z","body":"Fixed, thanks!"}}