Compare commits
merge into: bgallet:12.0
bgallet:10.0
bgallet:12.0
bgallet:13.0
bgallet:14.0
bgallet:14.0-patch-get-request-odoo
bgallet:16.0
bgallet:v12_initial_fix
Myceliandre:10.0
Myceliandre:12.0
Myceliandre:13.0
Myceliandre:14.0
Myceliandre:16.0
Myceliandre:v12_initial_fix
pull from: bgallet:v12_initial_fix
bgallet:10.0
bgallet:12.0
bgallet:13.0
bgallet:14.0
bgallet:14.0-patch-get-request-odoo
bgallet:16.0
bgallet:v12_initial_fix
Myceliandre:10.0
Myceliandre:12.0
Myceliandre:13.0
Myceliandre:14.0
Myceliandre:16.0
Myceliandre:v12_initial_fix
1 Commits
12.0
...
v12_initia
Author | SHA1 | Message | Date |
---|---|---|---|
Maciej Wawro | ae77d5f762 |
v12_initial_fix
|
5 years ago |
15 changed files with 273 additions and 82 deletions
-
7galicea_environment_checkup/__init__.py
-
2galicea_environment_checkup/__manifest__.py
-
4galicea_environment_checkup/environment_checkup/__init__.py
-
2galicea_environment_checkup/environment_checkup/custom.py
-
2galicea_environment_checkup/environment_checkup/dependencies.py
-
2galicea_environment_checkup/environment_checkup/runtime.py
-
80galicea_environment_checkup/static/src/js/environment_checkup.js
-
108galicea_environment_checkup/static/src/js/environment_checkup10.js
-
2galicea_git/__manifest__.py
-
2galicea_openid_connect/__init__.py
-
8galicea_openid_connect/__manifest__.py
-
3galicea_openid_connect/api.py
-
1galicea_openid_connect/models/__init__.py
-
28galicea_openid_connect/models/config_parameter.py
-
8galicea_openid_connect/security/init.xml
@ -1,7 +1,8 @@ |
|||||
# -*- coding: utf-8 -*- |
# -*- coding: utf-8 -*- |
||||
|
|
||||
from . import models |
|
||||
|
from .environment_checkup.custom import custom_check |
||||
|
from .environment_checkup.core import CheckFail, CheckWarning, CheckSuccess |
||||
|
|
||||
from . import controllers |
from . import controllers |
||||
|
from . import models |
||||
|
|
||||
from environment_checkup.custom import custom_check |
|
||||
from environment_checkup.core import CheckFail, CheckWarning, CheckSuccess |
|
@ -0,0 +1,4 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
|
||||
|
from . import core |
||||
|
from . import custom |
@ -0,0 +1,108 @@ |
|||||
|
odoo.define('galicea_environment_checkup', function(require) { |
||||
|
"use strict"; |
||||
|
|
||||
|
var core = require('web.core'); |
||||
|
var form_common = require('web.form_common'); |
||||
|
var Widget = require('web.Widget'); |
||||
|
var session = require('web.session'); |
||||
|
var QWeb = core.qweb; |
||||
|
var SystrayMenu = require('web.SystrayMenu'); |
||||
|
var Model = require('web.Model'); |
||||
|
|
||||
|
var Users = new Model('res.users'); |
||||
|
|
||||
|
var SystrayIcon = Widget.extend({ |
||||
|
tagName: 'li', |
||||
|
events: { |
||||
|
"click": "on_click", |
||||
|
}, |
||||
|
|
||||
|
start: function(){ |
||||
|
this.load(this.all_dashboards); |
||||
|
return this._super(); |
||||
|
}, |
||||
|
|
||||
|
load: function(dashboards){ |
||||
|
var self = this; |
||||
|
var loading_done = new $.Deferred(); |
||||
|
Users.call('has_group', ['base.group_erp_manager']).then(function(is_admin) { |
||||
|
if (is_admin) { |
||||
|
session.rpc('/galicea_environment_checkup/data', {}) |
||||
|
.then(function (data) { |
||||
|
var counts = { 'success': 0, 'warning': 0, 'fail': 0 }; |
||||
|
data.forEach(function (check) { ++counts[check.result]; }); |
||||
|
|
||||
|
var result; |
||||
|
if (counts['fail']) { |
||||
|
result = 'fail'; |
||||
|
} else if (counts['warning']) { |
||||
|
result = 'warning'; |
||||
|
} else { |
||||
|
result = 'success'; |
||||
|
} |
||||
|
|
||||
|
self.replaceElement(QWeb.render('GaliceaEnvironmentCheckupIcon', { |
||||
|
'result': result, |
||||
|
'count': counts['warning'] + counts['fail'] |
||||
|
})); |
||||
|
loading_done.resolve(); |
||||
|
}); |
||||
|
} else { |
||||
|
loading_done.resolve(); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
return loading_done; |
||||
|
}, |
||||
|
|
||||
|
on_click: function (event) { |
||||
|
event.preventDefault(); |
||||
|
this.do_action('galicea_environment_checkup.dashboard_action', {clear_breadcrumbs: true}); |
||||
|
}, |
||||
|
}); |
||||
|
|
||||
|
SystrayMenu.Items.push(SystrayIcon); |
||||
|
|
||||
|
var Dashboard = Widget.extend({ |
||||
|
start: function(){ |
||||
|
return this.load(this.all_dashboards); |
||||
|
}, |
||||
|
|
||||
|
load: function(dashboards) { |
||||
|
var self = this; |
||||
|
var loading_done = new $.Deferred(); |
||||
|
session.rpc('/galicea_environment_checkup/data', {}) |
||||
|
.then(function (data) { |
||||
|
self.replaceElement(QWeb.render('GaliceaEnvironmentCheckupDashboard', {'data': data})); |
||||
|
loading_done.resolve(); |
||||
|
}); |
||||
|
return loading_done; |
||||
|
}, |
||||
|
}); |
||||
|
|
||||
|
core.action_registry.add('galicea_environment_checkup.dashboard', Dashboard); |
||||
|
|
||||
|
var FormWidget = form_common.AbstractField.extend({ |
||||
|
init: function() { |
||||
|
this._super.apply(this, arguments); |
||||
|
this.set("value", "[]"); |
||||
|
}, |
||||
|
|
||||
|
render_value: function() { |
||||
|
var data = JSON.parse(this.get('value')); |
||||
|
if (data.length == 0) { |
||||
|
this.replaceElement('<div />'); |
||||
|
return; |
||||
|
} |
||||
|
this.replaceElement(QWeb.render('GaliceaEnvironmentCheckupFormWidget', {'data': data})); |
||||
|
}, |
||||
|
}); |
||||
|
|
||||
|
core.form_widget_registry.add('environment_checks', FormWidget); |
||||
|
|
||||
|
return { |
||||
|
SystrayIcon: SystrayIcon, |
||||
|
Dashboard: Dashboard, |
||||
|
FormWidget: FormWidget |
||||
|
}; |
||||
|
}); |
@ -0,0 +1,28 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
|
||||
|
from odoo import models, fields, api |
||||
|
from .. import random_tokens |
||||
|
try: |
||||
|
from jwcrypto import jwk |
||||
|
except ImportError: |
||||
|
pass |
||||
|
|
||||
|
class ConfigParameter(models.Model): |
||||
|
_inherit = 'ir.config_parameter' |
||||
|
|
||||
|
@api.model |
||||
|
def openid_init_keys(self): |
||||
|
keys = { |
||||
|
'galicea_openid_connect.authorization_code_jwk': lambda: \ |
||||
|
jwk.JWK.generate(kty='oct', size=256, kid=random_tokens.alpha_numeric(16), use='sig', alg='HS256').export(), |
||||
|
'galicea_openid_connect.id_token_jwk': lambda: \ |
||||
|
jwk.JWK.generate(kty='RSA', size=2054, kid=random_tokens.alpha_numeric(16), use='sig', alg='RS256').export() |
||||
|
} |
||||
|
|
||||
|
for key, gen in iter(keys.items()): |
||||
|
if not self.search([('key', '=', key)]): |
||||
|
self.create({ |
||||
|
'key': key, |
||||
|
'value': gen(), |
||||
|
'group_ids': [(4, self.env.ref('base.group_erp_manager').id)] |
||||
|
}) |
@ -0,0 +1,8 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<odoo> |
||||
|
<data noupdate="1"> |
||||
|
<function model="ir.config_parameter" |
||||
|
name="openid_init_keys" |
||||
|
/> |
||||
|
</data> |
||||
|
</odoo> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue