OSDN Git Service

[Develop ang manual test] TagFilter at SelectCommand Modal v0.3.0p0045
authorhimetani_cafe <fumifumi@yasunaga-lab.bio.kyutech.ac.jp>
Mon, 8 Feb 2016 09:09:28 +0000 (18:09 +0900)
committerhimetani_cafe <fumifumi@yasunaga-lab.bio.kyutech.ac.jp>
Mon, 8 Feb 2016 09:09:28 +0000 (18:09 +0900)
 On branch master
 Changes to be committed:
modified:   app/scripts/App.ts
modified:   app/scripts/controllers/SelectCommand.ts
new file:   app/scripts/filters/Tag.ts
modified:   app/scripts/reference.ts
modified:   app/templates/select-command.html
modified:   dist/bundle.js
modified:   dist/templates/select-command.html

front-end/app/scripts/App.ts
front-end/app/scripts/controllers/SelectCommand.ts
front-end/app/scripts/filters/Tag.ts [new file with mode: 0644]
front-end/app/scripts/reference.ts
front-end/app/templates/select-command.html
front-end/dist/bundle.js
front-end/dist/templates/select-command.html

index b6524fe..d640627 100644 (file)
@@ -36,7 +36,10 @@ namespace app {
     });
 
     zephyr.service('APIEndPoint', services.APIEndPoint);
+
+    zephyr.filter('Tag', filters.Tag);
     zephyr.controller('selectCommandController', controllers.SelectCommand);
+
     zephyr.service('MyModal', services.MyModal);
 
     zephyr.controller('executionController', controllers.Execution);
index 20637cc..ad5b060 100644 (file)
@@ -20,8 +20,12 @@ namespace app.controllers {
                 .$promise.then((result) => {
                    controller.commands = result.info; 
                 });
-            this.currnetTag = 'all';
+            this.currentTag = 'all';
 
         } 
+
+        private changeTag(tag: string) {
+            this.currentTag = tag;
+        }
     }
 }
diff --git a/front-end/app/scripts/filters/Tag.ts b/front-end/app/scripts/filters/Tag.ts
new file mode 100644 (file)
index 0000000..4a8bc14
--- /dev/null
@@ -0,0 +1,16 @@
+namespace filters {
+    export function Tag() {
+        return function(commands, tag) {
+            var result = []
+            angular.forEach(commands, function(command) {
+                var flag = false
+                angular.forEach(command.tags, function(value) {
+                    if (tag === value) flag = true
+                })
+                if(flag) result.push(command)
+            })
+            return result
+        }
+    }
+}
+
index e20acb8..401de15 100644 (file)
@@ -15,3 +15,4 @@
 /// <reference path="./controllers/History.ts" />
 /// <reference path="./controllers/SelectCommand.ts" />
 
+/// <reference path="./filters/Tag.ts" />
index 0486342..f8eeba8 100644 (file)
@@ -6,7 +6,7 @@
     <div class="row">
         <div class="col-md-8">
             <div class="btn-group"ng-repeat="tag in c.tags">
-                <button type="button" class="btn btn-default btn-xs" ng-click="changeTag(tag)"><span class="glyphicon glyphicon-tag"></span>{{tag}}</button>
+                <button type="button" class="btn btn-default btn-xs" ng-click="c.changeTag(tag)"><span class="glyphicon glyphicon-tag"></span>{{tag}}</button>
             </div>
         </div>
         <div class="col-md-4">
@@ -27,7 +27,7 @@
         <!--
         <div ng-repeat="command in commands | filter:searchText | tagFilter:tag">
             -->
-        <div ng-repeat="command in c.commands | filter:c.searchText">
+        <div ng-repeat="command in c.commands | filter:c.searchText | Tag:c.currentTag">
             <div class="col-md-6">
                 <a class="pull-left" ng-click="selectCommand(command.name)" ng-if="$even">{{command.name}}</a>
             </div>
index f46514e..098d214 100644 (file)
                            .$promise.then(function (result) {
                            controller.commands = result.info;
                        });
+                       this.currentTag = 'all';
                    }
+                   SelectCommand.prototype.changeTag = function (tag) {
+                       this.currentTag = tag;
+                       console.log(this.currentTag);
+                   };
                    SelectCommand.$inject = ['$scope', 'APIEndPoint'];
                    return SelectCommand;
                })();
                controllers.SelectCommand = SelectCommand;
            })(controllers = app.controllers || (app.controllers = {}));
        })(app || (app = {}));
+       var filters;
+       (function (filters) {
+           function Tag() {
+               return function (commands, tag) {
+                   var result = [];
+                   angular.forEach(commands, function (command) {
+                       var flag = false;
+                       angular.forEach(command.tags, function (value) {
+                           if (tag === value)
+                               flag = true;
+                       });
+                       if (flag)
+                           result.push(command);
+                   });
+                   return result;
+               };
+           }
+           filters.Tag = Tag;
+       })(filters || (filters = {}));
        var app;
        (function (app) {
            'use strict';
                });
            });
            app.zephyr.service('APIEndPoint', app.services.APIEndPoint);
+           app.zephyr.filter('Tag', filters.Tag);
            app.zephyr.controller('selectCommandController', app.controllers.SelectCommand);
            app.zephyr.service('MyModal', app.services.MyModal);
            app.zephyr.controller('executionController', app.controllers.Execution);
                            .$promise.then(function (result) {
                            controller.commands = result.info;
                        });
+                       this.currentTag = 'all';
                    }
+                   SelectCommand.prototype.changeTag = function (tag) {
+                       this.currentTag = tag;
+                       console.log(this.currentTag);
+                   };
                    SelectCommand.$inject = ['$scope', 'APIEndPoint'];
                    return SelectCommand;
                })();
                controllers.SelectCommand = SelectCommand;
            })(controllers = app.controllers || (app.controllers = {}));
        })(app || (app = {}));
+       var filters;
+       (function (filters) {
+           function Tag() {
+               return function (commands, tag) {
+                   var result = [];
+                   angular.forEach(commands, function (command) {
+                       var flag = false;
+                       angular.forEach(command.tags, function (value) {
+                           if (tag === value)
+                               flag = true;
+                       });
+                       if (flag)
+                           result.push(command);
+                   });
+                   return result;
+               };
+           }
+           filters.Tag = Tag;
+       })(filters || (filters = {}));
        var app;
        (function (app) {
            'use strict';
                });
            });
            app.zephyr.service('APIEndPoint', app.services.APIEndPoint);
+           app.zephyr.filter('Tag', filters.Tag);
            app.zephyr.controller('selectCommandController', app.controllers.SelectCommand);
            app.zephyr.service('MyModal', app.services.MyModal);
            app.zephyr.controller('executionController', app.controllers.Execution);
                            .$promise.then(function (result) {
                            controller.commands = result.info;
                        });
+                       this.currentTag = 'all';
                    }
+                   SelectCommand.prototype.changeTag = function (tag) {
+                       this.currentTag = tag;
+                       console.log(this.currentTag);
+                   };
                    SelectCommand.$inject = ['$scope', 'APIEndPoint'];
                    return SelectCommand;
                })();
                controllers.SelectCommand = SelectCommand;
            })(controllers = app.controllers || (app.controllers = {}));
        })(app || (app = {}));
+       var filters;
+       (function (filters) {
+           function Tag() {
+               return function (commands, tag) {
+                   var result = [];
+                   angular.forEach(commands, function (command) {
+                       var flag = false;
+                       angular.forEach(command.tags, function (value) {
+                           if (tag === value)
+                               flag = true;
+                       });
+                       if (flag)
+                           result.push(command);
+                   });
+                   return result;
+               };
+           }
+           filters.Tag = Tag;
+       })(filters || (filters = {}));
        var app;
        (function (app) {
            'use strict';
                });
            });
            app.zephyr.service('APIEndPoint', app.services.APIEndPoint);
+           app.zephyr.filter('Tag', filters.Tag);
            app.zephyr.controller('selectCommandController', app.controllers.SelectCommand);
            app.zephyr.service('MyModal', app.services.MyModal);
            app.zephyr.controller('executionController', app.controllers.Execution);
                            .$promise.then(function (result) {
                            controller.commands = result.info;
                        });
+                       this.currentTag = 'all';
                    }
+                   SelectCommand.prototype.changeTag = function (tag) {
+                       this.currentTag = tag;
+                       console.log(this.currentTag);
+                   };
                    SelectCommand.$inject = ['$scope', 'APIEndPoint'];
                    return SelectCommand;
                })();
                controllers.SelectCommand = SelectCommand;
            })(controllers = app.controllers || (app.controllers = {}));
        })(app || (app = {}));
+       var filters;
+       (function (filters) {
+           function Tag() {
+               return function (commands, tag) {
+                   var result = [];
+                   angular.forEach(commands, function (command) {
+                       var flag = false;
+                       angular.forEach(command.tags, function (value) {
+                           if (tag === value)
+                               flag = true;
+                       });
+                       if (flag)
+                           result.push(command);
+                   });
+                   return result;
+               };
+           }
+           filters.Tag = Tag;
+       })(filters || (filters = {}));
        var app;
        (function (app) {
            'use strict';
                });
            });
            app.zephyr.service('APIEndPoint', app.services.APIEndPoint);
+           app.zephyr.filter('Tag', filters.Tag);
            app.zephyr.controller('selectCommandController', app.controllers.SelectCommand);
            app.zephyr.service('MyModal', app.services.MyModal);
            app.zephyr.controller('executionController', app.controllers.Execution);
                            .$promise.then(function (result) {
                            controller.commands = result.info;
                        });
+                       this.currentTag = 'all';
                    }
+                   SelectCommand.prototype.changeTag = function (tag) {
+                       this.currentTag = tag;
+                       console.log(this.currentTag);
+                   };
                    SelectCommand.$inject = ['$scope', 'APIEndPoint'];
                    return SelectCommand;
                })();
                controllers.SelectCommand = SelectCommand;
            })(controllers = app.controllers || (app.controllers = {}));
        })(app || (app = {}));
+       var filters;
+       (function (filters) {
+           function Tag() {
+               return function (commands, tag) {
+                   var result = [];
+                   angular.forEach(commands, function (command) {
+                       var flag = false;
+                       angular.forEach(command.tags, function (value) {
+                           if (tag === value)
+                               flag = true;
+                       });
+                       if (flag)
+                           result.push(command);
+                   });
+                   return result;
+               };
+           }
+           filters.Tag = Tag;
+       })(filters || (filters = {}));
        var app;
        (function (app) {
            'use strict';
                });
            });
            app.zephyr.service('APIEndPoint', app.services.APIEndPoint);
+           app.zephyr.filter('Tag', filters.Tag);
            app.zephyr.controller('selectCommandController', app.controllers.SelectCommand);
            app.zephyr.service('MyModal', app.services.MyModal);
            app.zephyr.controller('executionController', app.controllers.Execution);
                            .$promise.then(function (result) {
                            controller.commands = result.info;
                        });
+                       this.currentTag = 'all';
                    }
+                   SelectCommand.prototype.changeTag = function (tag) {
+                       this.currentTag = tag;
+                       console.log(this.currentTag);
+                   };
                    SelectCommand.$inject = ['$scope', 'APIEndPoint'];
                    return SelectCommand;
                })();
                controllers.SelectCommand = SelectCommand;
            })(controllers = app.controllers || (app.controllers = {}));
        })(app || (app = {}));
+       var filters;
+       (function (filters) {
+           function Tag() {
+               return function (commands, tag) {
+                   var result = [];
+                   angular.forEach(commands, function (command) {
+                       var flag = false;
+                       angular.forEach(command.tags, function (value) {
+                           if (tag === value)
+                               flag = true;
+                       });
+                       if (flag)
+                           result.push(command);
+                   });
+                   return result;
+               };
+           }
+           filters.Tag = Tag;
+       })(filters || (filters = {}));
        var app;
        (function (app) {
            'use strict';
                });
            });
            app.zephyr.service('APIEndPoint', app.services.APIEndPoint);
+           app.zephyr.filter('Tag', filters.Tag);
            app.zephyr.controller('selectCommandController', app.controllers.SelectCommand);
            app.zephyr.service('MyModal', app.services.MyModal);
            app.zephyr.controller('executionController', app.controllers.Execution);
                            .$promise.then(function (result) {
                            controller.commands = result.info;
                        });
+                       this.currentTag = 'all';
                    }
+                   SelectCommand.prototype.changeTag = function (tag) {
+                       this.currentTag = tag;
+                       console.log(this.currentTag);
+                   };
                    SelectCommand.$inject = ['$scope', 'APIEndPoint'];
                    return SelectCommand;
                })();
                controllers.SelectCommand = SelectCommand;
            })(controllers = app.controllers || (app.controllers = {}));
        })(app || (app = {}));
+       var filters;
+       (function (filters) {
+           function Tag() {
+               return function (commands, tag) {
+                   var result = [];
+                   angular.forEach(commands, function (command) {
+                       var flag = false;
+                       angular.forEach(command.tags, function (value) {
+                           if (tag === value)
+                               flag = true;
+                       });
+                       if (flag)
+                           result.push(command);
+                   });
+                   return result;
+               };
+           }
+           filters.Tag = Tag;
+       })(filters || (filters = {}));
        var app;
        (function (app) {
            'use strict';
                });
            });
            app.zephyr.service('APIEndPoint', app.services.APIEndPoint);
+           app.zephyr.filter('Tag', filters.Tag);
            app.zephyr.controller('selectCommandController', app.controllers.SelectCommand);
            app.zephyr.service('MyModal', app.services.MyModal);
            app.zephyr.controller('executionController', app.controllers.Execution);
                            .$promise.then(function (result) {
                            controller.commands = result.info;
                        });
+                       this.currentTag = 'all';
                    }
+                   SelectCommand.prototype.changeTag = function (tag) {
+                       this.currentTag = tag;
+                       console.log(this.currentTag);
+                   };
                    SelectCommand.$inject = ['$scope', 'APIEndPoint'];
                    return SelectCommand;
                })();
                controllers.SelectCommand = SelectCommand;
            })(controllers = app.controllers || (app.controllers = {}));
        })(app || (app = {}));
+       var filters;
+       (function (filters) {
+           function Tag() {
+               return function (commands, tag) {
+                   var result = [];
+                   angular.forEach(commands, function (command) {
+                       var flag = false;
+                       angular.forEach(command.tags, function (value) {
+                           if (tag === value)
+                               flag = true;
+                       });
+                       if (flag)
+                           result.push(command);
+                   });
+                   return result;
+               };
+           }
+           filters.Tag = Tag;
+       })(filters || (filters = {}));
        var app;
        (function (app) {
            'use strict';
                });
            });
            app.zephyr.service('APIEndPoint', app.services.APIEndPoint);
+           app.zephyr.filter('Tag', filters.Tag);
            app.zephyr.controller('selectCommandController', app.controllers.SelectCommand);
            app.zephyr.service('MyModal', app.services.MyModal);
            app.zephyr.controller('executionController', app.controllers.Execution);
                            .$promise.then(function (result) {
                            controller.commands = result.info;
                        });
+                       this.currentTag = 'all';
                    }
+                   SelectCommand.prototype.changeTag = function (tag) {
+                       this.currentTag = tag;
+                       console.log(this.currentTag);
+                   };
                    SelectCommand.$inject = ['$scope', 'APIEndPoint'];
                    return SelectCommand;
                })();
                controllers.SelectCommand = SelectCommand;
            })(controllers = app.controllers || (app.controllers = {}));
        })(app || (app = {}));
+       var filters;
+       (function (filters) {
+           function Tag() {
+               return function (commands, tag) {
+                   var result = [];
+                   angular.forEach(commands, function (command) {
+                       var flag = false;
+                       angular.forEach(command.tags, function (value) {
+                           if (tag === value)
+                               flag = true;
+                       });
+                       if (flag)
+                           result.push(command);
+                   });
+                   return result;
+               };
+           }
+           filters.Tag = Tag;
+       })(filters || (filters = {}));
        var app;
        (function (app) {
            'use strict';
                });
            });
            app.zephyr.service('APIEndPoint', app.services.APIEndPoint);
+           app.zephyr.filter('Tag', filters.Tag);
            app.zephyr.controller('selectCommandController', app.controllers.SelectCommand);
            app.zephyr.service('MyModal', app.services.MyModal);
            app.zephyr.controller('executionController', app.controllers.Execution);
                            .$promise.then(function (result) {
                            controller.commands = result.info;
                        });
+                       this.currentTag = 'all';
                    }
+                   SelectCommand.prototype.changeTag = function (tag) {
+                       this.currentTag = tag;
+                       console.log(this.currentTag);
+                   };
                    SelectCommand.$inject = ['$scope', 'APIEndPoint'];
                    return SelectCommand;
                })();
                controllers.SelectCommand = SelectCommand;
            })(controllers = app.controllers || (app.controllers = {}));
        })(app || (app = {}));
+       var filters;
+       (function (filters) {
+           function Tag() {
+               return function (commands, tag) {
+                   var result = [];
+                   angular.forEach(commands, function (command) {
+                       var flag = false;
+                       angular.forEach(command.tags, function (value) {
+                           if (tag === value)
+                               flag = true;
+                       });
+                       if (flag)
+                           result.push(command);
+                   });
+                   return result;
+               };
+           }
+           filters.Tag = Tag;
+       })(filters || (filters = {}));
        var app;
        (function (app) {
            'use strict';
                });
            });
            app.zephyr.service('APIEndPoint', app.services.APIEndPoint);
+           app.zephyr.filter('Tag', filters.Tag);
            app.zephyr.controller('selectCommandController', app.controllers.SelectCommand);
            app.zephyr.service('MyModal', app.services.MyModal);
            app.zephyr.controller('executionController', app.controllers.Execution);
                            .$promise.then(function (result) {
                            controller.commands = result.info;
                        });
+                       this.currentTag = 'all';
                    }
+                   SelectCommand.prototype.changeTag = function (tag) {
+                       this.currentTag = tag;
+                       console.log(this.currentTag);
+                   };
                    SelectCommand.$inject = ['$scope', 'APIEndPoint'];
                    return SelectCommand;
                })();
                controllers.SelectCommand = SelectCommand;
            })(controllers = app.controllers || (app.controllers = {}));
        })(app || (app = {}));
+       var filters;
+       (function (filters) {
+           function Tag() {
+               return function (commands, tag) {
+                   var result = [];
+                   angular.forEach(commands, function (command) {
+                       var flag = false;
+                       angular.forEach(command.tags, function (value) {
+                           if (tag === value)
+                               flag = true;
+                       });
+                       if (flag)
+                           result.push(command);
+                   });
+                   return result;
+               };
+           }
+           filters.Tag = Tag;
+       })(filters || (filters = {}));
        var app;
        (function (app) {
            'use strict';
                });
            });
            app.zephyr.service('APIEndPoint', app.services.APIEndPoint);
+           app.zephyr.filter('Tag', filters.Tag);
            app.zephyr.controller('selectCommandController', app.controllers.SelectCommand);
            app.zephyr.service('MyModal', app.services.MyModal);
            app.zephyr.controller('executionController', app.controllers.Execution);
                            .$promise.then(function (result) {
                            controller.commands = result.info;
                        });
+                       this.currentTag = 'all';
                    }
+                   SelectCommand.prototype.changeTag = function (tag) {
+                       this.currentTag = tag;
+                       console.log(this.currentTag);
+                   };
                    SelectCommand.$inject = ['$scope', 'APIEndPoint'];
                    return SelectCommand;
                })();
                controllers.SelectCommand = SelectCommand;
            })(controllers = app.controllers || (app.controllers = {}));
        })(app || (app = {}));
+       var filters;
+       (function (filters) {
+           function Tag() {
+               return function (commands, tag) {
+                   var result = [];
+                   angular.forEach(commands, function (command) {
+                       var flag = false;
+                       angular.forEach(command.tags, function (value) {
+                           if (tag === value)
+                               flag = true;
+                       });
+                       if (flag)
+                           result.push(command);
+                   });
+                   return result;
+               };
+           }
+           filters.Tag = Tag;
+       })(filters || (filters = {}));
        var app;
        (function (app) {
            'use strict';
                });
            });
            app.zephyr.service('APIEndPoint', app.services.APIEndPoint);
+           app.zephyr.filter('Tag', filters.Tag);
            app.zephyr.controller('selectCommandController', app.controllers.SelectCommand);
            app.zephyr.service('MyModal', app.services.MyModal);
            app.zephyr.controller('executionController', app.controllers.Execution);
index 0486342..f8eeba8 100644 (file)
@@ -6,7 +6,7 @@
     <div class="row">
         <div class="col-md-8">
             <div class="btn-group"ng-repeat="tag in c.tags">
-                <button type="button" class="btn btn-default btn-xs" ng-click="changeTag(tag)"><span class="glyphicon glyphicon-tag"></span>{{tag}}</button>
+                <button type="button" class="btn btn-default btn-xs" ng-click="c.changeTag(tag)"><span class="glyphicon glyphicon-tag"></span>{{tag}}</button>
             </div>
         </div>
         <div class="col-md-4">
@@ -27,7 +27,7 @@
         <!--
         <div ng-repeat="command in commands | filter:searchText | tagFilter:tag">
             -->
-        <div ng-repeat="command in c.commands | filter:c.searchText">
+        <div ng-repeat="command in c.commands | filter:c.searchText | Tag:c.currentTag">
             <div class="col-md-6">
                 <a class="pull-left" ng-click="selectCommand(command.name)" ng-if="$even">{{command.name}}</a>
             </div>