Skip to content

Commit

Permalink
Merge branch 'feature/angular-1.7' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
nadouani committed May 23, 2019
2 parents f4848c3 + ea8931a commit 6ec86ca
Show file tree
Hide file tree
Showing 12 changed files with 72 additions and 7,543 deletions.
67 changes: 33 additions & 34 deletions www/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
"name": "cortex",
"version": "3.0.0-RC2",
"description": "A powerfull observable analysis engine",
"license": "AGPL-v3",
"license": "AGPL-3.0-or-later",
"homepage": "https://github.com/TheHive-Project/Cortex",
"repository": "https://github.com/TheHive-Project/Cortex",
"bin": {
"cross-env": "./node_modules/cross-env/bin/cross-env.js",
"webpack": "./node_modules/webpack/bin/webpack.js",
Expand All @@ -15,65 +16,63 @@
"build": "cross-env NODE_ENV=production webpack -p --colors"
},
"dependencies": {
"@uirouter/angularjs": "^1.0.12",
"angular": "1.6.8",
"@uirouter/angularjs": "^1.0.22",
"angular": "^1.7.8",
"angular-base64-upload": "^0.1.23",
"angular-bootstrap-multiselect": "git+https://github.com/bentorfs/angular-bootstrap-multiselect.git",
"angular-clipboard": "^1.6.2",
"angular-images-resizer": "^2.0.2",
"angular-input-masks": "^4.1.0",
"angular-clipboard": "^1.7.0",
"angular-images-resizer": "^2.0.3",
"angular-input-masks": "^4.3.0",
"angular-local-storage": "^0.7.1",
"angular-messages": "1.6.8",
"angular-moment": "^1.2.0",
"angular-resource": "1.6.8",
"angular-sanitize": "1.6.8",
"angular-messages": "^1.7.8",
"angular-moment": "^1.3.0",
"angular-resource": "^1.7.8",
"angular-sanitize": "^1.7.8",
"angular-ui-bootstrap": "^2.5.6",
"angular-ui-notification": "^0.3.6",
"angular-utils-pagination": "^0.11.1",
"bootstrap-sass": "^3.4.1",
"dropzone": "^5.5.1",
"es6-promise": "^4.2.6",
"font-awesome": "^4.7.0",
"jquery": "^3.4.1",
"lodash": "^4.17.11",
"js-url": "^2.3.0",
"moment": "^2.24.0",
"url": "^0.11.0"
},
"engines": {
"node": ">=0.12.0"
},
"devDependencies": {
"assets-webpack-plugin": "^3.4.0",
"autoprefixer": "^6.5.0",
"babel-core": "^6.14.0",
"babel-core": "^6.26.3",
"babel-eslint": "^8.2.1",
"babel-loader": "^6.2.5",
"babel-preset-es2015": "^6.16.0",
"babel-preset-es2017": "^6.16.0",
"babel-preset-stage-1": "^6.16.0",
"babel-plugin-angularjs-annotate": "^0.5.3",
"babel-preset-es2015": "^6.24.1",
"babel-preset-es2017": "^6.24.1",
"babel-preset-stage-1": "^6.24.1",
"baggage-loader": "^0.2.4",
"bootstrap-sass": "^3.3.7",
"clean-webpack-plugin": "^0.1.10",
"cross-env": "^3.0.0",
"css-loader": "^0.25.0",
"css-spaces": "^0.3.5",
"dropzone": "^5.2.0",
"es6-promise": "^4.0.3",
"eslint": "^4.14.0",
"eslint-loader": "^1.5.0",
"extract-text-webpack-plugin": "^2.0.0-beta.4",
"file-loader": "^0.9.0",
"font-awesome": "^4.7.0",
"html-loader": "^0.4.4",
"html-webpack-plugin": "^2.22.0",
"jquery": "^3.2.1",
"js-url": "^2.3.0",
"lodash": "^4.17.4",
"manifest-revision-webpack-plugin": "^0.3.0",
"moment": "^2.20.1",
"ng-storage": "^0.3.2",
"ngtemplate-loader": "^1.3.1",
"node-sass": "^4.11.0",
"oclazyload": "^1.1.0",
"node-sass": "^4.12.0",
"postcss-loader": "^0.13.0",
"sass-loader": "^4.0.2",
"style-loader": "^0.13.1",
"url": "^0.11.0",
"url-loader": "^0.5.7",
"url-loader": "^0.5.9",
"webpack": "^3.5.0",
"webpack-dev-server": "^2.2.0"
},
"engines": {
"node": ">=0.12.0"
},
"devDependencies": {
"babel-eslint": "^8.2.1",
"babel-plugin-angularjs-annotate": "^0.5.3"
}
}
36 changes: 17 additions & 19 deletions www/src/app/components/user-dialog/user.edit.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,10 @@ export default class UserEditController {
this.orgId = orgId;

this.formData = _.defaults(
_.pick(this.user, 'id', 'name', 'roles', 'organization'),
{
_.pick(this.user, 'id', 'name', 'roles', 'organization'), {
id: null,
name: null,
roles:
orgId && orgId === 'cortex'
? [Roles.SUPERADMIN]
: [Roles.READ, Roles.ANALYZE],
roles: orgId && orgId === 'cortex' ? [Roles.SUPERADMIN] : [Roles.READ, Roles.ANALYZE],
organization: orgId
}
);
Expand All @@ -58,13 +54,13 @@ export default class UserEditController {
}

getRolesList(orgId) {
return orgId && orgId === 'cortex'
? [[this.Roles.SUPERADMIN]]
: [
[this.Roles.READ],
[this.Roles.READ, this.Roles.ANALYZE],
[this.Roles.READ, this.Roles.ANALYZE, this.Roles.ORGADMIN]
];
return orgId && orgId === 'cortex' ? [
[this.Roles.SUPERADMIN]
] : [
[this.Roles.READ],
[this.Roles.READ, this.Roles.ANALYZE],
[this.Roles.READ, this.Roles.ANALYZE, this.Roles.ORGADMIN]
];
}

onOrgChange() {
Expand All @@ -73,9 +69,7 @@ export default class UserEditController {
this.rolesList = this.getRolesList(this.formData.organization);

this.formData.roles =
this.formData.organization === 'cortex'
? [this.Roles.SUPERADMIN]
: [this.Roles.READ, this.Roles.ANALYZE];
this.formData.organization === 'cortex' ? [this.Roles.SUPERADMIN] : [this.Roles.READ, this.Roles.ANALYZE];
}

onSuccess(data) {
Expand Down Expand Up @@ -105,19 +99,23 @@ export default class UserEditController {
if (this.user.id) {
promise = this.UserService.update(this.user.id, postData);
} else {
postData.login = angular.lowercase(this.formData.id);
postData.login = _.lowerCase(this.formData.id);
promise = this.UserService.save(postData);
}

return promise
.then(response => this.onSuccess(response.data))
.catch(rejection => {
const { data: { type } } = rejection;
const {
data: {
type
}
} = rejection;
if (type === 'ConflictError') {
form.login.$setValidity('exists', false);
} else {
this.onFailure(rejection.data);
}
});
}
}
}
1 change: 0 additions & 1 deletion www/src/app/index.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ const App = angular.module('cortex', [
'ngSanitize',
'ngMessages',
'ngResource',
'oc.lazyLoad',
'ui.bootstrap',
'ui-notification',
'angularUtils.directives.dirPagination',
Expand Down
2 changes: 0 additions & 2 deletions www/src/app/index.vendor.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import '@uirouter/angularjs';

import 'angular-resource';

import 'oclazyload';

import 'angular-sanitize';

import 'angular-messages';
Expand Down
36 changes: 17 additions & 19 deletions www/src/app/pages/admin/common/user-dialog/user.edit.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,10 @@ export default class UserEditController {
this.orgId = orgId;

this.formData = _.defaults(
_.pick(this.user, 'id', 'name', 'roles', 'organization'),
{
_.pick(this.user, 'id', 'name', 'roles', 'organization'), {
id: null,
name: null,
roles:
orgId && orgId === 'cortex'
? [Roles.SUPERADMIN]
: [Roles.READ, Roles.ANALYZE],
roles: orgId && orgId === 'cortex' ? [Roles.SUPERADMIN] : [Roles.READ, Roles.ANALYZE],
organization: orgId
}
);
Expand All @@ -58,13 +54,13 @@ export default class UserEditController {
}

getRolesList(orgId) {
return orgId && orgId === 'cortex'
? [[this.Roles.SUPERADMIN]]
: [
[this.Roles.READ],
[this.Roles.READ, this.Roles.ANALYZE],
[this.Roles.READ, this.Roles.ANALYZE, this.Roles.ORGADMIN]
];
return orgId && orgId === 'cortex' ? [
[this.Roles.SUPERADMIN]
] : [
[this.Roles.READ],
[this.Roles.READ, this.Roles.ANALYZE],
[this.Roles.READ, this.Roles.ANALYZE, this.Roles.ORGADMIN]
];
}

onOrgChange() {
Expand All @@ -73,9 +69,7 @@ export default class UserEditController {
this.rolesList = this.getRolesList(this.formData.organization);

this.formData.roles =
this.formData.organization === 'cortex'
? [this.Roles.SUPERADMIN]
: [this.Roles.READ, this.Roles.ANALYZE];
this.formData.organization === 'cortex' ? [this.Roles.SUPERADMIN] : [this.Roles.READ, this.Roles.ANALYZE];
}

onSuccess(data) {
Expand Down Expand Up @@ -113,19 +107,23 @@ export default class UserEditController {
if (this.user.id) {
promise = this.UserService.update(this.user.id, postData);
} else {
postData.login = angular.lowercase(this.formData.id);
postData.login = _.lowerCase(this.formData.id);
promise = this.UserService.save(postData);
}

return promise
.then(response => this.onSuccess(response.data))
.catch(rejection => {
const { data: { type } } = rejection;
const {
data: {
type
}
} = rejection;
if (type === 'ConflictError') {
form.login.$setValidity('exists', false);
} else {
this.onFailure(rejection.data);
}
});
}
}
}
10 changes: 0 additions & 10 deletions www/src/app/pages/async-page-example/async.controller.js

This file was deleted.

27 changes: 0 additions & 27 deletions www/src/app/pages/async-page-example/async.html

This file was deleted.

11 changes: 0 additions & 11 deletions www/src/app/pages/async-page-example/async.module.js

This file was deleted.

4 changes: 0 additions & 4 deletions www/src/app/pages/async-page-example/async.scss

This file was deleted.

3 changes: 2 additions & 1 deletion www/src/app/pages/login/login.controller.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
export default class LoginController {
constructor(
$log,
Expand Down Expand Up @@ -26,7 +27,7 @@ export default class LoginController {
}

login() {
this.params.username = angular.lowercase(this.params.username);
this.params.username = _.lowerCase(this.params.username);

this.AuthService.login(this.params.username, this.params.password)
.then(() => this.$state.go('index'))
Expand Down
8 changes: 3 additions & 5 deletions www/src/app/pages/maintenance/maintenance.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ export default class MaintenanceController {
this.migrating = true;
this.$http
.post(
'./api/maintenance/migrate',
{},
{
'./api/maintenance/migrate', {}, {
timeout: 10 * 60 * 60 * 1000 // 10 minutes
}
)
Expand All @@ -61,7 +59,7 @@ export default class MaintenanceController {

createInitialUser() {
this.UserService.save({
login: angular.lowercase(this.newUser.login),
login: _.lowerCase(this.newUser.login),
name: this.newUser.name,
password: this.newUser.password,
roles: ['superadmin'],
Expand Down Expand Up @@ -110,4 +108,4 @@ export default class MaintenanceController {
}
});
}
}
}
Loading

0 comments on commit 6ec86ca

Please sign in to comment.