mirror of
https://github.com/fazo96/pbs.git
synced 2025-01-27 14:34:19 +01:00
fix #1 and performance improvements
This commit is contained in:
parent
ad3b97edd5
commit
265f3bc7f8
@ -1,13 +1,13 @@
|
||||
class Pert
|
||||
class PBS
|
||||
constructor: (@list, @verbose) ->
|
||||
@verbose = true
|
||||
@days = []
|
||||
@criticalPaths = []
|
||||
|
||||
log: (x...) ->
|
||||
if chalk?
|
||||
console.log chalk.bold "[ Pert ]", x...
|
||||
else console.log "[ Pert ]", x...
|
||||
if @verbose
|
||||
if chalk?
|
||||
console.log chalk.bold "[ Pert ]", x...
|
||||
else console.log "[ Pert ]", x...
|
||||
err: (x...) ->
|
||||
if chalk?
|
||||
console.log chalk.bold chalk.red("[ !Pert! ]"), x...
|
@ -41,10 +41,12 @@ pertController = ($scope) ->
|
||||
if !data.push?
|
||||
return swal 'Error', 'data is not a list', 'error'
|
||||
try
|
||||
console.log "Saving: "+data
|
||||
localStorage.setItem 'ganttpert', JSON.stringify data
|
||||
sdata = JSON.stringify data
|
||||
console.log "Saving: "+sdata
|
||||
localStorage.setItem 'ganttpert', sdata
|
||||
unless options.silent
|
||||
swal 'Ok', 'Data updated', 'success'
|
||||
$scope.pbs = new PBS(data).calculate()
|
||||
$scope.$broadcast 'dataChanged'
|
||||
catch e
|
||||
swal 'Error', e, 'error'
|
||||
@ -69,6 +71,5 @@ pertController = ($scope) ->
|
||||
#console.log 'Loading: '+jdata
|
||||
return jdata
|
||||
else
|
||||
r = new Pert(jdata).calculate()
|
||||
#console.log 'Loading: '+r
|
||||
return r
|
||||
#console.log 'Loading: '+$scope.pbs
|
||||
return $scope.pbs ?= new PBS(jdata).calculate()
|
||||
|
@ -30,9 +30,11 @@ pertApp.controller 'pertDiagController', ($scope) ->
|
||||
edges:
|
||||
style: 'arrow'
|
||||
network = new vis.Network (document.getElementById 'pertDiagram'), { nodes: nodes, edges: connections }, options
|
||||
$scope.$on 'dataChanged', ->
|
||||
$scope.rebuild = ->
|
||||
console.log 'rebuild'
|
||||
$scope.buildGraph $scope.fromLocalStorage()
|
||||
$scope.buildGraph $scope.fromLocalStorage()
|
||||
$scope.$on 'dataChanged', $scope.rebuild
|
||||
$scope.rebuild()
|
||||
|
||||
pertApp.controller 'ganttDiagController', ($scope) ->
|
||||
$scope.toDates = (list, startDay) ->
|
||||
|
@ -16,7 +16,7 @@
|
||||
<script src="angular-ui-router.js"></script>
|
||||
<script src="vis.min.js"></script>
|
||||
<script src="moment.js"></script>
|
||||
<script src="pert.js"></script>
|
||||
<script src="PBSlib.js"></script>
|
||||
<script src="app.js"></script>
|
||||
<script src="controllers.js"></script>
|
||||
</head>
|
||||
|
@ -1 +1,4 @@
|
||||
<div id="pertDiagram" ng-controller="pertDiagController"></div>
|
||||
<div class="text-center" ng-controller="pertDiagController">
|
||||
<button class="btn btn-primary" ng-click="rebuild()"><i class="fa fa-spinner"></i> Redraw</button>
|
||||
<div id="pertDiagram" ></div>
|
||||
</div>
|
||||
|
@ -3,6 +3,7 @@
|
||||
width: 100%;
|
||||
border: 1px solid lightgray;
|
||||
margin-bottom: 1em;
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
.container {
|
||||
|
Loading…
Reference in New Issue
Block a user