ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oleew...@apache.org
Subject [42/50] [abbrv] ambari git commit: AMBARI-20371. WFM: Delete option in Manage recent list. (Venkata Sairam via pallavkul)
Date Thu, 09 Mar 2017 16:40:11 GMT
AMBARI-20371. WFM: Delete option in Manage recent list. (Venkata Sairam via pallavkul)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c9f70565
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c9f70565
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c9f70565

Branch: refs/heads/branch-dev-logsearch
Commit: c9f70565538ea7710b2824c95c6190417711ff1b
Parents: c7086b1
Author: pallavkul <pallav.kul@gmail.com>
Authored: Thu Mar 9 19:28:52 2017 +0530
Committer: pallavkul <pallav.kul@gmail.com>
Committed: Thu Mar 9 19:29:57 2017 +0530

----------------------------------------------------------------------
 .../ui/app/components/designer-workspace.js     |   1 +
 .../resources/ui/app/components/drafts-wf.js    |  84 +++++++--
 .../ui/app/components/recent-projects.js        |  32 +---
 .../src/main/resources/ui/app/styles/app.less   |  14 +-
 .../templates/components/designer-workspace.hbs |   2 +-
 .../ui/app/templates/components/drafts-wf.hbs   | 175 ++++++++++++-------
 .../templates/components/recent-projects.hbs    |  17 +-
 7 files changed, 195 insertions(+), 130 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c9f70565/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 0e49d70..980904f 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
@@ -213,6 +213,7 @@ export default Ember.Component.extend({
     },
     editWorkflow(path, type){
       this.sendAction('editWorkflow', path, type);
+      this.send('hideProjectManagerList');
     },
     showProjectManagerList(){
       var deferred = Ember.RSVP.defer();

http://git-wip-us.apache.org/repos/asf/ambari/blob/c9f70565/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
index 1d01e9b..ed448d9 100644
--- 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
@@ -24,9 +24,10 @@ export default Ember.Component.extend({
   "isCoordinator": true,
   "isWorkflow": true,
   "sortProp": ['updatedAt:desc'],
-  "filteredModels": Ember.computed("model", "search", "isBundle", "isCoordinator", "isWorkflow",
function(){
+  "filteredModels": Ember.computed("recentFiles", "search", "isBundle", "isCoordinator",
"isWorkflow", {
+    get(key) {
     var score = 0, condition = true, searchTxt = this.get("search").toLowerCase(), isWorkflow
= this.get("isWorkflow"), isCoordinator = this.get("isCoordinator"), isBundle = this.get("isBundle");
-    return this.get("model").filter( (role) => {
+    return this.get("recentFiles").filter( (role) => {
       score = 0
       if(searchTxt && searchTxt.length) {
         condition = role.get('name') && role.get('name').toLowerCase().indexOf(searchTxt)>-1;
@@ -42,22 +43,42 @@ export default Ember.Component.extend({
       }
       return condition && score > 0;
     });
+    },
+    set(key, value) {
+      this.set('recentFiles', value);
+
+      var score = 0, condition = true, searchTxt = this.get("search").toLowerCase(), isWorkflow
= this.get("isWorkflow"), isCoordinator = this.get("isCoordinator"), isBundle = this.get("isBundle");
+      return this.get("recentFiles").filter( (role) => {
+        score = 0
+        if(searchTxt && searchTxt.length) {
+          condition = role.get('name') && role.get('name').toLowerCase().indexOf(searchTxt)>-1;
+        }
+        if(isWorkflow && role.get('type') === 'WORKFLOW') {
+          score++;
+        }
+        if(isCoordinator && role.get('type') === 'COORDINATOR') {
+          score++;
+        }
+        if(isBundle && role.get('type') === 'BUNDLE') {
+          score++;
+        }
+        return condition && score > 0;
+      });
+      //return value;
+    }
   }),
+  resetDetails() {
+    this.set("deleteMsg", null);
+    this.set("deleteInProgress", false);
+  },
   modelSorted : Ember.computed.sort("filteredModels", "sortProp"),
   "isDeleteDraftConformation": false,
   "currentDraft": undefined,
   "deleteInProgress": false,
   "deleteMsg": undefined,
   "currentJobService" : Ember.inject.service('current-job'),
-  elementsInserted: function () {
-      this.$('.actions').hide();
-  }.on("didInsertElement"),
   rendered : function(){
     var self = this;
-    this.$("#projectsList").on("hidden.bs.modal", function () {
-      this.sendAction("close");
-      history.back();
-    }.bind(this));
     this.$("#projectDeleteModal").on('hidden.bs.modal', function () {
       self.set("isDeleteDraftConformation", true);
       self.set("deleteMsg", null);
@@ -73,15 +94,11 @@ export default Ember.Component.extend({
       this.sendAction('editWorkflow', path, type);
     },
     confirmDelete (job ){
-	    this.set("showingConfirmation", true);
-	    this.set("currentDraft", job);
-    },
-    deleteDraft () {
-	    this.sendAction("deleteWorkflow", this.get('currentDraft'));
+      this.send("showDeleteConfirmation", job);
     },
-    closeProjects () {
-		  //this.$('.modal-backdrop').remove();
-		  this.$("#projectsList").modal("hide");
+    close () {
+      this.$("#projectsList").modal("hide");
+      this.sendAction('close');
     },
     showActions (job) {
       this.$('.'+job.get("updatedAt")+'Actions').show();
@@ -90,6 +107,39 @@ export default Ember.Component.extend({
     hideActions (job) {
       this.$('.'+job.get("updatedAt")+'Actions').hide();
       this.$('.Actions'+job.get("updatedAt")).show();
+    },
+    showDeleteConfirmation(job) {
+      this.resetDetails();
+      this.set('currentDraft', job);
+      this.set('showingDeleteConfirmation', true);
+      Ember.run.later(()=>{
+        this.$("#projectsDeleteConfirmation").modal("show");
+      }, 100);
+    },
+    deleteWorkflow () {
+      let job = this.get("currentDraft");
+      this.set("deleteInProgress", true);
+      var self= this;
+      var rec = this.get("store").peekRecord('wfproject', job.id);
+      if(rec){
+        rec.destroyRecord().then(function () {
+          self.get('recentFiles', self.get('store').peekAll("wfproject"));
+          self.set("deleteInProgress", false);
+          self.set("deleteMsg", "Workflow successfully deleted.");
+          self.get('store').unloadRecord(rec);
+          self.set('filteredModels', self.get('store').peekAll("wfproject"));
+          Ember.run.later(()=>{
+            self.set('showingDeleteConfirmation', false);
+            self.$("#projectsDeleteConfirmation").modal("hide");
+          }, 1000);
+        }).catch(function (response) {
+          self.get('store').unloadRecord(rec);
+          self.get('filteredModels', self.get('store').peekAll("wfproject"));
+          self.sendAction("showProjectManagerList");
+          self.set("deleteInProgress", false);
+          self.set("deleteMsg", "There is some problem while deletion.Please try again.");
+        });
+      }
     }
   }
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/c9f70565/contrib/views/wfmanager/src/main/resources/ui/app/components/recent-projects.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/recent-projects.js
b/contrib/views/wfmanager/src/main/resources/ui/app/components/recent-projects.js
index 18a57f6..bbc51cc 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/recent-projects.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/recent-projects.js
@@ -18,40 +18,12 @@
 import Ember from 'ember';
 
 export default Ember.Component.extend({
-  store: Ember.inject.service(),
-  rendered : function(){
-  	var self = this;
-    this.$("#projectDeleteModal").on('hidden.bs.modal', function () {
-      self.set("isDeleteDraftConformation", true);
-      self.set("deleteMsg", null);
-      self.set("deleteInProgress", false);
-    }.bind(this));
-    this.$("#projectsList").on("hidden.bs.modal", function () {
-      this.sendAction("close");
-    }.bind(this));
-    this.$("#projectsList").modal("show");
-  }.on('didInsertElement'),
   actions: {
   	close(){
-  		this.sendAction("close");
+  		this.sendAction('close');
   	},
-  	deleteWorkflow (job) {
-	    this.set("deleteInProgress", true);
-	    var self= this;
-	    var rec = this.get("store").peekRecord('wfproject', job.id);
-	    if(rec){
-	      rec.destroyRecord().then(function () {
-  	      self.set("deleteInProgress", false);
-  	      self.set("deleteMsg", "Workflow successfully deleted.");
-  	    }).catch(function (response) {
-  	      self.set("deleteInProgress", false);
-  	      self.set("deleteMsg", "There is some problem while deletion.Please try again.");
-  	    });
-	    }
-    },
     editWorkflow ( path, type ) {
       this.sendAction('editWorkflow', path, type);
-      this.$("#projectsList").modal("hide");
-    },
+    }
   }
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/c9f70565/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 a30833c..5577239 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
@@ -1597,7 +1597,7 @@ input:invalid {
 .inlineBlock{
   display:inline-block;
 }
-.asset-list .fa-trash-o {
+.asset-list .fa-trash-o, #projectsList .fa-trash-o{
   color: @defaultRed;
   cursor: pointer;
 }
@@ -1713,9 +1713,6 @@ input:invalid {
 .displayBlock {
   display : block;
 }
-.tab-pane #draftsTable, #projectsList #dashboard, .tab-pane .searchWorkflows {
-   display : none;
- }
  .projects-list {
    white-space: nowrap;
    width: 100%;
@@ -1760,3 +1757,12 @@ input:invalid {
 .processing-message {
   padding-left: 48%;
 }
+#projectsList .modal-body {
+   max-height: 70vh;
+   overflow-y: scroll;
+   overflow-x: auto;
+ }
+#projectsDeleteConfirmation .modal-body {
+   max-height: 70vh;
+   overflow: auto;
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/c9f70565/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 c8d8dc3..c190511 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
@@ -160,7 +160,7 @@
     {{#asset-manager showAssetManager="showAssetManager"}}{{/asset-manager}}
   {{/if}}
   {{#if isProjManagerVisible}}
-    {{recent-projects recentFiles=recentFiles routeToDesigner="routeToDesigner" editWorkflow="editWorkflow"
deleteWorkflow="deleteWorkflow" close="hideProjectManagerList" deleteWorkflowJob="deleteWorkflowJob"
currentDraft=currentDraft}}
+    {{recent-projects recentFiles=recentFiles routeToDesigner="routeToDesigner" editWorkflow="editWorkflow"
deleteWorkflow="deleteWorkflow" close="hideProjectManagerList" deleteWorkflowJob="deleteWorkflowJob"
currentDraft=currentDraft showProjectManagerList="showProjectManagerList"}}
   {{/if}}
   {{#if showingWarning}}
   {{#confirmation-dialog title="Confirm workflow reset"

http://git-wip-us.apache.org/repos/asf/ambari/blob/c9f70565/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
index 632d6bd..ac28de3 100644
--- 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
@@ -15,68 +15,119 @@
 * See the License for the specific language governing permissions and
 * limitations under the License.
 }}
-<div id="loading" class="displayBlock">
-    {{spin-spinner lines=13 length=20 width=10}}
-</div>
-<div class="searchWorkflows">
-  {{input type="checkbox" class="marginright5" name="isWorkflow" checked=isWorkflow}}Workflow&nbsp;&nbsp;
-  {{input type="checkbox" class="marginright5" name="isCoordinator" checked=isCoordinator}}Coordinator&nbsp;&nbsp;
-  {{input type="checkbox" class="marginright5" name="isBundle" checked=isBundle}}Bundle&nbsp;&nbsp;
-  {{input type="text" class="l-input" value=search placeholder="Type Workflow name or path"}}
-</div>
-{{#if modelSorted}}
-    <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></th>
-                  <th>Name</th>
-                  <th>Path</th>
-                  <th>Updated at</th>
-              </tr>
-            </thead>
-            <tbody>
-            {{#if modelSorted}}
-                {{#each modelSorted as |job idx|}}
-                {{#if true}}
-                    <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>
-                          {{else if  (eq job.type "COORDINATOR")}}
-                              <i class="fa fa-history marginright5"></i>
-                          {{else}}
-                              <i class="fa fa-cubes marginright5"></i>
-                          {{/if}}
-                        </td>
-                        <td title={{job.name}} class="pointer action-link">
-                            <div class="width100" {{action "importActionToEditor" job.workflowDefinitionPath
job.type}}>
-                              {{job.name}}
-                            </div>
-                        </td>
-                        <td title={{job.workflowDefinitionPath}}>
-                            <div class="width300">
-                                {{job.workflowDefinitionPath}}
-                            </div>
-                        </td>
-                        <td>
-                            <div class="width50">
-                                {{format-unicode-date job.updatedAt}}
-                            </div>
-                        </td>
-                    </tr>
+
+
+<div class="modal" id="projectsList" role="dialog">
+  <div class="modal-dialog">
+    <div class="modal-content">
+      <div class="modal-header">
+        <button type="button" class="close"  {{action "close"}}>&times;</button>
+        <h4 class="modal-title">My Workflows</h4>
+      </div>
+      <div class="modal-body">
+
+
+
+        <div class="searchWorkflows">
+          {{input type="checkbox" class="marginright5" name="isWorkflow" checked=isWorkflow}}Workflow&nbsp;&nbsp;
+          {{input type="checkbox" class="marginright5" name="isCoordinator" checked=isCoordinator}}Coordinator&nbsp;&nbsp;
+          {{input type="checkbox" class="marginright5" name="isBundle" checked=isBundle}}Bundle&nbsp;&nbsp;
+          {{input type="text" class="l-input" value=search placeholder="Type Workflow name
or path"}}
+        </div>
+        {{#if modelSorted}}
+            <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></th>
+                          <th>Name</th>
+                          <th>Path</th>
+                          <th>Updated at</th>
+                      </tr>
+                    </thead>
+                    <tbody>
+                    {{#if modelSorted}}
+                        {{#each modelSorted as |job idx|}}
+                            <tr id={{job.id}}>
+                                <!--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>
+                                  {{else if  (eq job.type "COORDINATOR")}}
+                                      <i class="fa fa-history marginright5"></i>
+                                  {{else}}
+                                      <i class="fa fa-cubes marginright5"></i>
+                                  {{/if}}
+                                </td>
+                                <td title={{job.name}} class="pointer action-link">
+                                    <div class="width100" {{action "importActionToEditor"
job.workflowDefinitionPath job.type}}>
+                                      {{job.name}}
+                                    </div>
+                                </td>
+                                <td title={{job.workflowDefinitionPath}}>
+                                    <div class="width300">
+                                        {{job.workflowDefinitionPath}}
+                                    </div>
+                                </td>
+                                <td>
+                                    <div class="width50">
+                                        {{format-unicode-date job.updatedAt}}
+                                    </div>
+                                </td>
+                                <td>
+                                    <div class="width50">
+                                        <span title="Delete Workflow" {{action "confirmDelete"
job}}><i class="fa fa-trash-o"></i></span>
+                                    </div>
+                                </td>
+                            </tr>
+                        {{/each}}
                     {{/if}}
-                {{/each}}
-            {{/if}}
-            </tbody>
-        </table>
+                    </tbody>
+                </table>
+            </div>
+            <div id="draftsNum">Displaying {{modelSorted.length}} workflows</div>
+        {{else}}
+            <div id="emptyDrafts">
+                <label class="control-label" for="{{type}}-path">There are no workflows
currently</label>
+            </div>
+        {{/if}}
+
+
+      </div>
+      <div class="modal-footer">
+        <button type="button" class="btn btn-default" {{action "close"}}>Close</button>
+      </div>
     </div>
-    <div id="draftsNum">Displaying {{modelSorted.length}} workflows</div>
-{{else}}
-    <div id="emptyDrafts">
-        <label class="control-label" for="{{type}}-path">There are no workflows currently</label>
+  </div>
+</div>
+
+
+{{#if showingDeleteConfirmation}}
+<div class="modal" id="projectsDeleteConfirmation" role="dialog">
+  <div class="modal-dialog">
+    <div class="modal-content">
+      <div class="modal-header">
+        <button type="button" class="close" data-dismiss="modal">&times;</button>
+        <h4 class="modal-title">Delete confirmation</h4>
+      </div>
+      <div class="modal-body">
+         {{#unless deleteMsg}}
+           <label>Do you want to delete the draft?</label>
+         {{/unless}}
+         {{#if true}}
+           {{spin-spinner lines=7 length=3 width=3 radius=3 top=-10 left=150}}
+         {{/if}}
+         <div><label>{{deleteMsg}}</label></div>
+      </div>
+      <div class="modal-footer">
+        {{#unless deleteMsg}}
+          <button type="button" class="btn btn-primary" {{action "deleteWorkflow"}}>Delete</button>
+        {{/unless}}
+        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
+      </div>
     </div>
-{{/if}}
\ No newline at end of file
+  </div>
+</div>
+{{/if}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/c9f70565/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/recent-projects.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/recent-projects.hbs
b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/recent-projects.hbs
index cd8f6af..c616586 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/recent-projects.hbs
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/recent-projects.hbs
@@ -15,19 +15,4 @@
 * See the License for the specific language governing permissions and
 * limitations under the License.
 }}
-<div class="modal" id="projectsList" role="dialog">
-  <div class="modal-dialog">
-    <div class="modal-content">
-      <div class="modal-header">
-        <button type="button" class="close" data-dismiss="modal">&times;</button>
-        <h4 class="modal-title">My Workflows</h4>
-      </div>
-      <div class="modal-body">
-         {{drafts-wf model=recentFiles routeToDesigner="routeToDesigner" editWorkflow="editWorkflow"
deleteWorkflow="deleteWorkflow"}}
-      </div>
-      <div class="modal-footer">
-        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
-      </div>
-    </div>
-  </div>
-</div>
+{{drafts-wf recentFiles=recentFiles routeToDesigner="routeToDesigner" editWorkflow="editWorkflow"
deleteWorkflow="deleteWorkflow" showDeleteConfirmation="showDeleteConfirmation" showProjectManagerList="showProjectManagerList"
close="close"}}


Mime
View raw message