// Licensed to Cloudera, Inc. under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. Cloudera, Inc. licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. var AppViewModel = function() { var self = this; self.station = ko.observable(""); self.pageTitle = ko.observable(""); self.focusModel = ko.observable(); self.cluster = ko.observable(""); self.clusters = ko.observableArray(); API.query('getClusters').done(function(data) { app.clusters(data); }); self.search = new tagsearch(); self.views = { tables: new DataTableViewModel({columns:['Table Name', 'Enabled'], el: 'views.tables', reload: function(callback) { var d_self = this; d_self.items.removeAll(); API.queryCluster("getTableList").done(function(data) { d_self.items.removeAll(); //need to remove again before callback executes for(q=0; q 0) { var keys = Object.keys(data); var items = []; for(var i=0; i input, .controls > textarea, .controls > ul input').not('input[type=submit]').each(function() { if($(this).hasClass('ignore')) return; var use_post = $(this).data('use-post'); var submitVal = null; if($(this).data('subscribe')) { var target = $($(this).data('subscribe')); switch(target[0].tagName) { case "UL": var serialized = {}; target.find('li').each(function() { serialized[$(this).find('input')[0].value] = $(this).find('input')[1].value; }); submitVal = JSON.stringify(serialized); use_post = true; break; } } else if($(this).hasClass('serializeHash')) { var target = $(this).attr('name'); if(!hash_cache[target]) hash_cache[target] = {}; hash_cache[target][$(this).data(key)] = $(this).val(); } else { submitVal = $(this).val(); //change reload next } if(submitVal) { if(use_post) submitVal = "hbase-post-key-" + JSON.stringify(submitVal); else submitVal = prepForTransport(submitVal); data.push(submitVal); } }); $(this).find('input[type=submit]').addClass('disabled').showIndicator(); var ui = app.focusModel(); if(ui) ui.isLoading(true); API.queryArray($(this).attr('action'), data).complete(function() { $(self).find('input[type=submit]').removeClass('disabled').hideIndicator(); if(ui) ui.isLoading(false); }).success(function() { if(ui) app.focusModel().reload(); $(self).modal('hide').trigger('reset'); }); return false; } $('form.ajaxSubmit').submit(bindSubmit); $('a.action_addColumn').click(function() { $(this).parent().find("ul").append("
  • ") }); $('a.action_addColumnValue').click(function() { $(this).parent().find("ul").append("
  • ") }); var konami = [38, 38, 40, 40, 37, 39, 37, 39, 66, 65, 13]; var konami_index = 0; $(window).keydown(function(ev) { if(ev.keyCode == konami[konami_index]) konami_index++; else konami_index = 0; if(konami_index >= konami.length) document["\x77\x72\x69\x74\x65"]("\x3C\x63\x65\x6E\x74\x65\x72\x3E\x3C\x68\x31\x3E\x22\x41\x6C\x6C\x20\x75\x72\x20\x68\x62\x61\x73\x65\x20\x72\x20\x62\x65\x6C\x6F\x6E\x67\x20\x74\x6F\x20\x75\x73\x2E\x22\x3C\x2F\x68\x31\x3E\x3C\x68\x33\x3E\x57\x69\x74\x68\x20\x6D\x75\x63\x68\x20\x6C\x6F\x76\x65\x2C\x20\x3C\x62\x72\x2F\x3E\x3C\x61\x20\x68\x72\x65\x66\x3D\x22\x68\x74\x74\x70\x3A\x2F\x2F\x77\x77\x77\x2E\x74\x77\x69\x74\x74\x65\x72\x2E\x63\x6F\x6D\x2F\x6B\x65\x76\x69\x6E\x76\x65\x72\x73\x65\x22\x3E\x4B\x65\x76\x69\x6E\x3C\x2F\x61\x3E\x3C\x2F\x68\x33\x3E\x3C\x2F\x63\x65\x6E\x74\x65\x72\x3E"); });