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

Tag normalization #657

Merged
merged 5 commits into from
Dec 19, 2018
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
1 change: 0 additions & 1 deletion ui/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@
<script src="bower_components/underscore.string/dist/underscore.string.js"></script>
<script src="bower_components/angular-drag-and-drop-lists/angular-drag-and-drop-lists.js"></script>
<script src="bower_components/angular-bootstrap-colorpicker/js/bootstrap-colorpicker-module.js"></script>
<script src="bower_components/file-saver/FileSaver.js"></script>
<!-- endbower -->

<script type="text/javascript" src="bower_components/ace-builds/src-min-noconflict/ace.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion ui/app/scripts/controllers/case/CaseCreationCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@

$scope.keys = function(o) {
return _.keys(o).length;
}
};
}
);
})();
2 changes: 1 addition & 1 deletion ui/app/scripts/controllers/case/CaseDetailsCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,4 @@
};
});

})();
})();
6 changes: 5 additions & 1 deletion ui/app/scripts/controllers/case/ObservableCreationCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
'use strict';

angular.module('theHiveControllers').controller('ObservableCreationCtrl',
function($scope, $stateParams, $uibModalInstance, clipboard, CaseArtifactSrv, ListSrv, NotificationSrv) {
function($scope, $stateParams, $uibModalInstance, clipboard, CaseArtifactSrv, ListSrv, NotificationSrv, TagSrv) {

$scope.activeTlp = 'active';
$scope.pendingAsync = false;
Expand Down Expand Up @@ -167,6 +167,10 @@
return false;
}
};

$scope.getTags = function(query) {
return TagSrv.fromObservables(query);
};
}
);

Expand Down
7 changes: 6 additions & 1 deletion ui/app/scripts/services/TagSrv.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
});

return defer.promise;
}
};


this.fromCases = function(term) {
Expand All @@ -39,5 +39,10 @@
return getTags('alert', term);
};

this.fromObservables = function(term) {
return getTags('case/artifact', term);
};

});
})();

3 changes: 2 additions & 1 deletion ui/app/views/directives/updatable-tags.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@

<span ng-show="updatable.updating">
<div class="form-group">
<tags-input class="ti-input-sm" min-length="2" ng-model="value" placeholder="Add labels" replace-spaces-with-dashes="false"></tags-input>
<tags-input class="ti-input-sm" min-length="2" ng-model="value" placeholder="Add labels" replace-spaces-with-dashes="false">
</tags-input>
</div>
<div class="form-group">
<span class="btn" ng-click='update()' tooltip-placement="top" tooltip-popup-delay='500' uib-tooltip="save">
Expand Down
2 changes: 1 addition & 1 deletion ui/app/views/partials/case/case.creation.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ <h4 class="vpad10 text-primary">Case details</h4>
min-length="2"
ng-model="tags"
replace-spaces-with-dashes="false">
<auto-complete debounceDelay="400" source="getTags($query)"></auto-complete>
<auto-complete min-length="1" debounceDelay="400" source="getTags($query)"></auto-complete>
</tags-input>
</div>
</div>
Expand Down
4 changes: 3 additions & 1 deletion ui/app/views/partials/observables/creation/form.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@
</label>
<div class="col-md-9">
<input type="hidden" name="tags" ng-model="params.tagNames" ng-required="!params.message.length"/>
<tags-input name="tagsInput" ng-model="tags" class="ti-input-sm" placeholder="Add tags" replace-spaces-with-dashes="false" min-length="2"></tags-input>
<tags-input name="tagsInput" ng-model="tags" class="ti-input-sm" placeholder="Add tags" replace-spaces-with-dashes="false" min-length="2">
<auto-complete min-length="1" debounceDelay="400" source="getTags($query)"></auto-complete>
</tags-input>
<p class="help-block" ng-show="observableForm.tags.$invalid && !observableForm.tagsInput.$pristine">The observable(s) description or tags are required.</p>
</div>
</div>
Expand Down
1 change: 0 additions & 1 deletion ui/test/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ module.exports = function(config) {
'bower_components/underscore.string/dist/underscore.string.js',
'bower_components/angular-drag-and-drop-lists/angular-drag-and-drop-lists.js',
'bower_components/angular-bootstrap-colorpicker/js/bootstrap-colorpicker-module.js',
'bower_components/file-saver/FileSaver.js',
'bower_components/angular-mocks/angular-mocks.js',
// endbower
"bower_components/cryptojslib/components/core-min.js",
Expand Down