feat(draw-route): Basic threat interface

This commit is contained in:
Joel Kuntz 2015-01-10 14:32:18 -04:00
Родитель 87ce3afb68
Коммит 3f5497c270
3 изменённых файлов: 35 добавлений и 22 удалений

Просмотреть файл

@ -104,6 +104,16 @@ angular.module('seaspongeApp')
# return arr
# )()
$scope.generateThreat = ->
model.addThreat($scope.newThreat)
$scope.menu.newThreatOpen = false
$scope.menu.threatsOpen = true
$scope.newThreat = {
name: ''
severity: null
description: ''
}
$scope.shareModel = ->
model = $scope.model
serialized = model.serialize()

Просмотреть файл

@ -18,7 +18,7 @@ angular.module('seaspongeApp')
title: "Untitled Model"
version: "0.0.0"
authors: ""
threats: ""
threats: []
notes: ""
diagrams: null
@ -34,6 +34,21 @@ angular.module('seaspongeApp')
@diagrams.push(diagram)
return diagram
addThreat: (threat) ->
@threats.push(threat)
removeThreat: (threat) ->
index = @threats.indexOf(threat)
if index > - 1
@threats.splice(index, 1)
return
threatLength: ->
if @threats.length > 0
return true
else
return false
removeDiagram: (diagram) ->
@diagrams.remove(diagram)

Просмотреть файл

@ -283,7 +283,7 @@
</div>
<div class="form-group">
<button class="btn btn-sm btn-primary">Add Threat</button>
<button class="btn btn-sm btn-primary" ng-click="generateThreat()">Add Threat</button>
</div>
</form>
@ -296,32 +296,20 @@
Threat Information <i class="pull-right glyphicon" ng-class="{'glyphicon-chevron-down': menu.threatsOpen, 'glyphicon-chevron-right': !menu.threatsOpen}"></i>
</accordion-heading>
<div class="panel panel-default">
<div class="panel-heading">
Sample High <span class="label label-danger pull-right">High</span>
</div>
<div class="panel-body">
Top Priority
</div>
</div>
<p class="lead" ng-hide="model.threatLength()">
Add threats first
</p>
<div class="panel panel-default">
<div class="panel panel-default" ng-repeat-start="item in model.threats">
<div class="panel-heading">
Sample Medium <span class="label label-warning pull-right">Medium</span>
<span class="label label-danger">{{item.severity}}</span> {{item.name}}
<button class="btn btn-danger btn-xs pull-right" ng-click="model.removeThreat(item)"><span class="glyphicon glyphicon-trash"></span></button>
</div>
<div class="panel-body">
You should address this
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
Sample Low <span class="label label-info pull-right">Low</span>
</div>
<div class="panel-body">
This could wait
{{item.description}}
</div>
</div>
<br ng-repeat-end>
</accordion-group>