|
@@ -19,43 +19,87 @@ import Ember from 'ember';
|
|
|
const { computed } = Ember;
|
|
|
|
|
|
export default Ember.Component.extend({
|
|
|
+ "search": "",
|
|
|
+ "isBundle": true,
|
|
|
+ "isCoordinator": true,
|
|
|
+ "isWorkflow": true,
|
|
|
+ "filteredModels": Ember.computed("model", "search", "isBundle", "isCoordinator", "isWorkflow", function(){
|
|
|
+ Ember.run.later(()=>{
|
|
|
+ this.$('.actions').hide();
|
|
|
+ }, 10);
|
|
|
+ var condition = "", condition1 = "", condition2 = "", searchTxt = this.get("search");
|
|
|
+ if(searchTxt && searchTxt.length){
|
|
|
+ condition1 = "(role.get('name') && role.get('name').indexOf(searchTxt)>-1)";
|
|
|
+ }
|
|
|
+ if(this.get("isWorkflow")){
|
|
|
+ if(condition2.length){
|
|
|
+ condition2 = condition2 + " role.get('type') == 'WORKFLOW'";
|
|
|
+ } else {
|
|
|
+ condition2 = condition2 + " role.get('type') == 'WORKFLOW'";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(this.get("isCoordinator")){
|
|
|
+ if(condition2.length){
|
|
|
+ condition2 = condition2 + " || role.get('type') == 'COORDINATOR'";
|
|
|
+ } else {
|
|
|
+ condition2 = condition2 + "role.get('type') == 'COORDINATOR'";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(this.get("isBundle")){
|
|
|
+ if(condition2.length) {
|
|
|
+ condition2 = condition2 + " || role.get('type') == 'BUNDLE'";
|
|
|
+ } else {
|
|
|
+ condition2 = condition2 + " role.get('type') == 'BUNDLE'";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(condition1.length && condition2.length) {
|
|
|
+ condition = condition1 + "&&(" + condition2+ ")";
|
|
|
+ } else if(condition2.length) {
|
|
|
+ condition = condition2;
|
|
|
+ }
|
|
|
+ return this.get("model").filter( (role) => {
|
|
|
+ return eval(condition);
|
|
|
+ });
|
|
|
+ }),
|
|
|
+ modelSorted : Ember.computed.sort("filteredModels", "['updatedAt:desc']"),
|
|
|
"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.$("#configureJob").on('hidden.bs.modal', function () {
|
|
|
+ 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);
|
|
|
self.set("deleteInProgress", false);
|
|
|
}.bind(this));
|
|
|
+ this.$("#projectsList").modal("show");
|
|
|
+ Ember.$("#loading").css("display", "none");
|
|
|
}.on('didInsertElement'),
|
|
|
store: Ember.inject.service(),
|
|
|
actions: {
|
|
|
- importActionToEditor ( path ) {
|
|
|
- this.sendAction('editWorkflow', path);
|
|
|
+ importActionToEditor ( path, type ) {
|
|
|
+ this.$("#projectsList").modal("hide");
|
|
|
+ this.sendAction('editWorkflow', path, type);
|
|
|
},
|
|
|
- deleteDraftConformation (job ){
|
|
|
- this.set("isDeleteDraftConformation", true);
|
|
|
- this.$("#configureJob").modal("show");
|
|
|
+ confirmDelete (job ){
|
|
|
+ this.set("showingConfirmation", true);
|
|
|
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.");
|
|
|
- });
|
|
|
+ this.sendAction("deleteWorkflow", this.get('currentDraft'));
|
|
|
+ },
|
|
|
+ closeProjects () {
|
|
|
+ $('.modal-backdrop').remove();
|
|
|
+ this.$("#projectsList").modal("hide");
|
|
|
},
|
|
|
showActions (job) {
|
|
|
this.$('.'+job.get("updatedAt")+'Actions').show();
|