Author: yusaku
Date: Fri Jan 11 01:54:58 2013
New Revision: 1431802
URL: http://svn.apache.org/viewvc?rev=1431802&view=rev
Log:
AMBARI-1145. Cluster Management refactoring. (yusaku)
Added:
incubator/ambari/trunk/ambari-web/app/assets/data/services/metrics/mapreduce/tasks_running_waiting.json
incubator/ambari/trunk/ambari-web/app/views/main/service/info/metrics/mapreduce/tasks_running_waiting.js
incubator/ambari/trunk/ambari-web/vendor/scripts/jquery.jqprint-0.3.js
Removed:
incubator/ambari/trunk/ambari-web/app/assets/data/services/metrics/mapreduce/jobs_running_waiting.json
incubator/ambari/trunk/ambari-web/app/views/main/service/info/metrics/mapreduce/jobs_running_waiting.js
Modified:
incubator/ambari/trunk/ambari-web/app/controllers/global/cluster_controller.js
incubator/ambari/trunk/ambari-web/app/controllers/login_controller.js
incubator/ambari/trunk/ambari-web/app/controllers/main/apps_controller.js
incubator/ambari/trunk/ambari-web/app/controllers/main/host/add_controller.js
incubator/ambari/trunk/ambari-web/app/controllers/main/service/add_controller.js
incubator/ambari/trunk/ambari-web/app/controllers/wizard.js
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step10_controller.js
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step3_controller.js
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step8_controller.js
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step9_controller.js
incubator/ambari/trunk/ambari-web/app/data/config_mapping.js
incubator/ambari/trunk/ambari-web/app/data/review_configs.js
incubator/ambari/trunk/ambari-web/app/messages.js
incubator/ambari/trunk/ambari-web/app/routes/installer.js
incubator/ambari/trunk/ambari-web/app/templates/main/dashboard/service/mapreduce.hbs
incubator/ambari/trunk/ambari-web/app/templates/main/host/summary.hbs
incubator/ambari/trunk/ambari-web/app/templates/main/service/info/configs.hbs
incubator/ambari/trunk/ambari-web/app/templates/main/service/info/summary/zookeeper.hbs
incubator/ambari/trunk/ambari-web/app/templates/wizard/step8.hbs
incubator/ambari/trunk/ambari-web/app/utils/data_table.js
incubator/ambari/trunk/ambari-web/app/utils/misc.js
incubator/ambari/trunk/ambari-web/app/views.js
incubator/ambari/trunk/ambari-web/app/views/main/apps_view.js
incubator/ambari/trunk/ambari-web/app/views/main/service/info/metrics/mapreduce/map_slots.js
incubator/ambari/trunk/ambari-web/app/views/main/service/info/summary.js
incubator/ambari/trunk/ambari-web/app/views/wizard/controls_view.js
incubator/ambari/trunk/ambari-web/app/views/wizard/step8_view.js
Added:
incubator/ambari/trunk/ambari-web/app/assets/data/services/metrics/mapreduce/tasks_running_waiting.json
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/assets/data/services/metrics/mapreduce/tasks_running_waiting.json?rev=1431802&view=auto
==============================================================================
---
incubator/ambari/trunk/ambari-web/app/assets/data/services/metrics/mapreduce/tasks_running_waiting.json
(added)
+++
incubator/ambari/trunk/ambari-web/app/assets/data/services/metrics/mapreduce/tasks_running_waiting.json
Fri Jan 11 01:54:58 2013
@@ -0,0 +1,18 @@
+{
+ "href" :
"http://ambari/clusters/SrimanthAmbari/services/MAPREDUCE/components/JOBTRACKER?fields=metrics/mapred/jobtracker/running_maps[1351213550,1351217148,60],metrics/mapred/jobtracker/running_reduces[1351213550,1351217148,60],metrics/mapred/jobtracker/waiting_maps[1351213550,1351217148,60],metrics/mapred/jobtracker/waiting_reduces[1351213550,1351217148,60]",
+ "metrics" : {
+ "mapred" : {
+ "jobtracker" : {
+ "running_maps" :
"[[0.0,1351213560],[0.0,1351213920],[0.0,1351214280],[0.0,1351214640],[0.0,1351215000],[0.0,1351215360],[0.0,1351215720],[0.0,1351216080],[0.0,1351216440],[0.0,1351216800],[0.038888888889,1351217160]]",
+ "running_reduces" :
"[[0.0,1351213560],[0.0,1351213920],[0.0,1351214280],[0.0,1351214640],[0.0,1351215000],[0.0,1351215360],[0.0,1351215720],[0.0,1351216080],[0.0,1351216440],[0.0,1351216800],[0.038888888889,1351217160]]",
+ "waiting_maps" :
"[[0.0,1351213560],[0.0,1351213920],[0.0,1351214280],[0.0,1351214640],[0.0,1351215000],[0.0,1351215360],[0.0,1351215720],[0.0,1351216080],[0.0,1351216440],[0.0,1351216800],[0.0,1351217160]]",
+ "waiting_reduces" :
"[[0.0,1351213560],[0.0,1351213920],[0.0,1351214280],[0.0,1351214640],[0.0,1351215000],[0.0,1351215360],[0.0,1351215720],[0.0,1351216080],[0.0,1351216440],[0.0,1351216800],[0.0,1351217160]]"
+ }
+ }
+ },
+ "ServiceComponentInfo" : {
+ "cluster_name" : "SrimanthAmbari",
+ "component_name" : "JOBTRACKER",
+ "service_name" : "MAPREDUCE"
+ }
+}
\ No newline at end of file
Modified:
incubator/ambari/trunk/ambari-web/app/controllers/global/cluster_controller.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/global/cluster_controller.js?rev=1431802&r1=1431801&r2=1431802&view=diff
==============================================================================
---
incubator/ambari/trunk/ambari-web/app/controllers/global/cluster_controller.js
(original)
+++
incubator/ambari/trunk/ambari-web/app/controllers/global/cluster_controller.js
Fri Jan 11 01:54:58 2013
@@ -145,7 +145,7 @@ App.ClusterController = Em.Controller.ex
}
return null;
}
- }.property('App.router.updateController.isUpdated'),
+ }.property('App.router.updateController.isUpdated','dataLoadList.services'),
isNagiosInstalled:function () {
if (App.testMode) {
Modified: incubator/ambari/trunk/ambari-web/app/controllers/login_controller.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/login_controller.js?rev=1431802&r1=1431801&r2=1431802&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/login_controller.js
(original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/login_controller.js Fri
Jan 11 01:54:58 2013
@@ -27,6 +27,9 @@ App.LoginController = Em.Object.extend({
errorMessage: '',
+ isAdmin: function(){
+ return App.db.getUser().admin;
+ }.property('loginName'),
submit: function (e) {
this.set('errorMessage', '');
Modified:
incubator/ambari/trunk/ambari-web/app/controllers/main/apps_controller.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/main/apps_controller.js?rev=1431802&r1=1431801&r2=1431802&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/main/apps_controller.js
(original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/main/apps_controller.js
Fri Jan 11 01:54:58 2013
@@ -41,6 +41,18 @@ App.MainAppsController = Em.ArrayControl
this.set('filteredRunsLength',
this.get('content').filterProperty('isFiltered', true).length);
},
/**
+ * Mark Runs as filtered
+ * @param ids array of Run id
+ */
+ filterFilteredRuns: function(ids) {
+ this.get('content').filter(function(item) {
+ if ($.inArray(item.get('id'), ids) !== -1) {
+ item.set('isFiltered', true);
+ }
+ });
+ this.set('filteredRunsLength',
this.get('content').filterProperty('isFiltered', true).length);
+ },
+ /**
* Identifier of the last starred/unstarred run
*/
lastStarClicked: null,
Modified:
incubator/ambari/trunk/ambari-web/app/controllers/main/host/add_controller.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/main/host/add_controller.js?rev=1431802&r1=1431801&r2=1431802&view=diff
==============================================================================
---
incubator/ambari/trunk/ambari-web/app/controllers/main/host/add_controller.js
(original)
+++
incubator/ambari/trunk/ambari-web/app/controllers/main/host/add_controller.js
Fri Jan 11 01:54:58 2013
@@ -517,6 +517,8 @@ App.AddHostController = App.WizardContro
*/
clearAllSteps: function () {
this.clearInstallOptions();
+ // clear temporary information stored during the install
+ this.set('content.cluster', this.getCluster());
},
/**
@@ -524,6 +526,7 @@ App.AddHostController = App.WizardContro
*/
finish: function () {
this.setCurrentStep('1');
+ this.clearAllSteps();
this.clearStorageData();
App.router.get('updateController').updateAll();
}
Modified:
incubator/ambari/trunk/ambari-web/app/controllers/main/service/add_controller.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/main/service/add_controller.js?rev=1431802&r1=1431801&r2=1431802&view=diff
==============================================================================
---
incubator/ambari/trunk/ambari-web/app/controllers/main/service/add_controller.js
(original)
+++
incubator/ambari/trunk/ambari-web/app/controllers/main/service/add_controller.js
Fri Jan 11 01:54:58 2013
@@ -555,6 +555,8 @@ App.AddServiceController = App.WizardCon
*/
clearAllSteps: function () {
this.clearInstallOptions();
+ // clear temporary information stored during the install
+ this.set('content.cluster', this.getCluster());
},
/**
@@ -562,6 +564,7 @@ App.AddServiceController = App.WizardCon
*/
finish: function () {
this.setCurrentStep('1');
+ this.clearAllSteps();
this.clearStorageData();
App.router.get('updateController').updateAll();
}
Modified: incubator/ambari/trunk/ambari-web/app/controllers/wizard.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/wizard.js?rev=1431802&r1=1431801&r2=1431802&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/wizard.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/wizard.js Fri Jan 11
01:54:58 2013
@@ -244,13 +244,11 @@ App.WizardController = Em.Controller.ext
* @param isRetry
*/
installServices: function (isRetry) {
- if (!isRetry && this.get('content.cluster.requestId')) {
- return;
- }
// clear requests since we are installing services
// and we don't want to get tasks for previous install attempts
this.set('content.cluster.oldRequestsId', []);
+ this.set('content.cluster.requestId', null);
var self = this;
var clusterName = this.get('content.cluster.name');
Modified:
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step10_controller.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/wizard/step10_controller.js?rev=1431802&r1=1431801&r2=1431802&view=diff
==============================================================================
---
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step10_controller.js
(original)
+++
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step10_controller.js
Fri Jan 11 01:54:58 2013
@@ -29,8 +29,12 @@ App.WizardStep10Controller = Em.Controll
console.log("TRACE: Loading step10: Summary Page");
this.clearStep();
this.loadInstalledHosts(this.loadRegisteredHosts());
- var installFlag = this.loadMasterComponents();
- var startFlag = this.loadStartedServices();
+ var installFlag = true;
+ var startFlag = true;
+ if (this.get('content.controllerName') == 'installerController') {
+ installFlag = this.loadMasterComponents();
+ startFlag = this.loadStartedServices();
+ }
if (installFlag && startFlag) {
this.loadInstallTime();
}
@@ -342,9 +346,9 @@ App.WizardStep10Controller = Em.Controll
var seconds = Math.floor((this.get('content.cluster.installTime') -
minutes) * secondsPerMinute);
var statement;
if (minutes !== 0) {
- statement = 'Install and start of all services completed in ' +
minutes + ' minutes and ' + seconds + ' seconds';
+ statement = 'Install and start completed in ' + minutes + ' minutes
and ' + seconds + ' seconds';
} else {
- statement = 'Install and start of all services completed in ' +
seconds + ' seconds';
+ statement = 'Install and start completed in ' + seconds + ' seconds';
}
this.get('clusterInfo').pushObject(Ember.Object.create({
id: 5,
Modified:
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step3_controller.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/wizard/step3_controller.js?rev=1431802&r1=1431801&r2=1431802&view=diff
==============================================================================
---
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step3_controller.js
(original)
+++
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step3_controller.js
Fri Jan 11 01:54:58 2013
@@ -266,6 +266,7 @@ App.WizardStep3Controller = Em.Controlle
type: 'GET',
url: url,
timeout: App.timeout,
+ cache: false,
success: function (data) {
if (data.hostsStatus !== null) {
// in case of bootstrapping just one host, the server returns an
object rather than an array, so
Modified:
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step8_controller.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/wizard/step8_controller.js?rev=1431802&r1=1431801&r2=1431802&view=diff
==============================================================================
---
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step8_controller.js
(original)
+++
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step8_controller.js
Fri Jan 11 01:54:58 2013
@@ -168,6 +168,9 @@ App.WizardStep8Controller = Em.Controlle
* Set all site property that are derived from other site-properties
*/
setConfigValue: function (uiConfig, config) {
+ if (config.value == null) {
+ return;
+ }
var fkValue = config.value.match(/<(foreignKey.*?)>/g);
if (fkValue) {
fkValue.forEach(function (_fkValue) {
@@ -358,6 +361,14 @@ App.WizardStep8Controller = Em.Controlle
*/
loadClusterInfo: function () {
+ //Admin name
+ var admin = this.rawContent.findProperty('config_name', 'Admin');
+ admin.config_value = App.db.getLoginName();
+ console.log("STEP8: the value of content cluster name: " +
App.db.getLoginName());
+ if (admin.config_value) {
+ this.get('clusterInfo').pushObject(Ember.Object.create(admin));
+ }
+
// cluster name
var cluster = this.rawContent.findProperty('config_name', 'cluster');
cluster.config_value = this.get('content.cluster.name');
@@ -756,7 +767,7 @@ App.WizardStep8Controller = Em.Controlle
clusterName: this.get('clusterName'),
clusterState: 'CLUSTER_DEPLOY_PREP_2',
wizardControllerName: this.get('content.controllerName'),
- localdb: App.db.data,
+ localdb: App.db.data
});
break;
@@ -1380,13 +1391,13 @@ App.WizardStep8Controller = Em.Controlle
case 'MAPREDUCE':
return {config: {'global': 'version1', 'core-site': 'version1',
'mapred-site': 'version1'}};
case 'HBASE':
- return {config: {'global': 'version1', 'core-site': 'version1',
'hbase-site': 'version1'}};
+ return {config: {'global': 'version1', 'hbase-site': 'version1'}};
case 'OOZIE':
- return {config: {'global': 'version1', 'core-site': 'version1',
'oozie-site': 'version1'}};
+ return {config: {'global': 'version1', 'oozie-site': 'version1'}};
case 'HIVE':
- return {config: {'global': 'version1', 'core-site': 'version1',
'hive-site': 'version1'}};
+ return {config: {'global': 'version1', 'hive-site': 'version1'}};
case 'WEBHCAT':
- return {config: {'global': 'version1', 'core-site': 'version1',
'webhcat-site': 'version1'}};
+ return {config: {'global': 'version1', 'webhcat-site': 'version1'}};
default:
return {config: {'global': 'version1'}};
}
Modified:
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step9_controller.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/wizard/step9_controller.js?rev=1431802&r1=1431801&r2=1431802&view=diff
==============================================================================
---
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step9_controller.js
(original)
+++
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step9_controller.js
Fri Jan 11 01:54:58 2013
@@ -355,10 +355,10 @@ App.WizardStep9Controller = Em.Controlle
return polledData.everyProperty('Tasks.status', 'COMPLETED');
},
- // for DATANODE, JOBTRACKER, HBASE_REGIONSERVER, and GANGLIA_MONITOR, if
more than 50% fail, then it's a fatal error;
+ // for DATANODE, TASKTRACKER, HBASE_REGIONSERVER, and GANGLIA_MONITOR, if
more than 50% fail, then it's a fatal error;
// otherwise, it's only a warning and installation/start can continue
getSuccessFactor: function (role) {
- return ['DATANODE', 'JOBTRACKER', 'HBASE_REGIONSERVER',
'GANGLIA_MONITOR'].contains(role) ? 50 : 100;
+ return ['DATANODE', 'TASKTRACKER', 'HBASE_REGIONSERVER',
'GANGLIA_MONITOR'].contains(role) ? 50 : 100;
},
isStepFailed: function (polledData) {
@@ -436,9 +436,12 @@ App.WizardStep9Controller = Em.Controlle
this.set('status', 'success');
} else {
if (this.isStepFailed(polledData)) {
- clusterStatus.status = 'START FAILED'; // 'START FAILED'
implies to step10 that installation was successful but start failed
+ clusterStatus.status = 'START FAILED'; // 'START FAILED' implies
to step10 that installation was successful but start failed
this.set('status', 'failed');
this.setHostsStatus(this.getFailedHostsForFailedRoles(polledData),
'failed');
+ } else {
+ clusterStatus.status = 'START FAILED';
+ this.set('status', 'warning');
}
}
App.router.get(this.get('content.controllerName')).saveClusterStatus(clusterStatus);
Modified: incubator/ambari/trunk/ambari-web/app/data/config_mapping.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/data/config_mapping.js?rev=1431802&r1=1431801&r2=1431802&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/data/config_mapping.js (original)
+++ incubator/ambari/trunk/ambari-web/app/data/config_mapping.js Fri Jan 11
01:54:58 2013
@@ -60,6 +60,13 @@ module.exports = [
"filename": "core-site.xml"
},
{
+ "name": "hadoop.proxyuser.<foreignKey[0]>.hosts",
+ "templateName": ["hivemetastore_host"],
+ "foreignKey": ["hive_user"],
+ "value": "<templateName[0]>",
+ "filename": "core-site.xml"
+ },
+ {
"name": "hadoop.proxyuser.<foreignKey[0]>.groups",
"templateName": ["proxyuser_group"],
"foreignKey": ["oozie_user"],
@@ -766,7 +773,7 @@ module.exports = [
"name": "templeton.hive.properties",
"templateName": ["hivemetastore_host"],
"foreignKey": null,
- "value":
"hive.metastore.local=false,hive.metastore.uris=thrift://<templateName[0]>:9083,hive.metastore.sasl.enabled=no",
+ "value":
"hive.metastore.local=false,hive.metastore.uris=thrift://<templateName[0]>:9083,hive.metastore.sasl.enabled=yes,hive.metastore.execute.setugi=true",
"filename": "webhcat-site.xml"
},
{
Modified: incubator/ambari/trunk/ambari-web/app/data/review_configs.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/data/review_configs.js?rev=1431802&r1=1431801&r2=1431802&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/data/review_configs.js (original)
+++ incubator/ambari/trunk/ambari-web/app/data/review_configs.js Fri Jan 11
01:54:58 2013
@@ -19,6 +19,11 @@
module.exports = [
{
+ config_name: 'Admin',
+ display_name: 'Admin Name',
+ config_value: ''
+ },
+ {
config_name: 'cluster',
display_name: 'Cluster Name',
config_value: ''
Modified: incubator/ambari/trunk/ambari-web/app/messages.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/messages.js?rev=1431802&r1=1431801&r2=1431802&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/messages.js (original)
+++ incubator/ambari/trunk/ambari-web/app/messages.js Fri Jan 11 01:54:58 2013
@@ -70,11 +70,11 @@ Em.I18n.translations = {
'installer.step1.clusterName.error.specialChar':'Cluster Name cannot contain
special characters',
'installer.step2.header':'Install Options',
- 'installer.step2.body':'Enter the list of hosts to be included in the
cluster, provide your SSH key, and optionally specify a local repository.',
+ 'installer.step2.body':'Enter the list of hosts to be included in the
cluster and provide your SSH key.',
'installer.step2.targetHosts':'Target Hosts',
'installer.step2.targetHosts.info':'Enter a list of host names, one per
line',
'installer.step2.hostPattern.tooltip.title':'Pattern Expressions',
- 'installer.step2.hostPattern.tooltip.content':'You can use pattern
expressions to specify a number of target hosts. For example, to specify host1
thru host10, enter host[1-10] in the target hosts textarea.',
+ 'installer.step2.hostPattern.tooltip.content':'You can use pattern
expressions to specify a number of target hosts. For example, to specify
host01.domain thru host10.domain, enter host[01-10].domain in the target hosts
textarea.',
'installer.step2.hostName.error.required':'You must specify at least one
host name',
'installer.step2.hostName.error.notRequired':'Host Names will be ignored if
not using SSH to automatically configure hosts',
'installer.step2.hostName.error.invalid':'Invalid Host Name(s)',
@@ -92,7 +92,7 @@ Em.I18n.translations = {
'installer.step2.localRepo.label_instead':'instead of downloading software
packages from the Internet',
'installer.step2.localRepo.error.required':'Local repository file path is
required',
'installer.step2.localRepo.tooltip.title':'Local Software Repository',
- 'installer.step2.localRepo.tooltip.content': 'The cluster install requires
access to the Internet to fetch software ' +
+ 'installer.step2.localRepo.tooltip.content': 'The install process requires
access to the Internet to fetch software ' +
'from a remote repository. In some cases, adequate bandwidth is not
available and you want to prevent downloading ' +
'packages from the remote repository over and over again. Other times,
Internet access is not available from the ' +
'hosts in your cluster. In these situations, you must set up a version of
the repository that your machines can ' +
@@ -143,13 +143,13 @@ Em.I18n.translations = {
'installer.step7.attentionNeeded':'<strong>Attention:</strong> Some
configurations need your attention before you can proceed.',
'installer.step8.header':'Review',
- 'installer.step8.body':'Please review the cluster configuration before
installation',
+ 'installer.step8.body':'Please review the configuration before installation',
'installer.step9.header':'Install, Start and Test',
- 'installer.step9.body':'Please wait while the selected services are
installed, started, and tested on your new cluster.',
- 'installer.step9.status.success':'Successfully installed and started the
cluster.',
- 'installer.step9.status.warning':'Installed and started the cluster with
some warnings.',
- 'installer.step9.status.failed':'Failed to install/start the cluster.',
+ 'installer.step9.body':'Please wait while the selected services are
installed and started.',
+ 'installer.step9.status.success':'Successfully installed and started the
services.',
+ 'installer.step9.status.warning':'Installed and started the services with
some warnings.',
+ 'installer.step9.status.failed':'Failed to install/start the services.',
'installer.step9.host.status.success':'Success',
'installer.step9.host.status.warning':'Warnings encountered',
'installer.step9.host.status.failed':'Failures encountered',
@@ -157,7 +157,7 @@ Em.I18n.translations = {
'installer.step9.hostLog.popup.header':'Tasks. executed on ',
'installer.step10.header':'Summary',
- 'installer.step10.body':'Here is the summary of the cluster install
process.',
+ 'installer.step10.body':'Here is the summary of the install process.',
'form.create':'Create',
Modified: incubator/ambari/trunk/ambari-web/app/routes/installer.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/routes/installer.js?rev=1431802&r1=1431801&r2=1431802&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/routes/installer.js (original)
+++ incubator/ambari/trunk/ambari-web/app/routes/installer.js Fri Jan 11
01:54:58 2013
@@ -292,7 +292,7 @@ module.exports = Em.Route.extend({
var controller = router.get('installerController');
controller.setCurrentStep('9');
controller.loadAllPriorSteps();
- if (!App.testMode) { // if test mode is ON don't disable prior steps
link.
+ if (!App.testMode) {
controller.setLowerStepsDisable(9);
}
controller.connectOutlet('wizardStep9', controller.get('content'));
@@ -342,6 +342,9 @@ module.exports = Em.Route.extend({
var controller = router.get('installerController');
controller.setCurrentStep('10');
controller.loadAllPriorSteps();
+ if (!App.testMode) {
+ controller.setLowerStepsDisable(10);
+ }
controller.connectOutlet('wizardStep10', controller.get('content'));
},
back: Em.Router.transitionTo('step9'),
Modified:
incubator/ambari/trunk/ambari-web/app/templates/main/dashboard/service/mapreduce.hbs
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/templates/main/dashboard/service/mapreduce.hbs?rev=1431802&r1=1431801&r2=1431802&view=diff
==============================================================================
---
incubator/ambari/trunk/ambari-web/app/templates/main/dashboard/service/mapreduce.hbs
(original)
+++
incubator/ambari/trunk/ambari-web/app/templates/main/dashboard/service/mapreduce.hbs
Fri Jan 11 01:54:58 2013
@@ -122,7 +122,7 @@
</table>
</div>
<div class="dashboard-mini-chart span2">
- {{view App.ChartServiceMetricsMapReduce_JobsRunningWaiting}}
+ {{view App.ChartServiceMetricsMapReduce_TasksRunningWaiting}}
{{#if view.service.quickLinks.length}}
{{#view App.QuickViewLinks contentBinding="view.service"}}
Modified: incubator/ambari/trunk/ambari-web/app/templates/main/host/summary.hbs
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/templates/main/host/summary.hbs?rev=1431802&r1=1431801&r2=1431802&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/templates/main/host/summary.hbs
(original)
+++ incubator/ambari/trunk/ambari-web/app/templates/main/host/summary.hbs Fri
Jan 11 01:54:58 2013
@@ -54,6 +54,7 @@
<a href="#" {{action routeToService component.service
target="controller" }}>{{component.service.displayName}}</a>
</div>
<div class="span4">
+ {{#if controller.isAdmin}}
<div class="btn-group">
<a {{ bindAttr class=":btn :dropdown-toggle
view.disabledClass"}} data-toggle="dropdown">
Action
@@ -84,6 +85,7 @@
</li>
</ul>
</div>
+ {{/if}}
</div>
{{/view}}
</div>
Modified:
incubator/ambari/trunk/ambari-web/app/templates/main/service/info/configs.hbs
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/templates/main/service/info/configs.hbs?rev=1431802&r1=1431801&r2=1431802&view=diff
==============================================================================
---
incubator/ambari/trunk/ambari-web/app/templates/main/service/info/configs.hbs
(original)
+++
incubator/ambari/trunk/ambari-web/app/templates/main/service/info/configs.hbs
Fri Jan 11 01:54:58 2013
@@ -54,11 +54,13 @@
</div>
{{/each}}
</div>
+ {{#if App.router.loginController.isAdmin}}
<p class="pull-right">
<!--<input class="btn btn-primary" type="button" value="Save and apply
changes" {{!bindAttr disabled="isSubmitDisabled"}} />-->
<a class="btn btn-primary" {{bindAttr disabled="isSubmitDisabled"}}
{{action restartServicePopup target="controller"}}>Save and apply
changes</a>
</p>
+ {{/if}}
{{else}}
<div class="spinner"></div>
{{/if}}
Modified:
incubator/ambari/trunk/ambari-web/app/templates/main/service/info/summary/zookeeper.hbs
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/templates/main/service/info/summary/zookeeper.hbs?rev=1431802&r1=1431801&r2=1431802&view=diff
==============================================================================
---
incubator/ambari/trunk/ambari-web/app/templates/main/service/info/summary/zookeeper.hbs
(original)
+++
incubator/ambari/trunk/ambari-web/app/templates/main/service/info/summary/zookeeper.hbs
Fri Jan 11 01:54:58 2013
@@ -19,19 +19,13 @@
<tr>
<td class="summary-label">Servers</td>
<td>
- {{#each view.servers}}
- <a {{action filterHosts view.serversHost}}
href="javascript:void(null)">{{host}}</a>{{#if isComma}}, {{/if}}
- {{#if isAnd}} and {{/if}}
- {{/each}}
+ <a {{action filterHosts view.serversHost}}
href="javascript:void(null)">{{view.servers.length}} ZooKeeper Server{{#if
view.hasManyServers}}s{{/if}}</a>
</td>
</tr>
<tr>
<td class="summary-label">Clients</td>
<td>
- {{#each view.clients}}
- <a {{action filterHosts view.clientObj}}
href="javascript:void(null)">{{displayName}}</a>{{#if isComma}}, {{/if}}
- {{#if isAnd}} and {{/if}}
- {{/each}}
+ <a {{action filterHosts view.clientObj}}
href="javascript:void(null)">{{view.clients.length}} ZooKeeper Client{{#if
view.hasManyClients}}s{{/if}}</a>
</td>
</tr>
Modified: incubator/ambari/trunk/ambari-web/app/templates/wizard/step8.hbs
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/templates/wizard/step8.hbs?rev=1431802&r1=1431801&r2=1431802&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/templates/wizard/step8.hbs (original)
+++ incubator/ambari/trunk/ambari-web/app/templates/wizard/step8.hbs Fri Jan 11
01:54:58 2013
@@ -19,32 +19,40 @@
<h2>{{t installer.step8.header}}</h2>
<div class="alert alert-info">
- {{t installer.step8.body}}
+ {{t installer.step8.body}}
</div>
+
<div id="step8-content" class="well pre-scrollable">
-{{#each item in controller.clusterInfo}}
-<p>
- <b>{{item.display_name}}</b> : {{item.config_value}}
-</p>
-{{/each}}
+ <div id="printReview">
+ <a class="btn btn-info pull-right" {{action printReview
target="view"}}>Print</a> <br/>
+ </div>
+ <div id="step8-info">
+ {{#each item in controller.clusterInfo}}
+ <p>
+ <b>{{item.display_name}}</b> : {{item.config_value}}
+ </p>
+ {{/each}}
- <div>
- <p><b>Services</b></p>
- {{#each controller.services}}
- <div>
- <ul><em><b>{{display_name}}</b></em>
+ <div>
+ <p><b>Services</b></p>
+ {{#each controller.services}}
+ <div>
+ <ul><em><b>{{display_name}}</b></em>
- <div>
- {{#each component in
this.service_components}}
- <ul><span class="text
text-info">{{component.display_name }} :
</span>{{component.component_value}}</ul>
- {{/each}}
- </div>
- </ul>
- </div>
- {{/each}}
- </div>
+ <div>
+ {{#each component in this.service_components}}
+ <ul><span class="text
text-info">{{component.display_name }}
+ : </span>{{component.component_value}}</ul>
+ {{/each}}
+ </div>
+ </ul>
+ </div>
+ {{/each}}
+ </div>
+ </div>
</div>
<div class="btn-area">
<a class="btn pull-left" {{action back href="true"}}>← Back</a>
- <a class="btn btn-success pull-right" id="spinner" {{bindAttr
disabled="controller.isSubmitDisabled"}} {{action submit
target="controller"}}>Deploy →</a>
+ <a class="btn btn-success pull-right"
+ id="spinner" {{bindAttr disabled="controller.isSubmitDisabled"}}
{{action submit target="controller"}}>Deploy →</a>
</div>
Modified: incubator/ambari/trunk/ambari-web/app/utils/data_table.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/utils/data_table.js?rev=1431802&r1=1431801&r2=1431802&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/utils/data_table.js (original)
+++ incubator/ambari/trunk/ambari-web/app/utils/data_table.js Fri Jan 11
01:54:58 2013
@@ -229,7 +229,7 @@ jQuery.extend($.fn.dataTableExt.afnFilte
var compareScale = rangeExp.charAt(rangeExp.length - 1);
var compareValue = isNaN(parseInt(compareScale), 10) ?
parseInt(rangeExp.substr(1, rangeExp.length - 2), 10) :
parseInt(rangeExp.substr(1, rangeExp.length - 1), 10);
rowValue = (jQuery(rowValue).text()) ? jQuery(rowValue).text() :
rowValue;
- var convertedRowValue = parseInt(rowValue.substr(0, 2), 10) * 3600 +
parseInt(rowValue.substr(3, 2), 10) * 60 + parseInt(rowValue.substr(6, 2), 10);
+ var convertedRowValue = parseInt(rowValue.substr(0,
rowValue.indexOf('secs')), 10);
switch (compareScale) {
case 'm':
convertedRowValue /= 60;
Modified: incubator/ambari/trunk/ambari-web/app/utils/misc.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/utils/misc.js?rev=1431802&r1=1431801&r2=1431802&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/utils/misc.js (original)
+++ incubator/ambari/trunk/ambari-web/app/utils/misc.js Fri Jan 11 01:54:58 2013
@@ -25,9 +25,11 @@ module.exports = {
value = '<1KB';
} else {
if (value < 1048576) {
- value = (Math.round(value / 102.4) / 10).toFixed(1) + 'KB';
+ value = (value / 1024).toFixed(1) + 'KB';
+ } else if (value >= 1048576 && value < 1073741824){
+ value = (value / 1048576).toFixed(1) + 'MB';
} else {
- value = (Math.round(value / 104857.6) / 10).toFixed(1) + 'MB';
+ value = (value / 1073741824).toFixed(2) + 'GB';
}
}
}
Modified: incubator/ambari/trunk/ambari-web/app/views.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views.js?rev=1431802&r1=1431801&r2=1431802&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views.js (original)
+++ incubator/ambari/trunk/ambari-web/app/views.js Fri Jan 11 01:54:58 2013
@@ -93,7 +93,7 @@ require('views/main/service/info/metrics
require('views/main/service/info/metrics/mapreduce/jvm_threads');
require('views/main/service/info/metrics/mapreduce/jvm_heap');
require('views/main/service/info/metrics/mapreduce/rpc');
-require('views/main/service/info/metrics/mapreduce/jobs_running_waiting');
+require('views/main/service/info/metrics/mapreduce/tasks_running_waiting');
require('views/main/service/info/metrics/mapreduce/jobs_status');
require('views/main/service/info/metrics/mapreduce/map_slots');
require('views/main/service/info/metrics/mapreduce/reduce_slots');
Modified: incubator/ambari/trunk/ambari-web/app/views/main/apps_view.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/main/apps_view.js?rev=1431802&r1=1431801&r2=1431802&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/main/apps_view.js (original)
+++ incubator/ambari/trunk/ambari-web/app/views/main/apps_view.js Fri Jan 11
01:54:58 2013
@@ -394,7 +394,9 @@ App.MainAppsView = Em.View.extend({
});
});
this.get('oTable').fnSettings()._iDisplayLength = 10;
+ $('#dataTable_length select option:eq(0)').attr('selected', 'selected');
this.get('oTable').fnDraw(false);
+
console.log('Rendering Apps Table:');
console.log('Start - ', d.toLocaleTimeString());
console.log('End - ', (new Date()).toLocaleTimeString());
@@ -486,9 +488,11 @@ App.MainAppsView = Em.View.extend({
averageRefresh:function() {
var rows = this.get('oTable')._('tr', {"filter":"applied"});
this.get('controller').clearFilteredRuns();
+ var ids = [];
for(var i = 0; i < rows.length; i++) {
- this.get('controller').addFilteredRun(rows[i][1]);
+ ids.push(rows[i][1]);
}
+ this.get('controller').filterFilteredRuns(ids);
}.observes('filtered'),
/**
* dataTable filter views
Modified:
incubator/ambari/trunk/ambari-web/app/views/main/service/info/metrics/mapreduce/map_slots.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/main/service/info/metrics/mapreduce/map_slots.js?rev=1431802&r1=1431801&r2=1431802&view=diff
==============================================================================
---
incubator/ambari/trunk/ambari-web/app/views/main/service/info/metrics/mapreduce/map_slots.js
(original)
+++
incubator/ambari/trunk/ambari-web/app/views/main/service/info/metrics/mapreduce/map_slots.js
Fri Jan 11 01:54:58 2013
@@ -28,7 +28,7 @@ var App = require('app');
*/
App.ChartServiceMetricsMapReduce_MapSlots = App.ChartLinearTimeView.extend({
id: "service-metrics-mapreduce-map-slots",
- title: "Map Slot Utilization",
+ title: "Map Slots Utilization",
renderer: 'line',
url: function () {
return App.formatUrl(App.apiPrefix +
"/clusters/{clusterName}/services/MAPREDUCE/components/JOBTRACKER?fields=metrics/mapred/jobtracker/occupied_map_slots[{fromSeconds},{toSeconds},{stepSeconds}],metrics/mapred/jobtracker/reserved_map_slots[{fromSeconds},{toSeconds},{stepSeconds}]",
{
Added:
incubator/ambari/trunk/ambari-web/app/views/main/service/info/metrics/mapreduce/tasks_running_waiting.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/main/service/info/metrics/mapreduce/tasks_running_waiting.js?rev=1431802&view=auto
==============================================================================
---
incubator/ambari/trunk/ambari-web/app/views/main/service/info/metrics/mapreduce/tasks_running_waiting.js
(added)
+++
incubator/ambari/trunk/ambari-web/app/views/main/service/info/metrics/mapreduce/tasks_running_waiting.js
Fri Jan 11 01:54:58 2013
@@ -0,0 +1,82 @@
+/**
+ * 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');
+
+/**
+ * @class
+ *
+ * This is a view for showing cluster CPU metrics
+ *
+ * @extends App.ChartLinearTimeView
+ * @extends Ember.Object
+ * @extends Ember.View
+ */
+App.ChartServiceMetricsMapReduce_TasksRunningWaiting =
App.ChartLinearTimeView.extend({
+ id: "service-metrics-mapreduce-tasks-running-waiting",
+ title: "Tasks (Running/Waiting)",
+ renderer: 'line',
+ url: function () {
+ return App.formatUrl(App.apiPrefix +
"/clusters/{clusterName}/services/MAPREDUCE/components/JOBTRACKER?fields=metrics/mapred/jobtracker/running_maps[{fromSeconds},{toSeconds},{stepSeconds}],metrics/mapred/jobtracker/running_reduces[{fromSeconds},{toSeconds},{stepSeconds}],metrics/mapred/jobtracker/waiting_maps[{fromSeconds},{toSeconds},{stepSeconds}],metrics/mapred/jobtracker/waiting_reduces[{fromSeconds},{toSeconds},{stepSeconds}]",
{
+ clusterName: App.router.get('clusterController.clusterName')
+ }, "/data/services/metrics/mapreduce/tasks_running_waiting.json");
+ }.property('App.router.clusterController.clusterName'),
+
+ transformToSeries: function (jsonData) {
+ var seriesArray = [];
+ if (jsonData && jsonData.metrics && jsonData.metrics.mapred &&
jsonData.metrics.mapred.jobtracker) {
+ for ( var name in jsonData.metrics.mapred.jobtracker) {
+ var displayName;
+ var seriesData = jsonData.metrics.mapred.jobtracker[name];
+ switch (name) {
+ case "running_maps":
+ displayName = "Running Map Tasks";
+ break;
+ case "running_reduces":
+ displayName = "Running Reduce Tasks";
+ break;
+ case "waiting_maps":
+ displayName = "Waiting Map Tasks";
+ break;
+ case "waiting_reduces":
+ displayName = "Waiting Reduce Tasks";
+ break;
+ default:
+ break;
+ }
+ if (seriesData) {
+ // Is it a string?
+ if ("string" == typeof seriesData) {
+ seriesData = JSON.parse(seriesData);
+ }
+ // We have valid data
+ var series = {};
+ series.name = displayName;
+ series.data = [];
+ for ( var index = 0; index < seriesData.length; index++) {
+ series.data.push({
+ x: seriesData[index][1],
+ y: seriesData[index][0]
+ });
+ }
+ seriesArray.push(series);
+ }
+ }
+ }
+ return seriesArray;
+ }
+});
\ No newline at end of file
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=1431802&r1=1431801&r2=1431802&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
Fri Jan 11 01:54:58 2013
@@ -77,6 +77,20 @@ App.MainServiceInfoSummaryView = Em.View
return result;
}.property('controller.content'),
+ hasManyServers: function () {
+ if (this.get('servers').length > 1) {
+ return true;
+ }
+ return false;
+ }.property('servers'),
+
+ hasManyClients: function () {
+ if (this.get('clients').length > 1) {
+ return true;
+ }
+ return false;
+ }.property('clients'),
+
servers: function () {
var result = [];
var service = this.get('controller.content');
@@ -286,7 +300,7 @@ App.MainServiceInfoSummaryView = Em.View
break;
case 'mapreduce':
graphs = [ App.ChartServiceMetricsMapReduce_JobsStatus.extend(),
- App.ChartServiceMetricsMapReduce_JobsRunningWaiting.extend(),
+ App.ChartServiceMetricsMapReduce_TasksRunningWaiting.extend(),
App.ChartServiceMetricsMapReduce_MapSlots.extend(),
App.ChartServiceMetricsMapReduce_ReduceSlots.extend(),
App.ChartServiceMetricsMapReduce_GC.extend(),
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=1431802&r1=1431801&r2=1431802&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 Fri Jan
11 01:54:58 2013
@@ -191,18 +191,21 @@ App.ServiceConfigRadioButton = Ember.Che
var components = this.get('parentView.serviceConfig.options');
components.forEach(function (_component) {
_component.foreignKeys.forEach(function (_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 (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);
+ }
}
}, this);
}, this);
- }.observes('checked'),
+ }.observes('checked') ,
+
disabled: function () {
- return !this.get('serviceConfig.isEditable');
- }.property('serviceConfig.isEditable')
+ return !this.get('parentView.serviceConfig.isEditable');
+ }.property('parentView.serviceConfig.isEditable')
});
App.ServiceConfigComboBox =
Ember.Select.extend(App.ServiceConfigPopoverSupport, {
Modified: incubator/ambari/trunk/ambari-web/app/views/wizard/step8_view.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/wizard/step8_view.js?rev=1431802&r1=1431801&r2=1431802&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/wizard/step8_view.js (original)
+++ incubator/ambari/trunk/ambari-web/app/views/wizard/step8_view.js Fri Jan 11
01:54:58 2013
@@ -29,6 +29,11 @@ App.WizardStep8View = Em.View.extend({
},
spinner : null,
+ printReview: function() {
+ var o = $("#step8-info");
+ o.jqprint();
+ },
+
showLoadingIndicator: function(){
if(this.get('controller.hasErrorOccurred')){
$('.spinner').hide();
Added: incubator/ambari/trunk/ambari-web/vendor/scripts/jquery.jqprint-0.3.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/vendor/scripts/jquery.jqprint-0.3.js?rev=1431802&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-web/vendor/scripts/jquery.jqprint-0.3.js
(added)
+++ incubator/ambari/trunk/ambari-web/vendor/scripts/jquery.jqprint-0.3.js Fri
Jan 11 01:54:58 2013
@@ -0,0 +1,75 @@
+// -----------------------------------------------------------------------
+// Eros Fratini - [email protected]
+// jqprint 0.3
+//
+// - 19/06/2009 - some new implementations, added Opera support
+// - 11/05/2009 - first sketch
+//
+// Printing plug-in for jQuery, evolution of jPrintArea:
http://plugins.jquery.com/project/jPrintArea
+// requires jQuery 1.3.x
+//
+// Licensed under the MIT license:
http://www.opensource.org/licenses/mit-license.php
+//------------------------------------------------------------------------
+
+(function($) {
+ var opt;
+
+ $.fn.jqprint = function (options) {
+ opt = $.extend({}, $.fn.jqprint.defaults, options);
+
+ var $element = (this instanceof jQuery) ? this : $(this);
+
+ if (opt.operaSupport && $.browser.opera)
+ {
+ var tab = window.open("","jqPrint-preview");
+ tab.document.open();
+
+ var doc = tab.document;
+ }
+ else
+ {
+ var $iframe = $("<iframe />");
+
+ if (!opt.debug) { $iframe.css({ position: "absolute", width:
"0px", height: "0px", left: "-600px", top: "-600px" }); }
+
+ $iframe.appendTo("body");
+ var doc = $iframe[0].contentWindow.document;
+ }
+
+ if (opt.importCSS)
+ {
+ if ($("link[media=print]").length > 0)
+ {
+ $("link[media=print]").each( function() {
+ doc.write("<link type='text/css' rel='stylesheet' href='"
+ $(this).attr("href") + "' media='print' />");
+ });
+ }
+ else
+ {
+ $("link").each( function() {
+ doc.write("<link type='text/css' rel='stylesheet' href='"
+ $(this).attr("href") + "' />");
+ });
+ }
+ }
+
+ if (opt.printContainer) { doc.write($element.outer()); }
+ else { $element.each( function() { doc.write($(this).html()); }); }
+
+ doc.close();
+
+ (opt.operaSupport && $.browser.opera ? tab :
$iframe[0].contentWindow).focus();
+ setTimeout( function() { (opt.operaSupport && $.browser.opera ? tab :
$iframe[0].contentWindow).print(); if (tab) { tab.close(); } }, 1000);
+ }
+
+ $.fn.jqprint.defaults = {
+ debug: false,
+ importCSS: true,
+ printContainer: true,
+ operaSupport: true
+ };
+
+ // Thanks to 9__, found at http://users.livejournal.com/9__/380664.html
+ jQuery.fn.outer = function() {
+ return $($('<div></div>').html(this.clone())).html();
+ }
+})(jQuery);
\ No newline at end of file