You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by yu...@apache.org on 2013/04/06 03:55:47 UTC
svn commit: r1465166 [14/15] - in /incubator/ambari/trunk: ./
ambari-web/app/ ambari-web/app/assets/data/background_operations/
ambari-web/app/assets/data/clusters/
ambari-web/app/assets/data/configurations/
ambari-web/app/assets/data/dashboard/ ambari...
Added: incubator/ambari/trunk/ambari-web/app/views/main/mirroring/dropdown_view.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/main/mirroring/dropdown_view.js?rev=1465166&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/main/mirroring/dropdown_view.js (added)
+++ incubator/ambari/trunk/ambari-web/app/views/main/mirroring/dropdown_view.js Sat Apr 6 01:55:42 2013
@@ -0,0 +1,43 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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 App = require('app');
+var filters = require('views/common/filter_view');
+var sort = require('views/common/sort_view');
+var date = require('utils/date');
+
+App.MainMirroringDropdownView = Em.View.extend({
+
+ name : 'mainMirroringDropdownSelect',
+
+ templateName:require('templates/main/mirroring/dropdown'),
+
+ selected: Ember.Object.create({title: 'Select', value: ''}),
+
+ listOfOptions : null,
+
+ select: function(event){
+ var selected = event.context;
+ this.set('selected', selected);
+ },
+
+ didInsertElement:function () {
+ console.debug('In didInsertElement');
+ var controller = this.get('controller');
+ }
+})
\ No newline at end of file
Added: incubator/ambari/trunk/ambari-web/app/views/main/mirroring/jobs_view.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/main/mirroring/jobs_view.js?rev=1465166&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/main/mirroring/jobs_view.js (added)
+++ incubator/ambari/trunk/ambari-web/app/views/main/mirroring/jobs_view.js Sat Apr 6 01:55:42 2013
@@ -0,0 +1,143 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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 App = require('app');
+var filters = require('views/common/filter_view');
+var sort = require('views/common/sort_view');
+
+App.MainJobsView = App.TableView.extend({
+ templateName: require('templates/main/mirroring/jobs'),
+ content: function () {
+ return this.get('controller.jobs');
+ }.property('controller.jobs'),
+
+ didInsertElement: function() {
+ this.set('content', this.get('controller.jobs'));
+ },
+
+ dataset: function() {
+ return this.get('controller.content');
+ }.property('controller.content'),
+
+ sortView: sort.wrapperView,
+ idSort: sort.fieldView.extend({
+ name: 'id',
+ displayName: Em.I18n.t('mirroring.table.jobId'),
+ type: 'number'
+ }),
+ startSort: sort.fieldView.extend({
+ name: 'startDate',
+ displayName: Em.I18n.t('mirroring.table.start'),
+ type: 'number'
+ }),
+ endSort: sort.fieldView.extend({
+ name: 'endDate',
+ displayName: Em.I18n.t('mirroring.table.end'),
+ type: 'number'
+ }),
+ durationSort: sort.fieldView.extend({
+ name: 'duration',
+ displayName: Em.I18n.t('mirroring.table.duration'),
+ type: 'number'
+ }),
+ dataSort: sort.fieldView.extend({
+ name: 'data',
+ displayName: Em.I18n.t('mirroring.table.data'),
+ type: 'number'
+ }),
+
+ /**
+ * Filter view for name column
+ * Based on <code>filters</code> library
+ */
+ idFilterView: filters.createTextView({
+ fieldType: 'input-small',
+ onChangeValue: function () {
+ this.get('parentView').updateFilter(1, this.get('value'), 'number');
+ }
+ }),
+
+ startFilterView: filters.createSelectView({
+ fieldType: 'input-small',
+ content: ['Any', 'Past 1 Day', 'Past 2 Days', 'Past 7 Days', 'Past 14 Days', 'Past 30 Days'],
+ onChangeValue: function () {
+ this.get('parentView').updateFilter(2, this.get('value'), 'date');
+ }
+ }),
+
+ endFilterView: filters.createSelectView({
+ fieldType: 'input-medium',
+ content: ['Any', 'Past 1 Day', 'Past 2 Days', 'Past 7 Days', 'Past 14 Days', 'Past 30 Days'],
+ onChangeValue: function () {
+ this.get('parentView').updateFilter(3, this.get('value'), 'date');
+ }
+ }),
+
+ durationFilterView: filters.createTextView({
+ fieldType: 'input-medium',
+ onChangeValue: function () {
+ this.get('parentView').updateFilter(4, this.get('value'), 'duration');
+ }
+ }),
+
+ dataFilterView: filters.createTextView({
+ fieldType: 'input-small',
+ onChangeValue: function () {
+ this.get('parentView').updateFilter(5, this.get('value'), 'ambari-bandwidth');
+ }
+ }),
+
+ JobView: Em.View.extend({
+ content: null,
+ tagName: 'tr',
+
+ durationFormatted: function () {
+ var milliseconds = this.get('content.duration');
+ var h = Math.floor(milliseconds / 3600000);
+ var m = Math.floor((milliseconds % 3600000) / 60000);
+ var s = Math.floor(((milliseconds % 360000) % 60000) / 1000);
+ return (h == 0 ? '' : h + 'hr ') + (m == 0 ? '' : m + 'mins ') + (s == 0 ? '' : s + 'secs ');
+ }.property('content.duration'),
+
+ startFormatted: function () {
+ if (this.get('content.startDate')) {
+ return $.timeago(this.get('content.startDate'));
+ }
+ }.property('content.startDate'),
+
+ endFormatted: function () {
+ if (this.get('content.endDate')) {
+ return $.timeago(this.get('content.endDate'));
+ }
+ }.property('content.endDate')
+ }),
+
+ /**
+ * associations between dataset property and column index
+ */
+ colPropAssoc: function () {
+ var associations = [];
+ associations[1] = 'id';
+ associations[2] = 'startDate';
+ associations[3] = 'endDate';
+ associations[4] = 'duration';
+ associations[5] = 'data';
+ return associations;
+ }.property()
+
+});
Added: incubator/ambari/trunk/ambari-web/app/views/main/mirroring/targetClusterView.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/main/mirroring/targetClusterView.js?rev=1465166&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/main/mirroring/targetClusterView.js (added)
+++ incubator/ambari/trunk/ambari-web/app/views/main/mirroring/targetClusterView.js Sat Apr 6 01:55:42 2013
@@ -0,0 +1,28 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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 App = require('app');
+var filters = require('views/common/filter_view');
+var sort = require('views/common/sort_view');
+var date = require('utils/date');
+
+App.MainMirroringAddTargetClusterView = Em.View.extend({
+ name : 'mainMirroringAddTargetClusterView',
+ templateName:require('templates/main/mirroring/addTargetCluster')
+
+});
Added: incubator/ambari/trunk/ambari-web/app/views/main/mirroring/testConnectionResults_view.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/main/mirroring/testConnectionResults_view.js?rev=1465166&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/main/mirroring/testConnectionResults_view.js (added)
+++ incubator/ambari/trunk/ambari-web/app/views/main/mirroring/testConnectionResults_view.js Sat Apr 6 01:55:42 2013
@@ -0,0 +1,34 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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 App = require('app');
+var filters = require('views/common/filter_view');
+var sort = require('views/common/sort_view');
+var date = require('utils/date');
+
+App.TestConnectionResultsView = Em.View.extend({
+ templateName: require('templates/main/mirroring/testConnectionResults'),
+
+ name: 'testConnectionResultsView',
+
+ didInsertElement: function () {
+ console.debug('In didInsertElement');
+ var controller = this.get('controller');
+ controller.tryConnecting();
+ }
+});
Added: incubator/ambari/trunk/ambari-web/app/views/main/mirroring/testConnection_view.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/main/mirroring/testConnection_view.js?rev=1465166&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/main/mirroring/testConnection_view.js (added)
+++ incubator/ambari/trunk/ambari-web/app/views/main/mirroring/testConnection_view.js Sat Apr 6 01:55:42 2013
@@ -0,0 +1,27 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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 App = require('app');
+var filters = require('views/common/filter_view');
+var sort = require('views/common/sort_view');
+var date = require('utils/date');
+
+App.TestConnectionView = Em.View.extend({
+ name : 'testConnectionView',
+ templateName:require('templates/main/mirroring/testConnection')
+});
Modified: incubator/ambari/trunk/ambari-web/app/views/main/mirroring_view.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/main/mirroring_view.js?rev=1465166&r1=1465165&r2=1465166&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/main/mirroring_view.js (original)
+++ incubator/ambari/trunk/ambari-web/app/views/main/mirroring_view.js Sat Apr 6 01:55:42 2013
@@ -17,272 +17,8 @@
*/
var App = require('app');
-var filters = require('views/common/filter_view');
-var sort = require('views/common/sort_view');
App.MainMirroringView = Em.View.extend({
- templateName: require('templates/main/mirroring'),
- content: function () {
- return this.get('controller.content');
- }.property('controller.content'),
-
- didInsertElement: function () {
- this.filter();
- },
-
- /**
- * return pagination information displayed on the mirroring page
- */
- paginationInfo: function () {
- return this.t('apps.filters.paginationInfo').format(this.get('startIndex'), this.get('endIndex'), this.get('filteredContent.length'));
- }.property('displayLength', 'filteredContent.length', 'startIndex', 'endIndex'),
-
- paginationLeft: Ember.View.extend({
- tagName: 'a',
- template: Ember.Handlebars.compile('<i class="icon-arrow-left"></i>'),
- classNameBindings: ['class'],
- class: function () {
- if (this.get("parentView.startIndex") > 1) {
- return "paginate_previous";
- }
- return "paginate_disabled_previous";
- }.property("parentView.startIndex", 'filteredContent.length'),
-
- click: function () {
- this.get('parentView').previousPage();
- }
- }),
-
- paginationRight: Ember.View.extend({
- tagName: 'a',
- template: Ember.Handlebars.compile('<i class="icon-arrow-right"></i>'),
- classNameBindings: ['class'],
- class: function () {
- if ((this.get("parentView.endIndex")) < this.get("parentView.filteredContent.length")) {
- return "paginate_next";
- }
- return "paginate_disabled_next";
- }.property("parentView.endIndex", 'filteredContent.length'),
-
- click: function () {
- this.get('parentView').nextPage();
- }
- }),
-
- datasetsPerPageSelectView: Em.Select.extend({
- content: ['10', '25', '50']
- }),
-
- // start index for displayed content on the mirroring page
- startIndex: 1,
-
- // calculate end index for displayed content on the mirroring page
- endIndex: function () {
- return Math.min(this.get('filteredContent.length'), this.get('startIndex') + parseInt(this.get('displayLength')) - 1);
- }.property('startIndex', 'displayLength', 'filteredContent.length'),
-
- /**
- * onclick handler for previous page button on the mirroring page
- */
- previousPage: function () {
- var result = this.get('startIndex') - parseInt(this.get('displayLength'));
- if (result < 2) {
- result = 1;
- }
- this.set('startIndex', result);
- },
-
- /**
- * onclick handler for next page button on the mirroring page
- */
- nextPage: function () {
- var result = this.get('startIndex') + parseInt(this.get('displayLength'));
- if (result - 1 < this.get('filteredContent.length')) {
- this.set('startIndex', result);
- }
- },
-
- // the number of mirroring to show on every page of the mirroring page view
- displayLength: null,
-
- // calculates default value for startIndex property after applying filter or changing displayLength
- updatePaging: function () {
- this.set('startIndex', Math.min(1, this.get('filteredContent.length')));
- }.observes('displayLength', 'filteredContent.length'),
-
- sortView: sort.wrapperView,
- nameSort: sort.fieldView.extend({
- name: 'name',
- displayName: Em.I18n.t('common.name')
- }),
- dataSetSourceSort: sort.fieldView.extend({
- name: 'sourceDir',
- displayName: Em.I18n.t('mirroring.table.datasetSource')
- }),
- lastSuccessSort: sort.fieldView.extend({
- name: 'lastSucceededDate',
- displayName: Em.I18n.t('mirroring.table.lastSuccess'),
- type: 'number'
- }),
- lastFailSort: sort.fieldView.extend({
- name: 'lastFailedDate',
- displayName: Em.I18n.t('mirroring.table.lastFail'),
- type: 'number'
- }),
- lastDurationSort: sort.fieldView.extend({
- name: 'lastDuration',
- displayName: Em.I18n.t('mirroring.table.lastDuration'),
- type: 'number'
- }),
- avgDataSort: sort.fieldView.extend({
- name: 'avgData',
- displayName: Em.I18n.t('mirroring.table.avgData'),
- type: 'number'
- }),
-
- /**
- * Filter view for name column
- * Based on <code>filters</code> library
- */
- nameFilterView: filters.createTextView({
- fieldType: 'input-small',
- onChangeValue: function () {
- this.get('parentView').updateFilter(1, this.get('value'), 'string');
- }
- }),
-
- datasetSourceFilterView: filters.createTextView({
- fieldType: 'input-small',
- onChangeValue: function () {
- this.get('parentView').updateFilter(2, this.get('value'), 'string');
- }
- }),
-
- lastSuccessFilterView: filters.createSelectView({
- fieldType: 'input-medium',
- content: ['Any', 'Past 1 Day', 'Past 2 Days', 'Past 7 Days', 'Past 14 Days', 'Past 30 Days'],
- onChangeValue: function () {
- this.get('parentView').updateFilter(3, this.get('value'), 'date');
- }
- }),
-
- lastFailFilterView: filters.createSelectView({
- fieldType: 'input-medium',
- content: ['Any', 'Past 1 Day', 'Past 2 Days', 'Past 7 Days', 'Past 14 Days', 'Past 30 Days'],
- onChangeValue: function () {
- this.get('parentView').updateFilter(4, this.get('value'), 'date');
- }
- }),
-
- lastDurationFilterView: filters.createTextView({
- fieldType: 'input-small',
- onChangeValue: function () {
- this.get('parentView').updateFilter(5, this.get('value'), 'duration');
- }
- }),
-
- avgDataFilterView: filters.createTextView({
- fieldType: 'input-small',
- onChangeValue: function () {
- this.get('parentView').updateFilter(6, this.get('value'), 'ambari-bandwidth');
- }
- }),
-
- DatasetView: Em.View.extend({
- content: null,
- tagName: 'tr',
-
- lastDurationFormatted: function () {
- var milliseconds = this.get('content.lastDuration');
- var h = Math.floor(milliseconds / 3600000);
- var m = Math.floor((milliseconds % 3600000) / 60000);
- var s = Math.floor(((milliseconds % 360000) % 60000) / 1000);
- return (h == 0 ? '' : h + 'hr ') + (m == 0 ? '' : m + 'mins ') + (s == 0 ? '' : s + 'secs ');
- }.property('content.lastDuration'),
-
- lastSucceededDateFormatted: function () {
- if (this.get('content.lastSucceededDate')) {
- return $.timeago(this.get('content.lastSucceededDate'));
- }
- }.property('content.lastSucceededDate'),
-
- lastFailedDateFormatted: function () {
- if (this.get('content.lastFailedDate')) {
- return $.timeago(this.get('content.lastFailedDate'));
- }
- }.property('content.lastFailedDate')
- }),
-
- /**
- * Apply each filter to dataset
- *
- * @param iColumn number of column by which filter
- * @param value
- */
- updateFilter: function (iColumn, value, type) {
- var filterCondition = this.get('filterConditions').findProperty('iColumn', iColumn);
- if (filterCondition) {
- filterCondition.value = value;
- } else {
- filterCondition = {
- iColumn: iColumn,
- value: value,
- type: type
- }
- this.get('filterConditions').push(filterCondition);
- }
- this.filter();
- },
-
- /**
- * associations between dataset property and column index
- */
- colPropAssoc: function () {
- var associations = [];
- associations[1] = 'name';
- associations[2] = 'sourceDir';
- associations[3] = 'lastSucceededDate';
- associations[4] = 'lastFailedDate';
- associations[5] = 'lastDuration';
- associations[6] = 'avgData';
- return associations;
- }.property(),
-
- /**
- * contain filter conditions for each column
- */
- filterConditions: [],
-
- filteredContent: [],
-
- // contain content to show on the current page of mirroring page view
- pageContent: function () {
- return this.get('filteredContent').slice(this.get('startIndex') - 1, this.get('endIndex'));
- }.property('filteredContent.length', 'startIndex', 'endIndex'),
-
- /**
- * filter table by filterConditions
- */
- filter: function () {
- var content = this.get('content');
- var filterConditions = this.get('filterConditions').filterProperty('value');
- var result;
- var assoc = this.get('colPropAssoc');
- if (filterConditions.length) {
- result = content.filter(function (dataset) {
- var match = true;
- filterConditions.forEach(function (condition) {
- var filterFunc = filters.getFilterByType(condition.type, false);
- if (match) {
- match = filterFunc(dataset.get(assoc[condition.iColumn]), condition.value);
- }
- });
- return match;
- });
- this.set('filteredContent', result);
- } else {
- this.set('filteredContent', content.toArray());
- }
- }.observes('content')
+ templateName: require('templates/main/mirroring')
});
Modified: incubator/ambari/trunk/ambari-web/app/views/main/service/info/summary.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/main/service/info/summary.js?rev=1465166&r1=1465165&r2=1465166&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/main/service/info/summary.js (original)
+++ incubator/ambari/trunk/ambari-web/app/views/main/service/info/summary.js Sat Apr 6 01:55:42 2013
@@ -42,7 +42,8 @@ App.MainServiceInfoSummaryView = Em.View
oozie:false,
hive:false,
ganglia:false,
- nagios:false
+ nagios:false,
+ hue: false
},
clients: function () {
@@ -187,6 +188,9 @@ App.MainServiceInfoSummaryView = Em.View
oozieServer:function(){
return this.getServer("OOZIE");
}.property('controller.content'),
+ hueServer:function(){
+ return this.getServer("HUE");
+ }.property('controller.content'),
/**
* Array of the hostComponents for service
Modified: incubator/ambari/trunk/ambari-web/app/views/main/service/item.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/main/service/item.js?rev=1465166&r1=1465165&r2=1465166&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/main/service/item.js (original)
+++ incubator/ambari/trunk/ambari-web/app/views/main/service/item.js Sat Apr 6 01:55:42 2013
@@ -30,11 +30,30 @@ App.MainServiceItemView = Em.View.extend
// case 'HBASE':
// options.push({action: 'runCompaction', 'label': Em.I18n.t('services.service.actions.run.compaction')});
// break;
- default:
- options.push({action: 'runSmokeTest', 'label': Em.I18n.t('services.service.actions.run.smoke')});
+ case 'GANGLIA':
+ case 'NAGIOS':
this.get('controller.content.hostComponents').filterProperty('isMaster').forEach (function (hostComponent){
options.push({action: 'reassignMaster', context: hostComponent, 'label': Em.I18n.t('services.service.actions.reassign.master').format(hostComponent.get('displayName'))});
})
+ break;
+ case 'HIVE':
+ options.push({action: 'runSmokeTest', 'label': Em.I18n.t('services.service.actions.run.smoke')});
+ options.push({action: 'reassignMaster', context: App.HostComponent.find().findProperty('componentName', 'HIVE_METASTORE'), 'label': Em.I18n.t('services.service.actions.reassign.master').format(App.HostComponent.find().findProperty('componentName', 'HIVE_METASTORE').get('displayName'))});
+ options.push({action: 'reassignMaster', context: App.HostComponent.find().findProperty('componentName', 'HIVE_SERVER'), 'label': Em.I18n.t('services.service.actions.reassign.master.hive')});
+ break;
+ case 'WEBHCAT':
+ options.push({action: 'runSmokeTest', 'label': Em.I18n.t('services.service.actions.run.smoke')});
+ options.push({action: 'reassignMaster', context: App.HostComponent.find().findProperty('componentName', 'HIVE_SERVER'), 'label': Em.I18n.t('services.service.actions.reassign.master.hive')});
+ break;
+ case 'HUE':
+ options.push({action: 'runSmokeTest', 'label': Em.I18n.t('services.service.actions.run.smoke')});
+ break;
+ default:
+ var components = this.get('controller.content.hostComponents');
+ options.push({action: 'runSmokeTest', 'label': Em.I18n.t('services.service.actions.run.smoke')});
+ components.filterProperty('isMaster').mapProperty('displayName').uniq().forEach (function (hostComponent){
+ options.push({action: 'reassignMaster', context: components.findProperty('displayName', hostComponent), 'label': Em.I18n.t('services.service.actions.reassign.master').format(hostComponent)});
+ })
}
return options;
}.property('controller.content'),
Modified: incubator/ambari/trunk/ambari-web/app/views/main/service/menu.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/main/service/menu.js?rev=1465166&r1=1465165&r2=1465166&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/main/service/menu.js (original)
+++ incubator/ambari/trunk/ambari-web/app/views/main/service/menu.js Sat Apr 6 01:55:42 2013
@@ -33,6 +33,7 @@ App.MainServiceMenuView = Em.CollectionV
didInsertElement:function () {
App.router.location.addObserver('lastSetURL', this, 'renderOnRoute');
this.renderOnRoute();
+ $(".restart-required-service").tooltip({html:true, placement:"right"});
},
activeServiceId:null,
Modified: incubator/ambari/trunk/ambari-web/app/views/wizard/controls_view.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/wizard/controls_view.js?rev=1465166&r1=1465165&r2=1465166&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/wizard/controls_view.js (original)
+++ incubator/ambari/trunk/ambari-web/app/views/wizard/controls_view.js Sat Apr 6 01:55:42 2013
@@ -53,6 +53,12 @@ App.ServiceConfigTextField = Ember.TextF
classNameBindings: 'textFieldClassName',
placeholderBinding: 'serviceConfig.defaultValue',
+ keyPress: function(event) {
+ if (event.keyCode == 13) {
+ return false;
+ }
+ },
+
textFieldClassName: function () {
// sets the width of the field depending on display type
if (['directory', 'url', 'email', 'user', 'host'].contains(this.get('serviceConfig.displayType'))) {
@@ -101,10 +107,21 @@ App.ServiceConfigPasswordField = Ember.T
template: Ember.Handlebars.compile('{{view view.retypePasswordView}}'),
+ keyPress: function(event) {
+ if (event.keyCode == 13) {
+ return false;
+ }
+ },
+
retypePasswordView: Ember.TextField.extend({
placeholder: Em.I18n.t('form.passwordRetype'),
type: 'password',
classNames: [ 'span3', 'retyped-password' ],
+ keyPress: function(event) {
+ if (event.keyCode == 13) {
+ return false;
+ }
+ },
valueBinding: 'parentView.serviceConfig.retypedPassword'
})
@@ -160,7 +177,7 @@ App.ServiceConfigRadioButtons = Ember.Vi
'{{/each}}'
].join('\n')),
serviceConfig: null,
- categoryConfigs: null,
+ categoryConfigsAll: null,
nameBinding: 'serviceConfig.radioName',
optionsBinding: 'serviceConfig.options',
disabled: function () {
@@ -191,16 +208,18 @@ App.ServiceConfigRadioButton = Ember.Che
this.set('parentView.serviceConfig.value', this.get('value'));
var components = this.get('parentView.serviceConfig.options');
components.forEach(function (_component) {
- _component.foreignKeys.forEach(function (_componentName) {
- if (this.get('parentView.categoryConfigs').someProperty('name', _componentName)) {
- var component = this.get('parentView.categoryConfigs').findProperty('name', _componentName);
- if (_component.displayName === this.get('value')) {
- component.set('isVisible', true);
- } else {
- component.set('isVisible', false);
+ if(_component.foreignKeys){
+ _component.foreignKeys.forEach(function (_componentName) {
+ if (this.get('parentView.categoryConfigsAll').someProperty('name', _componentName)) {
+ var component = this.get('parentView.categoryConfigsAll').findProperty('name', _componentName);
+ if (_component.displayName === this.get('value')) {
+ component.set('isVisible', true);
+ } else {
+ component.set('isVisible', false);
+ }
}
- }
- }, this);
+ }, this);
+ }
}, this);
}.observes('checked') ,
@@ -382,7 +401,25 @@ App.ServiceConfigSlaveHostsView = Ember.
valueBinding: 'serviceConfig.value',
- templateName: require('templates/wizard/slave_hosts')
+ templateName: require('templates/wizard/slave_hosts'),
+
+ /**
+ * Onclick handler for link
+ */
+ showHosts: function () {
+ var serviceConfig = this.get('serviceConfig');
+ App.ModalPopup.show({
+ header: Em.I18n.t('installer.controls.serviceConfigMasterHosts.header').format(serviceConfig.category),
+ bodyClass: Ember.View.extend({
+ serviceConfig: serviceConfig,
+ templateName: require('templates/wizard/master_hosts_popup')
+ }),
+ onPrimary: function () {
+ this.hide();
+ },
+ secondary: null
+ });
+ }
});
Modified: incubator/ambari/trunk/ambari-web/app/views/wizard/stack_upgrade/step3_view.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/wizard/stack_upgrade/step3_view.js?rev=1465166&r1=1465165&r2=1465166&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/wizard/stack_upgrade/step3_view.js (original)
+++ incubator/ambari/trunk/ambari-web/app/views/wizard/stack_upgrade/step3_view.js Sat Apr 6 01:55:42 2013
@@ -21,49 +21,81 @@ var App = require('app');
App.StackUpgradeStep3View = Em.View.extend({
templateName: require('templates/wizard/stack_upgrade/step3'),
+ overallStatus: Em.I18n.t('installer.stackUpgrade.step3.status.info'),
+ statusClass: 'alert-info',
didInsertElement: function(){
- this.get('controller').navigateStep();
+ this.get('controller').resumeStep();
this.onStatus();
},
- statusMessage: null,
- statusClass: 'alert-info',
- barColor: '',
- servicesStopWidth: function(){
- return 'width: ' + this.get('controller.servicesStopProgress') + '%;';
- }.property('controller.servicesStopProgress'),
- /**
- * change message of Upgrade status depending on the Upgrade status
- */
onStatus: function(){
- switch (this.get('controller.status')){
- case 'SUCCESS':
- this.set('statusMessage', Em.I18n.t('installer.stackUpgrade.step3.status.success').format(this.get('controller.content.upgradeVersion')));
- this.set('statusClass', 'alert-success');
- break;
- case 'FAILED':
- this.set('statusMessage', Em.I18n.t('installer.stackUpgrade.step3.status.failed'));
- this.set('statusClass', 'alert-error');
- break;
- case 'WARNING':
- this.set('statusMessage', Em.I18n.t('installer.stackUpgrade.step3.status.warning').format(this.get('controller.content.upgradeVersion')));
- this.set('statusClass', 'alert-block');
- break;
- case 'IN_PROGRESS':
- default:
- this.set('statusMessage', Em.I18n.t('installer.stackUpgrade.step3.status.info'));
- this.set('statusClass', 'alert-info');
+ var currentProcess = this.get('controller.processes').findProperty('isRunning', true);
+ if(currentProcess && (currentProcess.get('name') == 'UPGRADE_SERVICES')){
+ switch (currentProcess.get('status')){
+ case 'SUCCESS':
+ this.set('overallStatus', Em.I18n.t('installer.stackUpgrade.step3.status.success').format(this.get('controller.content.upgradeVersion')));
+ this.set('statusClass', 'alert-success');
+ break;
+ case 'FAILED':
+ this.set('overallStatus', Em.I18n.t('installer.stackUpgrade.step3.status.failed'));
+ this.set('statusClass', 'alert-error');
+ break;
+ case 'WARNING':
+ this.set('overallStatus', Em.I18n.t('installer.stackUpgrade.step3.status.warning').format(this.get('controller.content.upgradeVersion')));
+ this.set('statusClass', 'alert-block');
+ break;
+ case 'IN_PROGRESS':
+ default:
+ this.set('overallStatus', Em.I18n.t('installer.stackUpgrade.step3.status.info'));
+ this.set('statusClass', 'alert-info');
+ }
+ } else {
+ this.set('overallStatus', Em.I18n.t('installer.stackUpgrade.step3.status.info'));
+ this.set('statusClass', 'alert-info');
}
- }.observes('controller.status'),
-
- serviceView: Em.View.extend({
+ }.observes('controller.processes.@each.status'),
+ processView: Em.View.extend({
barColor: '',
icon:'',
iconColor:'',
+ status: function(){
+ var process = this.get('content');
+ if(process.get('name') == 'STOP_SERVICES'){
+ switch(process.get('status')){
+ case 'IN_PROGRESS':
+ return Em.I18n.t('installer.stackUpgrade.step3.service.stopping');
+ case 'FAILED':
+ return Em.I18n.t('installer.stackUpgrade.step3.service.stopFail');
+ case 'SUCCESS':
+ return Em.I18n.t('installer.stackUpgrade.step3.service.stopped');
+ default:
+ return Em.I18n.t('installer.stackUpgrade.step3.service.stopPending');
+ }
+ } else {
+ switch(process.get('status')){
+ case 'IN_PROGRESS':
+ return Em.I18n.t('installer.stackUpgrade.step3.service.upgrading');
+ case 'WARNING':
+ return Em.I18n.t('installer.stackUpgrade.step3.service.upgraded');
+ case 'FAILED':
+ return Em.I18n.t('installer.stackUpgrade.step3.service.failedUpgrade');
+ case 'SUCCESS':
+ return Em.I18n.t('installer.stackUpgrade.step3.service.upgraded');
+ default:
+ return Em.I18n.t('installer.stackUpgrade.step3.service.pending');
+ }
+ }
+ }.property('content.status'),
didInsertElement: function(){
this.onStatus();
},
- isServiceCompleted: function(){
- return this.get('content.status') === 'SUCCESS';
+ retryMessage: function(){
+ if(this.get('content.name') == 'STOP_SERVICES'){
+ return Em.I18n.t('installer.stackUpgrade.step3.retry.services');
+ }
+ return Em.I18n.t('installer.stackUpgrade.step3.retry.upgrade');
+ }.property('content.name'),
+ isProcessCompleted: function(){
+ return this.get('content.status') == 'SUCCESS' || this.get('content.status') === 'WARNING';
}.property('content.status'),
barWidth: function(){
return 'width: ' + this.get('content.progress') + '%;';
@@ -95,7 +127,7 @@ App.StackUpgradeStep3View = Em.View.exte
}
}.observes('content.status'),
inProgress: function(){
- return this.get('content.status') === "IN_PROGRESS";
+ return this.get('content.isRunning') && !this.get('content.isRetry');
}.property('content.status'),
/**
* open popup with list of hosts, that associated to service
Modified: incubator/ambari/trunk/ambari-web/app/views/wizard/step14_view.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/wizard/step14_view.js?rev=1465166&r1=1465165&r2=1465166&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/wizard/step14_view.js (original)
+++ incubator/ambari/trunk/ambari-web/app/views/wizard/step14_view.js Sat Apr 6 01:55:42 2013
@@ -31,11 +31,15 @@ App.WizardStep14View = Em.View.extend({
},
tasks: function () {
- return this.get('controller.tasks');
- }.property('controller.tasks'),
+ var tasks = this.get('controller.tasks');
+ if (this.get('controller.service.serviceName') == 'GANGLIA') {
+ tasks = tasks.slice(0,2).concat(tasks.slice(4));
+ }
+ return tasks;
+ }.property('controller.tasks', 'controller.service'),
onStatus: function () {
- var master = this.get('controller.content.reassign.display_name');
+ var master = (this.get('controller.isCohosted')) ? Em.I18n.t('installer.step5.hiveGroup') : this.get('controller.content.reassign.display_name');
switch (this.get('controller.status')) {
case 'COMPLETED':
this.set('statusMessage', Em.I18n.t('installer.step14.status.success').format(master));
Modified: incubator/ambari/trunk/ambari-web/app/views/wizard/step1_view.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/wizard/step1_view.js?rev=1465166&r1=1465165&r2=1465166&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/wizard/step1_view.js (original)
+++ incubator/ambari/trunk/ambari-web/app/views/wizard/step1_view.js Sat Apr 6 01:55:42 2013
@@ -37,3 +37,12 @@ App.WizardStep1View = Em.View.extend({
}.property('controller.clusterNameError')
});
+
+App.WizardStep1ViewClusterNameInput = Em.TextField.extend({
+ keyPress: function(event) {
+ if (event.keyCode == 13) {
+ this.get('parentView.controller').submit();
+ return false;
+ }
+ }
+});
Modified: incubator/ambari/trunk/ambari-web/app/views/wizard/step5_view.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/wizard/step5_view.js?rev=1465166&r1=1465165&r2=1465166&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/wizard/step5_view.js (original)
+++ incubator/ambari/trunk/ambari-web/app/views/wizard/step5_view.js Sat Apr 6 01:55:42 2013
@@ -70,7 +70,9 @@ App.SelectHostView = Em.Select.extend({
},
didInsertElement:function () {
- this.filterContent();
+ if (!this.get('controller.isReassignWizard')) {
+ this.filterContent();
+ }
this.set("value", this.get("selectedHost"));
}
});
Modified: incubator/ambari/trunk/ambari-web/app/views/wizard/step6_view.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/wizard/step6_view.js?rev=1465166&r1=1465165&r2=1465166&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/wizard/step6_view.js (original)
+++ incubator/ambari/trunk/ambari-web/app/views/wizard/step6_view.js Sat Apr 6 01:55:42 2013
@@ -99,7 +99,7 @@ App.WizardStep6CheckboxView = Em.Checkbo
checkedBinding: 'checkbox.checked',
- disabledBinding: 'checkbox.disabled',
+ disabledBinding: 'checkbox.isInstalled',
checkCallback: function() {
var self = this;
Added: incubator/ambari/trunk/ambari-web/vendor/scripts/bootstrap-datepicker.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/vendor/scripts/bootstrap-datepicker.js?rev=1465166&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-web/vendor/scripts/bootstrap-datepicker.js (added)
+++ incubator/ambari/trunk/ambari-web/vendor/scripts/bootstrap-datepicker.js Sat Apr 6 01:55:42 2013
@@ -0,0 +1,1026 @@
+/* =========================================================
+ * bootstrap-datepicker.js
+ * http://www.eyecon.ro/bootstrap-datepicker
+ * =========================================================
+ * Copyright 2012 Stefan Petre
+ * Improvements by Andrew Rowls
+ *
+ * Licensed 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.
+ * ========================================================= */
+
+!function( $ ) {
+
+ function UTCDate(){
+ return new Date(Date.UTC.apply(Date, arguments));
+ }
+ function UTCToday(){
+ var today = new Date();
+ return UTCDate(today.getUTCFullYear(), today.getUTCMonth(), today.getUTCDate());
+ }
+
+ // Picker object
+
+ var Datepicker = function(element, options) {
+ var that = this;
+
+ this.element = $(element);
+ this.language = options.language||this.element.data('date-language')||"en";
+ this.language = this.language in dates ? this.language : this.language.split('-')[0]; //Check if "de-DE" style date is available, if not language should fallback to 2 letter code eg "de"
+ this.language = this.language in dates ? this.language : "en";
+ this.isRTL = dates[this.language].rtl||false;
+ this.format = DPGlobal.parseFormat(options.format||this.element.data('date-format')||dates[this.language].format||'mm/dd/yyyy');
+ this.isInline = false;
+ this.isInput = this.element.is('input');
+ this.component = this.element.is('.date') ? this.element.find('.add-on, .btn') : false;
+ this.hasInput = this.component && this.element.find('input').length;
+ if(this.component && this.component.length === 0)
+ this.component = false;
+
+ this._attachEvents();
+
+ this.forceParse = true;
+ if ('forceParse' in options) {
+ this.forceParse = options.forceParse;
+ } else if ('dateForceParse' in this.element.data()) {
+ this.forceParse = this.element.data('date-force-parse');
+ }
+
+
+ this.picker = $(DPGlobal.template)
+ .on({
+ click: $.proxy(this.click, this),
+ mousedown: $.proxy(this.mousedown, this)
+ });
+
+ if(this.isInline) {
+ this.picker.addClass('datepicker-inline').appendTo(this.element);
+ } else {
+ this.picker.addClass('datepicker-dropdown dropdown-menu');
+ }
+ if (this.isRTL){
+ this.picker.addClass('datepicker-rtl');
+ this.picker.find('.prev i, .next i')
+ .toggleClass('icon-arrow-left icon-arrow-right');
+ }
+ $(document).on('mousedown', function (e) {
+ // Clicked outside the datepicker, hide it
+ if ($(e.target).closest('.datepicker.datepicker-inline, .datepicker.datepicker-dropdown').length === 0) {
+ that.hide();
+ }
+ });
+
+ this.autoclose = false;
+ if ('autoclose' in options) {
+ this.autoclose = options.autoclose;
+ } else if ('dateAutoclose' in this.element.data()) {
+ this.autoclose = this.element.data('date-autoclose');
+ }
+
+ this.keyboardNavigation = true;
+ if ('keyboardNavigation' in options) {
+ this.keyboardNavigation = options.keyboardNavigation;
+ } else if ('dateKeyboardNavigation' in this.element.data()) {
+ this.keyboardNavigation = this.element.data('date-keyboard-navigation');
+ }
+
+ this.viewMode = this.startViewMode = 0;
+ switch(options.startView || this.element.data('date-start-view')){
+ case 2:
+ case 'decade':
+ this.viewMode = this.startViewMode = 2;
+ break;
+ case 1:
+ case 'year':
+ this.viewMode = this.startViewMode = 1;
+ break;
+ }
+
+ this.minViewMode = options.minViewMode||this.element.data('date-min-view-mode')||0;
+ if (typeof this.minViewMode === 'string') {
+ switch (this.minViewMode) {
+ case 'months':
+ this.minViewMode = 1;
+ break;
+ case 'years':
+ this.minViewMode = 2;
+ break;
+ default:
+ this.minViewMode = 0;
+ break;
+ }
+ }
+
+ this.viewMode = this.startViewMode = Math.max(this.startViewMode, this.minViewMode);
+
+ this.todayBtn = (options.todayBtn||this.element.data('date-today-btn')||false);
+ this.todayHighlight = (options.todayHighlight||this.element.data('date-today-highlight')||false);
+
+ this.calendarWeeks = false;
+ if ('calendarWeeks' in options) {
+ this.calendarWeeks = options.calendarWeeks;
+ } else if ('dateCalendarWeeks' in this.element.data()) {
+ this.calendarWeeks = this.element.data('date-calendar-weeks');
+ }
+ if (this.calendarWeeks)
+ this.picker.find('tfoot th.today')
+ .attr('colspan', function(i, val){
+ return parseInt(val) + 1;
+ });
+
+ this._allow_update = false;
+
+ this.weekStart = ((options.weekStart||this.element.data('date-weekstart')||dates[this.language].weekStart||0) % 7);
+ this.weekEnd = ((this.weekStart + 6) % 7);
+ this.startDate = -Infinity;
+ this.endDate = Infinity;
+ this.daysOfWeekDisabled = [];
+ this.setStartDate(options.startDate||this.element.data('date-startdate'));
+ this.setEndDate(options.endDate||this.element.data('date-enddate'));
+ this.setDaysOfWeekDisabled(options.daysOfWeekDisabled||this.element.data('date-days-of-week-disabled'));
+ this.fillDow();
+ this.fillMonths();
+
+ this._allow_update = true;
+
+ this.update();
+ this.showMode();
+
+ if(this.isInline) {
+ this.show();
+ }
+ };
+
+ Datepicker.prototype = {
+ constructor: Datepicker,
+
+ _events: [],
+ _attachEvents: function(){
+ this._detachEvents();
+ if (this.isInput) { // single input
+ this._events = [
+ [this.element, {
+ focus: $.proxy(this.show, this),
+ keyup: $.proxy(this.update, this),
+ keydown: $.proxy(this.keydown, this)
+ }]
+ ];
+ }
+ else if (this.component && this.hasInput){ // component: input + button
+ this._events = [
+ // For components that are not readonly, allow keyboard nav
+ [this.element.find('input'), {
+ focus: $.proxy(this.show, this),
+ keyup: $.proxy(this.update, this),
+ keydown: $.proxy(this.keydown, this)
+ }],
+ [this.component, {
+ click: $.proxy(this.show, this)
+ }]
+ ];
+ }
+ else if (this.element.is('div')) { // inline datepicker
+ this.isInline = true;
+ }
+ else {
+ this._events = [
+ [this.element, {
+ click: $.proxy(this.show, this)
+ }]
+ ];
+ }
+ for (var i=0, el, ev; i<this._events.length; i++){
+ el = this._events[i][0];
+ ev = this._events[i][1];
+ el.on(ev);
+ }
+ },
+ _detachEvents: function(){
+ for (var i=0, el, ev; i<this._events.length; i++){
+ el = this._events[i][0];
+ ev = this._events[i][1];
+ el.off(ev);
+ }
+ this._events = [];
+ },
+
+ show: function(e) {
+ if (!this.isInline)
+ this.picker.appendTo('body');
+ this.picker.show();
+ this.height = this.component ? this.component.outerHeight() : this.element.outerHeight();
+ this.place();
+ $(window).on('resize', $.proxy(this.place, this));
+ if (e) {
+ e.preventDefault();
+ }
+ this.element.trigger({
+ type: 'show',
+ date: this.date
+ });
+ },
+
+ hide: function(e){
+ if(this.isInline) return;
+ if (!this.picker.is(':visible')) return;
+ this.picker.hide().detach();
+ $(window).off('resize', this.place);
+ this.viewMode = this.startViewMode;
+ this.showMode();
+ if (!this.isInput) {
+ $(document).off('mousedown', this.hide);
+ }
+
+ if (
+ this.forceParse &&
+ (
+ this.isInput && this.element.val() ||
+ this.hasInput && this.element.find('input').val()
+ )
+ )
+ this.setValue();
+ this.element.trigger({
+ type: 'hide',
+ date: this.date
+ });
+ },
+
+ remove: function() {
+ this._detachEvents();
+ this.picker.remove();
+ delete this.element.data().datepicker;
+ if (!this.isInput) {
+ delete this.element.data().date;
+ }
+ },
+
+ getDate: function() {
+ var d = this.getUTCDate();
+ return new Date(d.getTime() + (d.getTimezoneOffset()*60000));
+ },
+
+ getUTCDate: function() {
+ return this.date;
+ },
+
+ setDate: function(d) {
+ this.setUTCDate(new Date(d.getTime() - (d.getTimezoneOffset()*60000)));
+ },
+
+ setUTCDate: function(d) {
+ this.date = d;
+ this.setValue();
+ },
+
+ setValue: function() {
+ var formatted = this.getFormattedDate();
+ if (!this.isInput) {
+ if (this.component){
+ this.element.find('input').val(formatted);
+ }
+ this.element.data('date', formatted);
+ } else {
+ this.element.val(formatted);
+ }
+ },
+
+ getFormattedDate: function(format) {
+ if (format === undefined)
+ format = this.format;
+ return DPGlobal.formatDate(this.date, format, this.language);
+ },
+
+ setStartDate: function(startDate){
+ this.startDate = startDate||-Infinity;
+ if (this.startDate !== -Infinity) {
+ this.startDate = DPGlobal.parseDate(this.startDate, this.format, this.language);
+ }
+ this.update();
+ this.updateNavArrows();
+ },
+
+ setEndDate: function(endDate){
+ this.endDate = endDate||Infinity;
+ if (this.endDate !== Infinity) {
+ this.endDate = DPGlobal.parseDate(this.endDate, this.format, this.language);
+ }
+ this.update();
+ this.updateNavArrows();
+ },
+
+ setDaysOfWeekDisabled: function(daysOfWeekDisabled){
+ this.daysOfWeekDisabled = daysOfWeekDisabled||[];
+ if (!$.isArray(this.daysOfWeekDisabled)) {
+ this.daysOfWeekDisabled = this.daysOfWeekDisabled.split(/,\s*/);
+ }
+ this.daysOfWeekDisabled = $.map(this.daysOfWeekDisabled, function (d) {
+ return parseInt(d, 10);
+ });
+ this.update();
+ this.updateNavArrows();
+ },
+
+ place: function(){
+ if(this.isInline) return;
+ var zIndex = parseInt(this.element.parents().filter(function() {
+ return $(this).css('z-index') != 'auto';
+ }).first().css('z-index'))+10;
+ var offset = this.component ? this.component.parent().offset() : this.element.offset();
+ var height = this.component ? this.component.outerHeight(true) : this.element.outerHeight(true);
+ this.picker.css({
+ top: offset.top + height,
+ left: offset.left,
+ zIndex: zIndex
+ });
+ },
+
+ _allow_update: true,
+ update: function(){
+ if (!this._allow_update) return;
+
+ var date, fromArgs = false;
+ if(arguments && arguments.length && (typeof arguments[0] === 'string' || arguments[0] instanceof Date)) {
+ date = arguments[0];
+ fromArgs = true;
+ } else {
+ date = this.isInput ? this.element.val() : this.element.data('date') || this.element.find('input').val();
+ }
+
+ this.date = DPGlobal.parseDate(date, this.format, this.language);
+
+ if(fromArgs) this.setValue();
+
+ if (this.date < this.startDate) {
+ this.viewDate = new Date(this.startDate);
+ } else if (this.date > this.endDate) {
+ this.viewDate = new Date(this.endDate);
+ } else {
+ this.viewDate = new Date(this.date);
+ }
+ this.fill();
+ },
+
+ fillDow: function(){
+ var dowCnt = this.weekStart,
+ html = '<tr>';
+ if(this.calendarWeeks){
+ var cell = '<th class="cw"> </th>';
+ html += cell;
+ this.picker.find('.datepicker-days thead tr:first-child').prepend(cell);
+ }
+ while (dowCnt < this.weekStart + 7) {
+ html += '<th class="dow">'+dates[this.language].daysMin[(dowCnt++)%7]+'</th>';
+ }
+ html += '</tr>';
+ this.picker.find('.datepicker-days thead').append(html);
+ },
+
+ fillMonths: function(){
+ var html = '',
+ i = 0;
+ while (i < 12) {
+ html += '<span class="month">'+dates[this.language].monthsShort[i++]+'</span>';
+ }
+ this.picker.find('.datepicker-months td').html(html);
+ },
+
+ fill: function() {
+ var d = new Date(this.viewDate),
+ year = d.getUTCFullYear(),
+ month = d.getUTCMonth(),
+ startYear = this.startDate !== -Infinity ? this.startDate.getUTCFullYear() : -Infinity,
+ startMonth = this.startDate !== -Infinity ? this.startDate.getUTCMonth() : -Infinity,
+ endYear = this.endDate !== Infinity ? this.endDate.getUTCFullYear() : Infinity,
+ endMonth = this.endDate !== Infinity ? this.endDate.getUTCMonth() : Infinity,
+ currentDate = this.date && this.date.valueOf(),
+ today = new Date();
+ this.picker.find('.datepicker-days thead th.switch')
+ .text(dates[this.language].months[month]+' '+year);
+ this.picker.find('tfoot th.today')
+ .text(dates[this.language].today)
+ .toggle(this.todayBtn !== false);
+ this.updateNavArrows();
+ this.fillMonths();
+ var prevMonth = UTCDate(year, month-1, 28,0,0,0,0),
+ day = DPGlobal.getDaysInMonth(prevMonth.getUTCFullYear(), prevMonth.getUTCMonth());
+ prevMonth.setUTCDate(day);
+ prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.weekStart + 7)%7);
+ var nextMonth = new Date(prevMonth);
+ nextMonth.setUTCDate(nextMonth.getUTCDate() + 42);
+ nextMonth = nextMonth.valueOf();
+ var html = [];
+ var clsName;
+ while(prevMonth.valueOf() < nextMonth) {
+ if (prevMonth.getUTCDay() == this.weekStart) {
+ html.push('<tr>');
+ if(this.calendarWeeks){
+ // ISO 8601: First week contains first thursday.
+ // ISO also states week starts on Monday, but we can be more abstract here.
+ var
+ // Start of current week: based on weekstart/current date
+ ws = new Date(+prevMonth + (this.weekStart - prevMonth.getUTCDay() - 7) % 7 * 864e5),
+ // Thursday of this week
+ th = new Date(+ws + (7 + 4 - ws.getUTCDay()) % 7 * 864e5),
+ // First Thursday of year, year from thursday
+ yth = new Date(+(yth = UTCDate(th.getUTCFullYear(), 0, 1)) + (7 + 4 - yth.getUTCDay())%7*864e5),
+ // Calendar week: ms between thursdays, div ms per day, div 7 days
+ calWeek = (th - yth) / 864e5 / 7 + 1;
+ html.push('<td class="cw">'+ calWeek +'</td>');
+
+ }
+ }
+ clsName = '';
+ if (prevMonth.getUTCFullYear() < year || (prevMonth.getUTCFullYear() == year && prevMonth.getUTCMonth() < month)) {
+ clsName += ' old';
+ } else if (prevMonth.getUTCFullYear() > year || (prevMonth.getUTCFullYear() == year && prevMonth.getUTCMonth() > month)) {
+ clsName += ' new';
+ }
+ // Compare internal UTC date with local today, not UTC today
+ if (this.todayHighlight &&
+ prevMonth.getUTCFullYear() == today.getFullYear() &&
+ prevMonth.getUTCMonth() == today.getMonth() &&
+ prevMonth.getUTCDate() == today.getDate()) {
+ clsName += ' today';
+ }
+ if (currentDate && prevMonth.valueOf() == currentDate) {
+ clsName += ' active';
+ }
+ if (prevMonth.valueOf() < this.startDate || prevMonth.valueOf() > this.endDate ||
+ $.inArray(prevMonth.getUTCDay(), this.daysOfWeekDisabled) !== -1) {
+ clsName += ' disabled';
+ }
+ html.push('<td class="day'+clsName+'">'+prevMonth.getUTCDate() + '</td>');
+ if (prevMonth.getUTCDay() == this.weekEnd) {
+ html.push('</tr>');
+ }
+ prevMonth.setUTCDate(prevMonth.getUTCDate()+1);
+ }
+ this.picker.find('.datepicker-days tbody').empty().append(html.join(''));
+ var currentYear = this.date && this.date.getUTCFullYear();
+
+ var months = this.picker.find('.datepicker-months')
+ .find('th:eq(1)')
+ .text(year)
+ .end()
+ .find('span').removeClass('active');
+ if (currentYear && currentYear == year) {
+ months.eq(this.date.getUTCMonth()).addClass('active');
+ }
+ if (year < startYear || year > endYear) {
+ months.addClass('disabled');
+ }
+ if (year == startYear) {
+ months.slice(0, startMonth).addClass('disabled');
+ }
+ if (year == endYear) {
+ months.slice(endMonth+1).addClass('disabled');
+ }
+
+ html = '';
+ year = parseInt(year/10, 10) * 10;
+ var yearCont = this.picker.find('.datepicker-years')
+ .find('th:eq(1)')
+ .text(year + '-' + (year + 9))
+ .end()
+ .find('td');
+ year -= 1;
+ for (var i = -1; i < 11; i++) {
+ html += '<span class="year'+(i == -1 || i == 10 ? ' old' : '')+(currentYear == year ? ' active' : '')+(year < startYear || year > endYear ? ' disabled' : '')+'">'+year+'</span>';
+ year += 1;
+ }
+ yearCont.html(html);
+ },
+
+ updateNavArrows: function() {
+ if (!this._allow_update) return;
+
+ var d = new Date(this.viewDate),
+ year = d.getUTCFullYear(),
+ month = d.getUTCMonth();
+ switch (this.viewMode) {
+ case 0:
+ if (this.startDate !== -Infinity && year <= this.startDate.getUTCFullYear() && month <= this.startDate.getUTCMonth()) {
+ this.picker.find('.prev').css({visibility: 'hidden'});
+ } else {
+ this.picker.find('.prev').css({visibility: 'visible'});
+ }
+ if (this.endDate !== Infinity && year >= this.endDate.getUTCFullYear() && month >= this.endDate.getUTCMonth()) {
+ this.picker.find('.next').css({visibility: 'hidden'});
+ } else {
+ this.picker.find('.next').css({visibility: 'visible'});
+ }
+ break;
+ case 1:
+ case 2:
+ if (this.startDate !== -Infinity && year <= this.startDate.getUTCFullYear()) {
+ this.picker.find('.prev').css({visibility: 'hidden'});
+ } else {
+ this.picker.find('.prev').css({visibility: 'visible'});
+ }
+ if (this.endDate !== Infinity && year >= this.endDate.getUTCFullYear()) {
+ this.picker.find('.next').css({visibility: 'hidden'});
+ } else {
+ this.picker.find('.next').css({visibility: 'visible'});
+ }
+ break;
+ }
+ },
+
+ click: function(e) {
+ e.preventDefault();
+ var target = $(e.target).closest('span, td, th');
+ if (target.length == 1) {
+ switch(target[0].nodeName.toLowerCase()) {
+ case 'th':
+ switch(target[0].className) {
+ case 'switch':
+ this.showMode(1);
+ break;
+ case 'prev':
+ case 'next':
+ var dir = DPGlobal.modes[this.viewMode].navStep * (target[0].className == 'prev' ? -1 : 1);
+ switch(this.viewMode){
+ case 0:
+ this.viewDate = this.moveMonth(this.viewDate, dir);
+ break;
+ case 1:
+ case 2:
+ this.viewDate = this.moveYear(this.viewDate, dir);
+ break;
+ }
+ this.fill();
+ break;
+ case 'today':
+ var date = new Date();
+ date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
+
+ this.showMode(-2);
+ var which = this.todayBtn == 'linked' ? null : 'view';
+ this._setDate(date, which);
+ break;
+ }
+ break;
+ case 'span':
+ if (!target.is('.disabled')) {
+ this.viewDate.setUTCDate(1);
+ if (target.is('.month')) {
+ var day = 1;
+ var month = target.parent().find('span').index(target);
+ var year = this.viewDate.getUTCFullYear();
+ this.viewDate.setUTCMonth(month);
+ this.element.trigger({
+ type: 'changeMonth',
+ date: this.viewDate
+ });
+ if ( this.minViewMode == 1 ) {
+ this._setDate(UTCDate(year, month, day,0,0,0,0));
+ }
+ } else {
+ var year = parseInt(target.text(), 10)||0;
+ var day = 1;
+ var month = 0;
+ this.viewDate.setUTCFullYear(year);
+ this.element.trigger({
+ type: 'changeYear',
+ date: this.viewDate
+ });
+ if ( this.minViewMode == 2 ) {
+ this._setDate(UTCDate(year, month, day,0,0,0,0));
+ }
+ }
+ this.showMode(-1);
+ this.fill();
+ }
+ break;
+ case 'td':
+ if (target.is('.day') && !target.is('.disabled')){
+ var day = parseInt(target.text(), 10)||1;
+ var year = this.viewDate.getUTCFullYear(),
+ month = this.viewDate.getUTCMonth();
+ if (target.is('.old')) {
+ if (month === 0) {
+ month = 11;
+ year -= 1;
+ } else {
+ month -= 1;
+ }
+ } else if (target.is('.new')) {
+ if (month == 11) {
+ month = 0;
+ year += 1;
+ } else {
+ month += 1;
+ }
+ }
+ this._setDate(UTCDate(year, month, day,0,0,0,0));
+ }
+ break;
+ }
+ }
+ },
+
+ _setDate: function(date, which){
+ if (!which || which == 'date')
+ this.date = date;
+ if (!which || which == 'view')
+ this.viewDate = date;
+ this.fill();
+ this.setValue();
+ this.element.trigger({
+ type: 'changeDate',
+ date: this.date
+ });
+ var element;
+ if (this.isInput) {
+ element = this.element;
+ } else if (this.component){
+ element = this.element.find('input');
+ }
+ if (element) {
+ element.change();
+ if (this.autoclose && (!which || which == 'date')) {
+ this.hide();
+ }
+ }
+ },
+
+ moveMonth: function(date, dir){
+ if (!dir) return date;
+ var new_date = new Date(date.valueOf()),
+ day = new_date.getUTCDate(),
+ month = new_date.getUTCMonth(),
+ mag = Math.abs(dir),
+ new_month, test;
+ dir = dir > 0 ? 1 : -1;
+ if (mag == 1){
+ test = dir == -1
+ // If going back one month, make sure month is not current month
+ // (eg, Mar 31 -> Feb 31 == Feb 28, not Mar 02)
+ ? function(){ return new_date.getUTCMonth() == month; }
+ // If going forward one month, make sure month is as expected
+ // (eg, Jan 31 -> Feb 31 == Feb 28, not Mar 02)
+ : function(){ return new_date.getUTCMonth() != new_month; };
+ new_month = month + dir;
+ new_date.setUTCMonth(new_month);
+ // Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11
+ if (new_month < 0 || new_month > 11)
+ new_month = (new_month + 12) % 12;
+ } else {
+ // For magnitudes >1, move one month at a time...
+ for (var i=0; i<mag; i++)
+ // ...which might decrease the day (eg, Jan 31 to Feb 28, etc)...
+ new_date = this.moveMonth(new_date, dir);
+ // ...then reset the day, keeping it in the new month
+ new_month = new_date.getUTCMonth();
+ new_date.setUTCDate(day);
+ test = function(){ return new_month != new_date.getUTCMonth(); };
+ }
+ // Common date-resetting loop -- if date is beyond end of month, make it
+ // end of month
+ while (test()){
+ new_date.setUTCDate(--day);
+ new_date.setUTCMonth(new_month);
+ }
+ return new_date;
+ },
+
+ moveYear: function(date, dir){
+ return this.moveMonth(date, dir*12);
+ },
+
+ dateWithinRange: function(date){
+ return date >= this.startDate && date <= this.endDate;
+ },
+
+ keydown: function(e){
+ if (this.picker.is(':not(:visible)')){
+ if (e.keyCode == 27) // allow escape to hide and re-show picker
+ this.show();
+ return;
+ }
+ var dateChanged = false,
+ dir, day, month,
+ newDate, newViewDate;
+ switch(e.keyCode){
+ case 27: // escape
+ this.hide();
+ e.preventDefault();
+ break;
+ case 37: // left
+ case 39: // right
+ if (!this.keyboardNavigation) break;
+ dir = e.keyCode == 37 ? -1 : 1;
+ if (e.ctrlKey){
+ newDate = this.moveYear(this.date, dir);
+ newViewDate = this.moveYear(this.viewDate, dir);
+ } else if (e.shiftKey){
+ newDate = this.moveMonth(this.date, dir);
+ newViewDate = this.moveMonth(this.viewDate, dir);
+ } else {
+ newDate = new Date(this.date);
+ newDate.setUTCDate(this.date.getUTCDate() + dir);
+ newViewDate = new Date(this.viewDate);
+ newViewDate.setUTCDate(this.viewDate.getUTCDate() + dir);
+ }
+ if (this.dateWithinRange(newDate)){
+ this.date = newDate;
+ this.viewDate = newViewDate;
+ this.setValue();
+ this.update();
+ e.preventDefault();
+ dateChanged = true;
+ }
+ break;
+ case 38: // up
+ case 40: // down
+ if (!this.keyboardNavigation) break;
+ dir = e.keyCode == 38 ? -1 : 1;
+ if (e.ctrlKey){
+ newDate = this.moveYear(this.date, dir);
+ newViewDate = this.moveYear(this.viewDate, dir);
+ } else if (e.shiftKey){
+ newDate = this.moveMonth(this.date, dir);
+ newViewDate = this.moveMonth(this.viewDate, dir);
+ } else {
+ newDate = new Date(this.date);
+ newDate.setUTCDate(this.date.getUTCDate() + dir * 7);
+ newViewDate = new Date(this.viewDate);
+ newViewDate.setUTCDate(this.viewDate.getUTCDate() + dir * 7);
+ }
+ if (this.dateWithinRange(newDate)){
+ this.date = newDate;
+ this.viewDate = newViewDate;
+ this.setValue();
+ this.update();
+ e.preventDefault();
+ dateChanged = true;
+ }
+ break;
+ case 13: // enter
+ this.hide();
+ e.preventDefault();
+ break;
+ case 9: // tab
+ this.hide();
+ break;
+ }
+ if (dateChanged){
+ this.element.trigger({
+ type: 'changeDate',
+ date: this.date
+ });
+ var element;
+ if (this.isInput) {
+ element = this.element;
+ } else if (this.component){
+ element = this.element.find('input');
+ }
+ if (element) {
+ element.change();
+ }
+ }
+ },
+
+ showMode: function(dir) {
+ if (dir) {
+ this.viewMode = Math.max(this.minViewMode, Math.min(2, this.viewMode + dir));
+ }
+ /*
+ vitalets: fixing bug of very special conditions:
+ jquery 1.7.1 + webkit + show inline datepicker in bootstrap popover.
+ Method show() does not set display css correctly and datepicker is not shown.
+ Changed to .css('display', 'block') solve the problem.
+ See https://github.com/vitalets/x-editable/issues/37
+
+ In jquery 1.7.2+ everything works fine.
+ */
+ //this.picker.find('>div').hide().filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName).show();
+ this.picker.find('>div').hide().filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName).css('display', 'block');
+ this.updateNavArrows();
+ }
+ };
+
+ $.fn.datepicker = function ( option ) {
+ var args = Array.apply(null, arguments);
+ args.shift();
+ return this.each(function () {
+ var $this = $(this),
+ data = $this.data('datepicker'),
+ options = typeof option == 'object' && option;
+ if (!data) {
+ $this.data('datepicker', (data = new Datepicker(this, $.extend({}, $.fn.datepicker.defaults,options))));
+ }
+ if (typeof option == 'string' && typeof data[option] == 'function') {
+ data[option].apply(data, args);
+ }
+ });
+ };
+
+ $.fn.datepicker.defaults = {
+ };
+ $.fn.datepicker.Constructor = Datepicker;
+ var dates = $.fn.datepicker.dates = {
+ en: {
+ days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
+ daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
+ daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"],
+ months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
+ monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
+ today: "Today"
+ }
+ };
+
+ var DPGlobal = {
+ modes: [
+ {
+ clsName: 'days',
+ navFnc: 'Month',
+ navStep: 1
+ },
+ {
+ clsName: 'months',
+ navFnc: 'FullYear',
+ navStep: 1
+ },
+ {
+ clsName: 'years',
+ navFnc: 'FullYear',
+ navStep: 10
+ }],
+ isLeapYear: function (year) {
+ return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0));
+ },
+ getDaysInMonth: function (year, month) {
+ return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
+ },
+ validParts: /dd?|DD?|mm?|MM?|yy(?:yy)?/g,
+ nonpunctuation: /[^ -\/:-@\[\u3400-\u9fff-`{-~\t\n\r]+/g,
+ parseFormat: function(format){
+ // IE treats \0 as a string end in inputs (truncating the value),
+ // so it's a bad format delimiter, anyway
+ var separators = format.replace(this.validParts, '\0').split('\0'),
+ parts = format.match(this.validParts);
+ if (!separators || !separators.length || !parts || parts.length === 0){
+ throw new Error("Invalid date format.");
+ }
+ return {separators: separators, parts: parts};
+ },
+ parseDate: function(date, format, language) {
+ if (date instanceof Date) return date;
+ if (/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(date)) {
+ var part_re = /([\-+]\d+)([dmwy])/,
+ parts = date.match(/([\-+]\d+)([dmwy])/g),
+ part, dir;
+ date = new Date();
+ for (var i=0; i<parts.length; i++) {
+ part = part_re.exec(parts[i]);
+ dir = parseInt(part[1]);
+ switch(part[2]){
+ case 'd':
+ date.setUTCDate(date.getUTCDate() + dir);
+ break;
+ case 'm':
+ date = Datepicker.prototype.moveMonth.call(Datepicker.prototype, date, dir);
+ break;
+ case 'w':
+ date.setUTCDate(date.getUTCDate() + dir * 7);
+ break;
+ case 'y':
+ date = Datepicker.prototype.moveYear.call(Datepicker.prototype, date, dir);
+ break;
+ }
+ }
+ return UTCDate(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), 0, 0, 0);
+ }
+ var parts = date && date.match(this.nonpunctuation) || [],
+ date = new Date(),
+ parsed = {},
+ setters_order = ['yyyy', 'yy', 'M', 'MM', 'm', 'mm', 'd', 'dd'],
+ setters_map = {
+ yyyy: function(d,v){ return d.setUTCFullYear(v); },
+ yy: function(d,v){ return d.setUTCFullYear(2000+v); },
+ m: function(d,v){
+ v -= 1;
+ while (v<0) v += 12;
+ v %= 12;
+ d.setUTCMonth(v);
+ while (d.getUTCMonth() != v)
+ d.setUTCDate(d.getUTCDate()-1);
+ return d;
+ },
+ d: function(d,v){ return d.setUTCDate(v); }
+ },
+ val, filtered, part;
+ setters_map['M'] = setters_map['MM'] = setters_map['mm'] = setters_map['m'];
+ setters_map['dd'] = setters_map['d'];
+ date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
+ var fparts = format.parts.slice();
+ // Remove noop parts
+ if (parts.length != fparts.length) {
+ fparts = $(fparts).filter(function(i,p){
+ return $.inArray(p, setters_order) !== -1;
+ }).toArray();
+ }
+ // Process remainder
+ if (parts.length == fparts.length) {
+ for (var i=0, cnt = fparts.length; i < cnt; i++) {
+ val = parseInt(parts[i], 10);
+ part = fparts[i];
+ if (isNaN(val)) {
+ switch(part) {
+ case 'MM':
+ filtered = $(dates[language].months).filter(function(){
+ var m = this.slice(0, parts[i].length),
+ p = parts[i].slice(0, m.length);
+ return m == p;
+ });
+ val = $.inArray(filtered[0], dates[language].months) + 1;
+ break;
+ case 'M':
+ filtered = $(dates[language].monthsShort).filter(function(){
+ var m = this.slice(0, parts[i].length),
+ p = parts[i].slice(0, m.length);
+ return m == p;
+ });
+ val = $.inArray(filtered[0], dates[language].monthsShort) + 1;
+ break;
+ }
+ }
+ parsed[part] = val;
+ }
+ for (var i=0, s; i<setters_order.length; i++){
+ s = setters_order[i];
+ if (s in parsed && !isNaN(parsed[s]))
+ setters_map[s](date, parsed[s]);
+ }
+ }
+ return date;
+ },
+ formatDate: function(date, format, language){
+ var val = {
+ d: date.getUTCDate(),
+ D: dates[language].daysShort[date.getUTCDay()],
+ DD: dates[language].days[date.getUTCDay()],
+ m: date.getUTCMonth() + 1,
+ M: dates[language].monthsShort[date.getUTCMonth()],
+ MM: dates[language].months[date.getUTCMonth()],
+ yy: date.getUTCFullYear().toString().substring(2),
+ yyyy: date.getUTCFullYear()
+ };
+ val.dd = (val.d < 10 ? '0' : '') + val.d;
+ val.mm = (val.m < 10 ? '0' : '') + val.m;
+ var date = [],
+ seps = $.extend([], format.separators);
+ for (var i=0, cnt = format.parts.length; i < cnt; i++) {
+ if (seps.length)
+ date.push(seps.shift());
+ date.push(val[format.parts[i]]);
+ }
+ return date.join('');
+ },
+ headTemplate: '<thead>'+
+ '<tr>'+
+ '<th class="prev"><i class="icon-arrow-left"/></th>'+
+ '<th colspan="5" class="switch"></th>'+
+ '<th class="next"><i class="icon-arrow-right"/></th>'+
+ '</tr>'+
+ '</thead>',
+ contTemplate: '<tbody><tr><td colspan="7"></td></tr></tbody>',
+ footTemplate: '<tfoot><tr><th colspan="7" class="today"></th></tr></tfoot>'
+ };
+ DPGlobal.template = '<div class="datepicker">'+
+ '<div class="datepicker-days">'+
+ '<table class=" table-condensed">'+
+ DPGlobal.headTemplate+
+ '<tbody></tbody>'+
+ DPGlobal.footTemplate+
+ '</table>'+
+ '</div>'+
+ '<div class="datepicker-months">'+
+ '<table class="table-condensed">'+
+ DPGlobal.headTemplate+
+ DPGlobal.contTemplate+
+ DPGlobal.footTemplate+
+ '</table>'+
+ '</div>'+
+ '<div class="datepicker-years">'+
+ '<table class="table-condensed">'+
+ DPGlobal.headTemplate+
+ DPGlobal.contTemplate+
+ DPGlobal.footTemplate+
+ '</table>'+
+ '</div>'+
+ '</div>';
+
+ $.fn.datepicker.DPGlobal = DPGlobal;
+
+}( window.jQuery );
Added: incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.bg.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.bg.js?rev=1465166&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.bg.js (added)
+++ incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.bg.js Sat Apr 6 01:55:42 2013
@@ -0,0 +1,14 @@
+/**
+ * Bulgarian translation for bootstrap-datepicker
+ * Apostol Apostolov <ap...@gmail.com>
+ */
+;(function($){
+ $.fn.datepicker.dates['bg'] = {
+ days: ["ÐеделÑ", "Ðонеделник", "ÐÑоÑник", "СÑÑда", "ЧеÑвÑÑÑÑк", "ÐеÑÑк", "СÑбоÑа", "ÐеделÑ"],
+ daysShort: ["Ðед", "Ðон", "ÐÑо", "СÑÑ", "ЧеÑ", "ÐеÑ", "СÑб", "Ðед"],
+ daysMin: ["Ð", "Ð", "Ð", "С", "Ч", "Ð", "С", "Ð"],
+ months: ["ЯнÑаÑи", "ФевÑÑаÑи", "ÐаÑÑ", "ÐпÑил", "Ðай", "Юни", "Юли", "ÐвгÑÑÑ", "СепÑемвÑи", "ÐкÑомвÑи", "ÐоемвÑи", "ÐекемвÑи"],
+ monthsShort: ["Ян", "Фев", "ÐаÑ", "ÐпÑ", "Ðай", "Юни", "Юли", "Ðвг", "Сеп", "ÐкÑ", "Ðое", "Ðек"],
+ today: "днеÑ"
+ };
+}(jQuery));
Propchange: incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.bg.js
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.ca.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.ca.js?rev=1465166&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.ca.js (added)
+++ incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.ca.js Sat Apr 6 01:55:42 2013
@@ -0,0 +1,14 @@
+/**
+ * Catalan translation for bootstrap-datepicker
+ * J. Garcia <jo...@gmail.com>
+ */
+;(function($){
+ $.fn.datepicker.dates['ca'] = {
+ days: ["Diumenge", "Dilluns", "Dimarts", "Dimecres", "Dijous", "Divendres", "Dissabte", "Diumenge"],
+ daysShort: ["Diu", "Dil", "Dmt", "Dmc", "Dij", "Div", "Dis", "Diu"],
+ daysMin: ["dg", "dl", "dt", "dc", "dj", "dv", "ds", "dg"],
+ months: ["Gener", "Febrer", "Març", "Abril", "Maig", "Juny", "Juliol", "Agost", "Setembre", "Octubre", "Novembre", "Desembre"],
+ monthsShort: ["Gen", "Feb", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Oct", "Nov", "Des"],
+ today: "Avui"
+ };
+}(jQuery));
Propchange: incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.ca.js
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.cs.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.cs.js?rev=1465166&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.cs.js (added)
+++ incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.cs.js Sat Apr 6 01:55:42 2013
@@ -0,0 +1,15 @@
+/**
+ * Czech translation for bootstrap-datepicker
+ * MatÄj KoubÃk <ma...@koubik.name>
+ * Fixes by Michal Remiš <mi...@gmail.com>
+ */
+;(function($){
+ $.fn.datepicker.dates['cs'] = {
+ days: ["NedÄle", "PondÄlÃ", "Ãterý", "StÅeda", "Ätvrtek", "Pátek", "Sobota", "NedÄle"],
+ daysShort: ["Ned", "Pon", "Ãte", "StÅ", "Ätv", "Pát", "Sob", "Ned"],
+ daysMin: ["Ne", "Po", "Ãt", "St", "Ät", "Pá", "So", "Ne"],
+ months: ["Leden", "Ãnor", "BÅezen", "Duben", "KvÄten", "Äerven", "Äervenec", "Srpen", "ZáÅÃ", "ÅÃjen", "Listopad", "Prosinec"],
+ monthsShort: ["Led", "Ãno", "BÅe", "Dub", "KvÄ", "Äer", "Änc", "Srp", "ZáÅ", "ÅÃj", "Lis", "Pro"],
+ today: "Dnes"
+ };
+}(jQuery));
Propchange: incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.cs.js
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.da.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.da.js?rev=1465166&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.da.js (added)
+++ incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.da.js Sat Apr 6 01:55:42 2013
@@ -0,0 +1,14 @@
+/**
+ * Danish translation for bootstrap-datepicker
+ * Christian Pedersen <http://github.com/chripede>
+ */
+;(function($){
+ $.fn.datepicker.dates['da'] = {
+ days: ["Søndag", "Mandag", "Tirsdag", "Onsdag", "Torsdag", "Fredag", "Lørdag", "Søndag"],
+ daysShort: ["Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør", "Søn"],
+ daysMin: ["Sø", "Ma", "Ti", "On", "To", "Fr", "Lø", "Sø"],
+ months: ["Januar", "Februar", "Marts", "April", "Maj", "Juni", "Juli", "August", "September", "Oktober", "November", "December"],
+ monthsShort: ["Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec"],
+ today: "I Dag"
+ };
+}(jQuery));
\ No newline at end of file
Propchange: incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.da.js
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.de.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.de.js?rev=1465166&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.de.js (added)
+++ incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.de.js Sat Apr 6 01:55:42 2013
@@ -0,0 +1,16 @@
+/**
+ * German translation for bootstrap-datepicker
+ * Sam Zurcher <sa...@orelias.ch>
+ */
+;(function($){
+ $.fn.datepicker.dates['de'] = {
+ days: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag"],
+ daysShort: ["Son", "Mon", "Die", "Mit", "Don", "Fre", "Sam", "Son"],
+ daysMin: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa", "So"],
+ months: ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"],
+ monthsShort: ["Jan", "Feb", "Mär", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"],
+ today: "Heute",
+ weekStart: 1,
+ format: "dd.mm.yyyy"
+ };
+}(jQuery));
Propchange: incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.de.js
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.el.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.el.js?rev=1465166&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.el.js (added)
+++ incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.el.js Sat Apr 6 01:55:42 2013
@@ -0,0 +1,13 @@
+/**
+* Greek translation for bootstrap-datepicker
+*/
+;(function($){
+ $.fn.datepicker.dates['el'] = {
+ days: ["ÎÏ
Ïιακή", "ÎεÏ
ÏÎÏα", "ΤÏίÏη", "ΤεÏάÏÏη", "Î ÎμÏÏη", "ΠαÏαÏκεÏ
ή", "ΣάββαÏο", "ÎÏ
Ïιακή"],
+ daysShort: ["ÎÏ
Ï", "ÎεÏ
", "ΤÏι", "ΤεÏ", "Πεμ", "ΠαÏ", "Σαβ", "ÎÏ
Ï"],
+ daysMin: ["ÎÏ
", "Îε", "ΤÏ", "Τε", "Πε", "Πα", "Σα", "ÎÏ
"],
+ months: ["ÎανοÏ
άÏιοÏ", "ΦεβÏοÏ
άÏιοÏ", "ÎάÏÏιοÏ", "ÎÏÏίλιοÏ", "ÎάιοÏ", "ÎοÏνιοÏ", "ÎοÏλιοÏ", "ÎÏγοÏ
ÏÏοÏ", "ΣεÏÏÎμβÏιοÏ", "ÎκÏÏβÏιοÏ", "ÎοÎμβÏιοÏ", "ÎεκÎμβÏιοÏ"],
+ monthsShort: ["Îαν", "Φεβ", "ÎαÏ", "ÎÏÏ", "Îάι", "ÎοÏ
ν", "ÎοÏ
λ", "ÎÏ
γ", "ΣεÏ", "ÎκÏ", "Îοε", "Îεκ"],
+ today: "ΣήμεÏα"
+ };
+}(jQuery));
\ No newline at end of file
Propchange: incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.el.js
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.es.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.es.js?rev=1465166&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.es.js (added)
+++ incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.es.js Sat Apr 6 01:55:42 2013
@@ -0,0 +1,14 @@
+/**
+ * Spanish translation for bootstrap-datepicker
+ * Bruno Bonamin <br...@gmail.com>
+ */
+;(function($){
+ $.fn.datepicker.dates['es'] = {
+ days: ["Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado", "Domingo"],
+ daysShort: ["Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb", "Dom"],
+ daysMin: ["Do", "Lu", "Ma", "Mi", "Ju", "Vi", "Sa", "Do"],
+ months: ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"],
+ monthsShort: ["Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic"],
+ today: "Hoy"
+ };
+}(jQuery));
Propchange: incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.es.js
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.fi.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.fi.js?rev=1465166&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.fi.js (added)
+++ incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.fi.js Sat Apr 6 01:55:42 2013
@@ -0,0 +1,14 @@
+/**
+ * Finnish translation for bootstrap-datepicker
+ * Jaakko Salonen <https://github.com/jsalonen>
+ */
+;(function($){
+ $.fn.datepicker.dates['fi'] = {
+ days: ["sunnuntai", "maanantai", "tiistai", "keskiviikko", "torstai", "perjantai", "lauantai", "sunnuntai"],
+ daysShort: ["sun", "maa", "tii", "kes", "tor", "per", "lau", "sun"],
+ daysMin: ["su", "ma", "ti", "ke", "to", "pe", "la", "su"],
+ months: ["tammikuu", "helmikuu", "maaliskuu", "huhtikuu", "toukokuu", "kesäkuu", "heinäkuu", "elokuu", "syyskuu", "lokakuu", "marraskuu", "joulukuu"],
+ monthsShort: ["tam", "hel", "maa", "huh", "tou", "kes", "hei", "elo", "syy", "lok", "mar", "jou"],
+ today: "tänään"
+ };
+}(jQuery));
Propchange: incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.fi.js
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.fr.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.fr.js?rev=1465166&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.fr.js (added)
+++ incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.fr.js Sat Apr 6 01:55:42 2013
@@ -0,0 +1,16 @@
+/**
+ * French translation for bootstrap-datepicker
+ * Nico Mollet <ni...@gmail.com>
+ */
+;(function($){
+ $.fn.datepicker.dates['fr'] = {
+ days: ["Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi", "Dimanche"],
+ daysShort: ["Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam", "Dim"],
+ daysMin: ["D", "L", "Ma", "Me", "J", "V", "S", "D"],
+ months: ["Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"],
+ monthsShort: ["Jan", "Fev", "Mar", "Avr", "Mai", "Jui", "Jul", "Aou", "Sep", "Oct", "Nov", "Dec"],
+ today: "Aujourd'hui",
+ weekStart: 1,
+ format: "dd/mm/yyyy"
+ };
+}(jQuery));
Propchange: incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.fr.js
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.he.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.he.js?rev=1465166&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.he.js (added)
+++ incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.he.js Sat Apr 6 01:55:42 2013
@@ -0,0 +1,15 @@
+/**
+ * Hebrew translation for bootstrap-datepicker
+ * Sagie Maoz <sa...@maoz.info>
+ */
+;(function($){
+ $.fn.datepicker.dates['he'] = {
+ days: ["ר×ש××", "×©× ×", "ש××ש×", "ר×××¢×", "×××ש×", "ש×ש×", "ש×ת", "ר×ש××"],
+ daysShort: ["×", "×", "×", "×", "×", "×", "ש", "×"],
+ daysMin: ["×", "×", "×", "×", "×", "×", "ש", "×"],
+ months: ["×× ××ר", "פ×ר××ר", "×רץ", "×פר××", "×××", "××× ×", "××××", "××××ס×", "ספ×××ר", "××ק×××ר", "× ××××ר", "×צ××ר"],
+ monthsShort: ["×× ×", "פ×ר", "×רץ", "×פר", "×××", "××× ", "×××", "×××", "ספ×", "××ק", "× ××", "×צ×"],
+ today: "××××",
+ rtl: true
+ };
+}(jQuery));
Propchange: incubator/ambari/trunk/ambari-web/vendor/scripts/locales/bootstrap-datepicker.he.js
------------------------------------------------------------------------------
svn:executable = *