Skip to content
Open
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
8 changes: 5 additions & 3 deletions .github/workflows/pythonapp.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Docker Unit-test

on: [push]
on:
push:
branches:
- develop

jobs:
build:
Expand All @@ -11,6 +14,5 @@ jobs:
- name: Build the Docker image
run: docker build . --file Dockerfile-dev --tag chartboard:test

- uses: actions/checkout@v4.2.2
- name: Unit Test inside docker
run: docker run --entrypoint=python themaux/chartboard:develop src/manage.py test -v 2
run: docker run --entrypoint=python chartboard:test src/manage.py test -v 2
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Carboard.egg-info/
CHARTBOARD.egg-info/
/.idea/*
/.coverage
.eggs/
.idea/
*TODO.md
*/__pycache__/
/Carboard2.0.egg-info/
/CHARTBOARD2.0.egg-info/
src/sensors/__pycache__/
src/Chartboard/__pycache__/
src/Chartboard/app/__pycache__/
Expand All @@ -16,7 +16,7 @@ src/Chartboard/webserver/__pycache__/
src/Chartboard/app/Config/dev_properties.json
/src/Chartboard/app/Config/tmp/
/src/Chartboard/templates/tmplinear.html
Carboard2.0.egg-info/
CHARTBOARD2.0.egg-info/
*.pyc
*.swp
/coverage_html_report/
Expand Down
8 changes: 4 additions & 4 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Change Log

* add Gitlab-Ci to push new package on Github and to push image on docker hub

* Create new package Carboard2.0 on pypi https://pypi.org/project/Carboard2.0/
* Create new package CHARTBOARD2.0 on pypi https://pypi.org/project/CHARTBOARD2.0/

* cleaning version

Expand Down Expand Up @@ -80,7 +80,7 @@ Change Log
* reworking of the file redis_utils.py to a cache.py
* Config for ASGI_APPLICATION

* Moving the .Carboard directory to ./Carboard/Config/ to make it compatible with bitnami/python
* Moving the .CHARTBOARD directory to ./CHARTBOARD/Config/ to make it compatible with bitnami/python

* Adding dockerfile support
* Using bitnami image in order to be cloud ready
Expand Down Expand Up @@ -118,7 +118,7 @@ Released on November 16, 2016.

Released on August 28, 2014.

* Carboard got open-sourced!
* CHARTBOARD got open-sourced!


1.3.1
Expand Down Expand Up @@ -230,6 +230,6 @@ This release contains mulCarle improvements and bugfixes:

Released on November 06, 2013.

This is the first release of Carboard.
This is the first release of CHARTBOARD.

* initial release
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ EXPOSE 8080
# Définir l'utilisateur non-root (décommenter si nécessaire)
# USER 1001


# Commande de démarrage
CMD ["python", "src/manage.py", "runserver", "0.0.0.0:8080", "--noreload"]
28 changes: 0 additions & 28 deletions Dockerfile-dev

This file was deleted.

33 changes: 18 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,32 +49,35 @@ Depot Github

License
-------
opyriht (c) 2013-2017 [Allegro Group](http://allegro.pl).
Copyright (c) 2019-2024 the-maux

Chartboard is licensed under the [Apache License, v2.0](http://Chartboard.readthedocs.org/en/latest/license.html). (like TIPBOARD)

[1]: https://travis-ci.com/the-maux/Carboard.svg?branch=develop
[2]: https://travis-ci.com/the-maux/Carboard
[3]: https://g.codefresh.io/api/badges/pipeline/themaux/Carboard%2FMyPipeline?key=eyJhbGciOiJIUzI1NiJ9.NWQ5NDkxYzg1YzI5YzVmOWQyODQ0MDc4.rDj-1Rn5DxSkv_oE8p87ijZhoTelE_WjvbbKWMCI3ZA&type=cf-1
Copyright (c) 2013-2017 [Allegro Group](http://allegro.pl).
Copyright (c) 2019-2025 the-maux


[1]: https://travis-ci.com/the-maux/CHARTBOARD.svg?branch=develop
[2]: https://travis-ci.com/the-maux/CHARTBOARD
[3]: https://g.codefresh.io/api/badges/pipeline/themaux/CHARTBOARD%2FMyPipeline?key=eyJhbGciOiJIUzI1NiJ9.NWQ5NDkxYzg1YzI5YzVmOWQyODQ0MDc4.rDj-1Rn5DxSkv_oE8p87ijZhoTelE_WjvbbKWMCI3ZA&type=cf-1
[4]: https://g.codefresh.io/pipelines/MyPipeline/builds?filter=trigger:build~Build;pipeline:5d9492f4941e460201d39d0a~MyPipeline
[5]: https://scrutinizer-ci.com/g/the-maux/Carboard/badges/quality-score.png?b=develop
[6]: https://scrutinizer-ci.com/g/the-maux/Carboard/?branch=develop
[7]: https://img.shields.io/docker/cloud/build/themaux/Carboard
[8]: https://img.shields.io/microbadger/image-size/themaux/Carboard/latest
[9]: https://pyup.io/repos/github/the-maux/Carboard/shield.svg
[5]: https://scrutinizer-ci.com/g/the-maux/CHARTBOARD/badges/quality-score.png?b=develop
[6]: https://scrutinizer-ci.com/g/the-maux/CHARTBOARD/?branch=develop
[7]: https://img.shields.io/docker/cloud/build/themaux/CHARTBOARD
[8]: https://img.shields.io/microbadger/image-size/themaux/CHARTBOARD/latest
[9]: https://pyup.io/repos/github/the-maux/CHARTBOARD/shield.svg
[10]: https://api.codacy.com/project/badge/Grade/b28af36f50584bd29612b66bc42ce0c3
[11]: https://www.codacy.com/manual/the-maux/Carboard?utm_source=github.com&utm_medium=referral&utm_content=the-maux/Carboard&utm_campaign=Badge_Grade
[11]: https://www.codacy.com/manual/the-maux/CHARTBOARD?utm_source=github.com&utm_medium=referral&utm_content=the-maux/CHARTBOARD&utm_campaign=Badge_Grade
[18]: https://img.shields.io/badge/pipeline-todo-orange
[19]: https://circleci.com/gh/the-maux/Carboard/tree/master.svg?style=svg
[20]: https://circleci.com/gh/the-maux/Carboard/tree/master
[19]: https://circleci.com/gh/the-maux/CHARTBOARD/tree/master.svg?style=svg
[20]: https://circleci.com/gh/the-maux/CHARTBOARD/tree/master
[22]: https://img.shields.io/badge/pipeline-todo-orange
[23]: https://circleci.com/gh/the-maux/Carboard/tree/master.svg?style=svg
[23]: https://circleci.com/gh/the-maux/CHARTBOARD/tree/master.svg?style=svg
[24]: https://img.shields.io/badge/pipeline-todo-orange
[25]: https://img.shields.io/badge/pipeline-todo-orange
[26]: https://img.shields.io/badge/pipeline-todo-orange
[27]: https://img.shields.io/badge/pipeline-todo-orange
[28]: https://img.shields.io/badge/pipeline-todo-orange
[31]: https://dev.azure.com/maximerenaud/Carboard/_apis/build/status/Carboard?branchName=master
[31]: https://dev.azure.com/maximerenaud/CHARTBOARD/_apis/build/status/CHARTBOARD?branchName=master
[33]: https://codebuild.eu-west-3.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoiOXBBZTVtMk5nMmJFcG9vVFlGUVh3cHNoWUFoWXlCVjNjNkd1RE9ZWGtpVlBpazBLaHFKaFpsdXRuamdTc1d4ckNuTSttZnNoNzkwZHNyRUZrbndaaGdvPSIsIml2UGFyYW1ldGVyU3BlYyI6IjNHTnRyekcvWER0Wk1uRW4iLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D&branch=master


Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@


setup(
name='Carboard2.0',
name='CHARTBOARD2.0',
version=__version__,
description='Carboard - a flexible solution for creating your dashboards.',
description='CHARTBOARD - a flexible solution for creating your dashboards.',
long_description=README,
long_description_content_type='text/markdown',
url='http://Carboard.allegrogroup.com',
url='http://CHARTBOARD.allegrogroup.com',
author='Allegro Group and Contributors',
author_email='pylabs@allegro.pl',
license='Apache Software License v2.0',
Expand Down
2 changes: 1 addition & 1 deletion src/Chartboard/app/Config/all.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
details:
page_title: Carboard exemple
page_title: CHARTBOARD exemple
color_mode: white
layout:
- row:
Expand Down
6 changes: 3 additions & 3 deletions src/Chartboard/app/Config/properties.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"CarBOARD_TOKEN": "abd581219b534c21be6a3ebe7ae96fda",
"CarBOARD_URL": "http://0.0.0.0:8080/api",
"DEFAULT_CONFIG": "stream",
"CHARTBOARD_TOKEN": "abd581219b534c21be6a3ebe7ae96fda",
"CHARTBOARD_URL": "http://0.0.0.0:8080/api",
"DEFAULT_CONFIG": "streams",
"REDIS_HOST": "0.0.0.0",
"REDIS_PASSWORD": null,
"REDIS_PORT": 6379,
Expand Down
Empty file.
Empty file removed src/Chartboard/app/__init__.py
Empty file.
2 changes: 1 addition & 1 deletion src/Chartboard/app/applicationconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from django.apps import AppConfig


class CarboardConfig(AppConfig):
class CHARTBOARDConfig(AppConfig):
name = 'Chartboard'
verbose_name = 'DjangoBoard'

Expand Down
2 changes: 2 additions & 0 deletions src/Chartboard/app/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def parseXmlLayout(layout_name='default_config'):
cols = [col for col in [[col for col in list(row.values())[0]] for row in rows]]
cols_data = [colsValue for colsList in cols for colsValue in colsList]
config['tiles_conf'] = getTilesConfigFromXml(cols_data)
print(f"(TEST) Congig loaded: {config}")
return config


Expand Down Expand Up @@ -82,6 +83,7 @@ def getDashboardName():
title = config['details']['page_title']
else: # if mulCarle file, need to have the .yaml displayed for the client
title = 'Flipboard Mode'
print(f"(TEST) Congig loaded title: {title}")
except KeyError:
print(f"[ERROR] config {config_names[0]} has no key: details/page_title'", flush=True)
return title
Expand Down
48 changes: 24 additions & 24 deletions src/Chartboard/app/properties.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
import json
import os

PATH_FOR_PIP = 'src.' # Location of Carboard sources
PATH_FOR_PIP = 'src.' # Location of CHARTBOARD sources
CONF_DIR = os.path.dirname(os.path.realpath(__file__)) + '/Config/' # Path of Config directory
PROPERTIES = json.load(open(CONF_DIR + 'properties.json'))
CarBOARD_URL = PROPERTIES['CarBOARD_URL']
CHARTBOARD_URL = PROPERTIES['CHARTBOARD_URL']
REDIS_HOST = PROPERTIES['REDIS_HOST']
REDIS_PORT = PROPERTIES['REDIS_PORT']
REDIS_PASSWORD = PROPERTIES['REDIS_PASSWORD']
REDIS_DB = PROPERTIES['REDIS_DB'] if 'REDIS_DB' in PROPERTIES else 0
BASIC_CONFIG = os.path.join(CONF_DIR, 'default_config.yaml') # Default layout config
API_KEY = PROPERTIES['CarBOARD_TOKEN']
API_KEY = PROPERTIES['CHARTBOARD_TOKEN']
DEBUG = PROPERTIES['DEBUG']
LOG = PROPERTIES['LOG']
BASIC_LAYOUT = 'default_config.yaml'
BASIC_CONFIG = os.path.join(CONF_DIR, PROPERTIES['default_config'] if 'default_config' in PROPERTIES else BASIC_LAYOUT)
CarBOARD_CSS_STYLES = ['css/layout.css']
CarBOARD_JAVASCRIPT_FILES = ['js/websocket.js', # Websocket mecanic
'js/style.js', # color / responsiv / fliping mecanic
'js/Chartboard.js', # all the client Chartboard logic is here
'tiles/chartjs.js', # simplify the chartJs librari usage
'tiles/text_value.js'] # handle all the other tiles mecanic (stream, txt, etc)
CHARTBOARD_CSS_STYLES = ['css/layout.css']
CHARTBOARD_JAVASCRIPT_FILES = ['js/websocket.js', # Websocket mecanic
'js/style.js', # color / responsiv / fliping mecanic
'js/Chartboard.js', # all the client Chartboard logic is here
'tiles/chartjs.js', # simplify the chartJs librari usage
'tiles/text_value.js'] # handle all the other tiles mecanic (stream, txt, etc)
FLIPBOARD_INTERVAL = PROPERTIES['FLIPBOARD_INTERVAL'] if 'FLIPBOARD_INTERVAL' in PROPERTIES else 10

ALLOWED_TILES = ['text', 'simple_percentage', 'listing', 'big_value', 'just_value', # Homemade
Expand All @@ -31,20 +31,20 @@
'iframe', 'stream', 'custom'] # misc

COLOR_TAB = [ # material color
'rgba(66, 165, 245, 0.8)', # blue #42a5f5
'rgba(114, 191, 68, 0.8)', # green #72bf44
'rgba(0, 150, 136, 0.8)', # teal #009688
'rgba(255, 234, 0, 0.8)', # yellow #ffea00
'rgba(255, 152, 0, 0.8)', # orange #ff9800
'rgba(213, 0, 0, 0.8)', # red #d50000
'rgb(240, 98, 146)', # pink #f06292
'rgba(224, 224, 224, 0.8)', # Grey #e0e0e0
'rgb(177, 208, 225)', # Light Blue #b1d0e1
'rgba(121, 85, 72, 0.8)', # Marron #795548
'rgba(149, 117, 205, 0.8)', # purple #9575cd
'rgb(224, 64, 251)', # Light Purple #e040fb
'rgb(48, 79, 254)', # Indigo #304ffe
'rgb(33, 33, 33)' # Black #212121
'rgba(66, 165, 245, 0.8)', # blue #42a5f5
'rgba(114, 191, 68, 0.8)', # green #72bf44
'rgba(0, 150, 136, 0.8)', # teal #009688
'rgba(255, 234, 0, 0.8)', # yellow #ffea00
'rgba(255, 152, 0, 0.8)', # orange #ff9800
'rgba(213, 0, 0, 0.8)', # red #d50000
'rgb(240, 98, 146)', # pink #f06292
'rgba(224, 224, 224, 0.8)', # Grey #e0e0e0
'rgb(177, 208, 225)', # Light Blue #b1d0e1
'rgba(121, 85, 72, 0.8)', # Marron #795548
'rgba(149, 117, 205, 0.8)', # purple #9575cd
'rgb(224, 64, 251)', # Light Purple #e040fb
'rgb(48, 79, 254)', # Indigo #304ffe
'rgb(33, 33, 33)' # Black #212121
]
BACKGROUND_TAB = ['#4caf50', '#ff6d00', '#d50000']
print(f"[DEBUG] Carboard start in DEBUG MODE:{DEBUG} & LOG:{LOG}", flush=True)
print(f"[DEBUG] CHARTBOARD start in DEBUG MODE:{DEBUG} & LOG:{LOG}", flush=True)
4 changes: 2 additions & 2 deletions src/Chartboard/app/routing.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.conf.urls import url
from django.urls import re_path
from src.Chartboard.app.views.wshandler import WSConsumer

websocket_urlpatterns = [
url(r'^communication/websocket$', WSConsumer.as_asgi()),
re_path(r'^communication/websocket$', WSConsumer.as_asgi()),
]
Empty file.
2 changes: 1 addition & 1 deletion src/Chartboard/app/views/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def get_tile(request, tile_key):
if redis.exists(getRedisPrefix(tile_key)):
if request.method == 'DELETE':
redis.delete(tile_key)
httpMessage = 'Tile\'s data deleted.'
httpMessage = f"{tile_key}: tiles data deleted."
if request.method == 'GET':
httpMessage = redis.get(tile_key)
else:
Expand Down
12 changes: 6 additions & 6 deletions src/Chartboard/app/views/flipboard.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
from django.http import JsonResponse, HttpResponse
from django.shortcuts import render
from src.Chartboard.app.parser import parseXmlLayout, getConfigNames, getFlipboardTitles
from src.Chartboard.app.properties import CarBOARD_CSS_STYLES, FLIPBOARD_INTERVAL, CarBOARD_JAVASCRIPT_FILES
from src.Chartboard.app.properties import CHARTBOARD_CSS_STYLES, FLIPBOARD_INTERVAL, CHARTBOARD_JAVASCRIPT_FILES


def renderFlipboardHtml(request):
""" Render the home page(Html flipboard), and start the javascript Chartboard mecanism """
return render(request, 'flipboard.html',
dict(page_title='Carboard',
dict(page_title='CHARTBOARD',
flipboard_interval=FLIPBOARD_INTERVAL,
Carboard_css=CarBOARD_CSS_STYLES,
Carboard_js=CarBOARD_JAVASCRIPT_FILES))
CHARTBOARD_css=CHARTBOARD_CSS_STYLES,
CHARTBOARD_js=CHARTBOARD_JAVASCRIPT_FILES))


def renderDashboardHtmlUniqueDashboard(request, layout_name='default_config', isFlipboard=False):
Expand All @@ -28,8 +28,8 @@ def renderDashboardHtmlUniqueDashboard(request, layout_name='default_config', is
if 'layout' in config:
data = dict(layout=config['layout'],
layout_name=layout_name, page_title=title,
Carboard_css=list() if isFlipboard else CarBOARD_CSS_STYLES,
Carboard_js=list() if isFlipboard else CarBOARD_JAVASCRIPT_FILES,
CHARTBOARD_css=list() if isFlipboard else CHARTBOARD_CSS_STYLES,
CHARTBOARD_js=list() if isFlipboard else CHARTBOARD_JAVASCRIPT_FILES,
color_mode=color_mode)
return render(request, 'dashboard.html' if isFlipboard else 'flipboard.html', data)
msg = f'''
Expand Down
25 changes: 16 additions & 9 deletions src/Chartboard/app/views/wshandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,36 @@ class WSConsumer(WebsocketConsumer):

def connect(self):
async_to_sync(self.channel_layer.group_add)('event', self.channel_name)
self.accept()
res = self.accept()
print(f"(DEBUG) New connection Websocket accepted: {res}")


def disconnect(self, close_code):
async_to_sync(self.channel_layer.group_discard)('event', self.channel_name)
self.close()
res = self.close()
print(f"(DEBUG) Closing websocket accepted: {res}")

def update_tile_receive(self, tile_id, template_name=None):
""" Create or update the tile with value and send to the client with websocket """
tileData = MyCache().get(tile_id=getRedisPrefix(tile_id))
if tileData is None:
print(f'[DEBUG] Building fake data for {tile_id}. with template {template_name}', flush=True)
tileData = buildFakeDataFromTemplate(tile_id, template_name, MyCache())
res = self.send(text_data=tileData)
print(f"(DEBUG) Update_tile_receive for {tile_id}")

def receive(self, text_data, **kwargs):
""" handle msg sended by client, by 2 way: update all tiles or update 1 specific tile """
print(f"(DEBUG) Websocket receive")
if 'first_connection:' in text_data:
print(f"(DEBUG) first_connection: websocket")
listOftiles = listOfTilesFromLayout(text_data.replace('first_connection:/', ''))
for tileId in listOftiles:
self.update_tile_receive(tile_id=tileId, template_name=listOftiles[tileId]['tile_template'])
else:
for tile_id in MyCache().listOfTilesCached():
self.update_tile_receive(tile_id=tile_id)

def update_tile_receive(self, tile_id, template_name=None):
""" Create or update the tile with value and send to the client with websocket """
tileData = MyCache().get(tile_id=getRedisPrefix(tile_id))
if tileData is None:
print(f'[DEBUG] Building fake data for {tile_id}. with template {template_name}', flush=True)
tileData = buildFakeDataFromTemplate(tile_id, template_name, MyCache())
self.send(text_data=tileData)

def update_tile(self, data):
""" send to client a single tile config """
Expand Down
Loading