-
Notifications
You must be signed in to change notification settings - Fork 10
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
NEW Showing framework/CMS version on module report #55
NEW Showing framework/CMS version on module report #55
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall! Just a couple of points regarding the extensibility of these changes
src/Reports/SiteSummary.php
Outdated
|
||
$fields->insertAfter('ReportDescription', new LiteralField( | ||
'Version', '<p><strong>' . _t(__CLASS__ . '.VERSION', 'Version: ') . $this->resolveCmsVersion() . '</strong></p>' | ||
)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only concern I have with this is that you're adding the field after the extension point, so the update method won't affect it for other devs who might want to remove or modify this field.
Can you switch to using the beforeUpdateCMSFields
callback?
$this->beforeUpdateCMSFields(function (FieldList $fields) {
$fields->insertAfter...
});
return parent::getCMSFields();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
beforeUpdateCMSFields
isn't available in SS_Report
which doesn't extend DataObject
but I can use $this->beforeExtending('updateCMSFields', $callback);
I guess?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect, cheers
src/Reports/SiteSummary.php
Outdated
'silverstripe/framework' => 'Framework', | ||
'silverstripe/cms' => 'CMS', | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it'd be good to provide this array to extensions, rather than define it as a fallback, e.g.:
$versionModules = array(...);
$this->extend('updateVersionModules', $versionModules);
...
We could expect extensions to modify the array by reference
2e5878c
to
033abfd
Compare
033abfd
to
d8fde1f
Compare
We also need a CWP pull request for this. I'd suggest you make it against the 1 (next minor) branch of the cwp/cwp module. We need to ensure that the framework version is removed in the CWP extension, so it'd read something like |
src/Reports/SiteSummary.php
Outdated
$this->beforeExtending('updateCMSFields', function (FieldList $fields) { | ||
$fields->insertAfter('ReportDescription', new LiteralField( | ||
'Version', | ||
'<p><strong>' . _t(__CLASS__ . '.VERSION', 'Version: ') . $this->resolveCmsVersion() . '</strong></p>' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should make this an <h3>
tag. There's an h2 in the report heading, so this would make sense as the next semantic step (and might align a little more closely with the designs)
We also need this to appear between the actions toolbar (added in #36) and the main GridField rather than above the actions toolbar. |
1ea1b10
to
2b7e20c
Compare
I have moved the version to be below the action buttons now. I've also addressed #60 in this PR too. |
2b7e20c
to
de4aac7
Compare
src/Forms/GridFieldHtmlFragment.php
Outdated
@@ -0,0 +1,35 @@ | |||
<?php | |||
|
|||
class GridFieldHtmlFragment implements GridField_HTMLProvider |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a phpdoc for this class please to explain what it does? Also I think the "button" references are misleading
src/Forms/GridFieldHtmlFragment.php
Outdated
|
||
/** | ||
* @param string Fragment to write the button to. | ||
* @param string An HTML fragment to render |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing PHPDoc variable names
src/Reports/SiteSummary.php
Outdated
) | ||
->getComponentByType(GridFieldExportButton::class) | ||
->setExportColumns( | ||
Package::create()->summaryFields() | ||
); | ||
return $grid; | ||
} | ||
|
||
/** | ||
* @return string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a description of what this is doing
9b01050
to
a70ffdc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One minor change, but otherwise looks great :)
src/Reports/SiteSummary.php
Outdated
]; | ||
$this->extend('updateVersionModules', $versionModules); | ||
|
||
$records = $this->sourceRecords()->filter('name', array_keys($versionModules)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe name
should be Name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done 👍
a70ffdc
to
424af55
Compare
Added a CWP PR: silverstripe/cwp#85 |
css/sitesummary.css
Outdated
@@ -2,6 +2,11 @@ | |||
display:block; | |||
} | |||
|
|||
.cms .ss-gridfield > div.site-summary__clearfix { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use BEM in order to avoid having this kind of specificity - can you please just reference .site-summary__clearfix
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately there's a margin being added to .cms .ss-gridfield > div
that wins out on specificity. I could reduce the selector to something like .cms div.site-summary__clearfix
or I could put an !important
in. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use an aside
instead? :>
(I'm not sure if I'm being all that serious here, but would that be semantically correct, out of interest?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok in that case keep it as it is. Can you maybe add a wee comment saying that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done 👍 . @NightJar Asides should be "tangentially related" so I guess it could be appropriate...
… Framework on the installed module report
c14c5c2
to
e1643e4
Compare
src/Reports/SiteSummary.php
Outdated
@@ -67,21 +54,61 @@ public function columns() | |||
public function getReportField() | |||
{ | |||
Requirements::css('silverstripe-maintenance/css/sitesummary.css'); | |||
|
|||
/** @var GridField $gridField */ | |||
$gridField = parent::getReportField(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add this doc block back in?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Bad merge conflict resolution I guess :\ - Adding a docblock for the $config
var right below it too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is less necessary, but won't hurt
e1643e4
to
f886720
Compare
src/Reports/SiteSummary.php
Outdated
->getComponentByType(GridFieldExportButton::class) | ||
->setExportColumns( | ||
Package::create()->summaryFields() | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two lines are merge conflict resolution errors - they're on 65/66 now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep I'm blind. Thanks
f886720
to
f338089
Compare
This adds a paragraph to display the version of SilverStripe CMS and Framework on the installed module report
Unfortunately the work done for SS3.7 is not available for providing the version so this looks at the contents of the report to find the relevant versions. It allows for extension in CWP. I tested it with an extension too:
Resolves #35
Resolves #60