-
Notifications
You must be signed in to change notification settings - Fork 824
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
ENH UI updated for versioned objects and all its relations #11101
ENH UI updated for versioned objects and all its relations #11101
Conversation
ce8d69b
to
f79ecfa
Compare
*/ | ||
private function getStatusFlags(DataObject $record): array | ||
{ | ||
if ($record->hasExtension(Versioned::class)) { |
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.
This check that this class does not have the Versioned extension is needed in order, firstly, not to have a duplicate badge and, secondly, not to override the badge of the current state of the current object.
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.
So there is already a versioned badge, and this PR is adding a new one? Is the original status badge wrong? Where is the code for the original status badge. Would it make sense to move this code there, or at least deprecate the old code since it's presumably wrong?
@@ -417,7 +420,7 @@ protected function getFormActions() | |||
throw new LogicException(get_class($this->record) . ' must implement ' . DataObjectInterface::class); | |||
} | |||
|
|||
$noChangesClasses = 'btn-outline-primary font-icon-tick'; | |||
$noChangesClasses = $this->stagesDifferRecursive() ? 'btn-primary font-icon-save' : 'btn-outline-primary font-icon-tick'; |
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.
This check is needed to highlight “Save” if child versioned objects have changes
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.
Not a proper review, just something I noticed at a glance.
src/Forms/Form.php
Outdated
@@ -1483,7 +1483,7 @@ public function loadDataFrom($data, $mergeStrategy = 0, $fieldList = null) | |||
* @param FieldList $fieldList An optional list of fields to process. This can be useful when you have a | |||
* form that has some fields that save to one object, and some that save to another. | |||
*/ | |||
public function saveInto(DataObjectInterface $dataObject, $fieldList = null) | |||
public function saveInto(ViewableData|DataObjectInterface $dataObject, $fieldList = null) |
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 can't change the method signature of public API
public function saveInto(ViewableData|DataObjectInterface $dataObject, $fieldList = null) | |
public function saveInto(DataObjectInterface $dataObject, $fieldList = null) |
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.
Updated
SilverStripe\Forms\Tests\GridField\GridFieldTest\Cheerleader: | ||
cheerleader1_team1: | ||
Name: Heather | ||
Team: =>SilverStripe\Forms\Tests\GridField\GridFieldTest\Team.team1 |
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.
Add a blank line at end of file
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.
Updated
@@ -0,0 +1,8 @@ | |||
SilverStripe\Forms\Tests\GridField\GridFieldTest\Team: | |||
team1: |
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.
Indentation in this file is wrong, should be 2 spaces
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.
Updated
@@ -0,0 +1,8 @@ | |||
SilverStripe\Forms\Tests\GridField\GridFieldTest\Team: | |||
team1: |
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.
Indentation in this file is wrong, should be 2 spaces
Also add a blank line at end of the file
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.
Updated
*/ | ||
private function getStatusFlags(DataObject $record): array | ||
{ | ||
if ($record->hasExtension(Versioned::class)) { |
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.
So there is already a versioned badge, and this PR is adding a new one? Is the original status badge wrong? Where is the code for the original status badge. Would it make sense to move this code there, or at least deprecate the old code since it's presumably wrong?
* @param string $columnName | ||
* @return string HTML for the column. Return NULL to skip. | ||
*/ | ||
public function getColumnContent($gridField, $record, $columnName) |
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.
Strongly type params and return type, remove docblocks for param types unless there is useful information for a param/return type. Do this for all methods in the PR
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.
There is a small problem, because interface GridField_ColumnProvider
still doesn't support strong types, so I can update only few methods.
We need this check in case when parent DataObject has Versioned extension and has current status
We have the original status badge only if parent object has Versioned extension.
All status badges are part of Versioned extension. So the main problem that require these changes it's if the parent object in the relations doesn't have Versioned extension |
Wouldn't it be confusing if the parent object doesn't have Versioned extension and would still show Modified? Perhaps we need another label when it's just the children? |
f79ecfa
to
107d9d9
Compare
107d9d9
to
c188ac7
Compare
Closing - we can reference this PR if we decide to go forward with this work in the future, pending the spike. |
Description
These changes add additional checking for the presence of changes in child classes (which have the Versioned extension) and if these changes exist, then the
“MODIFIED”
badge will be added to the name of the object. In my opinion, this is the only suitable badge, since there are several points that make the use of other badges difficult. For example, if the object itself has several child objects and these objects have different states, for example, one has the“DRAFT”
state, and the other has the“ARCHIVED”
state.Parent issue