зеркало из https://github.com/mozilla/seasponge.git
Fix merge conflicts
This commit is contained in:
Коммит
0dbc0b0fa4
|
@ -28,10 +28,17 @@ angular.module('seaspongeApp')
|
|||
|
||||
$scope.semverRegex = new RegExp("\\bv?(?:0|[1-9][0-9]*)\\.(?:0|[1-9][0-9]*)\\.(?:0|[1-9][0-9]*)(?:-[\\da-z\\-]+(?:\\.[\\da-z\\-]+)*)?(?:\\+[\\da-z\\-]+(?:\\.[\\da-z\\-]+)*)?\\b")
|
||||
|
||||
$scope.newThreat = {
|
||||
name: 'Untitled Threat'
|
||||
severity: 'Medium'
|
||||
description: ''
|
||||
}
|
||||
|
||||
$scope.menu = {
|
||||
modelOpen: false
|
||||
diagramOpen: false
|
||||
stencilsOpen: true
|
||||
newThreatOpen: false
|
||||
threatsOpen: false
|
||||
propertiesOpen: false
|
||||
}
|
||||
|
@ -41,8 +48,6 @@ angular.module('seaspongeApp')
|
|||
$scope.selectedStencil = false
|
||||
$scope.selectedDiagram = null
|
||||
|
||||
# UI
|
||||
|
||||
$scope.dataClassificationOptions = model.dataClassificationOptions
|
||||
|
||||
$scope.securityControlOptions = model.securityControlOptions
|
||||
|
@ -58,6 +63,12 @@ angular.module('seaspongeApp')
|
|||
# return arr
|
||||
# )()
|
||||
|
||||
$scope.generateThreat = ->
|
||||
newThreat = $.extend(true, {}, $scope.newThreat);
|
||||
model.addThreat(newThreat)
|
||||
$scope.menu.newThreatOpen = false
|
||||
$scope.menu.threatsOpen = true
|
||||
|
||||
$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)
|
||||
|
||||
|
|
|
@ -241,15 +241,75 @@
|
|||
</accordion-group>
|
||||
|
||||
<!-- Threats -->
|
||||
<!-- New -->
|
||||
<accordion-group is-open="menu.newThreatOpen">
|
||||
|
||||
<accordion-heading>
|
||||
New Threat <i class="pull-right glyphicon" ng-class="{'glyphicon-chevron-down': menu.newThreatOpen, 'glyphicon-chevron-right': !menu.newThreatOpen}"></i>
|
||||
</accordion-heading>
|
||||
|
||||
<form class="form" role="form" name="newThreatForm">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="threat-name" class="">Threat Name</label>
|
||||
<input type="text"
|
||||
class="form-control" placeholder="Threat Name"
|
||||
id="threat-name" name="threatName"
|
||||
ng-model="newThreat.name" required ng-required=true
|
||||
ng-minlength=2>
|
||||
|
||||
<span class="text-danger"
|
||||
ng-show="newThreatForm.threatName.$error.required">
|
||||
Threat Name is required!
|
||||
</span>
|
||||
<span class="text-danger"
|
||||
ng-show="newThreatForm.threatName.$error.minlength">
|
||||
Too short!
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="newThreat-severity" class="">Severity</label>
|
||||
<select class="form-control" id="newThreat-severity"
|
||||
ng-options="severity for severity in severityOptions"
|
||||
ng-model="newThreat.severity">
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="newThreat-description" class="">Description</label>
|
||||
<textarea
|
||||
class="form-control" id="newThreat-description" placeholder="Describe the threat" ng-model="newThreat.description"></textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<button class="btn btn-sm btn-primary" ng-click="generateThreat()">Add Threat</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</accordion-group>
|
||||
<!-- Existing -->
|
||||
<accordion-group is-open="menu.threatsOpen">
|
||||
|
||||
<accordion-heading>
|
||||
Threat Information <i class="pull-right glyphicon" ng-class="{'glyphicon-chevron-down': menu.threatsOpen, 'glyphicon-chevron-right': !menu.threatsOpen}"></i>
|
||||
</accordion-heading>
|
||||
|
||||
<div class="lead">
|
||||
Threat Information coming soon!
|
||||
<p class="lead" ng-hide="model.threatLength()">
|
||||
Add threats first
|
||||
</p>
|
||||
|
||||
<div class="panel panel-default" ng-repeat-start="item in model.threats">
|
||||
<div class="panel-heading">
|
||||
<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">
|
||||
{{item.description}}
|
||||
</div>
|
||||
</div>
|
||||
<br ng-repeat-end>
|
||||
|
||||
</accordion-group>
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче