You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2016/10/28 17:45:49 UTC
[10/38] ambari git commit: AMBARI-18691. Improve and Update Workflow
designer to support coordinators and bundles. (Belliraj HB via dipayanb)
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1b0bb9e/contrib/views/wfmanager/src/main/resources/ui/app/components/map-reduce-action-info.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/map-reduce-action-info.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/map-reduce-action-info.js
new file mode 100644
index 0000000..3192c72
--- /dev/null
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/map-reduce-action-info.js
@@ -0,0 +1,25 @@
+/*
+* 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.
+*/
+import Ember from 'ember';
+export default Ember.Component.extend({
+ actions : {
+ hideNotification(){
+ this.sendAction("hideNotification");
+ }
+ }
+});
+
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1b0bb9e/contrib/views/wfmanager/src/main/resources/ui/app/components/name-value-config.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/name-value-config.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/name-value-config.js
index 45dea7a..ae453a0 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/name-value-config.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/name-value-config.js
@@ -33,9 +33,12 @@ export default Ember.Component.extend({
}
}.on('willDestroyElement'),
addProperty (){
+ alert(this.get("validations"));
this.get('configuration.property').pushObject({name:this.get('propertyName'),value:this.get('propertyValue')});
- this.set('propertyName', "");
- this.set('propertyValue', "");
+ //if(this.get("doNotInitialize")){
+ this.set('propertyName', "");
+ this.set('propertyValue', "");
+ //}
},
actions : {
addProperty () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1b0bb9e/contrib/views/wfmanager/src/main/resources/ui/app/components/name-value-info.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/name-value-info.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/name-value-info.js
new file mode 100644
index 0000000..7a7c38d
--- /dev/null
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/name-value-info.js
@@ -0,0 +1,21 @@
+/*
+* 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.
+*/
+
+import Ember from 'ember';
+
+export default Ember.Component.extend({
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1b0bb9e/contrib/views/wfmanager/src/main/resources/ui/app/components/named-properties.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/named-properties.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/named-properties.js
index 067d643..f235018 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/named-properties.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/named-properties.js
@@ -15,18 +15,25 @@
* limitations under the License.
*/
import Ember from 'ember';
-import EmberValidations from 'ember-validations';
+import { validator, buildValidations } from 'ember-cp-validations';
-export default Ember.Component.extend(EmberValidations, {
+const Validations = buildValidations({
+ 'property.value': validator('presence', {
+ presence : true,
+ disabled(model){
+ return !model.get('required');
+ },
+ message : 'Required'
+ })
+});
+
+export default Ember.Component.extend(Validations, {
initialize : function () {
this.sendAction('register', this, this);
}.on('init'),
- validations : {
- 'property.value': {
- presence: {
- 'if' :'required',
- 'message' : 'Required'
- }
+ onDestroy : function () {
+ if(this.get('unregisterRequired')){
+ this.sendAction('unregister', this, this);
}
- }
+ }.on('willDestroyElement')
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1b0bb9e/contrib/views/wfmanager/src/main/resources/ui/app/components/pig-action-info.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/pig-action-info.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/pig-action-info.js
new file mode 100644
index 0000000..3192c72
--- /dev/null
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/pig-action-info.js
@@ -0,0 +1,25 @@
+/*
+* 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.
+*/
+import Ember from 'ember';
+export default Ember.Component.extend({
+ actions : {
+ hideNotification(){
+ this.sendAction("hideNotification");
+ }
+ }
+});
+
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1b0bb9e/contrib/views/wfmanager/src/main/resources/ui/app/components/pig-action.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/pig-action.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/pig-action.js
index ee24871..be983a9 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/pig-action.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/pig-action.js
@@ -16,9 +16,14 @@
*/
import Ember from 'ember';
-import EmberValidations from 'ember-validations';
+import { validator, buildValidations } from 'ember-cp-validations';
-export default Ember.Component.extend(EmberValidations,{
+const Validations = buildValidations({
+ 'actionModel.script': validator('presence', {
+ presence : true
+ })
+});
+export default Ember.Component.extend(Validations,{
setUp : function(){
if(this.get('actionModel.jobXml') === undefined){
this.set("actionModel.jobXml", Ember.A([]));
@@ -54,13 +59,6 @@ export default Ember.Component.extend(EmberValidations,{
this.$('#collapseOne').collapse('show');
}
}.on('didUpdate'),
- validations : {
- 'actionModel.script': {
- presence: {
- 'message' : 'You need to provide a value for Script',
- }
- }
- },
actions : {
openFileBrowser(model, context){
if(undefined === context){
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1b0bb9e/contrib/views/wfmanager/src/main/resources/ui/app/components/prepare-config-fs.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/prepare-config-fs.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/prepare-config-fs.js
index 9437c25..3c425d9 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/prepare-config-fs.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/prepare-config-fs.js
@@ -15,9 +15,8 @@
* limitations under the License.
*/
import Ember from 'ember';
-import EmberValidations from 'ember-validations';
-export default Ember.Component.extend(EmberValidations, {
+export default Ember.Component.extend({
mkdirORdeleteORtouchz: true,
mkdir: 1,
delete: 0,
@@ -96,8 +95,8 @@ export default Ember.Component.extend(EmberValidations, {
var gPerm = this.formPermissions(this.get("gread"), this.get("gwrite"), this.get("gexecute"), "g");
var rPerm = this.formPermissions(this.get("rread"), this.get("rwrite"), this.get("rexecute"), "r");
var permissionsObj = {};
- permissionsObj = $.extend(true, oPerm, gPerm);
- permissionsObj = $.extend(true, permissionsObj, rPerm);
+ permissionsObj = Ember.$.extend(true, oPerm, gPerm);
+ permissionsObj = Ember.$.extend(true, permissionsObj, rPerm);
var perm = oPerm.operm + ""+ gPerm.gperm + ""+ rPerm.rperm;
this.get('fsOps').pushObject({
settings: {
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1b0bb9e/contrib/views/wfmanager/src/main/resources/ui/app/components/prepare-config-info.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/prepare-config-info.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/prepare-config-info.js
new file mode 100644
index 0000000..7a7c38d
--- /dev/null
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/prepare-config-info.js
@@ -0,0 +1,21 @@
+/*
+* 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.
+*/
+
+import Ember from 'ember';
+
+export default Ember.Component.extend({
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1b0bb9e/contrib/views/wfmanager/src/main/resources/ui/app/components/prepare-config.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/prepare-config.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/prepare-config.js
index 038428f..6bb2ee4 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/prepare-config.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/prepare-config.js
@@ -16,9 +16,8 @@
*/
import Ember from 'ember';
-import EmberValidations from 'ember-validations';
-export default Ember.Component.extend(EmberValidations,{
+export default Ember.Component.extend({
multivalued: true,
prepareType : 'mkdir',
fileBrowser : Ember.inject.service('file-browser'),
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1b0bb9e/contrib/views/wfmanager/src/main/resources/ui/app/components/preview-dialog.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/preview-dialog.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/preview-dialog.js
new file mode 100644
index 0000000..31f9df8
--- /dev/null
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/preview-dialog.js
@@ -0,0 +1,20 @@
+/*
+* 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.
+*/
+import Ember from 'ember';
+
+export default Ember.Component.extend({
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1b0bb9e/contrib/views/wfmanager/src/main/resources/ui/app/components/property-value-config.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/property-value-config.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/property-value-config.js
new file mode 100644
index 0000000..7a7c38d
--- /dev/null
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/property-value-config.js
@@ -0,0 +1,21 @@
+/*
+* 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.
+*/
+
+import Ember from 'ember';
+
+export default Ember.Component.extend({
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1b0bb9e/contrib/views/wfmanager/src/main/resources/ui/app/components/save-wf.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/save-wf.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/save-wf.js
new file mode 100644
index 0000000..b41f743
--- /dev/null
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/save-wf.js
@@ -0,0 +1,170 @@
+/*
+* 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.
+*/
+
+import Ember from 'ember';
+import Constants from '../utils/constants';
+import { validator, buildValidations } from 'ember-cp-validations';
+
+const Validations = buildValidations({
+ 'filePath': validator('presence', {
+ presence : true
+ })
+});
+
+
+export default Ember.Component.extend(Validations, {
+ showingFileBrowser : false,
+ jobXml : "",
+ overwritePath : false,
+ savingInProgress : false,
+ isStackTraceVisible: false,
+ isStackTraceAvailable: false,
+ alertType : "",
+ alertMessage : "",
+ alertDetails : "",
+ filePath : "",
+ showErrorMessage: false,
+ displayName : Ember.computed('type', function(){
+ if(this.get('type') === 'wf'){
+ return "Workflow";
+ }else if(this.get('type') === 'coord'){
+ return "Coordinator";
+ }else{
+ return "Bundle";
+ }
+ }),
+ initialize :function(){
+ this.set("jobXml", this.get("jobConfigs").xml);
+ this.set('filePath', Ember.copy(this.get('jobFilePath')));
+ }.on('init'),
+ rendered : function(){
+ this.$("#configureJob").on('hidden.bs.modal', function () {
+ this.sendAction('closeJobConfigs');
+ }.bind(this));
+ this.$("#configureJob").modal("show");
+ }.on('didInsertElement'),
+ showNotification(data){
+ if (!data){
+ return;
+ }
+ if (data.type === "success"){
+ this.set("alertType", "success");
+ }
+ if (data.type === "error"){
+ this.set("alertType", "danger");
+ }
+ this.set("alertDetails", data.details);
+ this.set("alertMessage", data.message);
+ if(data.stackTrace.length){
+ this.set("stackTrace", data.stackTrace);
+ this.set("isStackTraceAvailable", true);
+ } else {
+ this.set("isStackTraceAvailable", false);
+ }
+ },
+ saveJob(){
+ var url = Ember.ENV.API_URL + "/saveWorkflow?app.path=" + this.get("filePath") + "&overwrite=" + this.get("overwritePath");
+ Ember.$.ajax({
+ url: url,
+ method: "POST",
+ dataType: "text",
+ contentType: "text/plain;charset=utf-8",
+ beforeSend: function(request) {
+ request.setRequestHeader("X-XSRF-HEADER", Math.round(Math.random()*100000));
+ request.setRequestHeader("X-Requested-By", "workflow-designer");
+ },
+ data: this.get("jobXml"),
+ success: function(response) {
+ //var result=JSON.parse(response);
+ this.showNotification({
+ "type": "success",
+ "message": "Workflow have been saved"
+ });
+ this.set("savingInProgress",false);
+ }.bind(this),
+ error: function(response) {
+ console.log(response);
+ this.set("savingInProgress",false);
+ this.set("isStackTraceVisible",true);
+ this.showNotification({
+ "type": "error",
+ "message": "Error occurred while saving "+ this.get('displayName').toLowerCase(),
+ "details": this.getParsedErrorResponse(response),
+ "stackTrace": this.getStackTrace(response.responseText)
+ });
+ }.bind(this)
+ });
+ },
+ getStackTrace(data){
+ if(data){
+ try{
+ var stackTraceMsg = JSON.parse(data).stackTrace;
+ if(!stackTraceMsg){
+ return "";
+ }
+ if(stackTraceMsg instanceof Array){
+ return stackTraceMsg.join("").replace(/\tat /g, '<br/> at ');
+ } else {
+ return stackTraceMsg.replace(/\tat /g, '<br/> at ');
+ }
+ } catch(err){
+ return "";
+ }
+ }
+ return "";
+ },
+ getParsedErrorResponse (response){
+ var detail;
+ if (response.responseText && response.responseText.charAt(0)==="{"){
+ var jsonResp=JSON.parse(response.responseText);
+ if (jsonResp.status==="workflow.oozie.error"){
+ detail="Oozie error. Please check the workflow.";
+ }else if(jsonResp.message && jsonResp.message.indexOf("<html>") > -1){
+ detail= "";
+ }else{
+ detail=jsonResp.message;
+ }
+ }else{
+ detail=response;
+ }
+ return detail;
+ },
+ actions: {
+ selectFile(){
+ this.set("showingFileBrowser",true);
+ },
+ showStackTrace(){
+ this.set("isStackTraceVisible", true);
+ },
+ hideStackTrace(){
+ this.set("isStackTraceVisible", false);
+ },
+ closeFileBrowser(){
+ this.set("showingFileBrowser",false);
+ },
+ saveWorkflow(){
+ if(!this.get("validations.isInvalid")){
+ this.sendAction("setFilePath", this.get("filePath"));
+ this.set('showErrorMessage', true);
+ this.saveJob();
+ }
+ },
+ closePreview(){
+ this.set("showingPreview",false);
+ }
+ }
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1b0bb9e/contrib/views/wfmanager/src/main/resources/ui/app/components/shell-action-info.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/shell-action-info.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/shell-action-info.js
new file mode 100644
index 0000000..3192c72
--- /dev/null
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/shell-action-info.js
@@ -0,0 +1,25 @@
+/*
+* 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.
+*/
+import Ember from 'ember';
+export default Ember.Component.extend({
+ actions : {
+ hideNotification(){
+ this.sendAction("hideNotification");
+ }
+ }
+});
+
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1b0bb9e/contrib/views/wfmanager/src/main/resources/ui/app/components/shell-action.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/shell-action.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/shell-action.js
index a1445dc..e4e33dd 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/shell-action.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/shell-action.js
@@ -16,9 +16,18 @@
*/
import Ember from 'ember';
-import EmberValidations from 'ember-validations';
+import { validator, buildValidations } from 'ember-cp-validations';
-export default Ember.Component.extend(EmberValidations,{
+const Validations = buildValidations({
+ 'actionModel.exec': validator('presence', {
+ presence : true
+ }),
+ 'actionModel.jobTracker': validator('presence', {
+ presence : true
+ })
+});
+
+export default Ember.Component.extend(Validations,{
initialize : function(){
this.sendAction('register','shellAction', this);
this.on('fileSelected',function(fileName){
@@ -47,13 +56,6 @@ export default Ember.Component.extend(EmberValidations,{
this.set("actionModel.configuration.property", Ember.A([]));
}
}.on('didInsertElement'),
- validations : {
- 'actionModel.exec': {
- presence: {
- 'message' : 'You need to provide a value for Exec'
- }
- }
- },
observeError :function(){
if(this.$('#collapseOne label.text-danger').length > 0 && !this.$('#collapseOne').hasClass("in")){
this.$('#collapseOne').collapse('show');
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1b0bb9e/contrib/views/wfmanager/src/main/resources/ui/app/components/sla-info.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/sla-info.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/sla-info.js
index a1bad85..7390205 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/sla-info.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/sla-info.js
@@ -15,12 +15,92 @@
* limitations under the License.
*/
import Ember from 'ember';
-import EmberValidations from 'ember-validations';
+import { validator, buildValidations } from 'ember-cp-validations';
+import { v1, v4 } from "ember-uuid";
-export default Ember.Component.extend(EmberValidations, {
+const Validations = buildValidations({
+ 'nominalTime': {
+ validators: [
+ validator('presence', {
+ presence : true,
+ disabled(model, attribute) {
+ return !model.get('slaEnabled');
+ },
+ dependentKeys : ['slaEnabled']
+ }),
+ validator('date', {
+ disabled(model, attribute) {
+ return !model.get('slaEnabled');
+ },
+ format: 'MM/DD/YYYY hh:mm A',
+ dependentKeys : ['slaEnabled']
+ }),
+ ]
+ },
+ 'slaInfo.shouldEnd.time': {
+ validators: [
+ validator('presence', {
+ presence : true,
+ disabled(model, attribute) {
+ return !model.get('slaEnabled');
+ },
+ dependentKeys : ['slaEnabled']
+ }),
+ validator('number', {
+ disabled(model) {
+ return !model.get('slaEnabled');
+ },
+ allowString : true,
+ allowBlank : true,
+ integer : true,
+ dependentKeys : ['slaEnabled']
+ }),
+ ]
+ },
+ 'slaInfo.shouldStart.time': validator('number', {
+ disabled(model) {
+ return !model.get('slaEnabled');
+ },
+ allowString : true,
+ allowBlank : true,
+ integer : true,
+ dependentKeys : ['slaEnabled']
+ }),
+ 'slaInfo.maxDuration.time': validator('number', {
+ disabled(model) {
+ return !model.get('slaEnabled');
+ },
+ allowString : true,
+ allowBlank : true,
+ integer : true,
+ dependentKeys : ['slaEnabled']
+ }),
+ 'slaInfo.shouldStart.unit':validator('presence', {
+ presence : true,
+ disabled(model) {
+ return !model.get('slaEnabled') || !model.get('slaInfo.shouldStart.time');
+ },
+ dependentKeys : ['slaEnabled', 'slaInfo.shouldStart.time']
+ }),
+ 'slaInfo.shouldEnd.unit':validator('presence', {
+ presence : true,
+ disabled(model) {
+ return !model.get('slaEnabled') || !model.get('slaInfo.shouldEnd.time');
+ },
+ dependentKeys : ['slaEnabled', 'slaInfo.shouldEnd.time']
+ }),
+ 'slaInfo.maxDuration.unit':validator('presence', {
+ presence : true,
+ disabled(model) {
+ return !model.get('slaEnabled') || !model.get('slaInfo.maxDuration.time');
+ },
+ dependentKeys : ['slaEnabled', 'slaInfo.maxDuration.time']
+ })
+});
+
+export default Ember.Component.extend(Validations, {
alertEvents: Ember.A([]),
timeUnitOptions : Ember.A([]),
- nominalTime : '',
initialize : function(){
this.set('alertEvents', Ember.A([]));
this.get('alertEvents').pushObject({eventType:'start_miss', alertEnabled:false, displayName :'Start Miss'});
@@ -53,6 +133,7 @@ export default Ember.Component.extend(EmberValidations, {
}
}
Ember.addObserver(this, 'nominalTime', this, this.nominalTimeObserver);
+ this.set('collapseId', v1());
}.on('init'),
alertEventsObserver : function(){
var alerts = this.get('alertEvents').filterBy('alertEnabled',true).mapBy('eventType');
@@ -64,7 +145,7 @@ export default Ember.Component.extend(EmberValidations, {
Ember.removeObserver(this, 'nominalTime', this, this.nominalTimeObserver);
}.on('willDestroyElement'),
elementsInserted : function() {
- this.$('#nominalTime').datetimepicker({
+ this.$('input[name="nominalTime"]').datetimepicker({
useCurrent: false,
showClose : true,
defaultDate : this.get('slaInfo.nominalTime')
@@ -78,65 +159,6 @@ export default Ember.Component.extend(EmberValidations, {
var date = new Date(this.get('nominalTime'));
this.set('slaInfo.nominalTime',moment(date).format("YYYY-MM-DDTHH:mm")+'Z');
},
- shouldEnd : Ember.computed.alias('slaInfo.shouldEnd'),
- shouldStart : Ember.computed.alias('slaInfo.shouldStart'),
- maxDuration : Ember.computed.alias('slaInfo.maxDuration'),
- validations : {
- 'nominalTime': {
- presence: {
- 'if': 'slaEnabled',
- 'message' : 'Required',
- }
- },
- 'shouldEnd.time': {
- presence: {
- 'if': 'slaEnabled',
- 'message' : 'Required',
- },
- numericality: {
- 'if': 'slaEnabled',
- onlyInteger: true,
- greaterThan: 0,
- 'message' : 'Number Only'
- }
- },
- 'shouldStart.time': {
- numericality: {
- 'if': 'slaEnabled',
- allowBlank :true,
- onlyInteger: true,
- greaterThan: 0,
- message : 'Number Only'
- }
- },
- 'maxDuration.time': {
- numericality: {
- 'if': 'slaEnabled',
- allowBlank :true,
- onlyInteger: true,
- greaterThan: 0,
- message : 'Number Only'
- }
- },
- 'shouldStart.unit': {
- presence: {
- 'if': 'shouldStart.time',
- 'message' : 'Required',
- }
- },
- 'shouldEnd.unit': {
- presence: {
- 'if': 'slaEnabled',
- 'message' : 'Required',
- }
- },
- 'maxDuration.unit': {
- presence: {
- 'if': 'maxDuration.time',
- 'message' : 'Required',
- }
- }
- },
slaObserver : function(){
if(this.get('slaEnabled')){
this.$('#slaCollapse').collapse('show');
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1b0bb9e/contrib/views/wfmanager/src/main/resources/ui/app/components/spark-action-info.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/spark-action-info.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/spark-action-info.js
new file mode 100644
index 0000000..3192c72
--- /dev/null
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/spark-action-info.js
@@ -0,0 +1,25 @@
+/*
+* 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.
+*/
+import Ember from 'ember';
+export default Ember.Component.extend({
+ actions : {
+ hideNotification(){
+ this.sendAction("hideNotification");
+ }
+ }
+});
+
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1b0bb9e/contrib/views/wfmanager/src/main/resources/ui/app/components/spark-action.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/spark-action.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/spark-action.js
index 4cb74d8..1a778c4 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/spark-action.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/spark-action.js
@@ -16,10 +16,20 @@
*/
import Ember from 'ember';
-import EmberValidations from 'ember-validations';
+import { validator, buildValidations } from 'ember-cp-validations';
import Constants from '../utils/constants';
-
-export default Ember.Component.extend(EmberValidations,{
+const Validations = buildValidations({
+ 'actionModel.master': validator('presence', {
+ presence : true
+ }),
+ 'actionModel.jar': validator('presence', {
+ presence : true
+ }),
+ 'actionModel.sparkName': validator('presence', {
+ presence : true
+ })
+});
+export default Ember.Component.extend(Validations,{
setup : function(){
if(this.get('actionModel.jobXml') === undefined){
this.set("actionModel.jobXml", Ember.A([]));
@@ -41,6 +51,7 @@ export default Ember.Component.extend(EmberValidations,{
this.set("actionModel.configuration.property", Ember.A([]));
}
this.set('mastersList',Ember.copy(Constants.sparkMasterList));
+ this.set('isJar', this.get('actionModel.jar') && this.get('actionModel.jar').endsWith('.jar'));
this.sendAction('register','sparkAction', this);
}.on('init'),
initialize : function(){
@@ -68,27 +79,27 @@ export default Ember.Component.extend(EmberValidations,{
this.set('actionModel.class', undefined);
}
}),
- validations : {
- 'actionModel.master': {
- presence: {
- 'message' : 'You need to provide a value for Runs on (Master)'
- }
- },
- 'actionModel.jar': {
- presence: {
- 'message' : 'You need to provide a value for Application'
- },
- format : {
- 'with' : /\.jar$|\.py$/i,
- 'message' : 'You need to provide a .jar or .py file'
- }
- },
- 'actionModel.sparkName': {
- presence: {
- 'message' : 'You need to provide a value for Name'
- }
- }
- },
+ // validations : {
+ // 'actionModel.master': {
+ // presence: {
+ // 'message' : 'You need to provide a value for Runs on (Master)'
+ // }
+ // },
+ // 'actionModel.jar': {
+ // presence: {
+ // 'message' : 'You need to provide a value for Application'
+ // },
+ // format : {
+ // 'with' : /\.jar$|\.py$/i,
+ // 'message' : 'You need to provide a .jar or .py file'
+ // }
+ // },
+ // 'actionModel.sparkName': {
+ // presence: {
+ // 'message' : 'You need to provide a value for Name'
+ // }
+ // }
+ // },
observeError :function(){
if(this.$('#collapseOne label.text-danger').length > 0 && !this.$('#collapseOne').hasClass("in")){
this.$('#collapseOne').collapse('show');
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1b0bb9e/contrib/views/wfmanager/src/main/resources/ui/app/components/sqoop-action-info.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/sqoop-action-info.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/sqoop-action-info.js
new file mode 100644
index 0000000..3192c72
--- /dev/null
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/sqoop-action-info.js
@@ -0,0 +1,25 @@
+/*
+* 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.
+*/
+import Ember from 'ember';
+export default Ember.Component.extend({
+ actions : {
+ hideNotification(){
+ this.sendAction("hideNotification");
+ }
+ }
+});
+
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1b0bb9e/contrib/views/wfmanager/src/main/resources/ui/app/components/sqoop-action.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/sqoop-action.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/sqoop-action.js
index 847cccd..13eb6e5 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/sqoop-action.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/sqoop-action.js
@@ -16,9 +16,8 @@
*/
import Ember from 'ember';
-import EmberValidations from 'ember-validations';
-export default Ember.Component.extend(EmberValidations,{
+export default Ember.Component.extend({
sqoopSendType : Ember.observer('isArg',function(){
if(this.get('isArg')){
this.set("actionModel.command", undefined);
@@ -61,8 +60,6 @@ export default Ember.Component.extend(EmberValidations,{
this.$('#collapseOne').collapse('show');
}
}.on('didUpdate'),
- validations : {
- },
actions : {
openFileBrowser(model, context){
if(undefined === context){
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1b0bb9e/contrib/views/wfmanager/src/main/resources/ui/app/components/ssh-action-info.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/ssh-action-info.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/ssh-action-info.js
new file mode 100644
index 0000000..3192c72
--- /dev/null
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/ssh-action-info.js
@@ -0,0 +1,25 @@
+/*
+* 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.
+*/
+import Ember from 'ember';
+export default Ember.Component.extend({
+ actions : {
+ hideNotification(){
+ this.sendAction("hideNotification");
+ }
+ }
+});
+
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1b0bb9e/contrib/views/wfmanager/src/main/resources/ui/app/components/ssh-action.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/ssh-action.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/ssh-action.js
index 3ae1f12..d879a0c 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/ssh-action.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/ssh-action.js
@@ -16,9 +16,17 @@
*/
import Ember from 'ember';
-import EmberValidations from 'ember-validations';
+import { validator, buildValidations } from 'ember-cp-validations';
-export default Ember.Component.extend(EmberValidations, {
+const Validations = buildValidations({
+ 'actionModel.host': validator('presence', {
+ presence : true
+ }),
+ 'actionModel.command': validator('presence', {
+ presence : true
+ })
+});
+export default Ember.Component.extend(Validations, {
fileBrowser : Ember.inject.service('file-browser'),
javaOptsObserver : Ember.observer('isSingle',function(){
if(this.get('isSingle')){
@@ -54,18 +62,6 @@ export default Ember.Component.extend(EmberValidations, {
this.$('#collapseOne').collapse('show');
}
}.on('didUpdate'),
- validations : {
- 'actionModel.host': {
- presence: {
- 'message' : 'You need to provide a value for host',
- }
- },
- 'actionModel.command': {
- presence: {
- 'message' : 'You need to provide a value for command',
- }
- }
- },
actions : {
openFileBrowser(model, context){
if(undefined === context){
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1b0bb9e/contrib/views/wfmanager/src/main/resources/ui/app/components/sub-workflow-action-info.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/sub-workflow-action-info.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/sub-workflow-action-info.js
new file mode 100644
index 0000000..3192c72
--- /dev/null
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/sub-workflow-action-info.js
@@ -0,0 +1,25 @@
+/*
+* 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.
+*/
+import Ember from 'ember';
+export default Ember.Component.extend({
+ actions : {
+ hideNotification(){
+ this.sendAction("hideNotification");
+ }
+ }
+});
+
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1b0bb9e/contrib/views/wfmanager/src/main/resources/ui/app/components/sub-workflow.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/sub-workflow.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/sub-workflow.js
index 50ac5bd..06cec22 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/sub-workflow.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/sub-workflow.js
@@ -16,9 +16,15 @@
*/
import Ember from 'ember';
-import EmberValidations from 'ember-validations';
+import { validator, buildValidations } from 'ember-cp-validations';
-export default Ember.Component.extend(EmberValidations,{
+const Validations = buildValidations({
+ 'actionModel.appPath': validator('presence', {
+ presence : true
+ })
+});
+
+export default Ember.Component.extend(Validations,{
setUp : function(){
if(this.get('actionModel.configuration') === undefined){
this.set("actionModel.configuration",{});
@@ -36,13 +42,6 @@ export default Ember.Component.extend(EmberValidations,{
this.$('#collapseOne').collapse('show');
}
}.on('didUpdate'),
- validations : {
- 'actionModel.appPath': {
- presence: {
- 'message' : 'You need to provide a value for app path'
- }
- }
- },
actions : {
openFileBrowser(model, context){
if(undefined === context){
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1b0bb9e/contrib/views/wfmanager/src/main/resources/ui/app/components/transition-config.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/transition-config.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/transition-config.js
index ccf69de..ca45b1f 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/transition-config.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/transition-config.js
@@ -16,32 +16,31 @@
*/
import Ember from 'ember';
-import EmberValidations,{ validator } from 'ember-validations';
+import { validator, buildValidations } from 'ember-cp-validations';
import {FindNodeMixin} from '../domain/findnode-mixin';
-export default Ember.Component.extend(FindNodeMixin, EmberValidations, {
+const Validations = buildValidations({
+ 'transition.errorNode.name': validator('presence', {
+ presence : true
+ })
+});
+
+export default Ember.Component.extend(FindNodeMixin, Validations, {
selectedKillNode : '',
initialize : function(){
this.set('descendantNodes',this.getDesendantNodes(this.get('currentNode')));
- this.set('okToNode', this.getOKToNode(this.get('currentNode')));
+ if(!this.get('transition.okToNode')){
+ var defaultOkToNode = this.getOKToNode(this.get('currentNode'));
+ this.set('transition.okToNode', defaultOkToNode);
+ this.set('defaultOkToNode', defaultOkToNode);
+ }
this.sendAction('register','transition', this);
if(Ember.isBlank(this.get('transition.errorNode.name'))){
this.set('transition.errorNode', this.get('killNodes').objectAt(0));
}
}.on('init'),
- //Work-around : Issue in ember-validations framework
- errorNode : Ember.computed.alias('transition.errorNode'),
- validations : {
- 'errorNode.name': {
- inline : validator(function() {
- if(!this.get('transition.errorNode.name') || this.get('transition.errorNode.name') === ""){
- return "You need to provide an error-to transition";
- }
- })
- }
- },
actions : {
- onSelectChange (value){
+ errorToHandler (value){
this.set('selectedKillNode', value);
if(this.get('selectedKillNode') === 'createNew'){
this.set('transition.errorNode.name', "");
@@ -60,8 +59,19 @@ export default Ember.Component.extend(FindNodeMixin, EmberValidations, {
}
}
},
- okNodeHandler (value){
-
+ okToHandler (name){
+ var validOkToNodes = this.get('currentNode.validOkToNodes');
+ var node = validOkToNodes.findBy('name',name);
+ if(node.id !== this.get('defaultOkToNode').id){
+ this.set('showWarning', true);
+ }else{
+ this.set('showWarning', false);
+ }
+ this.set('transition.okToNode', node);
+ },
+ undoChangeOkTo(){
+ this.set('transition.okToNode', this.get('defaultOkToNode'));
+ this.set('showWarning', false);
}
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1b0bb9e/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-action-editor.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-action-editor.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-action-editor.js
index 502fe50..8ee5a0a 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-action-editor.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-action-editor.js
@@ -16,11 +16,10 @@
*/
import Ember from 'ember';
-import EmberValidations from 'ember-validations';
import Constants from '../utils/constants';
import {SlaInfo} from '../domain/sla-info';
-export default Ember.Component.extend(EmberValidations, Ember.Evented,{
+export default Ember.Component.extend( Ember.Evented,{
actionIcons : {
"hive": "server",
"hive2": "server",
@@ -111,30 +110,14 @@ export default Ember.Component.extend(EmberValidations, Ember.Evented,{
}
}.on('didUpdate'),
validateChildrenComponents(){
- var validationPromises = [];
- var deferred = Ember.RSVP.defer();
- if(this.get('childComponents').size === 0){
- deferred.resolve(true);
- }else{
- this.get('childComponents').forEach((childComponent)=>{
- if(!childComponent.validations){
- return;
- }
- var validationDeferred = Ember.RSVP.defer();
- childComponent.validate().then(()=>{
- validationDeferred.resolve();
- }).catch((e)=>{
- validationDeferred.reject(e);
- });
- validationPromises.push(validationDeferred.promise);
- });
- Ember.RSVP.Promise.all(validationPromises).then(function(){
- deferred.resolve(true);
- }).catch(function(e){
- deferred.reject(e);
- });
- }
- return deferred;
+ var isChildComponentsValid = true;
+ this.get('childComponents').forEach((context)=>{
+ if(context.get('validations') && context.get('validations.isInvalid')){
+ isChildComponentsValid = false;
+ context.set('showErrorMessage', true);
+ }
+ }.bind(this));
+ return isChildComponentsValid;
},
processMultivaluedComponents(){
this.get('childComponents').forEach((childComponent)=>{
@@ -157,19 +140,16 @@ export default Ember.Component.extend(EmberValidations, Ember.Evented,{
this.sendAction('close');
},
save () {
- var isFormValid = this.validateChildrenComponents();
- isFormValid.promise.then(function(){
- this.validate().then(function(){
- this.processMultivaluedComponents();
- this.processStaticProps();
- this.$('#action_properties_dialog').modal('hide');
- this.sendAction('addKillNode', this.get('transition.errorNode'));
- this.set('saveClicked', true);
- }.bind(this)).catch(function(e){
- }.bind(this));
- }.bind(this)).catch(function (e) {
- });
-
+ var isChildComponentsValid = this.validateChildrenComponents();
+ if(this.get('validations.isInvalid') || !isChildComponentsValid) {
+ this.set('showErrorMessage', true);
+ return;
+ }
+ this.processMultivaluedComponents();
+ this.processStaticProps();
+ this.$('#action_properties_dialog').modal('hide');
+ this.sendAction('setNodeTransitions', this.get('transition'));
+ this.set('saveClicked', true);
},
openFileBrowser(model, context){
if(!context){
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1b0bb9e/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-actions.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-actions.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-actions.js
index 95a7f08..7fc1c94 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-actions.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-actions.js
@@ -17,12 +17,19 @@
import Ember from 'ember';
export default Ember.Component.extend({
+ clipboardHasContents : Ember.computed.oneWay('clipboard', function(){
+ return !Ember.isEmpty(this.get('clipboard'));
+ }),
actions : {
addAction : function(type){
this.$(".dr_action").css("background-color", "#fff");
this.$("[data-type="+type+"]").css("background-color", "#538EC0");
this.$(this.get('element')).popover('hide');
this.sendAction("addNode", type);
+ },
+ pasteNode(){
+ this.$(this.get('element')).popover('hide');
+ this.sendAction("pasteNode");
}
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1b0bb9e/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-credentials.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-credentials.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-credentials.js
index ae24770..1072ca4 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-credentials.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-credentials.js
@@ -42,51 +42,44 @@ export default Ember.Component.extend(Ember.Evented, {
}
});
},
- validateChildrenComponents(){
- var validationPromises = [];
- var deferred = Ember.RSVP.defer();
- if(this.get('childComponents').size === 0){
- deferred.resolve(true);
- }else{
- this.get('childComponents').forEach((childComponent)=>{
- if(!childComponent.validations){
- return;
- }
- var validationDeferred = Ember.RSVP.defer();
- childComponent.validate().then(()=>{
- validationDeferred.resolve();
- }).catch((e)=>{
- validationDeferred.reject(e);
- });
- validationPromises.push(validationDeferred.promise);
- });
- Ember.RSVP.Promise.all(validationPromises).then(function(){
- deferred.resolve(true);
- }).catch(function(e){
- deferred.reject(e);
- });
- }
- return deferred;
- },
actions : {
register(component, context){
this.get('childComponents').set(component, context);
},
+ createCredentials(){
+ this.set('editMode', false);
+ this.set('createMode',true);
+ },
+ editCredentials(index){
+ this.set('createMode', false);
+ this.set('editMode',true);
+ this.set('currentCredentialIndex', index);
+ this.set('currentCredentials', Ember.copy(this.get('credentialsList').objectAt(index)));
+ },
+ updateCredentials(){
+ this.set('editMode', false);
+ this.get('credentialsList').replace(this.get('currentCredentialIndex'), 1, Ember.copy(this.get('currentCredentials')));
+ },
addCredentials (credentialsInfo){
this.get('credentialsList').pushObject(credentialsInfo);
+ this.set('createMode', false);
+ },
+ deleteCredentials(index){
+ this.get('credentialsList').removeAt(index);
+ if(index === this.get('currentCredentialIndex')){
+ this.set('editMode', false);
+ }
+ },
+ cancelCreateMode(){
+ this.set('createMode', false);
},
- deleteCredentials(name){
- var credentials = this.get('credentialsList').findBy('name', name);
- this.get('credentialsList').removeObject(credentials);
+ cancelEditMode(){
+ this.set('editMode', false);
},
saveCredentials (){
- var isFormValid = this.validateChildrenComponents();
- isFormValid.promise.then(function(){
- this.processMultivaluedComponents();
- this.set('workflowCredentials', Ember.copy(this.get('credentialsList')));
- this.$('#workflow_credentials_dialog').modal('hide');
- }.bind(this)).catch(function (e) {
- });
+ this.processMultivaluedComponents();
+ this.set('workflowCredentials', Ember.copy(this.get('credentialsList')));
+ this.$('#workflow_credentials_dialog').modal('hide');
}
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1b0bb9e/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-job-action-info.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-job-action-info.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-job-action-info.js
new file mode 100644
index 0000000..9a2c9cc
--- /dev/null
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-job-action-info.js
@@ -0,0 +1,22 @@
+/*
+* 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.
+*/
+import Ember from 'ember';
+
+export default Ember.Component.extend({
+ actions : {
+ }
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1b0bb9e/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-node.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-node.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-node.js
index e51135e..0718152 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-node.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-node.js
@@ -72,6 +72,12 @@ export default Ember.Component.extend(Ember.Evented,{
registerAddBranchAction(component){
this.set("addBranchListener",component);
},
+ showNotification(node){
+ this.sendAction("showNotification", node);
+ },
+ // hideNotification(){
+ // this.sendAction("hideNotification");
+ // },
openEditor (){
this.sendAction("openEditor", this.get('node'));
},
@@ -86,6 +92,9 @@ export default Ember.Component.extend(Ember.Evented,{
},
addDecisionBranch(settings){
this.sendAction("addDecisionBranch",settings);
+ },
+ copyNode(){
+ this.sendAction("copyNode", this.get('node'));
}
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1b0bb9e/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-parameters.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-parameters.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-parameters.js
index 1f75e64..f3a25ac 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-parameters.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-parameters.js
@@ -15,9 +15,19 @@
* limitations under the License.
*/
import Ember from 'ember';
-import EmberValidations,{ validator } from 'ember-validations';
+import { validator, buildValidations } from 'ember-cp-validations';
-export default Ember.Component.extend(EmberValidations, {
+const Validations = buildValidations({
+ 'parameters.configuration.property': {
+ validators: [
+ validator('unique-name', {
+ dependentKeys: ['parameters.configuration.property.[]']
+ })
+ ]
+ }
+});
+export default Ember.Component.extend(Validations, {
+ saveClicked : false,
initialize : function(){
if(this.get('parameters') === undefined || this.get('parameters') === null){
this.set('parameters',{});
@@ -29,27 +39,15 @@ export default Ember.Component.extend(EmberValidations, {
this.sendAction('register','workflowParameters',this);
}.on('init'),
- validations : {
- 'parameters': {
- inline : validator(function() {
- var nameMap = [], errorMsg = undefined;
- if(this.get('parameters.configuration.property')){
- this.get('parameters.configuration.property').forEach(function(item, index){
- if(!item.name){
- errorMsg = "Name cannot be blank";
- } else if(nameMap.indexOf(item.name) > -1){
- errorMsg = "Name cannot be duplicate";
- } else{
- nameMap.push(item.name);
- }
- });
- if(errorMsg){
- return errorMsg;
- }
- }
- })
+ displayName : Ember.computed('type', function(){
+ if(this.get('type') === 'wf'){
+ return "Workflow";
+ }else if(this.get('type') === 'coord'){
+ return "Coordinator";
+ }else{
+ return "Bundle";
}
- },
+ }),
rendered : function(){
this.$('#workflow_parameters_dialog').modal({
backdrop: 'static',
@@ -57,24 +55,28 @@ export default Ember.Component.extend(EmberValidations, {
});
this.$('#workflow_parameters_dialog').modal('show');
this.$('#workflow_parameters_dialog').modal().on('hidden.bs.modal', function() {
- if(this.get('saveClicked')){
- this.sendAction('saveWorkFlowParam');
- }else{
- this.sendAction('closeWorkFlowParam');
- }
+ if(this.get('saveClicked')){
+ this.sendAction('saveWorkFlowParam');
+ }else{
+ this.sendAction('closeWorkFlowParam');
+ }
}.bind(this));
}.on('didInsertElement'),
actions : {
register(component, context){
this.set('nameValueContext', context);
},
+ close (){
+ this.$('#workflow_parameters_dialog').modal('hide');
+ this.set('saveClicked', false);
+ },
saveParameters (){
- this.get("nameValueContext").trigger("bindInputPlaceholder");
- this.validate().then(function(){
+ if(!this.get('validations.isInvalid')){
+ this.get("nameValueContext").trigger("bindInputPlaceholder");
this.set('saveClicked', true);
this.$('#workflow_parameters_dialog').modal('hide');
- }.bind(this)).catch(function(e){
- }.bind(this));
+ return ;
+ }
}
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1b0bb9e/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-sla.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-sla.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-sla.js
index dac325f..6d504c6 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-sla.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-sla.js
@@ -15,10 +15,9 @@
* limitations under the License.
*/
import Ember from 'ember';
-import {SlaInfo} from '../domain/sla-info'
-import EmberValidations from 'ember-validations';
+import {SlaInfo} from '../domain/sla-info';
-export default Ember.Component.extend(EmberValidations,{
+export default Ember.Component.extend({
slaInfo : {},
initialize : function(){
this.set('slaInfo',Ember.copy(this.get('workflowSla')));
@@ -35,13 +34,13 @@ export default Ember.Component.extend(EmberValidations,{
}.on('didInsertElement'),
actions : {
saveWorkflowSla () {
- this.get('slaContext').validate().then(()=>{
+ if(this.get('slaContext').get('validations.isInvalid')){
+ this.get('slaContext').set('showErrorMessage', true);
+ return;
+ }else{
this.set('workflowSla', this.get('slaInfo'));
this.$('#workflow_sla_dialog').modal('hide');
- }.bind(this)). catch(()=>{
-
- });
-
+ }
},
register (name, context) {
this.set('slaContext', context);
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1b0bb9e/contrib/views/wfmanager/src/main/resources/ui/app/controllers/.gitkeep
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/controllers/.gitkeep b/contrib/views/wfmanager/src/main/resources/ui/app/controllers/.gitkeep
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1b0bb9e/contrib/views/wfmanager/src/main/resources/ui/app/controllers/design.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/controllers/design.js b/contrib/views/wfmanager/src/main/resources/ui/app/controllers/design.js
index 285ad19..689ec0d 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/controllers/design.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/controllers/design.js
@@ -18,9 +18,4 @@
import Ember from 'ember';
export default Ember.Controller.extend({
- queryParams: "appPath",
- appPath : null,
- model: function(params) {
- return {};
- }
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1b0bb9e/contrib/views/wfmanager/src/main/resources/ui/app/domain/action-type-resolver.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/domain/action-type-resolver.js b/contrib/views/wfmanager/src/main/resources/ui/app/domain/action-type-resolver.js
new file mode 100644
index 0000000..c25b953
--- /dev/null
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/domain/action-type-resolver.js
@@ -0,0 +1,62 @@
+/*
+* 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.
+*/
+
+import Ember from 'ember';
+import * as actionJobHandler from '../domain/actionjob_hanlder';
+
+var ActionTypeResolver=Ember.Object.extend({
+ actionJobHandlerMap:null,
+ validStandardActionProps:["ok","error","info"],
+ init(){
+ var settings={schemaVersions:this.schemaVersions};
+ this.actionJobHandlerMap=new Map();
+ this.actionJobHandlerMap.set("java",actionJobHandler.JavaActionJobHandler.create(settings));
+ this.actionJobHandlerMap.set("pig",actionJobHandler.PigActionJobHandler.create(settings));
+ this.actionJobHandlerMap.set("hive",actionJobHandler.HiveActionJobHandler.create(settings));
+ this.actionJobHandlerMap.set("hive2",actionJobHandler.Hive2ActionJobHandler.create(settings));
+ this.actionJobHandlerMap.set("sqoop",actionJobHandler.SqoopActionJobHandler.create(settings));
+ this.actionJobHandlerMap.set("shell",actionJobHandler.ShellActionJobHandler.create(settings));
+ this.actionJobHandlerMap.set("spark",actionJobHandler.SparkActionJobHandler.create(settings));
+ this.actionJobHandlerMap.set("map-reduce",actionJobHandler.MapRedActionJobHandler.create(settings));
+ this.actionJobHandlerMap.set("sub-workflow",actionJobHandler.SubWFActionJobHandler.create(settings));
+ this.actionJobHandlerMap.set("distcp",actionJobHandler.DistCpJobHandler.create(settings));
+ this.actionJobHandlerMap.set("ssh",actionJobHandler.SshActionJobHandler.create(settings));
+ this.actionJobHandlerMap.set("email",actionJobHandler.EmailActionJobHandler.create(settings));
+ this.actionJobHandlerMap.set("fs",actionJobHandler.FSActionJobHandler.create(settings));
+ },
+ getActionType(json){
+ var self=this;
+ var resolvedType=null;
+ var problaleActionsTypes=[];
+ Object.keys(json).forEach(function functionName(key) {
+ if (!self.validStandardActionProps.contains(key) && !key.startsWith("_")){
+ problaleActionsTypes.push(key);
+ }
+ });
+ if (problaleActionsTypes.length===1){
+ return problaleActionsTypes[0];
+ }else{
+ console.error("Invalid Action spec..",json);
+ }
+ return resolvedType;
+ },
+ getActionJobHandler(jobType){
+ return this.actionJobHandlerMap.get(jobType);
+ }
+});
+
+export {ActionTypeResolver};
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1b0bb9e/contrib/views/wfmanager/src/main/resources/ui/app/domain/actionjob_hanlder.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/domain/actionjob_hanlder.js b/contrib/views/wfmanager/src/main/resources/ui/app/domain/actionjob_hanlder.js
index 33204ea..2ce0ab4 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/domain/actionjob_hanlder.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/domain/actionjob_hanlder.js
@@ -44,6 +44,7 @@ var ActionJobHandler=Ember.Object.extend(MappingMixin,{
}
this.handleMapping(nodeDomain,actionObj,this.mapping,nodeName);
},
+ /* jshint unused:vars */
validate(nodeDomain){
//overwrite in implmentations and return array of errors object.
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1b0bb9e/contrib/views/wfmanager/src/main/resources/ui/app/domain/bundle/bundle-xml-generator.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/domain/bundle/bundle-xml-generator.js b/contrib/views/wfmanager/src/main/resources/ui/app/domain/bundle/bundle-xml-generator.js
new file mode 100644
index 0000000..957d1c0
--- /dev/null
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/domain/bundle/bundle-xml-generator.js
@@ -0,0 +1,55 @@
+/*
+* 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.
+*/
+import Ember from 'ember';
+var BundleGenerator= Ember.Object.extend({
+ x2js : new X2JS({useDoubleQuotes:true}),
+ bundle: null,
+ process (){
+ var xmlJson={"bundle-app":{}};
+ console.log(this.bundle);
+ var bundleApp=xmlJson["bundle-app"];
+ bundleApp._xmlns = "uri:oozie:bundle:0.1";
+ bundleApp._name = this.bundle.name;
+ if(!Ember.isEmpty(this.bundle.kickOffTime.value)){
+ bundleApp["control"] = {};
+ bundleApp["control"]["kick-off-time"] = this.bundle.kickOffTime.value;
+ }
+ this.generateCoordinatorsJson(bundleApp);
+ var xmlAsStr = this.get("x2js").json2xml_str(xmlJson);
+ return xmlAsStr;
+ },
+ generateCoordinatorsJson(bundleApp){
+ if (this.bundle.coordinators && this.bundle.coordinators.length>0){
+ bundleApp["coordinator"] = [];
+ this.bundle.coordinators.forEach((coordinator)=>{
+ var coordinatorJson = {"_name":coordinator.name};
+ coordinatorJson["app-path"] = coordinator.appPath;
+ if (coordinator.configuration &&
+ coordinator.configuration.property &&
+ coordinator.configuration.property.length > 0){
+ coordinatorJson["configuration"]={"property":[]};
+ var propertiesJson=coordinatorJson.configuration.property;
+ coordinator.configuration.property.forEach((prop) =>{
+ propertiesJson.push({"name" : prop.name, "value" : prop.value});
+ });
+ }
+ bundleApp["coordinator"].push(coordinatorJson);
+ }, this);
+ }
+ }
+});
+export {BundleGenerator};
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1b0bb9e/contrib/views/wfmanager/src/main/resources/ui/app/domain/bundle/bundle-xml-importer.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/domain/bundle/bundle-xml-importer.js b/contrib/views/wfmanager/src/main/resources/ui/app/domain/bundle/bundle-xml-importer.js
new file mode 100644
index 0000000..aa96221
--- /dev/null
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/domain/bundle/bundle-xml-importer.js
@@ -0,0 +1,87 @@
+/*
+* 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.
+*/
+import Ember from 'ember';
+import { Bundle } from '../bundle/bundle';
+
+var BundleXmlImporter= Ember.Object.extend({
+ x2js : new X2JS(),
+ importBundle (xml){
+ var bundleJson = this.get("x2js").xml_str2json(xml);
+ return this.processBundleXML(bundleJson);
+ },
+ processBundleXML(bundleJson){
+ var bundle = Bundle.create({
+ name : '',
+ kickOffTime : {
+ value : '',
+ displayValue : '',
+ type : 'date'
+ },
+ coordinators : Ember.A([])
+ });
+ var bundleApp=bundleJson["bundle-app"];
+ bundle.name = bundleApp._name;
+ if(bundleApp.control && bundleApp.control["kick-off-time"]) {
+ bundle.kickOffTime = this.extractDateField(bundleApp["control"]["kick-off-time"]);
+ }else{
+
+ }
+ this.processCoordinatorsJson(bundleApp, bundle);
+ return bundle;
+ },
+ processCoordinatorsJson(bundleApp, bundle){
+ if (bundleApp.coordinator){
+ bundle.coordinators = Ember.A([]);
+ if(Array.isArray(bundleApp.coordinator)){
+ bundleApp.coordinator.forEach((coordinator)=>{
+ bundle.coordinators.push(this.extractCoordinator(coordinator));
+ }, this);
+ }else{
+ bundle.coordinators.push(this.extractCoordinator(bundleApp.coordinator));
+ }
+ }
+ },
+ extractDateField(value){
+ var dateField = {};
+ var date = new Date(value);
+ dateField.value = value;
+ if(isNaN(date.getTime())){
+ dateField.displayValue = value;
+ dateField.type = 'expr';
+ }else{
+ dateField.type = 'date';
+ var utcDate = new Date(date.getTime() + date.getTimezoneOffset()*60*1000);
+ dateField.displayValue = moment(utcDate).format("MM/DD/YYYY hh:mm A");
+ }
+ return dateField;
+ },
+ extractCoordinator(coordinator) {
+ var coordinatorJson = {"name":coordinator._name};
+ coordinatorJson.appPath = coordinator["app-path"];
+ if (coordinator.configuration &&
+ coordinator.configuration.property &&
+ coordinator.configuration.property.length > 0){
+ coordinatorJson.configuration = {};
+ coordinatorJson.configuration.property = Ember.A([]);
+ coordinator.configuration.property.forEach(function(prop){
+ coordinatorJson.configuration.property.push({"name" : prop.name, "value" : prop.value});
+ });
+ }
+ return coordinatorJson;
+ }
+});
+export {BundleXmlImporter};
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1b0bb9e/contrib/views/wfmanager/src/main/resources/ui/app/domain/bundle/bundle.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/domain/bundle/bundle.js b/contrib/views/wfmanager/src/main/resources/ui/app/domain/bundle/bundle.js
new file mode 100644
index 0000000..2b4bf59
--- /dev/null
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/domain/bundle/bundle.js
@@ -0,0 +1,22 @@
+/*
+* 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.
+*/
+
+import Ember from 'ember';
+var Bundle = Ember.Object.extend({
+
+});
+export {Bundle};
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1b0bb9e/contrib/views/wfmanager/src/main/resources/ui/app/domain/coordinator/coordinator-xml-generator.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/domain/coordinator/coordinator-xml-generator.js b/contrib/views/wfmanager/src/main/resources/ui/app/domain/coordinator/coordinator-xml-generator.js
new file mode 100644
index 0000000..a657706
--- /dev/null
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/domain/coordinator/coordinator-xml-generator.js
@@ -0,0 +1,204 @@
+/*
+* 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.
+*/
+import Ember from 'ember';
+var CoordinatorGenerator= Ember.Object.extend({
+ x2js : new X2JS({useDoubleQuotes:true}),
+ coordinator: null,
+ init(){
+ },
+ process(){
+ var xmlJson={"coordinator-app":{}};
+ console.log(this.coordinator);
+ var coordinatorApp=xmlJson["coordinator-app"];
+ coordinatorApp._name = this.coordinator.name;
+ if(this.coordinator.frequency.type !== 'cron'){
+ coordinatorApp._frequency = "${coord:"+this.coordinator.frequency.type+"("+this.coordinator.frequency.value+")}";
+ }else{
+ coordinatorApp._frequency = this.coordinator.frequency.value;
+ }
+ coordinatorApp._start = this.coordinator.start.value;
+ coordinatorApp._end = this.coordinator.end.value;
+ coordinatorApp._timezone = this.coordinator.timezone;
+ coordinatorApp._xmlns = "uri:oozie:coordinator:0.4";
+ this.generateDataSets(coordinatorApp);
+ if(this.coordinator.dataInputType === 'simple'){
+ this.generateInputEvents(coordinatorApp);
+ }else{
+ this.generateConditionalInputEvents(coordinatorApp);
+ }
+ if(this.coordinator.inputLogic){
+ this.generateInputLogic(coordinatorApp);
+ }
+ this.generateOutputEvents(coordinatorApp);
+ this.generateAction(coordinatorApp);
+ this.generateParameters(coordinatorApp);
+ this.generateControls(coordinatorApp);
+ var xmlAsStr = this.get("x2js").json2xml_str(xmlJson);
+ return xmlAsStr;
+ },
+ generateDataSets(coordinatorApp){
+ if (this.coordinator.datasets && this.coordinator.datasets.length>0){
+ var datasets=[];
+ coordinatorApp["datasets"]={"dataset":datasets};
+ this.coordinator.datasets.forEach(function(dataset){
+ var dataSetJson={_name:dataset.name,
+ "_initial-instance":dataset.initialInstance.value,
+ _timezone:dataset.timezone
+ };
+ if(dataset.frequency.type !== 'cron'){
+ dataSetJson._frequency = "${coord:"+ dataset.frequency.type + "("+dataset.frequency.value + ")}";
+ }else{
+ dataSetJson._frequency = dataset.frequency.value;
+ }
+ dataSetJson["uri-template"]=dataset.uriTemplate;
+ if (dataset.doneFlag){
+ dataSetJson["done-flag"]=dataset.doneFlag;
+ }
+ datasets.push(dataSetJson);
+ });
+ }
+ },
+ generateInputEvents(coordinatorApp){
+ if (this.coordinator.dataInputs && this.coordinator.dataInputs.length>0){
+ coordinatorApp["input-events"]={"data-in":[]};
+ var dataInListJson=coordinatorApp["input-events"]["data-in"];
+ this.coordinator.dataInputs.forEach(function(datain){
+ var datainJson={_name:datain.name,_dataset:datain.dataset};
+ if (datain.instances && datain.instances.length>0){
+ var instancesJson=[];
+ datain.instances.forEach(function(instance){
+ if (instance&& instance.value){
+ instancesJson.push(instance.value);
+ }
+ });
+ datainJson["instance"]=instancesJson;
+ }else if (datain.start && datain.end){
+ datainJson["start-instance"]=datain.start.value;
+ datainJson["end-instance"]=datain.end.value;
+ }
+ dataInListJson.push(datainJson);
+ });
+ }
+ },
+ generateConditionalInputEvents(coordinatorApp){
+ if(this.coordinator.conditionalDataInput){
+ var condition = this.coordinator.conditionalDataInput;
+ coordinatorApp["input-events"] = {};
+ var inputEventJson = coordinatorApp["input-events"];
+ inputEventJson[condition.operator] = {};
+ var conditionJson = inputEventJson[condition.operator];
+ this.parseConditionTree(conditionJson, condition);
+ }
+ },
+ generateInputLogic(coordinatorApp){
+ var condition = this.coordinator.inputLogic;
+ coordinatorApp["input-logic"] = {};
+ var inputLogicJson = coordinatorApp["input-logic"];
+ inputLogicJson[condition.operator] = {};
+ var conditionJson = inputLogicJson[condition.operator];
+ this.parseConditionTree(conditionJson, condition);
+ },
+ parseConditionTree(conditionJson, condition){
+ if(!condition) {
+ return;
+ }
+ conditionJson._name = condition.name;
+ if(condition.min){
+ conditionJson._min = condition.min;
+ }
+ if(condition.wait){
+ conditionJson._wait = condition.wait;
+ }
+ if(condition.name){
+ conditionJson._name = condition.name;
+ }
+ if(!condition.operands){
+ return;
+ }
+ condition.operands.forEach((operand)=>{
+ if(operand.type === 'dataInput'){
+ if(!conditionJson["data-in"]){
+ conditionJson["data-in"] = [];
+ }
+ var dataInJson = {_dataset:operand.dataset};
+ if(operand.min){
+ dataInJson._min = operand.min;
+ }
+ if(operand.wait){
+ dataInJson._wait = operand.wait;
+ }
+ if(operand.name){
+ dataInJson._name = operand.name;
+ }
+ conditionJson["data-in"].push(dataInJson);
+ }else if(operand.type === 'condition'){
+ conditionJson[operand.operator] = {};
+ this.parseConditionTree(conditionJson[operand.operator], operand);
+ }
+ }, this);
+ },
+ generateOutputEvents(coordinatorApp){
+ if (this.coordinator.dataOutputs && this.coordinator.dataOutputs.length>0){
+ coordinatorApp["output-events"]={"data-out":[]};
+ var dataOutputsJson= coordinatorApp["output-events"]["data-out"];
+ this.coordinator.dataOutputs.forEach(function(dataOut){
+ var dataOutJson={_dataset:dataOut.dataset,_name:dataOut.name,instance:dataOut.instance.value};
+ dataOutputsJson.push(dataOutJson);
+ });
+ }
+ },
+ generateAction(coordinatorApp){
+ var actionJson={"workflow":{"app-path":this.coordinator.workflow.appPath}};
+ coordinatorApp.action=actionJson;
+ if (this.coordinator.workflow.configuration &&
+ this.coordinator.workflow.configuration.property &&
+ this.coordinator.workflow.configuration.property.length>0){
+ actionJson.workflow["configuration"]={"property":[]};
+ var propertiesJson=actionJson.workflow.configuration.property;
+ this.coordinator.workflow.configuration.property.forEach(function(prop){
+ propertiesJson.push({"name":prop.name,"value":prop.value});
+ });
+ }
+ },
+ generateParameters(coordinatorApp){
+ if (this.coordinator.parameters.configuration &&
+ this.coordinator.parameters.configuration.property &&
+ this.coordinator.parameters.configuration.property.length>0){
+ coordinatorApp["parameters"] = {};
+ var paramJson = coordinatorApp["parameters"];
+ paramJson["configuration"]={"property":[]};
+ var propertiesJson=paramJson.configuration.property;
+ this.coordinator.parameters.configuration.property.forEach(function(prop){
+ propertiesJson.push({"name":prop.name,"value":prop.value});
+ });
+ }
+ },
+ generateControls(coordinatorApp) {
+ if(this.coordinator.controls && this.coordinator.controls.length > 0){
+ coordinatorApp["controls"] = {};
+ this.coordinator.controls.forEach((control)=>{
+ if(control.value){
+ coordinatorApp["controls"][control.name] = control.value;
+ }
+ }, this);
+ if(Object.keys(coordinatorApp["controls"]).length === 0){
+ delete coordinatorApp["controls"];
+ }
+ }
+ }
+ });
+ export {CoordinatorGenerator};