<!-----------------------------------------------------------------------------
|
|   Onyx Portfolio & Risk Management Framework
|
|   Copyright 2014 Carlo Sbraccia
|
|   Licensed 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.
|
------------------------------------------------------------------------------>

<div ng-controller="JobsCtrl">
    <table class="table table-striped table-hover table-condensed">
        <thead>
            <tr>
                <th data-sortable="true">Name</th>
                <th>Executor</th>
                <th data-sortable="true">Next Run Time</th>
                <th>Action</th>
            </tr>
        </thead>
        <tbody>
            <tr ng-repeat="job in jobs | orderBy: 'next_run_time'">
                <td>{{job.name}}</td>
                <td>{{job.executor}}</td>
                <td>{{job.next_run_time.toString()}}</td>
                <td>
                    <div class="btn-group btn-group-sm">
                        <button class="btn" ng-click="modifyJob($index,'edit')">
                            <span class="glyphicon glyphicon-pencil"></span>
                        </button>
                        <button class="btn" ng-show="job.running"
                                            ng-click="modifyJob($index,'pause')">
                            <span class="glyphicon glyphicon-pause"></span>
                        </button>
                        <button class="btn" ng-show="!job.running"
                                            ng-click="modifyJob($index,'resume')">
                            <span class="glyphicon glyphicon-play"></span>
                        </button>
                        <button class="btn" ng-click="modifyJob($index,'remove')">
                            <span class="glyphicon glyphicon-minus"></span>
                        </button>
                        <button class="btn" ng-click="modifyJob($index,'duplicate')">
                            <span class="glyphicon glyphicon-duplicate"></span>
                        </button>
                    </div>
                </td>
            </tr>
        </tbody>
    </table>

    <div>
        <button class="btn" ng-click="newJob()">
            <span class="glyphicon glyphicon-plus"></span>
        </button>
        <button class="btn" ng-click="refresh()">
            <span class="glyphicon glyphicon-refresh"></span>
        </button>
    </div>
</div>