From 4e40d66ed81e27e4d6a4bbabf23c201c75767229 Mon Sep 17 00:00:00 2001 From: Wesley Bomar Date: Wed, 4 Aug 2021 12:51:47 -0500 Subject: [PATCH 01/16] GH-88: Initial SystemSpecs (see TODO.md) --- .../contrib/taccsite_system_specs/TODO.md | 30 ++++++ .../contrib/taccsite_system_specs/__init__.py | 0 .../taccsite_system_specs/cms_plugins.py | 77 +++++++++++++++ .../taccsite_system_specs/constants.py | 1 + .../migrations/0001_initial.py | 49 ++++++++++ .../migrations/__init__.py | 0 .../contrib/taccsite_system_specs/models.py | 95 +++++++++++++++++++ .../templates/system_specs.html | 66 +++++++++++++ taccsite_cms/settings.py | 1 + 9 files changed, 319 insertions(+) create mode 100644 taccsite_cms/contrib/taccsite_system_specs/TODO.md create mode 100644 taccsite_cms/contrib/taccsite_system_specs/__init__.py create mode 100644 taccsite_cms/contrib/taccsite_system_specs/cms_plugins.py create mode 100644 taccsite_cms/contrib/taccsite_system_specs/constants.py create mode 100644 taccsite_cms/contrib/taccsite_system_specs/migrations/0001_initial.py create mode 100644 taccsite_cms/contrib/taccsite_system_specs/migrations/__init__.py create mode 100644 taccsite_cms/contrib/taccsite_system_specs/models.py create mode 100644 taccsite_cms/contrib/taccsite_system_specs/templates/system_specs.html diff --git a/taccsite_cms/contrib/taccsite_system_specs/TODO.md b/taccsite_cms/contrib/taccsite_system_specs/TODO.md new file mode 100644 index 000000000..7e220c2e8 --- /dev/null +++ b/taccsite_cms/contrib/taccsite_system_specs/TODO.md @@ -0,0 +1,30 @@ +# To Do + +## Preparation for Urgent + +- [x] Re-word "Read More / See All" ticket as "- Styles" ticket. + +## Urgent + +- [x] Undo initial commit and create indpendent branches for: + - [x] `c-see-all-link` → `task/GH-298-add-see-all-component` + - [x] `c-data-list` → `task/GH-75-styles` + - [x] plan for not loading new components in `site.css` → (merged to `main`) + - [x] changes to `taccsite_sysmon` → `task/GH-89` + - [x] changes to `x-truncate` → (merged to `main`) + +## Bugs to Fix + +- [ ] Prevent duplicate entires in "Internal Link". + +## Continued Development + +- [ ] Add "Data List" plugin. → GH-75 +- [ ] Add "Data List Item" plugin. → GH-75 +- [ ] Integrate "Data List(…)" plugins into "System Specs" plugin. +- [x] Create new "See All - Component" ticket. → GH-298 +- [ ] Style the new markup. + +## Related Development Planning + +- [x] Create new "See All - Plugin" ticket. → GH-299 diff --git a/taccsite_cms/contrib/taccsite_system_specs/__init__.py b/taccsite_cms/contrib/taccsite_system_specs/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/taccsite_cms/contrib/taccsite_system_specs/cms_plugins.py b/taccsite_cms/contrib/taccsite_system_specs/cms_plugins.py new file mode 100644 index 000000000..0dff773e5 --- /dev/null +++ b/taccsite_cms/contrib/taccsite_system_specs/cms_plugins.py @@ -0,0 +1,77 @@ +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 .constants import DEFAULT_OTHER_TITLE + +from .models import TaccsiteSystemSpecs + +@plugin_pool.register_plugin +class TaccsiteSystemSpecsPlugin(CMSPluginBase): + """ + Components > "System Specs" Plugin + """ + module = 'TACC Site' + model = TaccsiteSystemSpecs + name = _('System Specs') + render_template = 'system_specs.html' + + cache = True + text_enabled = False + allow_children = False + + fieldsets = [ + (_('System Specifications'), { + 'fields': ( + 'system_desc', + 'system_processor_count', + 'system_processor_type', + 'system_node_ram', + 'system_network', + 'system_performance', + 'system_memory', + ) + }), + (_('Subsystems / Resources'), { + 'fields': ( + 'other_title', + 'other_desc', + ) + }), + (_('Footer link'), { + 'classes': ('collapse',), + 'description': 'The "See All" link at the bottom of the list. "Display name" is the text.', + 'fields': ( + 'name', + ('external_link', 'internal_link'), + ('anchor', 'target'), + ) + }), + (_('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-data_list', + instance.attributes.get('class'), + ]) + instance.attributes['class'] = classes + + context.update({ + 'default_other_title': DEFAULT_OTHER_TITLE, + 'has_other': instance.other_title or instance.other_desc + }) + return context diff --git a/taccsite_cms/contrib/taccsite_system_specs/constants.py b/taccsite_cms/contrib/taccsite_system_specs/constants.py new file mode 100644 index 000000000..c6dc34ceb --- /dev/null +++ b/taccsite_cms/contrib/taccsite_system_specs/constants.py @@ -0,0 +1 @@ +DEFAULT_OTHER_TITLE = 'Subsystems and Associated Resources' diff --git a/taccsite_cms/contrib/taccsite_system_specs/migrations/0001_initial.py b/taccsite_cms/contrib/taccsite_system_specs/migrations/0001_initial.py new file mode 100644 index 000000000..63e14d901 --- /dev/null +++ b/taccsite_cms/contrib/taccsite_system_specs/migrations/0001_initial.py @@ -0,0 +1,49 @@ +# Generated by Django 2.2.16 on 2021-08-02 23:10 + +from django.db import migrations, models +import django.db.models.deletion +import djangocms_attributes_field.fields +import djangocms_link.validators +import filer.fields.file + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('cms', '0022_auto_20180620_1551'), + ('filer', '0012_file_mime_type'), + ] + + operations = [ + migrations.CreateModel( + name='TaccsiteSystemSpecs', + fields=[ + ('template', models.CharField(choices=[('default', 'Default')], default='default', max_length=255, verbose_name='Template')), + ('name', models.CharField(blank=True, max_length=255, verbose_name='Display name')), + ('external_link', models.CharField(blank=True, help_text='Provide a link to an external source.', max_length=2040, validators=[djangocms_link.validators.IntranetURLValidator(intranet_host_re=None)], verbose_name='External link')), + ('anchor', models.CharField(blank=True, help_text='Appends the value only after the internal or external link. Do not include a preceding "#" symbol.', max_length=255, verbose_name='Anchor')), + ('mailto', models.EmailField(blank=True, max_length=255, verbose_name='Email address')), + ('phone', models.CharField(blank=True, max_length=255, verbose_name='Phone')), + ('target', models.CharField(blank=True, choices=[('_blank', 'Open in new window'), ('_self', 'Open in same window'), ('_parent', 'Delegate to parent'), ('_top', 'Delegate to top')], max_length=255, verbose_name='Target')), + ('attributes', djangocms_attributes_field.fields.AttributesField(blank=True, default=dict, verbose_name='Attributes')), + ('cmsplugin_ptr', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, related_name='taccsite_system_specs_taccsitesystemspecs', serialize=False, to='cms.CMSPlugin')), + ('system_desc', models.TextField(blank=True, default='', help_text='Description of the system machine and mission.', verbose_name='System Description')), + ('system_processor_count', models.IntegerField(blank=True, help_text='The number of processors in the system', null=True, verbose_name='Processors')), + ('system_processor_type', models.CharField(blank=True, help_text='The number of processors in the system', max_length=50, verbose_name='Processor Type')), + ('system_node_ram', models.CharField(blank=True, help_text='The amount of RAM in each node of the system, including the unit. (Reminder: Type "GB" for Gigabyte, not "Gb".)', max_length=50, verbose_name='RAM per Node')), + ('system_network', models.CharField(blank=True, help_text='The network hardware in the system. (Reminder: Type "Gb" for Gigabit, not GB.)', max_length=50, verbose_name='Network')), + ('system_performance', models.CharField(blank=True, help_text='The peak performance of the system, including the unit. (Reminder: Type number, then space, then unit; example: "38.8 PetaFLOPS".)', max_length=50, verbose_name='Peak Performance')), + ('system_memory', models.CharField(blank=True, help_text='The amount of memory for the system, including the unit. (Reminder: Type "PB" for Petabyte, not "Pb".)', max_length=50, verbose_name='Memory')), + ('other_title', models.CharField(blank=True, help_text='An alternate title to replace "Subsystems and Associated Resources".', max_length=40, verbose_name='Resources Title')), + ('other_desc', models.TextField(blank=True, default='', help_text='Description of "Subsystems and Associated Resources".', verbose_name='Resources Description')), + ('file_link', filer.fields.file.FilerFileField(blank=True, help_text='If provided links a file from the filer app.', null=True, on_delete=django.db.models.deletion.SET_NULL, to='filer.File', verbose_name='File link')), + ('internal_link', models.ForeignKey(blank=True, help_text='If provided, overrides the external link.', null=True, on_delete=django.db.models.deletion.SET_NULL, to='cms.Page', verbose_name='Internal link')), + ], + options={ + 'abstract': False, + }, + bases=('cms.cmsplugin',), + ), + ] diff --git a/taccsite_cms/contrib/taccsite_system_specs/migrations/__init__.py b/taccsite_cms/contrib/taccsite_system_specs/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/taccsite_cms/contrib/taccsite_system_specs/models.py b/taccsite_cms/contrib/taccsite_system_specs/models.py new file mode 100644 index 000000000..5f41a1054 --- /dev/null +++ b/taccsite_cms/contrib/taccsite_system_specs/models.py @@ -0,0 +1,95 @@ +from django.core.exceptions import ValidationError +from django.utils.translation import gettext_lazy as _ + +from django.db import models + +from djangocms_link.models import AbstractLink + +from taccsite_cms.contrib.helpers import clean_for_abstract_link + +from .constants import DEFAULT_OTHER_TITLE + +class TaccsiteSystemSpecs(AbstractLink): + """ + Components > "System Specs" Model + """ + system_desc = models.TextField( + verbose_name=_('System Description'), + help_text=_('Description of the system machine and mission.'), + blank=True, + default='' + ) + system_processor_count = models.IntegerField( + verbose_name=_('Processors'), + help_text=_('The number of processors in the system'), + blank=True, + null=True, + # HELP: Is it worth it to create a min. value zero to avoid neg. values? + # SEE: https://stackoverflow.com/a/849426/11817077 + # min_value=0, + ) + system_processor_type = models.CharField( + verbose_name=_('Processor Type'), + help_text=_('The number of processors in the system'), + blank=True, + max_length=50, + ) + system_node_ram = models.CharField( + verbose_name=_('RAM per Node'), + help_text=_('The amount of RAM in each node of the system, including the unit. (Reminder: Type "GB" for Gigabyte, not "Gb".)'), + blank=True, + max_length=50, + ) + system_network = models.CharField( + verbose_name=_('Network'), + help_text=_('The network hardware in the system. (Reminder: Type "Gb" for Gigabit, not GB.)'), + blank=True, + max_length=50, + ) + system_performance = models.CharField( + verbose_name=_('Peak Performance'), + help_text=_('The peak performance of the system, including the unit. (Reminder: Type number, then space, then unit; example: "38.8 PetaFLOPS".)'), + blank=True, + max_length=50, + ) + system_memory = models.CharField( + verbose_name=_('Memory'), + help_text=_('The amount of memory for the system, including the unit. (Reminder: Type "PB" for Petabyte, not "Pb".)'), + blank=True, + max_length=50, + ) + + other_title = models.CharField( + verbose_name=_('Resources Title'), + help_text=_('An alternate title to replace "%(default_value)s".') % { 'default_value': DEFAULT_OTHER_TITLE }, + blank=True, + max_length=40, # Based on approx. space available in design + ) + other_desc = models.TextField( + verbose_name=_('Resources Description'), + help_text=_('Description of "%(default_value)s".') % { 'default_value': DEFAULT_OTHER_TITLE }, + blank=True, + default='' + ) + + def get_short_description(self): + return self.system_desc + + + + # Parent + + link_is_optional = True + + class Meta: + abstract = False + + # Validate + def clean(self): + clean_for_abstract_link(__class__, self) + + # If user provided link text, then require link + if self.name and not self.get_link(): + raise ValidationError( + _('Please provide a footer link or delete its display name.'), code='invalid' + ) diff --git a/taccsite_cms/contrib/taccsite_system_specs/templates/system_specs.html b/taccsite_cms/contrib/taccsite_system_specs/templates/system_specs.html new file mode 100644 index 000000000..dc3ecaa66 --- /dev/null +++ b/taccsite_cms/contrib/taccsite_system_specs/templates/system_specs.html @@ -0,0 +1,66 @@ +{% load static %} + +
+ + + + {# System #} + + {# System Intro #} +

System Specifications

+

{{ instance.system_desc }}

+ + {# System Data #} +
+
Processors
+
{{ instance.system_processor_count }}
+
Processor Type
+
{{ instance.system_processor_type }}
+
RAM/Node
+
{{ instance.system_node_ram }}
+
Network
+
{{ instance.system_network }}
+
Peak Performance
+
{{ instance.system_performance }}
+
System Memory
+
{{ instance.system_memory }}
+
+ + {# See All #} + {% if link_url %} + {% spaceless %} + + + {{ link_text|default:"See All" }} + + {% endspaceless %} + {% endif %} + + + + {# Other #} + {% if has_other %} + + {# Other Intro #} +

{{ instance.other_title|default:default_other_title }}

+

{{ instance.other_desc }}

+ + {# Other Data #} + {% if instance.child_plugin_instances %} +
+ {% for plugin_instance in instance.child_plugin_instances %} + {% comment %} +
Key
+
{{ plugin_instance.value }}
+ {% endcomment %} + {# {% render_plugin plugin_instance %} #} + {% endfor %} +
+ {% endif %} + + {% endif %} + + + +
diff --git a/taccsite_cms/settings.py b/taccsite_cms/settings.py index 530c2d3fd..f880812e8 100644 --- a/taccsite_cms/settings.py +++ b/taccsite_cms/settings.py @@ -241,6 +241,7 @@ def getsecrets(): # TODO: Extract TACC CMS UI components into pip-installable plugins # FAQ: The djangocms_bootstrap4 library can serve as an example 'taccsite_cms.contrib.taccsite_sample', + 'taccsite_cms.contrib.taccsite_system_specs', ] # Convert list of paths to list of dotted module names From e5fa6c4658b3f673f484883f661891616b02c349 Mon Sep 17 00:00:00 2001 From: Wesley Bomar Date: Thu, 5 Aug 2021 23:39:16 -0500 Subject: [PATCH 02/16] GH-88: SystemSpecs: Integrate DataList - Add DataList plugin support. - Require description. - Edit "Resources Title" verbose name. - Update To Do list. - Rebuild migrations. - Rebuild specifications using table. --- .../contrib/taccsite_system_specs/TODO.md | 10 ++-- .../taccsite_system_specs/cms_plugins.py | 22 +++++-- .../migrations/0001_initial.py | 8 +-- .../contrib/taccsite_system_specs/models.py | 4 +- .../templates/system_specs.html | 57 +++++++++++-------- 5 files changed, 63 insertions(+), 38 deletions(-) diff --git a/taccsite_cms/contrib/taccsite_system_specs/TODO.md b/taccsite_cms/contrib/taccsite_system_specs/TODO.md index 7e220c2e8..203427d74 100644 --- a/taccsite_cms/contrib/taccsite_system_specs/TODO.md +++ b/taccsite_cms/contrib/taccsite_system_specs/TODO.md @@ -13,15 +13,17 @@ - [x] changes to `taccsite_sysmon` → `task/GH-89` - [x] changes to `x-truncate` → (merged to `main`) -## Bugs to Fix +## Problems to Fix - [ ] Prevent duplicate entires in "Internal Link". +- [ ] Add missing link feature to "Data List Item" plugin. → GH-75 +- [ ] Find makeshift way to list dependency plugins i.e. taccsite_data_list. ## Continued Development -- [ ] Add "Data List" plugin. → GH-75 -- [ ] Add "Data List Item" plugin. → GH-75 -- [ ] Integrate "Data List(…)" plugins into "System Specs" plugin. +- [x] Add "Data List" plugin. → GH-75 +- [x] Add "Data List Item" plugin. → GH-75 +- [x] Integrate "Data List(…)" plugins into "System Specs" plugin. - [x] Create new "See All - Component" ticket. → GH-298 - [ ] Style the new markup. diff --git a/taccsite_cms/contrib/taccsite_system_specs/cms_plugins.py b/taccsite_cms/contrib/taccsite_system_specs/cms_plugins.py index 0dff773e5..be81e400d 100644 --- a/taccsite_cms/contrib/taccsite_system_specs/cms_plugins.py +++ b/taccsite_cms/contrib/taccsite_system_specs/cms_plugins.py @@ -21,10 +21,10 @@ class TaccsiteSystemSpecsPlugin(CMSPluginBase): cache = True text_enabled = False - allow_children = False + allow_children = True fieldsets = [ - (_('System Specifications'), { + (_('Specifications'), { 'fields': ( 'system_desc', 'system_processor_count', @@ -35,12 +35,26 @@ class TaccsiteSystemSpecsPlugin(CMSPluginBase): 'system_memory', ) }), - (_('Subsystems / Resources'), { + (_('Subsystems and/or resources - Introduction'), { 'fields': ( 'other_title', 'other_desc', ) }), + (_('Subsystems and/or resources - Data'), { + 'classes': ('collapse',), + 'description': '\ +
\ +
To add data
\ +
nest a plugin inside this one.
\ +
To edit data
\ +
edit the existing plugin.*
\ +
\ +
\ + * If the existing data is from a plugin not nested within this one, then you should nest it inside this one instead.\ + ', + 'fields': () + }), (_('Footer link'), { 'classes': ('collapse',), 'description': 'The "See All" link at the bottom of the list. "Display name" is the text.', @@ -65,7 +79,7 @@ def render(self, context, instance, placeholder): request = context['request'] classes = concat_classnames([ - 's-data_list', + 's-system-specs', instance.attributes.get('class'), ]) instance.attributes['class'] = classes diff --git a/taccsite_cms/contrib/taccsite_system_specs/migrations/0001_initial.py b/taccsite_cms/contrib/taccsite_system_specs/migrations/0001_initial.py index 63e14d901..9bea875f1 100644 --- a/taccsite_cms/contrib/taccsite_system_specs/migrations/0001_initial.py +++ b/taccsite_cms/contrib/taccsite_system_specs/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 2.2.16 on 2021-08-02 23:10 +# Generated by Django 2.2.16 on 2021-08-06 04:17 from django.db import migrations, models import django.db.models.deletion @@ -12,8 +12,8 @@ class Migration(migrations.Migration): initial = True dependencies = [ - ('cms', '0022_auto_20180620_1551'), ('filer', '0012_file_mime_type'), + ('cms', '0022_auto_20180620_1551'), ] operations = [ @@ -29,14 +29,14 @@ class Migration(migrations.Migration): ('target', models.CharField(blank=True, choices=[('_blank', 'Open in new window'), ('_self', 'Open in same window'), ('_parent', 'Delegate to parent'), ('_top', 'Delegate to top')], max_length=255, verbose_name='Target')), ('attributes', djangocms_attributes_field.fields.AttributesField(blank=True, default=dict, verbose_name='Attributes')), ('cmsplugin_ptr', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, related_name='taccsite_system_specs_taccsitesystemspecs', serialize=False, to='cms.CMSPlugin')), - ('system_desc', models.TextField(blank=True, default='', help_text='Description of the system machine and mission.', verbose_name='System Description')), + ('system_desc', models.TextField(default='', help_text='Description of the system machine and mission.', verbose_name='System Description')), ('system_processor_count', models.IntegerField(blank=True, help_text='The number of processors in the system', null=True, verbose_name='Processors')), ('system_processor_type', models.CharField(blank=True, help_text='The number of processors in the system', max_length=50, verbose_name='Processor Type')), ('system_node_ram', models.CharField(blank=True, help_text='The amount of RAM in each node of the system, including the unit. (Reminder: Type "GB" for Gigabyte, not "Gb".)', max_length=50, verbose_name='RAM per Node')), ('system_network', models.CharField(blank=True, help_text='The network hardware in the system. (Reminder: Type "Gb" for Gigabit, not GB.)', max_length=50, verbose_name='Network')), ('system_performance', models.CharField(blank=True, help_text='The peak performance of the system, including the unit. (Reminder: Type number, then space, then unit; example: "38.8 PetaFLOPS".)', max_length=50, verbose_name='Peak Performance')), ('system_memory', models.CharField(blank=True, help_text='The amount of memory for the system, including the unit. (Reminder: Type "PB" for Petabyte, not "Pb".)', max_length=50, verbose_name='Memory')), - ('other_title', models.CharField(blank=True, help_text='An alternate title to replace "Subsystems and Associated Resources".', max_length=40, verbose_name='Resources Title')), + ('other_title', models.CharField(blank=True, help_text='An alternate title to replace "Subsystems and Associated Resources".', max_length=40, verbose_name='Alternate Resources Title')), ('other_desc', models.TextField(blank=True, default='', help_text='Description of "Subsystems and Associated Resources".', verbose_name='Resources Description')), ('file_link', filer.fields.file.FilerFileField(blank=True, help_text='If provided links a file from the filer app.', null=True, on_delete=django.db.models.deletion.SET_NULL, to='filer.File', verbose_name='File link')), ('internal_link', models.ForeignKey(blank=True, help_text='If provided, overrides the external link.', null=True, on_delete=django.db.models.deletion.SET_NULL, to='cms.Page', verbose_name='Internal link')), diff --git a/taccsite_cms/contrib/taccsite_system_specs/models.py b/taccsite_cms/contrib/taccsite_system_specs/models.py index 5f41a1054..e3941e30d 100644 --- a/taccsite_cms/contrib/taccsite_system_specs/models.py +++ b/taccsite_cms/contrib/taccsite_system_specs/models.py @@ -16,7 +16,7 @@ class TaccsiteSystemSpecs(AbstractLink): system_desc = models.TextField( verbose_name=_('System Description'), help_text=_('Description of the system machine and mission.'), - blank=True, + blank=False, default='' ) system_processor_count = models.IntegerField( @@ -60,7 +60,7 @@ class TaccsiteSystemSpecs(AbstractLink): ) other_title = models.CharField( - verbose_name=_('Resources Title'), + verbose_name=_('Alternate Resources Title'), help_text=_('An alternate title to replace "%(default_value)s".') % { 'default_value': DEFAULT_OTHER_TITLE }, blank=True, max_length=40, # Based on approx. space available in design diff --git a/taccsite_cms/contrib/taccsite_system_specs/templates/system_specs.html b/taccsite_cms/contrib/taccsite_system_specs/templates/system_specs.html index dc3ecaa66..9b2124573 100644 --- a/taccsite_cms/contrib/taccsite_system_specs/templates/system_specs.html +++ b/taccsite_cms/contrib/taccsite_system_specs/templates/system_specs.html @@ -1,4 +1,4 @@ -{% load static %} +{% load cms_tags %}
@@ -11,20 +11,37 @@

System Specifications

{{ instance.system_desc }}

{# System Data #} -
-
Processors
-
{{ instance.system_processor_count }}
-
Processor Type
-
{{ instance.system_processor_type }}
-
RAM/Node
-
{{ instance.system_node_ram }}
-
Network
-
{{ instance.system_network }}
-
Peak Performance
-
{{ instance.system_performance }}
-
System Memory
-
{{ instance.system_memory }}
-
+ {# HELP: Build DataList plugin instance? What if DataList is not installed? #} + {# SEE: https://stackoverflow.com/q/27937448/11817077 #} + {# SEE taccsite_data_list #} + + + + + + + + + + + + + + + + + + + + + + + + + +
Processors{{ instance.system_processor_count }}
Processor Type{{ instance.system_processor_type }}
RAM/Node{{ instance.system_node_ram }}
Network{{ instance.system_network }}
Peak Performance{{ instance.system_performance }}
System Memory{{ instance.system_memory }}
{# See All #} {% if link_url %} @@ -47,17 +64,9 @@

{{ instance.other_title|default:default_other_title }}

{{ instance.other_desc }}

{# Other Data #} - {% if instance.child_plugin_instances %} -
{% for plugin_instance in instance.child_plugin_instances %} - {% comment %} -
Key
-
{{ plugin_instance.value }}
- {% endcomment %} - {# {% render_plugin plugin_instance %} #} + {% render_plugin plugin_instance %} {% endfor %} -
- {% endif %} {% endif %} From 45f07cf9bac85f51a59cf85cca84b210aaead0df Mon Sep 17 00:00:00 2001 From: Wesley Bomar Date: Fri, 6 Aug 2021 00:10:23 -0500 Subject: [PATCH 03/16] GH-88: SystemSpecs: Enable Link (Has Admin Bug) Enable the link by adding missing context variables. TODO: Prevent duplicate entires in "Internal Link". --- taccsite_cms/contrib/taccsite_system_specs/cms_plugins.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/taccsite_cms/contrib/taccsite_system_specs/cms_plugins.py b/taccsite_cms/contrib/taccsite_system_specs/cms_plugins.py index be81e400d..38066fbfe 100644 --- a/taccsite_cms/contrib/taccsite_system_specs/cms_plugins.py +++ b/taccsite_cms/contrib/taccsite_system_specs/cms_plugins.py @@ -86,6 +86,9 @@ def render(self, context, instance, placeholder): context.update({ 'default_other_title': DEFAULT_OTHER_TITLE, - 'has_other': instance.other_title or instance.other_desc + 'has_other': instance.other_title or instance.other_desc, + 'link_url': instance.get_link(), + 'link_text': instance.name, + 'link_target': instance.target }) return context From eba88c0b0ec81afb9415d4ec22208aa3d7864719 Mon Sep 17 00:00:00 2001 From: Wesley Bomar Date: Fri, 6 Aug 2021 12:56:41 -0500 Subject: [PATCH 04/16] GH-88: SystemSpecs: Fix Dup. Internal Link Opt Do not let "Internal Link" have duplicate options. --- taccsite_cms/contrib/taccsite_system_specs/TODO.md | 2 +- taccsite_cms/contrib/taccsite_system_specs/cms_plugins.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/taccsite_cms/contrib/taccsite_system_specs/TODO.md b/taccsite_cms/contrib/taccsite_system_specs/TODO.md index 203427d74..a5a876fda 100644 --- a/taccsite_cms/contrib/taccsite_system_specs/TODO.md +++ b/taccsite_cms/contrib/taccsite_system_specs/TODO.md @@ -15,7 +15,7 @@ ## Problems to Fix -- [ ] Prevent duplicate entires in "Internal Link". +- [x] Prevent duplicate entires in "Internal Link". - [ ] Add missing link feature to "Data List Item" plugin. → GH-75 - [ ] Find makeshift way to list dependency plugins i.e. taccsite_data_list. diff --git a/taccsite_cms/contrib/taccsite_system_specs/cms_plugins.py b/taccsite_cms/contrib/taccsite_system_specs/cms_plugins.py index 38066fbfe..392b5df75 100644 --- a/taccsite_cms/contrib/taccsite_system_specs/cms_plugins.py +++ b/taccsite_cms/contrib/taccsite_system_specs/cms_plugins.py @@ -1,7 +1,8 @@ -from cms.plugin_base import CMSPluginBase from cms.plugin_pool import plugin_pool from django.utils.translation import gettext_lazy as _ +from djangocms_link.cms_plugins import LinkPlugin + from taccsite_cms.contrib.helpers import concat_classnames from taccsite_cms.contrib.taccsite_offset.cms_plugins import get_direction_classname @@ -10,7 +11,7 @@ from .models import TaccsiteSystemSpecs @plugin_pool.register_plugin -class TaccsiteSystemSpecsPlugin(CMSPluginBase): +class TaccsiteSystemSpecsPlugin(LinkPlugin): """ Components > "System Specs" Plugin """ @@ -18,6 +19,8 @@ class TaccsiteSystemSpecsPlugin(CMSPluginBase): model = TaccsiteSystemSpecs name = _('System Specs') render_template = 'system_specs.html' + def get_render_template(self, context, instance, placeholder): + return self.render_template cache = True text_enabled = False From 491c385d6ac019e80d5bbe9a635786a47ab88ecc Mon Sep 17 00:00:00 2001 From: Wesley Bomar Date: Fri, 13 Aug 2021 05:01:52 -0500 Subject: [PATCH 05/16] GH-88: Update submod (merge main) --- taccsite_custom | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/taccsite_custom b/taccsite_custom index 4330d0cda..23ab68ff3 160000 --- a/taccsite_custom +++ b/taccsite_custom @@ -1 +1 @@ -Subproject commit 4330d0cdaf209310567312e3b59878fd7c175494 +Subproject commit 23ab68ff3b1560b16858f9c1e877a3a2354e7e62 From 3fb8a3056478a351432afae77347748fcf70ba3b Mon Sep 17 00:00:00 2001 From: Wesley Bomar Date: Thu, 12 Aug 2021 16:13:13 -0500 Subject: [PATCH 06/16] GH-88: SystemSpecs: Support Sysmon Image DataList For System Monitor, Image / Picture, and DataList: - Limit System Specs child plugins to these. - Style these in System Monitor layout. - Load System Monitor styles via new `app.*` stylesheet. --- .../taccsite_system_specs/cms_plugins.py | 63 ++++++--- .../templates/system_specs.html | 133 ++++++++++-------- .../src/_imports/trumps/s-system-specs.css | 111 +++++++++++++++ .../css/src/app.taccsite_system_specs.css | 7 + 4 files changed, 240 insertions(+), 74 deletions(-) create mode 100644 taccsite_cms/static/site_cms/css/src/_imports/trumps/s-system-specs.css create mode 100644 taccsite_cms/static/site_cms/css/src/app.taccsite_system_specs.css diff --git a/taccsite_cms/contrib/taccsite_system_specs/cms_plugins.py b/taccsite_cms/contrib/taccsite_system_specs/cms_plugins.py index 392b5df75..c437856cd 100644 --- a/taccsite_cms/contrib/taccsite_system_specs/cms_plugins.py +++ b/taccsite_cms/contrib/taccsite_system_specs/cms_plugins.py @@ -3,8 +3,8 @@ from djangocms_link.cms_plugins import LinkPlugin +from taccsite_cms.contrib.constants import TEXT_FOR_NESTED_PLUGIN_CONTENT_ADD from taccsite_cms.contrib.helpers import concat_classnames -from taccsite_cms.contrib.taccsite_offset.cms_plugins import get_direction_classname from .constants import DEFAULT_OTHER_TITLE @@ -25,6 +25,12 @@ def get_render_template(self, context, instance, placeholder): cache = True text_enabled = False allow_children = True + child_classes = [ + 'TaccsiteSysmonPlugin', + 'PicturePlugin', + 'Bootstrap4PicturePlugin', + 'TaccsiteDataListPlugin', + ] fieldsets = [ (_('Specifications'), { @@ -38,6 +44,15 @@ def get_render_template(self, context, instance, placeholder): 'system_memory', ) }), + (_('Footer link'), { + 'classes': ('collapse',), + 'description': 'The "See More Detailed Specs" link at the bottom of the list. "Display name" is for alternate link text.', + 'fields': ( + ('external_link', 'internal_link'), + ('anchor', 'target'), + 'name', + ) + }), (_('Subsystems and/or resources - Introduction'), { 'fields': ( 'other_title', @@ -46,26 +61,27 @@ def get_render_template(self, context, instance, placeholder): }), (_('Subsystems and/or resources - Data'), { 'classes': ('collapse',), - 'description': '\ -
\ -
To add data
\ -
nest a plugin inside this one.
\ -
To edit data
\ -
edit the existing plugin.*
\ -
\ -
\ - * If the existing data is from a plugin not nested within this one, then you should nest it inside this one instead.\ - ', + 'description': TEXT_FOR_NESTED_PLUGIN_CONTENT_ADD.format( + element='data', + plugin_name='Data List' + ), 'fields': () }), - (_('Footer link'), { + (_('Image'), { 'classes': ('collapse',), - 'description': 'The "See All" link at the bottom of the list. "Display name" is the text.', - 'fields': ( - 'name', - ('external_link', 'internal_link'), - ('anchor', 'target'), - ) + 'description': TEXT_FOR_NESTED_PLUGIN_CONTENT_ADD.format( + element='an image', + plugin_name='(…) Image' + ), + 'fields': () + }), + (_('System monitor'), { + 'classes': ('collapse',), + 'description': TEXT_FOR_NESTED_PLUGIN_CONTENT_ADD.format( + element='a system monitor', + plugin_name='(…) System Monitor' + ), + 'fields': () }), (_('Advanced settings'), { 'classes': ('collapse',), @@ -87,6 +103,17 @@ def render(self, context, instance, placeholder): ]) instance.attributes['class'] = classes + # To identify child plugins + for plugin_instance in instance.child_plugin_instances: + print(type(plugin_instance).__name__) + if (type(plugin_instance).__name__ == 'TaccsiteSysmon'): + context.update({ 'sysmon_plugin': plugin_instance }) + if (type(plugin_instance).__name__ == 'Picture' or + type(plugin_instance).__name__ == 'Bootstrap4Picture'): + context.update({ 'image_plugin': plugin_instance }) + if (type(plugin_instance).__name__ == 'TaccsiteDataList'): + context.update({ 'data_plugin': plugin_instance }) + context.update({ 'default_other_title': DEFAULT_OTHER_TITLE, 'has_other': instance.other_title or instance.other_desc, diff --git a/taccsite_cms/contrib/taccsite_system_specs/templates/system_specs.html b/taccsite_cms/contrib/taccsite_system_specs/templates/system_specs.html index 9b2124573..5590501f0 100644 --- a/taccsite_cms/contrib/taccsite_system_specs/templates/system_specs.html +++ b/taccsite_cms/contrib/taccsite_system_specs/templates/system_specs.html @@ -1,73 +1,94 @@ -{% load cms_tags %} +{% load cms_tags static %} -
+ +
- {# System #} - {# System Intro #} -

System Specifications

-

{{ instance.system_desc }}

- - {# System Data #} - {# HELP: Build DataList plugin instance? What if DataList is not installed? #} - {# SEE: https://stackoverflow.com/q/27937448/11817077 #} - {# SEE taccsite_data_list #} - - - - - - - - - - - - - - - - - - - - - - - - - -
Processors{{ instance.system_processor_count }}
Processor Type{{ instance.system_processor_type }}
RAM/Node{{ instance.system_node_ram }}
Network{{ instance.system_network }}
Peak Performance{{ instance.system_performance }}
System Memory{{ instance.system_memory }}
- - {# See All #} - {% if link_url %} - {% spaceless %} - - - {{ link_text|default:"See All" }} - - {% endspaceless %} + {# Image & Monitor #} + {% if image_plugin or sysmon_plugin %} +
+ {% if image_plugin %} + {% render_plugin image_plugin %} + {% endif %} + {% if sysmon_plugin %} +
+ {% render_plugin sysmon_plugin %} +
+ {% endif %} +
{% endif %} + {# System #} +
+ {# System Intro #} +

System Specifications

+

{{ instance.system_desc }}

+ + {# System Data #} + {# HELP: Build DataList plugin instance? What if DataList is not installed? #} + {# SEE: https://stackoverflow.com/q/27937448/11817077 #} + {# SEE taccsite_data_list #} + + + + + + + + + + + + + + + + + + + + + + + + + +
Processors{{ instance.system_processor_count }}
Processor Type{{ instance.system_processor_type }}
RAM/Node{{ instance.system_node_ram }}
Network{{ instance.system_network }}
Peak Performance{{ instance.system_performance }}
System Memory{{ instance.system_memory }}
+ + {# System Link #} + {% if link_url %} + {% spaceless %} + + + {{ link_text|default:"See More Detailed Specs" }} + + {% endspaceless %} + {% endif %} +
+ + + {# Other #} {% if has_other %} + {% endif %} diff --git a/taccsite_cms/static/site_cms/css/src/_imports/trumps/s-system-specs.css b/taccsite_cms/static/site_cms/css/src/_imports/trumps/s-system-specs.css new file mode 100644 index 000000000..a1b4a5ef2 --- /dev/null +++ b/taccsite_cms/static/site_cms/css/src/_imports/trumps/s-system-specs.css @@ -0,0 +1,111 @@ +/* +System Specifications + +Styles for System Specifications content which assumes external code: + +- custom properties + (for `--global-...`) +- `c-data-list` + (for "Data List") +- `s-sysmon` + (for "System Monitor") + +Styleguide Trumps.Scopes.SystemSpecs +*/ +@import url("_imports/tools/media-queries.css"); + + + +/* Layout */ + +@media only screen and (--narrow-and-above) { + .s-system-specs { + display: flow-root; + } + .s-system-specs > * { + display: inline-block; + } + .s-system-specs > figure { + float: left; + } +} + + + +/* Spacing */ + +.s-system-specs { + --row-height: 32px; +} + +.s-system-specs > aside { + margin-top: var(--row-height); +} + +@media only screen and (--medium-and-below) { + .s-system-specs > figure { + margin-bottom: var(--row-height); + } +} + + + +/* Sizes */ + +@media only screen and (--medium-and-above) { + .s-system-specs { + --col-width--thin: 42%; + --col-width--wide: 48%; + --col-gutter: 10%; + --col-padding: 40px; + + padding-inline: var(--col-padding); + } + .s-system-specs > div, + .s-system-specs > aside { + width: var(--col-width--thin); + padding-inline: var(--col-padding); + } + .s-system-specs > figure { + width: var(--col-width--wide); + margin-right: var(--col-gutter); + } +} + + + +/* Position */ + +.s-system-specs > figure > img { + display: block; /* to support margin */ +} +.s-system-specs > figure > figcaption { + /* To nudge upward on top of image */ + position: relative; /* to prevent image from appearing on top */ + margin-top: -40px; +} + +@media only screen and (--medium-and-below) { + .s-system-specs > figure > img { + /* To center horizontally */ + width: 60%; + margin-left: auto; + margin-right: auto; + } +} +@media only screen and (--medium-and-above) { + .s-system-specs > figure > figcaption { + /* To center horizontally */ + width: 80%; + margin-left: auto; + margin-right: auto; + } +} + + + +/* Components */ + +.s-system-specs .c-data-list__key a { + font-weight: var(--medium); +} diff --git a/taccsite_cms/static/site_cms/css/src/app.taccsite_system_specs.css b/taccsite_cms/static/site_cms/css/src/app.taccsite_system_specs.css new file mode 100644 index 000000000..330df832e --- /dev/null +++ b/taccsite_cms/static/site_cms/css/src/app.taccsite_system_specs.css @@ -0,0 +1,7 @@ +/* DO NOT ADD STYLES HERE; ONLY IMPORT OTHER STYLESHEETS */ + +/* Organize via ITCSS */ +/* SEE: https://confluence.tacc.utexas.edu/x/IAA9Cw */ + +/* TRUMPS */ +@import url("_imports/trumps/s-system-specs.css"); From e5748a1afdb5866e45417388e544aabad46c2855 Mon Sep 17 00:00:00 2001 From: Wesley Bomar Date: Thu, 12 Aug 2021 16:47:37 -0500 Subject: [PATCH 07/16] GH-88: SystemSpecs: Fix Bug using Generic Image --- .../static/site_cms/css/src/_imports/trumps/s-system-specs.css | 1 + 1 file changed, 1 insertion(+) diff --git a/taccsite_cms/static/site_cms/css/src/_imports/trumps/s-system-specs.css b/taccsite_cms/static/site_cms/css/src/_imports/trumps/s-system-specs.css index a1b4a5ef2..f708d059f 100644 --- a/taccsite_cms/static/site_cms/css/src/_imports/trumps/s-system-specs.css +++ b/taccsite_cms/static/site_cms/css/src/_imports/trumps/s-system-specs.css @@ -77,6 +77,7 @@ Styleguide Trumps.Scopes.SystemSpecs /* Position */ .s-system-specs > figure > img { + width: 100%; display: block; /* to support margin */ } .s-system-specs > figure > figcaption { From 2c28f4a403b3baccb35a59ebeab86d3eb711fa81 Mon Sep 17 00:00:00 2001 From: Wesley Bomar Date: Fri, 13 Aug 2021 05:04:32 -0500 Subject: [PATCH 08/16] GH-88: Set plugin font size and weight --- .../site_cms/css/src/_imports/trumps/s-system-specs.css | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/taccsite_cms/static/site_cms/css/src/_imports/trumps/s-system-specs.css b/taccsite_cms/static/site_cms/css/src/_imports/trumps/s-system-specs.css index f708d059f..a5ed1af11 100644 --- a/taccsite_cms/static/site_cms/css/src/_imports/trumps/s-system-specs.css +++ b/taccsite_cms/static/site_cms/css/src/_imports/trumps/s-system-specs.css @@ -16,6 +16,15 @@ Styleguide Trumps.Scopes.SystemSpecs +/* Cascade */ + +.s-system-specs { + font-size: var(--global-font-size--small); + font-weight: var(--global-font-size--medium); +} + + + /* Layout */ @media only screen and (--narrow-and-above) { From 5f5eb56e6339464619266632b64e66319c5532ed Mon Sep 17 00:00:00 2001 From: Wesley Bomar Date: Fri, 13 Aug 2021 06:00:21 -0500 Subject: [PATCH 09/16] GH-88: Document support for app stylesheets --- taccsite_cms/static/site_cms/css/src/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/taccsite_cms/static/site_cms/css/src/README.md b/taccsite_cms/static/site_cms/css/src/README.md index abb4a9601..1a94e6a09 100644 --- a/taccsite_cms/static/site_cms/css/src/README.md +++ b/taccsite_cms/static/site_cms/css/src/README.md @@ -23,6 +23,7 @@ _This directory exists in `static/` __only__ because it is customary, using Djan | `site(.*).css` | styles that apply to the entire website i.e. global styles | `template.*.css` | styles that apply only to certain templates | `page.*.css` | styles that apply only to certain pages +| `app.*.css` | styles that apply only to certain apps (a.k.a. plugins) ## Documentation Format From 732b99c926cf4a7e6a5eeb82be90b03309a674b6 Mon Sep 17 00:00:00 2001 From: Wesley Bomar Date: Fri, 13 Aug 2021 06:19:25 -0500 Subject: [PATCH 10/16] =?UTF-8?q?GH-88:=20Fix=20incorrect=20var=20name=20(?= =?UTF-8?q?font-size=E2=86=92weight)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../static/site_cms/css/src/_imports/trumps/s-system-specs.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/taccsite_cms/static/site_cms/css/src/_imports/trumps/s-system-specs.css b/taccsite_cms/static/site_cms/css/src/_imports/trumps/s-system-specs.css index a5ed1af11..691c3cef9 100644 --- a/taccsite_cms/static/site_cms/css/src/_imports/trumps/s-system-specs.css +++ b/taccsite_cms/static/site_cms/css/src/_imports/trumps/s-system-specs.css @@ -20,7 +20,7 @@ Styleguide Trumps.Scopes.SystemSpecs .s-system-specs { font-size: var(--global-font-size--small); - font-weight: var(--global-font-size--medium); + font-weight: var(--global-font-weight--medium); } From c2616c0de47fa78d3cba9c7dd047ce1e8b1971f4 Mon Sep 17 00:00:00 2001 From: Wesley Bomar Date: Mon, 16 Aug 2021 15:26:23 -0500 Subject: [PATCH 11/16] GH-88: Rename child plugin Sysmon to SystemMonitor This prepares for the rename that occurs in task/GH-89. --- taccsite_cms/contrib/taccsite_system_specs/cms_plugins.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/taccsite_cms/contrib/taccsite_system_specs/cms_plugins.py b/taccsite_cms/contrib/taccsite_system_specs/cms_plugins.py index c437856cd..3b857a80e 100644 --- a/taccsite_cms/contrib/taccsite_system_specs/cms_plugins.py +++ b/taccsite_cms/contrib/taccsite_system_specs/cms_plugins.py @@ -26,7 +26,7 @@ def get_render_template(self, context, instance, placeholder): text_enabled = False allow_children = True child_classes = [ - 'TaccsiteSysmonPlugin', + 'TaccsiteSystemMonitorPlugin', 'PicturePlugin', 'Bootstrap4PicturePlugin', 'TaccsiteDataListPlugin', @@ -106,7 +106,7 @@ def render(self, context, instance, placeholder): # To identify child plugins for plugin_instance in instance.child_plugin_instances: print(type(plugin_instance).__name__) - if (type(plugin_instance).__name__ == 'TaccsiteSysmon'): + if (type(plugin_instance).__name__ == 'TaccsiteSystemMonitor'): context.update({ 'sysmon_plugin': plugin_instance }) if (type(plugin_instance).__name__ == 'Picture' or type(plugin_instance).__name__ == 'Bootstrap4Picture'): From a64592daf7448a1983aa27100c5d50fbd9a0abdb Mon Sep 17 00:00:00 2001 From: Wesley Bomar Date: Fri, 20 Aug 2021 12:58:00 -0500 Subject: [PATCH 12/16] GH-88: Add missing taccsite helper and constant --- taccsite_cms/contrib/constants.py | 10 ++++++++ taccsite_cms/contrib/helpers.py | 38 +++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/taccsite_cms/contrib/constants.py b/taccsite_cms/contrib/constants.py index 169450392..78c2388be 100644 --- a/taccsite_cms/contrib/constants.py +++ b/taccsite_cms/contrib/constants.py @@ -1,3 +1,13 @@ +TEXT_FOR_NESTED_PLUGIN_CONTENT_ADD = '\ +
\ +
To add {element},
\ +
nest "{plugin_name}" plugin inside this plugin.
\ +
To edit {element},
\ +
edit existing nested "{plugin_name}" plugin.*
\ +
\ +
\ +* If the existing content is from a plugin not nested within this one, then you should nest it inside this one instead.' + TEXT_FOR_NESTED_PLUGIN_CONTENT_SWAP = '\
\
To add {element},
\ diff --git a/taccsite_cms/contrib/helpers.py b/taccsite_cms/contrib/helpers.py index f26f86cf5..baae5a6a0 100644 --- a/taccsite_cms/contrib/helpers.py +++ b/taccsite_cms/contrib/helpers.py @@ -29,3 +29,41 @@ def concat_classnames(classes): # GH-93, GH-142, GH-133: Upcoming functions here (ease merge conflict, maybe) + + + +# SEE: https://github.com/django-cms/djangocms-link/blob/3.0.0/djangocms_link/models.py#L48 +def clean_for_abstract_link(model, self): + """ + Intercept and manipulate validation on `AbstractLink` so that it suits TACC's minimal subclassing of it. (To catch only parent validation errors, not custom ones, run this before any custom validation.) + Usage: + ``` + from taccsite_cms.contrib.helpers import clean_for_abstract_link + # Validate + def clean(self): + clean_for_abstract_link(__class__, self) + ... + ``` + """ + + # Bypass irrelevant parent validation + # SEE: ./_docs/how-to-override-validation-error-from-parent-model.md + try: + super(model, self).clean() + except ValidationError as err: + # Intercept multi-field errors + if hasattr(err, 'error_dict'): + for field, errors in err.message_dict.items(): + # Reduce verbosity of original error message + # FAQ: Original error message assumes more fields exist + indices = get_indices_that_start_with( + 'Only one of ', errors + ) + for i in indices: + err.error_dict[field] = ValidationError( + _('Only one of External link or Internal link may be given.'), code='invalid') + + if len(err.messages) == 0: + pass + else: + raise err From 0bfb57fe35fa3d9966cb5ebc507bc9a23f59dcf6 Mon Sep 17 00:00:00 2001 From: Wesley Bomar Date: Mon, 23 Aug 2021 15:03:21 -0500 Subject: [PATCH 13/16] GH-88: Noop: Cleanup --- .../contrib/taccsite_system_specs/TODO.md | 32 ------------------- .../taccsite_system_specs/cms_plugins.py | 1 - .../src/_imports/trumps/s-system-specs.css | 4 --- 3 files changed, 37 deletions(-) delete mode 100644 taccsite_cms/contrib/taccsite_system_specs/TODO.md diff --git a/taccsite_cms/contrib/taccsite_system_specs/TODO.md b/taccsite_cms/contrib/taccsite_system_specs/TODO.md deleted file mode 100644 index a5a876fda..000000000 --- a/taccsite_cms/contrib/taccsite_system_specs/TODO.md +++ /dev/null @@ -1,32 +0,0 @@ -# To Do - -## Preparation for Urgent - -- [x] Re-word "Read More / See All" ticket as "- Styles" ticket. - -## Urgent - -- [x] Undo initial commit and create indpendent branches for: - - [x] `c-see-all-link` → `task/GH-298-add-see-all-component` - - [x] `c-data-list` → `task/GH-75-styles` - - [x] plan for not loading new components in `site.css` → (merged to `main`) - - [x] changes to `taccsite_sysmon` → `task/GH-89` - - [x] changes to `x-truncate` → (merged to `main`) - -## Problems to Fix - -- [x] Prevent duplicate entires in "Internal Link". -- [ ] Add missing link feature to "Data List Item" plugin. → GH-75 -- [ ] Find makeshift way to list dependency plugins i.e. taccsite_data_list. - -## Continued Development - -- [x] Add "Data List" plugin. → GH-75 -- [x] Add "Data List Item" plugin. → GH-75 -- [x] Integrate "Data List(…)" plugins into "System Specs" plugin. -- [x] Create new "See All - Component" ticket. → GH-298 -- [ ] Style the new markup. - -## Related Development Planning - -- [x] Create new "See All - Plugin" ticket. → GH-299 diff --git a/taccsite_cms/contrib/taccsite_system_specs/cms_plugins.py b/taccsite_cms/contrib/taccsite_system_specs/cms_plugins.py index 3b857a80e..250ffc4c1 100644 --- a/taccsite_cms/contrib/taccsite_system_specs/cms_plugins.py +++ b/taccsite_cms/contrib/taccsite_system_specs/cms_plugins.py @@ -105,7 +105,6 @@ def render(self, context, instance, placeholder): # To identify child plugins for plugin_instance in instance.child_plugin_instances: - print(type(plugin_instance).__name__) if (type(plugin_instance).__name__ == 'TaccsiteSystemMonitor'): context.update({ 'sysmon_plugin': plugin_instance }) if (type(plugin_instance).__name__ == 'Picture' or diff --git a/taccsite_cms/static/site_cms/css/src/_imports/trumps/s-system-specs.css b/taccsite_cms/static/site_cms/css/src/_imports/trumps/s-system-specs.css index 691c3cef9..eac88787b 100644 --- a/taccsite_cms/static/site_cms/css/src/_imports/trumps/s-system-specs.css +++ b/taccsite_cms/static/site_cms/css/src/_imports/trumps/s-system-specs.css @@ -3,12 +3,8 @@ System Specifications Styles for System Specifications content which assumes external code: -- custom properties - (for `--global-...`) - `c-data-list` (for "Data List") -- `s-sysmon` - (for "System Monitor") Styleguide Trumps.Scopes.SystemSpecs */ From b57e072b16b46a040a515b8501bb908f301ad491 Mon Sep 17 00:00:00 2001 From: Wesley Bomar Date: Wed, 25 Aug 2021 10:43:42 -0500 Subject: [PATCH 14/16] GH-88: Do not allow Bootstrap Picture --- taccsite_cms/contrib/taccsite_system_specs/cms_plugins.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/taccsite_cms/contrib/taccsite_system_specs/cms_plugins.py b/taccsite_cms/contrib/taccsite_system_specs/cms_plugins.py index 250ffc4c1..47231f77a 100644 --- a/taccsite_cms/contrib/taccsite_system_specs/cms_plugins.py +++ b/taccsite_cms/contrib/taccsite_system_specs/cms_plugins.py @@ -28,7 +28,6 @@ def get_render_template(self, context, instance, placeholder): child_classes = [ 'TaccsiteSystemMonitorPlugin', 'PicturePlugin', - 'Bootstrap4PicturePlugin', 'TaccsiteDataListPlugin', ] @@ -107,8 +106,7 @@ def render(self, context, instance, placeholder): for plugin_instance in instance.child_plugin_instances: if (type(plugin_instance).__name__ == 'TaccsiteSystemMonitor'): context.update({ 'sysmon_plugin': plugin_instance }) - if (type(plugin_instance).__name__ == 'Picture' or - type(plugin_instance).__name__ == 'Bootstrap4Picture'): + if (type(plugin_instance).__name__ == 'Picture'): context.update({ 'image_plugin': plugin_instance }) if (type(plugin_instance).__name__ == 'TaccsiteDataList'): context.update({ 'data_plugin': plugin_instance }) From 755fbbd83383d58d2b488881e145890b2eef7420 Mon Sep 17 00:00:00 2001 From: "W. Bomar" <62723358+tacc-wbomar@users.noreply.github.com> Date: Wed, 29 Sep 2021 12:29:42 -0500 Subject: [PATCH 15/16] GH-88: Reduce verbosity of helpers.py clean_for_abstract_link Co-authored-by: Ian Park --- taccsite_cms/contrib/helpers.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/taccsite_cms/contrib/helpers.py b/taccsite_cms/contrib/helpers.py index baae5a6a0..c91d11d58 100644 --- a/taccsite_cms/contrib/helpers.py +++ b/taccsite_cms/contrib/helpers.py @@ -63,7 +63,5 @@ def clean(self): err.error_dict[field] = ValidationError( _('Only one of External link or Internal link may be given.'), code='invalid') - if len(err.messages) == 0: - pass - else: + if len(err.messages): raise err From f32ac3894ac8aa0b7785d3bfc5366cdca6936a63 Mon Sep 17 00:00:00 2001 From: Wesley Bomar Date: Wed, 29 Sep 2021 12:52:05 -0500 Subject: [PATCH 16/16] GH-88: Set desc limits --- .../migrations/0002_limit_desc_length.py | 25 +++++++++++++++++++ .../contrib/taccsite_system_specs/models.py | 2 ++ 2 files changed, 27 insertions(+) create mode 100644 taccsite_cms/contrib/taccsite_system_specs/migrations/0002_limit_desc_length.py diff --git a/taccsite_cms/contrib/taccsite_system_specs/migrations/0002_limit_desc_length.py b/taccsite_cms/contrib/taccsite_system_specs/migrations/0002_limit_desc_length.py new file mode 100644 index 000000000..eeed45a60 --- /dev/null +++ b/taccsite_cms/contrib/taccsite_system_specs/migrations/0002_limit_desc_length.py @@ -0,0 +1,25 @@ +# Generated by Django 2.2.16 on 2021-09-29 17:51 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + replaces = [('taccsite_system_specs', '0002_auto_20210929_1238'), ('taccsite_system_specs', '0003_auto_20210929_1247')] + + dependencies = [ + ('taccsite_system_specs', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='taccsitesystemspecs', + name='system_desc', + field=models.TextField(default='', help_text='Description of the system machine and mission.', max_length=500, verbose_name='System Description'), + ), + migrations.AlterField( + model_name='taccsitesystemspecs', + name='other_desc', + field=models.TextField(blank=True, default='', help_text='Description of "Subsystems and Associated Resources".', max_length=500, verbose_name='Resources Description'), + ), + ] diff --git a/taccsite_cms/contrib/taccsite_system_specs/models.py b/taccsite_cms/contrib/taccsite_system_specs/models.py index e3941e30d..a1b09c067 100644 --- a/taccsite_cms/contrib/taccsite_system_specs/models.py +++ b/taccsite_cms/contrib/taccsite_system_specs/models.py @@ -17,6 +17,7 @@ class TaccsiteSystemSpecs(AbstractLink): verbose_name=_('System Description'), help_text=_('Description of the system machine and mission.'), blank=False, + max_length=500, default='' ) system_processor_count = models.IntegerField( @@ -69,6 +70,7 @@ class TaccsiteSystemSpecs(AbstractLink): verbose_name=_('Resources Description'), help_text=_('Description of "%(default_value)s".') % { 'default_value': DEFAULT_OTHER_TITLE }, blank=True, + max_length=500, default='' )