Repository: ambari Updated Branches: refs/heads/trunk 96aaf1dbb -> 21697822f
AMBARI-19419 : Save workflows via save mechanism instead of submission button configured (Venkata Sairam via nitirajrathore) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/21697822 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/21697822 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/21697822 Branch: refs/heads/trunk Commit: 21697822f96c69b03eb6534b55f4fedabb311fd7 Parents: 96aaf1d Author: Nitiraj Rathore <nitiraj.rath...@gmail.com> Authored: Tue Jan 10 15:01:54 2017 +0530 Committer: Nitiraj Rathore <nitiraj.rath...@gmail.com> Committed: Tue Jan 10 15:05:19 2017 +0530 ---------------------------------------------------------------------- .../ambari/view/OozieProxyImpersonator.java | 4 +- .../WorkflowsManagerResource.java | 2 +- .../resources/ui/app/adapters/application.js | 27 +++++ .../app/components/design/proj-manager-tabs.js | 21 ++++ .../ui/app/components/designer-workspace.js | 35 +++++- .../resources/ui/app/components/drafts-wf.js | 69 +++++++++++ .../ui/app/helpers/format-unicode-date.js | 24 ++++ .../main/resources/ui/app/models/wfproject.js | 25 ++++ .../src/main/resources/ui/app/router.js | 1 + .../src/main/resources/ui/app/routes/design.js | 8 ++ .../ui/app/routes/design/proj-manager-tab.js | 29 +++++ .../src/main/resources/ui/app/styles/app.less | 25 +++- .../components/design/proj-manager-tabs.hbs | 18 +++ .../templates/components/designer-workspace.hbs | 11 ++ .../ui/app/templates/components/drafts-wf.hbs | 121 +++++++++++++++++++ .../main/resources/ui/app/templates/design.hbs | 4 +- .../app/templates/design/proj-manager-tab.hbs | 19 +++ .../main/resources/ui/app/utils/constants.js | 1 + .../components/design/proj-manager-tabs-test.js | 41 +++++++ .../integration/components/drafts-wf-test.js | 41 +++++++ .../ui/tests/unit/adapters/application-test.js | 29 +++++ .../unit/helpers/format-unicode-date-test.js | 27 +++++ .../ui/tests/unit/models/wfproject-test.js | 29 +++++ .../unit/routes/design/proj-manager-tab-test.js | 28 +++++ 24 files changed, 631 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/21697822/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/OozieProxyImpersonator.java ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/OozieProxyImpersonator.java b/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/OozieProxyImpersonator.java index df2e3d8..7596de0 100644 --- a/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/OozieProxyImpersonator.java +++ b/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/OozieProxyImpersonator.java @@ -76,7 +76,7 @@ public class OozieProxyImpersonator { private final HDFSFileUtils hdfsFileUtils; private final WorkflowFilesService workflowFilesService; private WorkflowManagerService workflowManagerService; - private static final boolean PROJ_MANAGER_ENABLED = false; + private static final boolean PROJ_MANAGER_ENABLED = true; private final OozieDelegate oozieDelegate; private final OozieUtils oozieUtils = new OozieUtils(); private final AssetResource assetResource; @@ -511,4 +511,4 @@ public class OozieProxyImpersonator { } return getErrorDetails(errorCode, errorMessage, ex); } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ambari/blob/21697822/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/workflowmanager/WorkflowsManagerResource.java ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/workflowmanager/WorkflowsManagerResource.java b/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/workflowmanager/WorkflowsManagerResource.java index 64e2060a..7513107 100644 --- a/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/workflowmanager/WorkflowsManagerResource.java +++ b/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/workflowmanager/WorkflowsManagerResource.java @@ -46,7 +46,7 @@ public class WorkflowsManagerResource { @DELETE - @Path("/projectId") + @Path("/{projectId}") public void deleteWorkflow( @PathParam("projectId") String id, @DefaultValue("false") @QueryParam("deleteDefinition") Boolean deleteDefinition){ workflowManagerService.deleteWorkflow(id,deleteDefinition); http://git-wip-us.apache.org/repos/asf/ambari/blob/21697822/contrib/views/wfmanager/src/main/resources/ui/app/adapters/application.js ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/adapters/application.js b/contrib/views/wfmanager/src/main/resources/ui/app/adapters/application.js new file mode 100644 index 0000000..453f2e9 --- /dev/null +++ b/contrib/views/wfmanager/src/main/resources/ui/app/adapters/application.js @@ -0,0 +1,27 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one or more +* contributor license agreements. See the NOTICE file distributed with +* this work for additional information regarding copyright ownership. +* The ASF licenses this file to You under the Apache License, Version 2.0 +* (the "License"); you may not use this file except in compliance with +* the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import Ember from 'ember'; +import DS from 'ember-data'; + +export default DS.RESTAdapter.extend({ + namespace: Ember.ENV.API_URL, + headers:{ + "X-XSRF-HEADER":Math.round(Math.random()*100000), + "X-Requested-By":"Ambari" + } +}); http://git-wip-us.apache.org/repos/asf/ambari/blob/21697822/contrib/views/wfmanager/src/main/resources/ui/app/components/design/proj-manager-tabs.js ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/design/proj-manager-tabs.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/design/proj-manager-tabs.js new file mode 100644 index 0000000..0803faa --- /dev/null +++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/design/proj-manager-tabs.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/21697822/contrib/views/wfmanager/src/main/resources/ui/app/components/designer-workspace.js ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/designer-workspace.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/designer-workspace.js index c4f1b09..f70658e 100644 --- a/contrib/views/wfmanager/src/main/resources/ui/app/components/designer-workspace.js +++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/designer-workspace.js @@ -16,13 +16,15 @@ */ import Ember from 'ember'; import CommonUtils from "../utils/common-utils"; +import Constants from '../utils/constants'; export default Ember.Component.extend({ workspaceManager : Ember.inject.service('workspace-manager'), assetManager : Ember.inject.service('asset-manager'), xmlAppPath : null, appPath : null, type : 'wf', - tabId: 0, + tabId : 0, + //isProjectManagerEnabled : Constants.isProjectManagerEnabled, hasMultitabSupport : true, tabCounter : new Map(), tabs : Ember.A([]), @@ -33,6 +35,11 @@ export default Ember.Component.extend({ this.get('workspaceManager').saveTabs(this.get('tabs')); }), initialize : function(){ + if (Constants.isProjectManagerEnabled) { + this.set("isProjectManagerEnabled", "true"); + } else { + this.set("isProjectManagerEnabled", "false"); + } this.get('tabCounter').set('wf', 0); this.get('tabCounter').set('coord', 0); this.get('tabCounter').set('bundle', 0); @@ -56,7 +63,10 @@ export default Ember.Component.extend({ var tab = this.get('tabs').findBy('id', id); if(tab.type === 'dashboard'){ this.sendAction('showDashboard'); - }else{ + } else if (tab.type === 'Projects') { + this.createOrShowProjManager(); + } + else{ this.sendAction('hideDashboard'); } }.bind(this)); @@ -107,6 +117,24 @@ export default Ember.Component.extend({ this.get('tabCounter').set(type, ++count); return count; }, + createOrShowProjManager(){ + var projectsTab = this.get('tabs').findBy('type', 'Projects'); + if(projectsTab && projectsTab.type === 'Projects'){ + this.$('.nav-tabs a[href="#' + projectsTab.id + '"]').tab('show'); + }else{ + var tab = { + type : 'Projects', + id : this.generateTabId(), + name : 'Projects' + }; + this.$('.nav-tabs li').removeClass('active'); + this.$('.tab-content .tab-pane').removeClass('active'); + this.get('tabs').pushObject(tab); + this.$('.nav-tabs a[href="#' + tab.id + '"]').tab('show'); + } + this.sendAction('showProjManager'); + return; + }, createOrshowDashboard(){ var dashboardTab = this.get('tabs').findBy('type', 'dashboard'); if(dashboardTab && dashboardTab.type === 'dashboard'){ @@ -148,6 +176,9 @@ export default Ember.Component.extend({ showDashboard(){ this.createOrshowDashboard(); }, + showProjectManager(){ + this.createOrShowProjManager(); + }, closeTab(index){ if(index < this.get('tabs').length - 1){ var previousTab = this.get('tabs').objectAt(index + 1); http://git-wip-us.apache.org/repos/asf/ambari/blob/21697822/contrib/views/wfmanager/src/main/resources/ui/app/components/drafts-wf.js ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/drafts-wf.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/drafts-wf.js new file mode 100644 index 0000000..885655a --- /dev/null +++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/drafts-wf.js @@ -0,0 +1,69 @@ +/* +* 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'; +const { computed } = Ember; + +export default Ember.Component.extend({ + "isDeleteDraftConformation": false, + "currentDraft": undefined, + "deleteInProgress": false, + "deleteMsg": undefined, + elementsInserted: function () { + this.$('.actions').hide(); + }.on("didInsertElement"), + rendered : function(){ + var self = this; + this.$("#configureJob").on('hidden.bs.modal', function () { + self.set("deleteMsg", null); + self.set("deleteInProgress", false); + }.bind(this)); + }.on('didInsertElement'), + store: Ember.inject.service(), + actions: { + importActionToEditor ( path ) { + this.sendAction('editWorkflow', path); + }, + deleteDraftConformation (job ){ + this.set("isDeleteDraftConformation", true); + this.$("#configureJob").modal("show"); + this.set("currentDraft", job); + }, + deleteDraft () { + this.set("deleteInProgress", true); + var job = this.get("currentDraft"), self= this; + this.get("store").findRecord('wfproject', job.id).then(function(post) { + post.destroyRecord(); + }).then(function () { + self.set("deleteInProgress", false); + self.set("deleteMsg", "Draft successfully deleted."); + console.log("Deleted successfully"); + }).catch(function (response) { + self.set("deleteInProgress", false); + self.set("deleteMsg", "There is some problem while deletion.Please try again."); + }); + }, + showActions (job) { + this.$('.'+job.get("updatedAt")+'Actions').show(); + this.$('.Actions'+job.get("updatedAt")).hide(); + }, + hideActions (job) { + this.$('.'+job.get("updatedAt")+'Actions').hide(); + this.$('.Actions'+job.get("updatedAt")).show(); + } + } +}); http://git-wip-us.apache.org/repos/asf/ambari/blob/21697822/contrib/views/wfmanager/src/main/resources/ui/app/helpers/format-unicode-date.js ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/helpers/format-unicode-date.js b/contrib/views/wfmanager/src/main/resources/ui/app/helpers/format-unicode-date.js new file mode 100644 index 0000000..e6dd653 --- /dev/null +++ b/contrib/views/wfmanager/src/main/resources/ui/app/helpers/format-unicode-date.js @@ -0,0 +1,24 @@ +/* +* 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 function formatUnicodeDate(params) { + return new Date(parseInt(params[0])).toUTCString(); +} + +export default Ember.Helper.helper(formatUnicodeDate); http://git-wip-us.apache.org/repos/asf/ambari/blob/21697822/contrib/views/wfmanager/src/main/resources/ui/app/models/wfproject.js ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/models/wfproject.js b/contrib/views/wfmanager/src/main/resources/ui/app/models/wfproject.js new file mode 100644 index 0000000..e90a613 --- /dev/null +++ b/contrib/views/wfmanager/src/main/resources/ui/app/models/wfproject.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 DS from 'ember-data'; + +export default DS.Model.extend({ + workflowDefinitionPath: DS.attr("string"), + type: DS.attr("string"), + updatedAt: DS.attr("string"), + owner:DS.attr("string") +}); http://git-wip-us.apache.org/repos/asf/ambari/blob/21697822/contrib/views/wfmanager/src/main/resources/ui/app/router.js ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/router.js b/contrib/views/wfmanager/src/main/resources/ui/app/router.js index f494f6f..26ff353 100644 --- a/contrib/views/wfmanager/src/main/resources/ui/app/router.js +++ b/contrib/views/wfmanager/src/main/resources/ui/app/router.js @@ -27,6 +27,7 @@ Router.map(function () { this.route('design', function() { this.route('dashboardtab'); this.route('jobtab'); + this.route('projManagerTab'); }); this.route('designtest'); this.route('job'); http://git-wip-us.apache.org/repos/asf/ambari/blob/21697822/contrib/views/wfmanager/src/main/resources/ui/app/routes/design.js ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/routes/design.js b/contrib/views/wfmanager/src/main/resources/ui/app/routes/design.js index d557625..3affe7c 100644 --- a/contrib/views/wfmanager/src/main/resources/ui/app/routes/design.js +++ b/contrib/views/wfmanager/src/main/resources/ui/app/routes/design.js @@ -73,9 +73,17 @@ export default Ember.Route.extend(Ember.Evented, { this.controller.set('dashboardShown', true); this.transitionTo('design.dashboardtab'); }, + showProjManager(){ + //this.controller.set('ProjManagerShown', true); + this.transitionTo('design.projManagerTab'); + }, hideDashboard(){ this.controller.set('dashboardShown', false); this.transitionTo('design'); + }, + hideProjManager(){ + //this.controller.set('ProjManagerShown', false); + this.transitionTo('design'); } } http://git-wip-us.apache.org/repos/asf/ambari/blob/21697822/contrib/views/wfmanager/src/main/resources/ui/app/routes/design/proj-manager-tab.js ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/routes/design/proj-manager-tab.js b/contrib/views/wfmanager/src/main/resources/ui/app/routes/design/proj-manager-tab.js new file mode 100644 index 0000000..b37ed83 --- /dev/null +++ b/contrib/views/wfmanager/src/main/resources/ui/app/routes/design/proj-manager-tab.js @@ -0,0 +1,29 @@ +/* +* 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.Route.extend({ + model:function(params) { + return this.store.findAll('wfproject'); + }, + actions: { + routeToDesigner(options){ + this.transitionTo("design", options); + } + } +}); http://git-wip-us.apache.org/repos/asf/ambari/blob/21697822/contrib/views/wfmanager/src/main/resources/ui/app/styles/app.less ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/styles/app.less b/contrib/views/wfmanager/src/main/resources/ui/app/styles/app.less index a5b0b4a..92955d7 100644 --- a/contrib/views/wfmanager/src/main/resources/ui/app/styles/app.less +++ b/contrib/views/wfmanager/src/main/resources/ui/app/styles/app.less @@ -1585,4 +1585,27 @@ input:invalid { } #search-table td:first-child { width:5%; -} \ No newline at end of file +} +#draftsTable { + padding-top: 0.5%; + padding-left: 0.5%; + padding-right: 0.5%; + max-height:500px; + overflow:scroll; +} +#emptyDrafts { + padding-left:40%; + padding-top:5%; +} +.width300 { + white-space: nowrap; + width: 70%; + overflow: hidden; + text-overflow: ellipsis; +} +#draftsTable td:second-child { + width:35%; +} +#draftsNum { + padding-left:40%; +} http://git-wip-us.apache.org/repos/asf/ambari/blob/21697822/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/design/proj-manager-tabs.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/design/proj-manager-tabs.hbs b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/design/proj-manager-tabs.hbs new file mode 100644 index 0000000..a4bf4b3 --- /dev/null +++ b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/design/proj-manager-tabs.hbs @@ -0,0 +1,18 @@ +{{! +* 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. +}} +{{yield}} http://git-wip-us.apache.org/repos/asf/ambari/blob/21697822/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/designer-workspace.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/designer-workspace.hbs b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/designer-workspace.hbs index 88e2c70..9bc46c2 100644 --- a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/designer-workspace.hbs +++ b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/designer-workspace.hbs @@ -68,6 +68,11 @@ <button {{action "showAssetManager" true}} class="btn btn-default" title="Manage Assets"> Manage Assets </button> + {{#if (eq isProjectManagerEnabled "true")}} + <button {{action "showProjectManager" true}} class="btn btn-default" title="Project Manager"> + <i class="fa fa-folder marginright5" aria-hidden="true"></i>Projects + </button> + {{/if}} {{help-icon}} </div> </div> @@ -84,6 +89,8 @@ <i class="fa fa-history marginright5"></i> {{else if (eq tab.type 'bundle')}} <i class="fa fa-cubes marginright5"></i> + {{else if (eq tab.type 'Projects')}} + <i class="fa fa-folder marginright5"></i> {{else}} <i class="fa fa-th marginright5"></i> {{/if}} @@ -107,6 +114,10 @@ changeFilePath="changeFilePath" tabInfo=tab}} {{else if (eq tab.type 'dashboard')}} {{outlet}} + {{else if (eq tab.type 'Projects')}} + {{#if (eq isProjectManagerEnabled "true")}} + {{outlet}} + {{/if}} {{else}} {{spin-spinner lines=7 length=3 width=3 radius=3 top=-10 left=150}} {{/if}} http://git-wip-us.apache.org/repos/asf/ambari/blob/21697822/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/drafts-wf.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/drafts-wf.hbs b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/drafts-wf.hbs new file mode 100644 index 0000000..54ea25f --- /dev/null +++ b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/drafts-wf.hbs @@ -0,0 +1,121 @@ +{{! +* 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. +}} + +{{#if model}} +<div id="draftsTable"> +<table id="search-table" class="table search-table listing table-striped table-hover table-bordered" cellspacing="0" width="100%"> + <thead> + <tr> + <!--th>Draft Name</th--> + <th>Type</th> + <th>Draft Path</th> + <th>Created Time</th> + <th>Action</th> + </tr> + </thead> + <tbody> + {{#if model}} + {{#each model as |job idx|}} + <tr> + <!--td title={{job.workflowDefinitionPath}}> <div class="width300">{{job.workflowDefinitionPath}}</div></td--> + <td class="{{job.type}} cyScrollMsg"> + {{#if (eq job.type "WORKFLOW")}} + <i class="fa fa-sitemap marginright5"></i> + {{/if}} + </td> + <td title={{job.workflowDefinitionPath}}> + <div class="width300"> + {{job.workflowDefinitionPath}} + </div> + </td> + <td> {{format-unicode-date job.updatedAt}}</td> + <td class=" no-sort" {{action 'hideActions' job on="mouseLeave"}} style="width:200px;"> + <div id="actions-div" class="pull-left Actions{{job.updatedAt}}"> + <button {{action 'showActions' job on='mouseEnter'}} type="button" class="btn btn-default isOn"> + <i class="fa fa-cog" aria-hidden="true"></i> + </button> + </div> + <div class="pull-left {{job.updatedAt}}Actions actions" id="actions"> + <div class="wf-buttons btn-group btn-group-sm" role="group" aria-label="buttons"> + <button {{action "importActionToEditor" job.workflowDefinitionPath}} type="button" class="btn btn-default"> + Edit + </button> + <button {{action 'deleteDraftConformation' job}} type="button" class="btn btn-default"> + Delete + </button> + </div> + </div> + </td> + </tr> + {{/each}} + {{/if}} + </tbody> +</table> +</div> +<div id="draftsNum">Displaying {{model.length}} projects</div> +{{else}} + <div id="emptyDrafts"> + There are no projects currently + </div> +{{/if}} +{{#if true}} +<div class="modal fade" id="configureJob" role="dialog"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal">×</button> + <h4 class="modal-title">Delete Draft Confirmation</h4> + </div> + <div class="modal-body"> + {{#if deleteMsg}} + <div class="row form-group"> + <div class="col-xs-4"> + </div> + <div class="col-xs-8"> + <div class="input-group"> + {{deleteMsg}} + </div> + </div> + </div> + {{/if}} + {{#unless deleteMsg}} + <div class="row form-group"> + <div class="col-xs-4"> + </div> + <div class="col-xs-8"> + <div class="input-group"> + <label class="control-label" for="{{type}}-path">Do you want to delete the draft?</label> + </div> + </div> + </div> + {{/unless}} + </div> + <div class="modal-footer"> + {{#if deleteInProgress}} + {{spin-spinner lines=10 length=10 width=5 radius=10 }} + <span class="pull-left">Deleting the draft</span> + {{/if}} + <button type="button" class="btn btn-default" data-dismiss="modal" {{action "closeDraftWindow"}}>Close</button> + {{#unless deleteMsg}} + <button type="button" class="btn btn-primary" {{action "deleteDraft" }}>Delete</button> + {{/unless}} + </div> + </div> + </div> +</div> +{{/if}} http://git-wip-us.apache.org/repos/asf/ambari/blob/21697822/contrib/views/wfmanager/src/main/resources/ui/app/templates/design.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/templates/design.hbs b/contrib/views/wfmanager/src/main/resources/ui/app/templates/design.hbs index e39ba8d..012d9e7 100644 --- a/contrib/views/wfmanager/src/main/resources/ui/app/templates/design.hbs +++ b/contrib/views/wfmanager/src/main/resources/ui/app/templates/design.hbs @@ -15,5 +15,5 @@ * See the License for the specific language governing permissions and * limitations under the License. }} -{{designer-workspace xmlAppPath=xmlAppPath showDashboard="showDashboard" - hideDashboard="hideDashboard" adminConfig=model.adminConfig}} +{{designer-workspace xmlAppPath=xmlAppPath showDashboard="showDashboard" showProjManager="showProjManager" + hideDashboard="hideDashboard" hideProjManager="hideProjManager" adminConfig=model.adminConfig}} http://git-wip-us.apache.org/repos/asf/ambari/blob/21697822/contrib/views/wfmanager/src/main/resources/ui/app/templates/design/proj-manager-tab.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/templates/design/proj-manager-tab.hbs b/contrib/views/wfmanager/src/main/resources/ui/app/templates/design/proj-manager-tab.hbs new file mode 100644 index 0000000..b897a4c --- /dev/null +++ b/contrib/views/wfmanager/src/main/resources/ui/app/templates/design/proj-manager-tab.hbs @@ -0,0 +1,19 @@ +{{! +* 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. +}} + +{{drafts-wf model=model routeToDesigner="routeToDesigner" editWorkflow="editWorkflow"}} http://git-wip-us.apache.org/repos/asf/ambari/blob/21697822/contrib/views/wfmanager/src/main/resources/ui/app/utils/constants.js ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/utils/constants.js b/contrib/views/wfmanager/src/main/resources/ui/app/utils/constants.js index a508905..fc20359 100644 --- a/contrib/views/wfmanager/src/main/resources/ui/app/utils/constants.js +++ b/contrib/views/wfmanager/src/main/resources/ui/app/utils/constants.js @@ -32,6 +32,7 @@ export default Ember.Object.create({ rmDefaultValue: "${resourceManager}", defaultNameNodeValue : "${nameNode}", useCytoscape : true, + isProjectManagerEnabled : false, autoRestoreWorkflowEnabled : true, actions:{ hiveAction:{name : "hive",supportsSchema : true, currentVersion:''}, http://git-wip-us.apache.org/repos/asf/ambari/blob/21697822/contrib/views/wfmanager/src/main/resources/ui/tests/integration/components/design/proj-manager-tabs-test.js ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/tests/integration/components/design/proj-manager-tabs-test.js b/contrib/views/wfmanager/src/main/resources/ui/tests/integration/components/design/proj-manager-tabs-test.js new file mode 100644 index 0000000..87b3c0a --- /dev/null +++ b/contrib/views/wfmanager/src/main/resources/ui/tests/integration/components/design/proj-manager-tabs-test.js @@ -0,0 +1,41 @@ +/* + * 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 { moduleForComponent, test } from 'ember-qunit'; +import hbs from 'htmlbars-inline-precompile'; + +moduleForComponent('design/proj-manager-tabs', 'Integration | Component | design/proj manager tabs', { + integration: true +}); + +test('it renders', function(assert) { + // Set any properties with this.set('myProperty', 'value'); + // Handle any actions with this.on('myAction', function(val) { ... });" + + this.render(hbs`{{design/proj-manager-tabs}}`); + + assert.equal(this.$().text().trim(), ''); + + // Template block usage:" + this.render(hbs` + {{#design/proj-manager-tabs}} + template block text + {{/design/proj-manager-tabs}} + `); + + assert.equal(this.$().text().trim(), 'template block text'); +}); http://git-wip-us.apache.org/repos/asf/ambari/blob/21697822/contrib/views/wfmanager/src/main/resources/ui/tests/integration/components/drafts-wf-test.js ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/tests/integration/components/drafts-wf-test.js b/contrib/views/wfmanager/src/main/resources/ui/tests/integration/components/drafts-wf-test.js new file mode 100644 index 0000000..a0bad76 --- /dev/null +++ b/contrib/views/wfmanager/src/main/resources/ui/tests/integration/components/drafts-wf-test.js @@ -0,0 +1,41 @@ +/* + * 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 { moduleForComponent, test } from 'ember-qunit'; +import hbs from 'htmlbars-inline-precompile'; + +moduleForComponent('drafts-wf', 'Integration | Component | drafts wf', { + integration: true +}); + +test('it renders', function(assert) { + // Set any properties with this.set('myProperty', 'value'); + // Handle any actions with this.on('myAction', function(val) { ... });" + + this.render(hbs`{{drafts-wf}}`); + + assert.equal(this.$().text().trim(), ''); + + // Template block usage:" + this.render(hbs` + {{#drafts-wf}} + template block text + {{/drafts-wf}} + `); + + assert.equal(this.$().text().trim(), 'template block text'); +}); http://git-wip-us.apache.org/repos/asf/ambari/blob/21697822/contrib/views/wfmanager/src/main/resources/ui/tests/unit/adapters/application-test.js ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/tests/unit/adapters/application-test.js b/contrib/views/wfmanager/src/main/resources/ui/tests/unit/adapters/application-test.js new file mode 100644 index 0000000..d04fc3d --- /dev/null +++ b/contrib/views/wfmanager/src/main/resources/ui/tests/unit/adapters/application-test.js @@ -0,0 +1,29 @@ +/* + * 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 { moduleFor, test } from 'ember-qunit'; + +moduleFor('adapter:application', 'Unit | Adapter | application', { + // Specify the other units that are required for this test. + // needs: ['serializer:foo'] +}); + +// Replace this with your real tests. +test('it exists', function(assert) { + let adapter = this.subject(); + assert.ok(adapter); +}); http://git-wip-us.apache.org/repos/asf/ambari/blob/21697822/contrib/views/wfmanager/src/main/resources/ui/tests/unit/helpers/format-unicode-date-test.js ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/tests/unit/helpers/format-unicode-date-test.js b/contrib/views/wfmanager/src/main/resources/ui/tests/unit/helpers/format-unicode-date-test.js new file mode 100644 index 0000000..807e8b6 --- /dev/null +++ b/contrib/views/wfmanager/src/main/resources/ui/tests/unit/helpers/format-unicode-date-test.js @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { formatUnicodeDate } from 'oozie-designer/helpers/format-unicode-date'; +import { module, test } from 'qunit'; + +module('Unit | Helper | format unicode date'); + +// Replace this with your real tests. +test('it works', function(assert) { + let result = formatUnicodeDate([42]); + assert.ok(result); +}); http://git-wip-us.apache.org/repos/asf/ambari/blob/21697822/contrib/views/wfmanager/src/main/resources/ui/tests/unit/models/wfproject-test.js ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/tests/unit/models/wfproject-test.js b/contrib/views/wfmanager/src/main/resources/ui/tests/unit/models/wfproject-test.js new file mode 100644 index 0000000..8469555 --- /dev/null +++ b/contrib/views/wfmanager/src/main/resources/ui/tests/unit/models/wfproject-test.js @@ -0,0 +1,29 @@ +/* + * 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 { moduleForModel, test } from 'ember-qunit'; + +moduleForModel('wfproject', 'Unit | Model | wfproject', { + // Specify the other units that are required for this test. + needs: [] +}); + +test('it exists', function(assert) { + let model = this.subject(); + // let store = this.store(); + assert.ok(!!model); +}); http://git-wip-us.apache.org/repos/asf/ambari/blob/21697822/contrib/views/wfmanager/src/main/resources/ui/tests/unit/routes/design/proj-manager-tab-test.js ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/tests/unit/routes/design/proj-manager-tab-test.js b/contrib/views/wfmanager/src/main/resources/ui/tests/unit/routes/design/proj-manager-tab-test.js new file mode 100644 index 0000000..4ded785 --- /dev/null +++ b/contrib/views/wfmanager/src/main/resources/ui/tests/unit/routes/design/proj-manager-tab-test.js @@ -0,0 +1,28 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one or more +* contributor license agreements. See the NOTICE file distributed with +* this work for additional information regarding copyright ownership. +* The ASF licenses this file to You under the Apache License, Version 2.0 +* (the "License"); you may not use this file except in compliance with +* the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('route:design/proj-manager-tab', 'Unit | Route | design/proj manager tab', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('it exists', function(assert) { + let route = this.subject(); + assert.ok(route); +});