-
Notifications
You must be signed in to change notification settings - Fork 2
GH-89: (Minimal) System Monitor Plugin (a.k.a. SysMon) #297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 7 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
dd87a29
GH-89: Initial SysMon plugin (functional)
wesleyboar c4cfd35
GH-89: Reference GH-295 for enhancements
wesleyboar 3508020
GH-89: Use system desc as plugin short desc
wesleyboar fdd5566
GH-89: Do not allow SysMon plugin in Text plugin
wesleyboar 8b6cd4f
GH-89: Noop: Fix inaccurate documentation
wesleyboar 9fa50c3
Merge branch 'main' into task/GH-89
wesleyboar ce317c4
GH-89: Remove outdated snippet from frontera-cms
wesleyboar c76c388
GH-89: Update submod to resolve snippet removal
wesleyboar 8ab7562
Merge branch 'main' into task/GH-89
wesleyboar 871676e
GH-89: Add missing helpers.py functions
wesleyboar a36e978
GH-89: Remove unused get_direction_classname
wesleyboar 0d9491f
GH-89: Rename "Sysmon" to "System Monitor"
wesleyboar a2807a2
Merge branch 'main' into task/GH-89
wesleyboar 5ed2892
GH-89: Bugfix: Remove erroneously added plugins
wesleyboar c3db8ea
Merge branch 'main' into task/GH-89
wesleyboar 67ef38b
GH-89: Noop: Add comments about using a class
wesleyboar 30c78a6
GH-89: Support internally unique IDs
wesleyboar 7220bc1
GH-89: Support multiple instances
wesleyboar 333918d
GH-89: Bugfix: Use Bootstrap "warning" pill color
wesleyboar d858a0d
Merge branch 'main' into task/GH-89
wesleyboar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # Sysmon | ||
|
|
||
| This is a _minimal_ conversion of the Frontera Sysmon snippet to a Django CMS plugin. | ||
|
|
||
| > There is a functionally more advanced plugin, [bitbucket:rochaa/tacc-sysmon](https://bitbucket.org/rochaa/tacc-sysmon), which allows: | ||
| > | ||
| > - server-side requests (Python) instead of client-side requests (JavaScript) | ||
| > - multi-system tables | ||
|
|
||
| ## To Do | ||
|
|
||
| - [GH-295](https://github.com/TACC/Core-CMS/issues/295) |
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| from cms.plugin_base import CMSPluginBase | ||
| from cms.plugin_pool import plugin_pool | ||
| from django.utils.translation import gettext_lazy as _ | ||
|
|
||
| from taccsite_cms.contrib.helpers import concat_classnames | ||
| from taccsite_cms.contrib.taccsite_offset.cms_plugins import get_direction_classname | ||
|
|
||
| from .models import TaccsiteSysmon | ||
|
|
||
| @plugin_pool.register_plugin | ||
| class TaccsiteSysmonPlugin(CMSPluginBase): | ||
| """ | ||
| Components > "System Monitor" Plugin | ||
| https://url.to/docs/components/sysmon/ | ||
wesleyboar marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| """ | ||
| module = 'TACC Site' | ||
| model = TaccsiteSysmon | ||
| name = _('System Monitor') | ||
| render_template = 'sysmon.html' | ||
|
|
||
| cache = True | ||
| text_enabled = False | ||
| allow_children = False | ||
|
|
||
| fieldsets = [ | ||
| (_('Single System'), { | ||
| # NOTE: Can GH-295 fix the reload caveat? | ||
| 'description': 'Only a single system may be shown. After editing this plugin, reload the page to load system data.', | ||
| 'fields': ( | ||
| 'system', | ||
| ) | ||
| }), | ||
| (_('Advanced settings'), { | ||
| 'classes': ('collapse',), | ||
| 'fields': ( | ||
| 'attributes', | ||
| ) | ||
| }), | ||
| ] | ||
|
|
||
| # Render | ||
|
|
||
| def render(self, context, instance, placeholder): | ||
| context = super().render(context, instance, placeholder) | ||
| request = context['request'] | ||
|
|
||
| classes = concat_classnames([ | ||
| 's-sysmon', | ||
| instance.attributes.get('class'), | ||
| ]) | ||
| instance.attributes['class'] = classes | ||
|
|
||
| return context | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| DEFAULT_SYSTEM = 'frontera.tacc.utexas.edu' |
29 changes: 29 additions & 0 deletions
29
taccsite_cms/contrib/taccsite_sysmon/migrations/0001_initial.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| # Generated by Django 2.2.16 on 2021-07-30 22:21 | ||
|
|
||
| from django.db import migrations, models | ||
| import django.db.models.deletion | ||
| import djangocms_attributes_field.fields | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| initial = True | ||
|
|
||
| dependencies = [ | ||
| ('cms', '0022_auto_20180620_1551'), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.CreateModel( | ||
| name='TaccsiteSysmon', | ||
| fields=[ | ||
| ('cmsplugin_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, related_name='taccsite_sysmon_taccsitesysmon', serialize=False, to='cms.CMSPlugin')), | ||
| ('system', models.CharField(choices=[('frontera.tacc.utexas.edu', 'Frontera'), ('stampede2.tacc.utexas.edu', 'Stampede2'), ('maverick2.tacc.utexas.edu', 'Maverick2'), ('longhorn.tacc.utexas.edu', 'Longhorn')], default='frontera.tacc.utexas.edu', max_length=255, verbose_name='System')), | ||
| ('attributes', djangocms_attributes_field.fields.AttributesField(default=dict)), | ||
| ], | ||
| options={ | ||
| 'abstract': False, | ||
| }, | ||
| bases=('cms.cmsplugin',), | ||
| ), | ||
| ] |
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| from cms.models.pluginmodel import CMSPlugin | ||
| from django.utils.translation import gettext_lazy as _ | ||
|
|
||
| from django.db import models | ||
|
|
||
| from djangocms_attributes_field import fields | ||
|
|
||
| from taccsite_cms.contrib.helpers import get_choices | ||
|
|
||
| from .constants import DEFAULT_SYSTEM | ||
|
|
||
| # TODO: (Maybe in GH-295) Do not replicate `display_name` data from API | ||
| SYSTEM_DICT = { | ||
wesleyboar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 'frontera.tacc.utexas.edu': { | ||
| 'description': 'Frontera' | ||
| }, | ||
| 'stampede2.tacc.utexas.edu': { | ||
| 'description': 'Stampede2' | ||
| }, | ||
| 'maverick2.tacc.utexas.edu': { | ||
| 'description': 'Maverick2' | ||
| }, | ||
| 'longhorn.tacc.utexas.edu': { | ||
| 'description': 'Longhorn' | ||
| }, | ||
| } | ||
| SYSTEM_CHOICES = get_choices(SYSTEM_DICT) | ||
|
|
||
| class TaccsiteSysmon(CMSPlugin): | ||
| """ | ||
| Components > "System Monitor" Model | ||
| """ | ||
| system = models.CharField( | ||
| verbose_name=_('System'), | ||
| choices=SYSTEM_CHOICES, | ||
| blank=False, | ||
| max_length=255, | ||
| default=DEFAULT_SYSTEM, | ||
| ) | ||
|
|
||
| attributes = fields.AttributesField() | ||
|
|
||
| def get_short_description(self): | ||
| system_choice = SYSTEM_DICT[self.system] | ||
| return system_choice['description'] | ||
86 changes: 86 additions & 0 deletions
86
taccsite_cms/contrib/taccsite_sysmon/static/taccsite_sysmon/css/sysmon.css
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| /* | ||
wesleyboar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| System Monitor a.k.a. SysMon | ||
|
|
||
| Styles for the system monitor table that assumes external code: | ||
|
|
||
| - custom properties | ||
| (for `--global-...`) | ||
| - Bootstrap | ||
| (for badge) | ||
| - Iconworks | ||
| (for icon) | ||
|
|
||
| Styleguide Trumps.Scopes.SystemMonitor | ||
| */ | ||
|
|
||
| /* Container */ | ||
|
|
||
| .s-sysmon { | ||
| font-size: 1.4rem; | ||
| min-width: 320px; | ||
| } | ||
|
|
||
| /* Table */ | ||
|
|
||
| .s-sysmon table { | ||
| /* vert. `padding` + vert. `border-spacing` + `border-width` = 14px */ | ||
| padding: 6px 0; | ||
|
|
||
| border: 1px solid var(--global-color-primary--xx-light); | ||
| border-radius: 9px; | ||
| border-spacing: 14px 7px; /* Overwrite Bootstrap 3 */ | ||
| border-collapse: separate; /* Overwrite Bootstrap 4 */ | ||
| } | ||
| .s-sysmon thead > tr { | ||
| margin-left: 5px; | ||
| margin-right: 5px; | ||
| } | ||
| .s-sysmon th { | ||
| font-weight: var(--bold); | ||
| } | ||
| .s-sysmon td { | ||
| font-weight: var(--medium); | ||
| } | ||
|
|
||
| /* Overwrite Bootstrap Class */ | ||
| .s-sysmon .table { | ||
| margin-bottom: 0px; | ||
| } | ||
| .s-sysmon .table-dark { | ||
| color: var(--global-color-primary--normal); | ||
| background-color: var(--global-color-primary--xx-dark); | ||
| } | ||
| .s-sysmon .table thead th { | ||
| border-bottom: 1px solid var(--global-color-primary--dark); | ||
| } | ||
| .s-sysmon .table th, | ||
| .s-sysmon .table td { | ||
| vertical-align: middle; | ||
| border: none; | ||
| padding: 0 0 5px; | ||
| } | ||
| .s-sysmon .table td { | ||
| padding: 0; | ||
| } | ||
|
|
||
| /* Status Label */ | ||
|
|
||
| .s-sysmon .badge { | ||
| font-family: Roboto; | ||
| } | ||
|
|
||
| /* Overwrite Bootstrap */ | ||
| .s-sysmon .badge { | ||
| border-radius: 3px; | ||
| font-size: 1.3rem; | ||
| font-weight: normal; | ||
| } | ||
| .s-sysmon .badge-warning { | ||
| background-color: var(--global-color-warning--normal); | ||
| color: var(--global-color-primary--xx-light); | ||
| } | ||
|
|
||
| /* Overwrite IconWorks */ | ||
| .s-sysmon .iconworks:before { | ||
| padding-right: 0.5em; | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.