{"id":27122220,"url":"https://github.com/vmapps/dashcards","last_synced_at":"2025-09-01T20:12:35.762Z","repository":{"id":53660624,"uuid":"191026548","full_name":"vmapps/dashcards","owner":"vmapps","description":"Create dashboard with simple cards","archived":false,"fork":false,"pushed_at":"2021-03-20T01:06:55.000Z","size":1193,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-07T11:31:29.694Z","etag":null,"topics":["cards","dashboard","jinja2","plugins","templates"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vmapps.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-06-09T15:58:39.000Z","updated_at":"2019-10-26T15:51:11.000Z","dependencies_parsed_at":"2022-09-23T21:40:30.189Z","dependency_job_id":null,"html_url":"https://github.com/vmapps/dashcards","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/vmapps/dashcards","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmapps%2Fdashcards","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmapps%2Fdashcards/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmapps%2Fdashcards/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmapps%2Fdashcards/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vmapps","download_url":"https://codeload.github.com/vmapps/dashcards/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmapps%2Fdashcards/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273183228,"owners_count":25059812,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-01T02:00:09.058Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cards","dashboard","jinja2","plugins","templates"],"created_at":"2025-04-07T11:26:19.452Z","updated_at":"2025-09-01T20:12:35.739Z","avatar_url":"https://github.com/vmapps.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dashcards\nBuild HTML dashboard using user-defined cards (bootstrap4 support)\n\n## Purpose \nPurpose of this very simple tool is to :\n- build a HTML dashboard using cards \n- cards are kind of plugins that user can develop\n- cards can be called multiple times\n\nThis small project has been first been developed to build a dashboard \nto Raspberry PI devices, to run it through crontab and to share the\nHTML page using a standard web server.\n\n## Requirements\nFollowing python modules are required :\n- [jinja2](http://jinja.pocoo.org/)\n\nModules could be installed using following commands:\n```\n$ pip install -r requirements.txt\n```\n## Configuration\nSettings have to be defined using JSON config file :\n```\n# enable/disable debug mode\n\"debug\": [true|false]\n\n# cards (array of settings)\n{\n\t\"title\": \"\u003cname of the card\u003e\",\n\t\"plugin\": \"\u003cplugin to be used\u003e\",\n\t\"arguments\": [\u003carguments\u003e,\u003csent\u003e,\u003cto\u003e,\u003cplugin\u003e]\n}\n```\nNotes: \n- specific template can be defined in configuration file to replace `\u003cplugin\u003e.html` (default).\n- template name should not contain any extension (`.html` will be automatically added).\n```\n{\n\t\"title\": \"\u003cname of the card\u003e\",\n\t\"plugin\": \"\u003cplugin to be used\u003e\",\n\t\"arguments\": [\u003carguments\u003e,\u003csent\u003e,\u003cto\u003e,\u003cplugin\u003e],\n\t\"template\": \"sample-alternative\"\n}\n```\nDo not forget to rename template file as `config.json`\n```\nmv config-template.json config.json\n```\n## Usage\n```\nusage: dashcards.py [-h] [-d] [-c \u003cfilename\u003e] [-t \u003cdirname\u003e] [-o \u003cfilename\u003e]\n\noptional arguments:\n  -h, --help     show this help message and exit\n  -d, --debug    force debug mode (not used yet)\n  -c \u003cfilename\u003e  config file name (defaut: config.json)\n  -t \u003cdirname\u003e   templates directory name (defaut: templates)\n  -o \u003cfilename\u003e  output file name\n```\n## Templates\nHTML code to be rendered with plugins is located in `templates` directory.\nOption `-t` can be used to specify another directory.\\\nTwo optional files could exist in the templates directory:\n- `_header_.html` content will be pushed at beginning of the HTML output code\n- `_footer_.html` content will be pushed at end of the HTML output code\n\n## Plugins \n#### Structure\nPlugins should respect following rules:\n- been placed into 'plugins' directory\n- plugin code could be named `\u003cplugin\u003e.py`\n- plugin card could be named `\u003cplugin\u003e.html`\n- have declared (at least) variables named : `name`, `version`, `url`, `author`, `contact`, `description`\n- have declared (at least) functions named : `test()`, `run()`\n\n#### Functions\nTwo functions are required for each plugin:\n- `test()` : could be executed in debug mode \n- `run()` : main plugin function called by main program\n- plugin should return a JSON object after execution of `run()`\n- JSON object is then rendered with Jinja2 using plugin HTML template `\u003cplugin\u003e.html`\n\n#### Rendering\nJinja2 templating module is used to render HTML :\n- JSON object returned by plugin is sent to template through variables `render.xxx`\n- card config is available in templates through variables `card.xx` + `card.id` (random)\n- rendering relies on file `\u003cplugin\u003e.html` from templates directory\n- if plugin returns JSON object containing `template`variable, that one will be used as alternative template\n\n## Sample plugin\n#### Python code\n```\n#!/usr/bin/env python3\n\nimport json\n\nname = 'Sample plugin'\nversion = '0.1'\nurl = 'https://githib.com/vmapps/'\nauthor = 'VMapps'\ncontact\t= '31423375+vmapps@users.noreply.github.com'\ndescription = 'Sample plugin for demo'\n\ndef test():\n\treturn name + ' - v' + version\n\ndef run(args):\n\tdata = { 'name':name, \n\t\t'version':version, \n\t\t'description':description, \n\t\t'arg0':args[0], \n\t\t'arg1':args[1] \n\t\t}\n\t# -- template can be changed at runtime --\n\t# if \u003csomething goes wrong\u003e:\n\t#\tdata['template'] = 'sample-danger'\n\treturn data\n```\n\n#### HTML template\n```\n\u003cdiv class=\"card {{ card.plugin }}\" id=\"{{ card.id }}\"\u003e\n\t\u003ch5 class=\"card-header\"\u003e{{ card.title }}\u003c/h5\u003e\n\t\u003cdiv class=\"card-body\"\u003ePlugin items:\n\t\t\u003cli\u003ename : {{ render.name }}\u003c/li\u003e\n\t\t\u003cli\u003eversion : {{ render.version }}\u003c/li\u003e\n\t\t\u003cli\u003edescription : {{ render.description }}\u003c/li\u003e\n\t\t\u003cli\u003eargument #0 : {{ render.arg0 }}\u003c/li\u003e\n\t\t\u003cli\u003eargument #1 : {{ render.arg1 }}\u003c/li\u003e\n\t\u003c/div\u003e\n\t\u003cdiv class=\"card-footer\"\u003eCard config:\n\t\t\u003cli\u003eid: {{ card.id }}\u003c/li\u003e\n\t\t\u003cli\u003etitle: {{ card.title }}\u003c/li\u003e\n\t\t\u003cli\u003eplugin: {{ card.plugin }}\u003c/li\u003e\n\t\t\u003cli\u003earguments: {{ card.arguments }}\u003c/li\u003e\n\t\t\u003cli\u003edummy: {{ card.dummy }}\u003c/li\u003e\n\t\u003c/div\u003e\n\u003c/div\u003e\n```\n\n#### Card configuration\n```\n{\n\t\"title\": \"Test Sample\",\n\t\"plugin\": \"sample\",\n\t\"arguments\": [\"foo\",\"bar\"],\n\t\"dummy\": \"foo/bar\"\n}\n```\n\n#### HTML Output\n```\n\u003cdiv class=\"card sample\" id=\"65f053e29a6043a09fd2b98993d8d91b\"\u003e\n        \u003ch5 class=\"card-header\"\u003eTest Sample\u003c/h5\u003e\n        \u003cdiv class=\"card-body\"\u003ePlugin items:\n                \u003cli\u003ename : Sample plugin\u003c/li\u003e\n                \u003cli\u003eversion : 0.1\u003c/li\u003e\n                \u003cli\u003edescription : Sample plugin for demo\u003c/li\u003e\n                \u003cli\u003eargument #0 : foo\u003c/li\u003e\n                \u003cli\u003eargument #1 : bar\u003c/li\u003e\n        \u003c/div\u003e\n        \u003cdiv class=\"card-footer\"\u003eCard config:\n                \u003cli\u003eid: 65f053e29a6043a09fd2b98993d8d91b\u003c/li\u003e\n                \u003cli\u003etitle: Test Sample\u003c/li\u003e\n                \u003cli\u003eplugin: sample\u003c/li\u003e\n                \u003cli\u003earguments: ['foo', 'bar']\u003c/li\u003e\n                \u003cli\u003edummy: foo/bar\u003c/li\u003e\n        \u003c/div\u003e\n\u003c/div\u003e\n```\n## Sample \n![dashcards](samples/dashcards.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvmapps%2Fdashcards","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvmapps%2Fdashcards","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvmapps%2Fdashcards/lists"}