Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update version in controllers #14

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions widget/edit.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
(function () {
angular
.module('cybersponse')
.controller('editMitreAttackSpread100Ctrl', editMitreAttackSpread100Ctrl);
.controller('editMitreAttackSpread101Ctrl', editMitreAttackSpread101Ctrl);

editMitreAttackSpread100Ctrl.$inject = ['$scope', '$uibModalInstance', 'config', 'ALL_RECORDS_SIZE', '$state', '$resource', 'API', 'Entity'];
editMitreAttackSpread101Ctrl.$inject = ['$scope', '$uibModalInstance', 'config', 'ALL_RECORDS_SIZE', '$state', '$resource', 'API', 'Entity'];

function editMitreAttackSpread100Ctrl($scope, $uibModalInstance, config, ALL_RECORDS_SIZE, $state, $resource, API, Entity) {
function editMitreAttackSpread101Ctrl($scope, $uibModalInstance, config, ALL_RECORDS_SIZE, $state, $resource, API, Entity) {
$scope.cancel = cancel;
$scope.save = save;
$scope.config = config;
Expand Down
27 changes: 22 additions & 5 deletions widget/view.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
(function () {
angular
.module('cybersponse')
.controller('mitreAttackSpread100Ctrl', mitreAttackSpread100Ctrl);
.controller('mitreAttackSpread101Ctrl', mitreAttackSpread101Ctrl);

mitreAttackSpread100Ctrl.$inject = ['$scope', 'appModulesService', 'currentPermissionsService', 'usersService',
mitreAttackSpread101Ctrl.$inject = ['$scope', 'appModulesService', 'currentPermissionsService', 'usersService',
'$state', '$filter', 'ALL_RECORDS_SIZE', 'API', '$resource', '_', '$q'
];

function mitreAttackSpread100Ctrl($scope, appModulesService, currentPermissionsService, usersService,
function mitreAttackSpread101Ctrl($scope, appModulesService, currentPermissionsService, usersService,
$state, $filter, ALL_RECORDS_SIZE, API, $resource, _, $q) {

// the relationship fields do not seem to follow a standard naming convention as seen below
Expand Down Expand Up @@ -81,7 +81,7 @@
}
};


if ($scope.config.incidentsQuery != undefined && $scope.config.incidentsQuery.filters.length != 0) {
var old_incidents_filter = {"logic": $scope.incidents.query.logic, "filters": $scope.incidents.query.filters};
$scope.incidents.query.logic = "AND";
Expand Down Expand Up @@ -184,6 +184,7 @@
$scope.related_tactics = [];
$scope.currentUser = usersService.getCurrentUser();
$scope.currentTheme = 'dark';
$scope.changeMatrix = changeMatrix;
$scope.globalRefresh = globalRefresh;
$scope.hide_all = false;

Expand All @@ -200,6 +201,10 @@
'TA0038', 'TA0039',
'TA0108', 'TA0104', 'TA0110', 'TA0111', 'TA0103', 'TA0102', // ics
'TA0109', 'TA0100', 'TA0101', 'TA0107', 'TA0106', 'TA0105'];
$scope.enterprise_list = $scope.tactics_order.slice(0, 14);
$scope.mobile_list = $scope.tactics_order.slice(14, 28);
$scope.ics_list = $scope.tactics_order.slice(28);
$scope.selected_list = $scope.enterprise_list;

init();

Expand Down Expand Up @@ -291,7 +296,7 @@
angular.forEach($scope.subtechniquesRecords, function (subtechnique_record) {
if (subtechnique_record.parentTechnique != null) { // need this check otherwise it breaks the loop
if (technique['@id'] == subtechnique_record.parentTechnique) {
// requires subtechnique object to be cloned
// requires subtechnique object to be cloned
// otherwise clicking on one toggle shows/hides alerts and incidents across all duplicates
technique._subtechniques.push(structuredClone(subtechnique_record));
}
Expand Down Expand Up @@ -528,6 +533,18 @@
$state.go(state, params);
}

function changeMatrix(selectedMatrix) {
if (selectedMatrix === 'mobile') {
$scope.selected_list = $scope.mobile_list;
}
else if (selectedMatrix === 'ics') {
$scope.selected_list = $scope.ics_list;
}
else {
$scope.selected_list = $scope.enterprise_list;
}
}

function globalRefresh() {
init();
}
Expand Down
20 changes: 15 additions & 5 deletions widget/view.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,18 @@
<div class="display-flex-space-between margin-chart">
<div class="padding-right-0 padding-left-0 widget-dashboard-title-width"
data-ng-class="(page === 'dashboard' || page === 'reporting') ? 'widget-dashboard-title-width' : 'widget-title-width'">
<h5 class="margin-top-0 margin-bottom-0 text-overflow ng-binding">{{ config.title ? config.title : 'MITRE ATT&CK
Alert/Incident Spread' }}</h5>
<h5 class="margin-top-0 margin-bottom-0 text-overflow ng-binding"><span class="pull-left padding-top-sm">{{ config.title ? config.title : 'MITRE ATT&CK
Alert/Incident Spread' }}&nbsp;&nbsp;&nbsp;
</span>
<span class="pull-left">
<select data-ng-readonly="disabled" data-ng-model="selectedMatrix" class="form-control ng-pristine ng-valid ng-empty input-sm ng-touched" data-ng-change="changeMatrix(selectedMatrix)" data-ng-class="::{'input-big': size === 'large', 'input-sm': size === 'small'}" aria-invalid="false">
<option value="" disabled selected>Select Matrix</option>
<option value="enterprise">Enterprise</option>
<option value="mobile">Mobile</option>
<option value="ics">ICS</option>
</select>
</span>
</h5>
</div>
<div class="padding-left-0 margin-top-8 padding-top-5 pull-left" data-ng-show="detail_display">
<span class="fa btn btn-sm" data-ng-class="{'hover':isOpen}" data-ng-click="globalRefresh()" role="button"
Expand All @@ -24,15 +34,15 @@ <h5 class="margin-top-0 margin-bottom-0 text-overflow ng-binding">{{ config.titl
<tr>
<td class="mitre-techniques-count padding-top-sm padding-left-sm padding-right-sm"
data-ng-repeat="tactic in tacticsRecords | orderBy:'_order_key'"
data-ng-hide="(tactic.techniques.length == 0 && config.hideTactics) || (tactic._hidden_techniques_count == tactic.techniques.length && config.hideParentTactics && !tactic._toggled) || (detail_display && !tactic._toggled_detail)">
data-ng-hide="(tactic.techniques.length == 0 && config.hideTactics) || (tactic._hidden_techniques_count == tactic.techniques.length && config.hideParentTactics && !tactic._toggled) || (detail_display && !tactic._toggled_detail) || (selected_list.indexOf(tactic.mitreId) === -1)">
{{ tactic.techniques.length }}
{{ tactic.techniques.length === 1 ? 'technique' : 'techniques' }}
</td>
</tr>
<tr>
<td class="mitre-tactics-cells padding-bottom-sm padding-left-sm padding-right-sm"
data-ng-repeat="tactic in tacticsRecords | orderBy:'_order_key'"
data-ng-hide="(tactic.techniques.length == 0 && config.hideTactics) || (tactic._hidden_techniques_count == tactic.techniques.length && config.hideParentTactics && !tactic._toggled) || (detail_display && !tactic._toggled_detail)">
data-ng-hide="(tactic.techniques.length == 0 && config.hideTactics) || (tactic._hidden_techniques_count == tactic.techniques.length && config.hideParentTactics && !tactic._toggled) || (detail_display && !tactic._toggled_detail) || (selected_list.indexOf(tactic.mitreId) === -1)">
<div class="div-style">
<a href="" data-ng-click="openRecord(tactics.module, tactic['@id'])" data-tooltip-placement="top"
data-uib-tooltip="{{tactic.mitreId}}" data-tooltip-append-to-body="true">{{ tactic.name }}</a>
Expand All @@ -43,7 +53,7 @@ <h5 class="margin-top-0 margin-bottom-0 text-overflow ng-binding">{{ config.titl
<tbody data-ng-class="currentTheme == 'light' ? 'mitre-techniques-light' : 'mitre-techniques'">
<tr>
<td class="padding-sm" data-ng-repeat="tactic in tacticsRecords | orderBy:'_order_key'"
data-ng-hide="(tactic.techniques.length == 0 && config.hideTactics) || (tactic._hidden_techniques_count == tactic.techniques.length && config.hideParentTactics && !tactic._toggled) || (detail_display && !tactic._toggled_detail)">
data-ng-hide="(tactic.techniques.length == 0 && config.hideTactics) || (tactic._hidden_techniques_count == tactic.techniques.length && config.hideParentTactics && !tactic._toggled) || (detail_display && !tactic._toggled_detail) || (selected_list.indexOf(tactic.mitreId) === -1)">
<table class="inner-mitre-table" width="100%">
<tr data-ng-repeat="technique in tactic.techniques">
<td
Expand Down
Loading