diff --git a/.gitignore b/.gitignore index 2eff3441a9f0efa53b131007a509ed04ec5a48b9..5f87871831579ee6cd03315251890ff4a5069787 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ tmp .DS_Store .idea .sass-cache -/vendor/ \ No newline at end of file +/vendor/ +api/*.sqlite3 \ No newline at end of file diff --git a/README.md b/README.md index a503705a0a92e3de0502cbf04defd2fa7ef57255..024da11bc0525125359f01e62ead5bda4082b4c3 100644 --- a/README.md +++ b/README.md @@ -1 +1,10 @@ -# virl-scheduler \ No newline at end of file +# virl-scheduler +Setup instructions + +* make sure bower, composer and npm are available on command line +* run **npm update** in virl-scheduler root directory (only if you want to test in devmodes, apache is enough otherwise) +* run **bower update** in virl-scheduler root directory, afterwards verify **bower_components** directory was created +* run **composer update** in virl-scheduler root directory, afterwards verify **vendor** directory was created +* configure apache to use **virl-scheduler** and **index.html** as webroot (make sure rewrite engine is on and .htaccess files are parsed by apache) + +Change hostname for **VIRLRestangular factory** in **app/topologyManager.js** to your VIRL-API-Hostname or IP-Address. diff --git a/api/index.php b/api/index.php index 8c9d8946bef952430ea6c1a6009028ddc326b4ec..9dfa146101ce2c94aaa6276d77b8eaea1cfd81c2 100644 --- a/api/index.php +++ b/api/index.php @@ -59,7 +59,7 @@ $app->delete('/plannedsims/{id}', function (Request $request, Response $response $array = array($id); $query->execute($array); - return $response->withJson(array("statusText"=>"Simulation mit id ".$id." erfolgreich gelöscht.")); + return $response->withJson(array("statusText"=>"Successfully deleted simulation with id ".$id.".")); }); @@ -100,6 +100,6 @@ $app->post('/plannedsims/new', function (Request $request, Response $response) { $sth = $this->db->prepare('INSERT INTO simulations (timestamp, topo_xml,sessionname,token,username,repeat_interval,repeat_count) VALUES (?, ?, ?,?,?,?,0);'); $sth->execute([intval($timestamp),$XML,$sessionName,$token,$username,$repeat]); - return $response->withJson(array("statusText"=>"Simulation erfolgreich hinzugefügt.")); + return $response->withJson(array("statusText"=>"Successfully added simulation startup.")); }); $app->run(); \ No newline at end of file diff --git a/app/index/controllers/IndexCtrl.js b/app/index/controllers/IndexCtrl.js index f4e44c0cfb7bd2156c926236cc2511312eac7e70..a9096bc6c5aa3e6fd55fb8e6b8b19d8e1bb89c54 100644 --- a/app/index/controllers/IndexCtrl.js +++ b/app/index/controllers/IndexCtrl.js @@ -54,7 +54,7 @@ angular.module('topologyManager').controller('IndexCtrl', function($scope,VIRLRe }, function(response) { console.log(response); - $scope.addAlert(response.statusText,"danger"); + $scope.addAlert(response.data.statusText,"danger"); }); }; diff --git a/composer.lock b/composer.lock index d833ded77cedb2a149f9573454851afa09668478..c2093861042dd5a2b94073022c539bf1b7d88f42 100644 --- a/composer.lock +++ b/composer.lock @@ -4,23 +4,26 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "6f5d3d05d70b58db9144bb1ca70c8698", + "hash": "0b9550b2cfb4a7517c773cd732b9ecf2", "content-hash": "3b0766dbcef4dfb1a4a2012fef8611d8", "packages": [ { "name": "container-interop/container-interop", - "version": "1.1.0", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/container-interop/container-interop.git", - "reference": "fc08354828f8fd3245f77a66b9e23a6bca48297e" + "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/container-interop/container-interop/zipball/fc08354828f8fd3245f77a66b9e23a6bca48297e", - "reference": "fc08354828f8fd3245f77a66b9e23a6bca48297e", + "url": "https://api.github.com/repos/container-interop/container-interop/zipball/79cbf1341c22ec75643d841642dd5d6acd83bdb8", + "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8", "shasum": "" }, + "require": { + "psr/container": "^1.0" + }, "type": "library", "autoload": { "psr-4": { @@ -32,20 +35,21 @@ "MIT" ], "description": "Promoting the interoperability of container objects (DIC, SL, etc.)", - "time": "2014-12-30 15:22:37" + "homepage": "https://github.com/container-interop/container-interop", + "time": "2017-02-14 19:40:03" }, { "name": "nikic/fast-route", - "version": "v1.0.1", + "version": "v1.2.0", "source": { "type": "git", "url": "https://github.com/nikic/FastRoute.git", - "reference": "8ea928195fa9b907f0d6e48312d323c1a13cc2af" + "reference": "b5f95749071c82a8e0f58586987627054400cdf6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/FastRoute/zipball/8ea928195fa9b907f0d6e48312d323c1a13cc2af", - "reference": "8ea928195fa9b907f0d6e48312d323c1a13cc2af", + "url": "https://api.github.com/repos/nikic/FastRoute/zipball/b5f95749071c82a8e0f58586987627054400cdf6", + "reference": "b5f95749071c82a8e0f58586987627054400cdf6", "shasum": "" }, "require": { @@ -75,7 +79,7 @@ "router", "routing" ], - "time": "2016-06-12 19:08:51" + "time": "2017-01-19 11:35:12" }, { "name": "pimple/pimple", @@ -123,6 +127,55 @@ ], "time": "2015-09-11 15:10:35" }, + { + "name": "psr/container", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "time": "2017-02-14 16:28:37" + }, { "name": "psr/http-message", "version": "1.0.1", @@ -175,16 +228,16 @@ }, { "name": "slim/slim", - "version": "3.5.0", + "version": "3.7.0", "source": { "type": "git", "url": "https://github.com/slimphp/Slim.git", - "reference": "184352bc1913d7ba552ab4131d62f4730ddb0893" + "reference": "4254e40d81559e35cdf856bcbaca5f3af468b7ef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/slimphp/Slim/zipball/184352bc1913d7ba552ab4131d62f4730ddb0893", - "reference": "184352bc1913d7ba552ab4131d62f4730ddb0893", + "url": "https://api.github.com/repos/slimphp/Slim/zipball/4254e40d81559e35cdf856bcbaca5f3af468b7ef", + "reference": "4254e40d81559e35cdf856bcbaca5f3af468b7ef", "shasum": "" }, "require": { @@ -234,14 +287,14 @@ } ], "description": "Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs", - "homepage": "http://slimframework.com", + "homepage": "https://slimframework.com", "keywords": [ "api", "framework", "micro", "router" ], - "time": "2016-07-26 15:12:13" + "time": "2016-12-20 20:30:47" } ], "packages-dev": [], diff --git a/partials/index.html b/partials/index.html index f6a3a804b55c660f4e59a539dd5c6a4b9f2f608c..d385fb6911cb2aecf4ec6c1124077c948b08e262 100644 --- a/partials/index.html +++ b/partials/index.html @@ -3,23 +3,23 @@ <div class="col-md-4"> <div class="well"> <fieldset> - <legend>Neue Topologie starten</legend> + <legend>Schedule a new topology</legend> <div class="form-group"> <label for="inputSession" class="col-md-2 control-label">Session Name</label> <div class="col-md-10"> - <input type="text" ng-model="topology.sessionName" class="form-control" id="inputSession" placeholder="Sessionname"> + <input type="text" ng-model="topology.sessionName" class="form-control" id="inputSession" placeholder="Session Name" required> </div> </div> <div class="form-group"> - <label for="inputXML" class="col-md-2 control-label">Topologie-XML</label> + <label for="inputXML" class="col-md-2 control-label">Topology-XML</label> <div class="col-md-10"> <textarea rows="10" id="inputXML" style="width:100%;" ng-model="topology.filecontent" style="max-height:200px;overflow:scroll;"></textarea> </div> </div> <div class="form-group"> - <label for="startDate" class="col-md-2 control-label">Topologie-Startzeitpunkt</label> + <label for="startDate" class="col-md-2 control-label">Topology startup date</label> <div class="col-md-10"> <input type="text" class="form-control" uib-datepicker-popup="dd.MM.yyyy" ng-model="topology.datetime" is-open="popup1.opened" datepicker-options="dateOptions" ng-required="true" close-text="Close" readonly/> @@ -29,7 +29,7 @@ </div> </div> <div class="form-group"> - <label for="startDate" class="col-md-2 control-label">Topologie-Startzeitpunkt</label> + <label for="startDate" class="col-md-2 control-label">Topology startup time</label> <div class="col-md-10"> @@ -38,17 +38,17 @@ </div> </div> <div class="form-group"> - <label for="repeat" class="col-md-2 control-label">Wiederholen</label> + <label for="repeat" class="col-md-2 control-label">Repeat interval</label> <div class="col-md-10"> <div class="btn-group btn-group-justified btn-group-raised"> - <label class="btn btn-raised" ng-model="topology.repeat" uib-btn-radio="'none'">Einmalig</label> - <label class="btn btn-raised" ng-model="topology.repeat" uib-btn-radio="'daily'">Täglich</label> - <label class="btn btn-raised" ng-model="topology.repeat" uib-btn-radio="'weekly'">Wöchentlich</label> + <label class="btn btn-raised" ng-model="topology.repeat" uib-btn-radio="'none'">Once</label> + <label class="btn btn-raised" ng-model="topology.repeat" uib-btn-radio="'daily'">Daily</label> + <label class="btn btn-raised" ng-model="topology.repeat" uib-btn-radio="'weekly'">Weekly</label> </div> </div> </div> - <button class="btn btn-primary btn-raised btn-block" ng-click="send()">Planen</button> + <button class="btn btn-primary btn-raised btn-block" ng-click="send()">Schedule</button> </fieldset> @@ -59,7 +59,7 @@ <div class="col-md-4"> <div class="well"> - <legend>geplante Simulationen</legend> + <legend>scheduled simulations</legend> <div class="list-group "> <div class="list-group-item" ng-repeat-start="sim in plannedSims"> <div class="row-action-primary"> @@ -72,8 +72,8 @@ <h4 class="list-group-item-heading">{{sim.sessionname}}</h4> <p class="list-group-item-text">Status: {{sim.status}}</p> - <p class="list-group-item-text">Benutzer: {{sim.username}}</p> - <p class="list-group-item-text" ng-if="sim.status == 'repeating'">Nächste Ausführung: {{sim.timestamp*1000 + sim.repeat_interval*1000 * sim.repeat_count | date:'EEEE, dd.MM.yyyy HH:mm'}}</p> + <p class="list-group-item-text">User: {{sim.username}}</p> + <p class="list-group-item-text" ng-if="sim.status == 'repeating'">Next startup: {{sim.timestamp*1000 + sim.repeat_interval*1000 * sim.repeat_count | date:'EEEE, dd.MM.yyyy HH:mm'}}</p> <button class="btn btn-danger" ng-click="removePlannedSim(sim.id)">Delete</button> </div> </div> @@ -85,7 +85,7 @@ <div class="col-md-4"> <div class="well"> - <legend>laufende Simulationen für {{credentials.username}}</legend> + <legend>running simulations for user: {{credentials.username}}</legend> <div class="list-group"> <div class="list-group-item" ng-repeat-start="(key,value) in runningSims"> <div class="row-action-primary"> diff --git a/partials/navbar.html b/partials/navbar.html index 1ceea1d994659a45b8fc63c61adbf19df7a1e7ca..5e65a8678f6dab21b631b84de26d6d96ae3941ac 100644 --- a/partials/navbar.html +++ b/partials/navbar.html @@ -12,8 +12,8 @@ <form class="navbar-form navbar-left"> <div class="form-group is-empty"> - <input type="text" ng-change="generateToken()" ng-model="credentials.username" class="form-control col-md-8" placeholder="Benutzername"> - <input type="password" ng-change="generateToken()" ng-model="credentials.password" class="form-control col-md-8" placeholder="Passwort"> + <input type="text" ng-change="generateToken()" ng-model="credentials.username" class="form-control col-md-8" placeholder="Username"> + <input type="password" ng-change="generateToken()" ng-model="credentials.password" class="form-control col-md-8" placeholder="Password"> <button class="btn btn-info btn-xs" ng-click="verifyCredentials()">Verify</button> </div> </form>