diff --git a/storage_dashboard/README.rst b/storage_dashboard/README.rst new file mode 100644 index 000000000..9e7a84d84 --- /dev/null +++ b/storage_dashboard/README.rst @@ -0,0 +1,47 @@ +.. image:: https://img.shields.io/badge/licence-LGPL--3-green.svg + :target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 + +Storage Dashboard +================= +Storage Dashboard Module for Odoo 16 Provides Memory Usage Statistics for +Various Models in the Current Database. + +configuration +============ +* No Additional Configuration Needed. + +Company +------- +* `Cybrosys Techno Solutions `__ + +License +------- +General Public License, Version 3 (LGPL v3). +(https://www.gnu.org/licenses/lgpl-3.0-standalone.html) + +Credits +------- +* Developer: (V16) Vishnuraj P +* Contact: odoo@cybrosys.com + +Contacts +-------- +* Mail Contact : odoo@cybrosys.com +* Website : https://cybrosys.com + +Bug Tracker +----------- +Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. + +Maintainer +========== +.. image:: https://cybrosys.com/images/logo.png + :target: https://cybrosys.com + +This module is maintained by Cybrosys Technologies. +For support and more information, please visit https://www.cybrosys.com + +Further information +=================== +HTML Description: ``__ diff --git a/storage_dashboard/__init__.py b/storage_dashboard/__init__.py new file mode 100755 index 000000000..097bdb395 --- /dev/null +++ b/storage_dashboard/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import models diff --git a/storage_dashboard/__manifest__.py b/storage_dashboard/__manifest__.py new file mode 100755 index 000000000..34f6ce831 --- /dev/null +++ b/storage_dashboard/__manifest__.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +{ + 'name': 'Odoo Storage Dashboard', + 'version': '16.0.1.0.0', + 'category': 'Extra Tools', + 'summary': "Storage Dashboard Provides Memory Usage Statistics for Various Models in the Current Database.", + 'description': "Storage Dashboard Provides Memory Usage Statistics for " + "Various Models in the Current Database.", + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': "https://www.cybrosys.com", + 'data': [ + 'views/storage_dashboard_menu.xml', + ], + 'assets': { + 'web.assets_backend': [ + 'storage_dashboard/static/src/js/storage_dashboard.js', + 'storage_dashboard/static/src/xml/storage_dashboard_templates.xml', + ] + }, + 'images': ['static/description/banner.jpg'], + 'license': 'LGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/storage_dashboard/doc/RELEASE_NOTES.md b/storage_dashboard/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..14abe6503 --- /dev/null +++ b/storage_dashboard/doc/RELEASE_NOTES.md @@ -0,0 +1,7 @@ +## Module + +#### 16.02.2024 +#### Version 16.0.1.0.0 +#### ADD + +- Initial commit for Storage Dashboard diff --git a/storage_dashboard/models/__init__.py b/storage_dashboard/models/__init__.py new file mode 100755 index 000000000..c83bdc21a --- /dev/null +++ b/storage_dashboard/models/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import storage_usage diff --git a/storage_dashboard/models/storage_usage.py b/storage_dashboard/models/storage_usage.py new file mode 100755 index 000000000..21b96694e --- /dev/null +++ b/storage_dashboard/models/storage_usage.py @@ -0,0 +1,219 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +import os +import platform +import psycopg2 +import psutil +from odoo import api, models +from odoo.exceptions import AccessError +from odoo.tools import config + + +def get_model_storage(db_name, model_name): + """ Method to get storage usage of a model it returns storage of + specific model passed to this method """ + sql_model_name = model_name.replace(".", "_") + db_host = config['db_host'] + db_port = config['db_port'] + db_user = config['db_user'] + db_password = config['db_password'] + try: + connection = psycopg2.connect( + dbname=db_name, + user=db_user, + password=db_password, + host=db_host, + port=db_port, + ) + cursor = connection.cursor() + cursor.execute(f""" + SELECT sum(pg_column_size(x)) + FROM (SELECT * FROM {sql_model_name}) AS x; + """) + total_storage = cursor.fetchone()[0] + cursor.close() + connection.close() + except psycopg2.Error as e: + if 'relation does not exist' in str(e).lower(): + # Return zero as storage when the relation doesn't exist + return '0 bytes' + else: + return None + return total_storage + + +def get_index_data(db_name, model_name): + sql_model_name = model_name.replace(".", "_") + db_host = config['db_host'] + db_port = config['db_port'] + db_user = config['db_user'] + db_password = config['db_password'] + try: + connection = psycopg2.connect( + dbname=db_name, + user=db_user, + password=db_password, + host=db_host, + port=db_port, + ) + cursor = connection.cursor() + cursor.execute(f"""SELECT + pg_indexes_size('{sql_model_name}'); + """) + index_size = cursor.fetchone()[0] + cursor.close() + connection.close() + except psycopg2.Error as e: + if 'relation does not exist' in str(e).lower(): + # Return zero as storage when the relation doesn't exist + return '0 bytes' + else: + return None + return index_size + + +class StorageUsage(models.Model): + """ Model for Compute Storage usage of each models """ + _name = 'storage.usage' + _description = "Storage Usage" + + @api.model + def get_data(self): + """ Method for get all existing models and return model with its + storage with the help of get_model_storage_method """ + user_group_ids = self.env.user.groups_id.ids + accessible_model_ids = self.env['ir.model.access'].search([ + ('group_id', 'in', user_group_ids) + ]).mapped('model_id').ids + model_names = [record.model for record in self.env['ir.model'].browse( + accessible_model_ids)] + model_storage = [] + index_data = [] + for name in model_names: + index_size = get_index_data(self.env.cr.dbname, name) if get_index_data(self.env.cr.dbname, name) else 0 + if index_size > 100000: + index_size = round(index_size / (1024 * 1024), 2) + if index_size != 0: + index_data.append({'model': name, 'index_size': index_size}) + size = get_model_storage(self.env.cr.dbname, name) if get_model_storage(self.env.cr.dbname, name) else 0 + if size > 100000: + size = round(size / (1024 * 1024), 2) + if size != 0: + model_storage.append({'model': name, 'size': size}) + model_storage = sorted(model_storage, key=lambda x: x['size'], + reverse=True) + return {'model_storage': model_storage, + 'index_data': index_data} + + @api.model + def get_info(self): + """ + Method for get database information and returns it as a dictionary + """ + + db_host = config['db_host'] + db_port = config['db_port'] + db_user = config['db_user'] + db_password = config['db_password'] + try: + connection = psycopg2.connect( + dbname=self.env.cr.dbname, + user=db_user, + password=db_password, + host=db_host, + port=db_port + ) + cursor = connection.cursor() + # Version of DB + cursor.execute("SELECT version();") + db_version = cursor.fetchone()[0] + # Total size of DB + cursor.execute(""" + SELECT sum(pg_total_relation_size(schemaname || '.' || + tablename)) FROM pg_tables + WHERE schemaname NOT IN ('pg_catalog', 'information_schema'); + """) + db_size = cursor.fetchone()[0] / (1024 * 1024) + # total storage test + cursor.execute(f""" + SELECT sum(pg_column_size(x)) + FROM (SELECT * FROM {"ir_model_data"}) AS x; + """) + total_storage_bytes = cursor.fetchone()[0] + total_storage_kb = total_storage_bytes / 1024 + # Execute a query to fetch the total relations in DB + cursor.execute(""" + SELECT count(*) FROM information_schema.tables WHERE + table_schema='public'; + """) + # Fetch the result + db_tables = cursor.fetchone()[0] + cursor.close() + connection.close() + # Getting system monitor datas + system_datas = dict(psutil.virtual_memory()._asdict()) + total_memory = system_datas['total'] / (1024 * 1024 * 1024) + used_memory = system_datas['used'] / (1024 * 1024 * 1024) + available_memory = system_datas['available'] / (1024 * 1024 * 1024) + cpu_usage = psutil.cpu_percent(interval=None) + operating_system = platform.system() + os_ver = platform.release() + soft_limit = config.get('limit_memory_soft') / (1024 * 1024 * 1024) + hard_limit = config.get('limit_memory_hard') / (1024 * 1024 * 1024) + transient_age_limit = config.get('transient_age_limit') + limit_time_cpu = config.get('limit_time_cpu') + limit_request = config.get('limit_request') + limit_time_real = config.get('limit_time_real') + http_port = config.get('http_port') + db_user = config.get('db_user') + # Odoo ram usage + process = psutil.Process(os.getpid()) + memory_info = process.memory_info() + ram_usage = memory_info.rss / (1024 * 1024) + + db_date = self.env['ir.config_parameter'].sudo().get_param( + 'database.create_date') + except psycopg2.Error as e: + raise AccessError( + f"Error while fetching database information via query: {e}") + return { + 'db_name': self.env.cr.dbname, + 'db_version': db_version, + 'db_date': db_date, + 'db_size': f"{round(db_size, 2)} MB", + 'db_tables': db_tables, + 'total_storage_kb': total_storage_kb, + 'total_memory': f"{round(total_memory, 2)} GB", + 'used_memory': f"{round(used_memory, 2)} GB", + 'available_memory': f"{round(available_memory, 2)} GB", + 'cpu_usage': f"{cpu_usage} %", + 'ram_usage': f"{round(ram_usage, 2)} MB", + 'os': f"{operating_system +' ' + os_ver}", + 'db_user': db_user, + 'soft_limit': f"{soft_limit} GB", + 'hard_limit': f"{hard_limit} GB", + 'transient_age_limit': f"{transient_age_limit} GB", + 'limit_time_cpu': f"{limit_time_cpu} s", + 'limit_request': limit_request, + 'limit_time_real': limit_time_real, + 'http_port': http_port, + } diff --git a/storage_dashboard/static/description/assets/icons/check.png b/storage_dashboard/static/description/assets/icons/check.png new file mode 100755 index 000000000..c8e85f51d Binary files /dev/null and b/storage_dashboard/static/description/assets/icons/check.png differ diff --git a/storage_dashboard/static/description/assets/icons/chevron.png b/storage_dashboard/static/description/assets/icons/chevron.png new file mode 100755 index 000000000..2089293d6 Binary files /dev/null and b/storage_dashboard/static/description/assets/icons/chevron.png differ diff --git a/storage_dashboard/static/description/assets/icons/cogs.png b/storage_dashboard/static/description/assets/icons/cogs.png new file mode 100755 index 000000000..95d0bad62 Binary files /dev/null and b/storage_dashboard/static/description/assets/icons/cogs.png differ diff --git a/storage_dashboard/static/description/assets/icons/consultation.png b/storage_dashboard/static/description/assets/icons/consultation.png new file mode 100755 index 000000000..8319d4baa Binary files /dev/null and b/storage_dashboard/static/description/assets/icons/consultation.png differ diff --git a/storage_dashboard/static/description/assets/icons/ecom-black.png b/storage_dashboard/static/description/assets/icons/ecom-black.png new file mode 100755 index 000000000..a9385ff13 Binary files /dev/null and b/storage_dashboard/static/description/assets/icons/ecom-black.png differ diff --git a/storage_dashboard/static/description/assets/icons/education-black.png b/storage_dashboard/static/description/assets/icons/education-black.png new file mode 100755 index 000000000..3eb09b27b Binary files /dev/null and b/storage_dashboard/static/description/assets/icons/education-black.png differ diff --git a/storage_dashboard/static/description/assets/icons/hotel-black.png b/storage_dashboard/static/description/assets/icons/hotel-black.png new file mode 100755 index 000000000..130f613be Binary files /dev/null and b/storage_dashboard/static/description/assets/icons/hotel-black.png differ diff --git a/storage_dashboard/static/description/assets/icons/license.png b/storage_dashboard/static/description/assets/icons/license.png new file mode 100755 index 000000000..a5869797e Binary files /dev/null and b/storage_dashboard/static/description/assets/icons/license.png differ diff --git a/storage_dashboard/static/description/assets/icons/lifebuoy.png b/storage_dashboard/static/description/assets/icons/lifebuoy.png new file mode 100755 index 000000000..658d56ccc Binary files /dev/null and b/storage_dashboard/static/description/assets/icons/lifebuoy.png differ diff --git a/storage_dashboard/static/description/assets/icons/manufacturing-black.png b/storage_dashboard/static/description/assets/icons/manufacturing-black.png new file mode 100755 index 000000000..697eb0e9f Binary files /dev/null and b/storage_dashboard/static/description/assets/icons/manufacturing-black.png differ diff --git a/storage_dashboard/static/description/assets/icons/pos-black.png b/storage_dashboard/static/description/assets/icons/pos-black.png new file mode 100755 index 000000000..97c0f90c1 Binary files /dev/null and b/storage_dashboard/static/description/assets/icons/pos-black.png differ diff --git a/storage_dashboard/static/description/assets/icons/puzzle.png b/storage_dashboard/static/description/assets/icons/puzzle.png new file mode 100755 index 000000000..65cf854e7 Binary files /dev/null and b/storage_dashboard/static/description/assets/icons/puzzle.png differ diff --git a/storage_dashboard/static/description/assets/icons/restaurant-black.png b/storage_dashboard/static/description/assets/icons/restaurant-black.png new file mode 100755 index 000000000..4a35eb939 Binary files /dev/null and b/storage_dashboard/static/description/assets/icons/restaurant-black.png differ diff --git a/storage_dashboard/static/description/assets/icons/service-black.png b/storage_dashboard/static/description/assets/icons/service-black.png new file mode 100755 index 000000000..301ab51cb Binary files /dev/null and b/storage_dashboard/static/description/assets/icons/service-black.png differ diff --git a/storage_dashboard/static/description/assets/icons/trading-black.png b/storage_dashboard/static/description/assets/icons/trading-black.png new file mode 100755 index 000000000..9398ba2f1 Binary files /dev/null and b/storage_dashboard/static/description/assets/icons/trading-black.png differ diff --git a/storage_dashboard/static/description/assets/icons/training.png b/storage_dashboard/static/description/assets/icons/training.png new file mode 100755 index 000000000..884ca024d Binary files /dev/null and b/storage_dashboard/static/description/assets/icons/training.png differ diff --git a/storage_dashboard/static/description/assets/icons/update.png b/storage_dashboard/static/description/assets/icons/update.png new file mode 100755 index 000000000..ecbc5a01a Binary files /dev/null and b/storage_dashboard/static/description/assets/icons/update.png differ diff --git a/storage_dashboard/static/description/assets/icons/user.png b/storage_dashboard/static/description/assets/icons/user.png new file mode 100755 index 000000000..6ffb23d9f Binary files /dev/null and b/storage_dashboard/static/description/assets/icons/user.png differ diff --git a/storage_dashboard/static/description/assets/icons/wrench.png b/storage_dashboard/static/description/assets/icons/wrench.png new file mode 100755 index 000000000..6c04dea0f Binary files /dev/null and b/storage_dashboard/static/description/assets/icons/wrench.png differ diff --git a/storage_dashboard/static/description/assets/misc/categories.png b/storage_dashboard/static/description/assets/misc/categories.png new file mode 100755 index 000000000..bedf1e0b1 Binary files /dev/null and b/storage_dashboard/static/description/assets/misc/categories.png differ diff --git a/storage_dashboard/static/description/assets/misc/check-box.png b/storage_dashboard/static/description/assets/misc/check-box.png new file mode 100755 index 000000000..42caf24b9 Binary files /dev/null and b/storage_dashboard/static/description/assets/misc/check-box.png differ diff --git a/storage_dashboard/static/description/assets/misc/compass.png b/storage_dashboard/static/description/assets/misc/compass.png new file mode 100755 index 000000000..d5fed8faa Binary files /dev/null and b/storage_dashboard/static/description/assets/misc/compass.png differ diff --git a/storage_dashboard/static/description/assets/misc/corporate.png b/storage_dashboard/static/description/assets/misc/corporate.png new file mode 100755 index 000000000..2eb13edbf Binary files /dev/null and b/storage_dashboard/static/description/assets/misc/corporate.png differ diff --git a/storage_dashboard/static/description/assets/misc/customer-support.png b/storage_dashboard/static/description/assets/misc/customer-support.png new file mode 100755 index 000000000..79efc72ed Binary files /dev/null and b/storage_dashboard/static/description/assets/misc/customer-support.png differ diff --git a/storage_dashboard/static/description/assets/misc/cybrosys-logo.png b/storage_dashboard/static/description/assets/misc/cybrosys-logo.png new file mode 100755 index 000000000..cc3cc0ccf Binary files /dev/null and b/storage_dashboard/static/description/assets/misc/cybrosys-logo.png differ diff --git a/storage_dashboard/static/description/assets/misc/features.png b/storage_dashboard/static/description/assets/misc/features.png new file mode 100755 index 000000000..b41769f77 Binary files /dev/null and b/storage_dashboard/static/description/assets/misc/features.png differ diff --git a/storage_dashboard/static/description/assets/misc/logo.png b/storage_dashboard/static/description/assets/misc/logo.png new file mode 100755 index 000000000..478462d3e Binary files /dev/null and b/storage_dashboard/static/description/assets/misc/logo.png differ diff --git a/storage_dashboard/static/description/assets/misc/pictures.png b/storage_dashboard/static/description/assets/misc/pictures.png new file mode 100755 index 000000000..56d255fe9 Binary files /dev/null and b/storage_dashboard/static/description/assets/misc/pictures.png differ diff --git a/storage_dashboard/static/description/assets/misc/pie-chart.png b/storage_dashboard/static/description/assets/misc/pie-chart.png new file mode 100755 index 000000000..426e05244 Binary files /dev/null and b/storage_dashboard/static/description/assets/misc/pie-chart.png differ diff --git a/storage_dashboard/static/description/assets/misc/right-arrow.png b/storage_dashboard/static/description/assets/misc/right-arrow.png new file mode 100755 index 000000000..730984a06 Binary files /dev/null and b/storage_dashboard/static/description/assets/misc/right-arrow.png differ diff --git a/storage_dashboard/static/description/assets/misc/star.png b/storage_dashboard/static/description/assets/misc/star.png new file mode 100755 index 000000000..2eb9ab29f Binary files /dev/null and b/storage_dashboard/static/description/assets/misc/star.png differ diff --git a/storage_dashboard/static/description/assets/misc/support.png b/storage_dashboard/static/description/assets/misc/support.png new file mode 100755 index 000000000..4f18b8b82 Binary files /dev/null and b/storage_dashboard/static/description/assets/misc/support.png differ diff --git a/storage_dashboard/static/description/assets/misc/whatsapp.png b/storage_dashboard/static/description/assets/misc/whatsapp.png new file mode 100755 index 000000000..d513a5356 Binary files /dev/null and b/storage_dashboard/static/description/assets/misc/whatsapp.png differ diff --git a/storage_dashboard/static/description/assets/modules/1.png b/storage_dashboard/static/description/assets/modules/1.png new file mode 100644 index 000000000..f3c986fc1 Binary files /dev/null and b/storage_dashboard/static/description/assets/modules/1.png differ diff --git a/storage_dashboard/static/description/assets/modules/2.png b/storage_dashboard/static/description/assets/modules/2.png new file mode 100644 index 000000000..2c8fbb83f Binary files /dev/null and b/storage_dashboard/static/description/assets/modules/2.png differ diff --git a/storage_dashboard/static/description/assets/modules/3.png b/storage_dashboard/static/description/assets/modules/3.png new file mode 100644 index 000000000..d2f60e3d3 Binary files /dev/null and b/storage_dashboard/static/description/assets/modules/3.png differ diff --git a/storage_dashboard/static/description/assets/modules/4.png b/storage_dashboard/static/description/assets/modules/4.png new file mode 100644 index 000000000..51555e88c Binary files /dev/null and b/storage_dashboard/static/description/assets/modules/4.png differ diff --git a/storage_dashboard/static/description/assets/modules/5.png b/storage_dashboard/static/description/assets/modules/5.png new file mode 100644 index 000000000..273effef7 Binary files /dev/null and b/storage_dashboard/static/description/assets/modules/5.png differ diff --git a/storage_dashboard/static/description/assets/modules/6.jpg b/storage_dashboard/static/description/assets/modules/6.jpg new file mode 100644 index 000000000..5ebc89036 Binary files /dev/null and b/storage_dashboard/static/description/assets/modules/6.jpg differ diff --git a/storage_dashboard/static/description/assets/screenshots/0.jpg b/storage_dashboard/static/description/assets/screenshots/0.jpg new file mode 100644 index 000000000..0b27c4fcc Binary files /dev/null and b/storage_dashboard/static/description/assets/screenshots/0.jpg differ diff --git a/storage_dashboard/static/description/assets/screenshots/1.png b/storage_dashboard/static/description/assets/screenshots/1.png new file mode 100644 index 000000000..36bfc04ec Binary files /dev/null and b/storage_dashboard/static/description/assets/screenshots/1.png differ diff --git a/storage_dashboard/static/description/assets/screenshots/2.png b/storage_dashboard/static/description/assets/screenshots/2.png new file mode 100644 index 000000000..b1cad90d0 Binary files /dev/null and b/storage_dashboard/static/description/assets/screenshots/2.png differ diff --git a/storage_dashboard/static/description/assets/screenshots/3.png b/storage_dashboard/static/description/assets/screenshots/3.png new file mode 100644 index 000000000..23df9fb57 Binary files /dev/null and b/storage_dashboard/static/description/assets/screenshots/3.png differ diff --git a/storage_dashboard/static/description/assets/screenshots/4.png b/storage_dashboard/static/description/assets/screenshots/4.png new file mode 100644 index 000000000..251b362f1 Binary files /dev/null and b/storage_dashboard/static/description/assets/screenshots/4.png differ diff --git a/storage_dashboard/static/description/assets/screenshots/hero.gif b/storage_dashboard/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..d7fde1786 Binary files /dev/null and b/storage_dashboard/static/description/assets/screenshots/hero.gif differ diff --git a/storage_dashboard/static/description/banner.jpg b/storage_dashboard/static/description/banner.jpg new file mode 100644 index 000000000..7c22d1f0a Binary files /dev/null and b/storage_dashboard/static/description/banner.jpg differ diff --git a/storage_dashboard/static/description/icon.png b/storage_dashboard/static/description/icon.png new file mode 100644 index 000000000..c9a363911 Binary files /dev/null and b/storage_dashboard/static/description/icon.png differ diff --git a/storage_dashboard/static/description/index.html b/storage_dashboard/static/description/index.html new file mode 100755 index 000000000..a87094a25 --- /dev/null +++ b/storage_dashboard/static/description/index.html @@ -0,0 +1,580 @@ +
+ +
+ +
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+ +
+
+
+ +

+ Odoo Storage Dashboard

+

+ Storage Dashboard Provides Memory Usage Statistics for Various Models in the Current Database

+ + +
+
+
+
+ + +
+
+ +
+

+ Explore This Module

+
+ + + + + +
+
+ +
+

+ Overview

+
+ +
+
This module crafted by Cybrosys Technologies; + StorageDashboard provides memory usage statistics for + various models in the current database. +
+
+ + + +
+
+ +
+

+ Features

+
+ +
+
+
+ + + Easy to Understand Storage Consumption. +
+
+ + + Shows Database Details. +
+
+ + + Shows Total Storage Used by Database. +
+
+ + + Index Chart +
+
+ + + Shows Model wise Storage Usage. +
+
+
+ + + +
+
+ +
+

+ Screenshots

+
+ +
+
+
+

+ Activate Storage Dashboard module. +

+ +
+
+

+ There will be a new Menu "Memory Usage" General Settings. +

+ +
+
+

+ The view of Storage Dashboard. +

+ +
+
+

+ System monitor details and database details +

+ +
+
+
+ + + +
+
+ +
+

+ Related Products

+
+ +
+
+ +
+
+ + + +
+
+ +
+

+ Our Services

+
+ +
+
+
+
+ +
+
+ Odoo Customization
+
+
+
+ +
+
+ Odoo Implementation
+
+
+
+ +
+
+ Odoo Support
+
+
+
+ +
+
+ Hire Odoo Developer
+
+
+
+ +
+
+ Odoo Integration
+
+
+
+ +
+
+ Odoo Migration
+
+
+
+ +
+
+ Odoo Consultancy
+
+
+
+ +
+
+ Odoo Implementation
+
+
+
+ +
+
+ Odoo Licensing Consultancy
+
+
+
+ + + +
+
+ +
+

+ Our Industries

+
+ +
+
+
+
+ +
+ Trading
+

+ Easily procure and sell your products

+
+
+
+
+ +
+ POS
+

+ Easy configuration and convivial experience

+
+
+
+
+ +
+ Education
+

+ A platform for educational management

+
+
+
+
+ +
+ Manufacturing
+

+ Plan, track and schedule your operations

+
+
+
+
+ +
+ E-commerce & Website
+

+ Mobile friendly, awe-inspiring product pages

+
+
+
+
+ +
+ Service Management
+

+ Keep track of services and invoice

+
+
+
+
+ +
+ Restaurant
+

+ Run your bar or restaurant methodically

+
+
+
+
+ +
+ Hotel Management
+

+ An all-inclusive hotel management application

+
+
+
+
+ + + +
+
+ +
+

+ Support

+
+ +
+
+
+
+
+ +
+
+

Need Help?

+

Got questions or need help? + Get in touch.

+ +

+ odoo@cybrosys.com

+
+
+
+
+
+
+
+ +
+
+

WhatsApp

+

Say hi to us on WhatsApp!

+ +

+ +91 86068 27707

+
+
+
+
+
+
+
+ +
+
+
+ diff --git a/storage_dashboard/static/src/js/storage_dashboard.js b/storage_dashboard/static/src/js/storage_dashboard.js new file mode 100755 index 000000000..13c0fea73 --- /dev/null +++ b/storage_dashboard/static/src/js/storage_dashboard.js @@ -0,0 +1,156 @@ +odoo.define("dashboard_dashboard.DashboardDashboard", function (require) { + "use strict"; + var AbstractAction = require('web.AbstractAction'); + var core = require('web.core'); + var QWeb = core.qweb; + var _t = core._t; + var rpc = require('web.rpc'); + var self = this; +/* + * Extends Action and shows different charts based on database related data + fetched from python model. +*/ + var DashBoard = AbstractAction.extend({ + //Adding Chart.js on js libraries. + jsLibs: [ + '/web/static/lib/Chart/Chart.js', + ], + contentTemplate: 'DashboardDashboard', + // Method for Change cart view + init: function(parent, context) { + this._super(parent, context); + this.dashboard_templates = ['MainSection']; + this.chart = []; + }, + start: function() { + var self = this; + this.set("title", 'Dashboard'); + return this._super().then(function() { + self.render_dashboards(); + }); + }, + willStart: function(){ + var self = this; + return this._super() + }, + render_dashboards: function() { + var self = this; + this.fetch_data() + var templates = ['MainSection']; + _.each(templates, function(template) { + self.$('.o_hr_dashboard').append(QWeb.render(template, {widget: self})) + }); + }, + // Method for fetching data related for database and model storage + // form storage.usage python model. + fetch_data: function() { + var self = this + var def0 = this._rpc({ + model: 'storage.usage', + method: "get_info", + }) + .then(function (result) { + $('#db_info_title').replaceWith('' + result['db_name'] + ''); + $('#db_info_body').replaceWith('' + result['db_version'] + ''); + $('#db_date').replaceWith('' + result['db_date'] + ''); + $('#db_tables').replaceWith('' + result['db_tables'] + ''); + $('#db_size_body').replaceWith('' + result['db_size'] + ''); + $('#total_memory').text(result['total_memory']); + $('#used_memory').text(result['used_memory']); + $('#available_memory').text(result['available_memory']); + $('#cpu_usage').text(result['cpu_usage']); + $('#ram_usage').text(result['ram_usage']); + $('#os').text(result['os']); + $('#soft_limit').text(result['soft_limit']); + $('#hard_limit').text(result['hard_limit']); + $('#transient_age_limit').text(result['transient_age_limit']); + $('#limit_time_cpu').text(result['limit_time_cpu']); + $('#limit_request').text(result['limit_request']); + $('#limit_time_real').text(result['limit_time_real']); + $('#http_port').text(result['http_port']); + $('#db_user').text(result['db_user']); + }); + var def1 = this._rpc({ + model: 'storage.usage', + method: "get_data", + }) + .then(function (result) { + var indexModelsArray = result.index_data.map(function(item){ + return item.model + }); + var indexSizeArray = result.index_data.map(function(item){ + return item.index_size + }); + var modelsArray = result.model_storage.map(function(item) { + return item.model; + }); + var sizesArray = result.model_storage.map(function(item) { + return item.size; + }); + const get_colors = () => { + var color = [] + for (var j = 0; j < result.index_data.length; j++) { + var r = Math.floor(Math.random() * 255); + var g = Math.floor(Math.random() * 255); + var b = Math.floor(Math.random() * 255); + color.push("rgb(" + r + "," + g + "," + b + ")"); + } + return color + } + // Chart templates. + self.chart.push(new Chart("chart_example", { + type: 'bar', + data: { + labels: modelsArray, // Labels for each segment + datasets: [{ + label: 'Size Used', + backgroundColor: get_colors(), + data: sizesArray, + }] + }, + options: { + responsive: true, + maintainAspectRatio: true, + tooltips: { + callbacks: { + label: function (tooltipItem, data) { + var label = data.labels[tooltipItem.index]; + var value = data.datasets[0].data[tooltipItem.index]; + return label + " : " + value.toLocaleString() + " MB"; + } + } + } + } + })); + + self.chart.push(new Chart("chart_index", { + type: 'line', + data: { + labels: indexModelsArray, // Labels for each segment + datasets: [{ + label: 'Index Size', + fill: false, + borderColor: 'rgb(75, 192, 192)', + data: indexSizeArray, + }] + }, + options: { + responsive: true, + maintainAspectRatio: true, + tooltips: { + callbacks: { + label: function (tooltipItem, data) { + var label = data.labels[tooltipItem.index]; + var value = data.datasets[0].data[tooltipItem.index]; + return label + " : " + value.toLocaleString() + " MB"; + } + } + } + } + })); + }); + }, + }); + core.action_registry.add('storage_dashboard_tag', DashBoard); + return DashBoard; +}); diff --git a/storage_dashboard/static/src/xml/storage_dashboard_templates.xml b/storage_dashboard/static/src/xml/storage_dashboard_templates.xml new file mode 100755 index 000000000..b93b38c4a --- /dev/null +++ b/storage_dashboard/static/src/xml/storage_dashboard_templates.xml @@ -0,0 +1,180 @@ + + + + +
+
+
+ + + +
+ +
+
+
+
+
+

Model Size Chart

+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+

Index Size Chart

+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+

Database Details

+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
Database Name
Database Version
Database Created on
Database Size
Total Tables
+
+
+
+
+
+
+
+
+
+
+
+

System Monitor

+
+
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Total Memory
Used Memory
Available Memory
CPU Usage
Odoo RAM Usage
Operating System
Database User
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Soft Memory Limit
Hard Memory Limit
Transient Age Limit
CPU Limit Time
Limit Request
Real Limit Time
Http Port
+
+
+
+
+
+
+
+
+ diff --git a/storage_dashboard/views/storage_dashboard_menu.xml b/storage_dashboard/views/storage_dashboard_menu.xml new file mode 100755 index 000000000..717ccfa3f --- /dev/null +++ b/storage_dashboard/views/storage_dashboard_menu.xml @@ -0,0 +1,16 @@ + + + + + Memory Usage + storage_dashboard_tag + + + +