ms2/431-process-list-view#635
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Solid overall, but there are many little details that need to addressed.
Also, the structure for the process list is quite repetitive, there are three options (edit, list, and no option selecte) and each file is almost identical.
For me it makes more sense to have one directory like this
.../[mode]/
.../[mode]/folder/[folderId]
.../[mode]/[processId]
And to handle the case where there is no mode selected do a rewrite in the next config something like this
{
source: '/processes'
destination: '/my/processes/edit/'
}
Also there was quite a lot of prop drilling, in this case I think it would have been better to use a react context
| backgroundColor: readOnly ? '#f5f5f5' : '#fafafa', | ||
| border: `1px solid ${readOnly ? '#d9d9d9' : '#f0f0f0'}`, |
There was a problem hiding this comment.
Where did these colors come from? If they're from ant design, I think it would be better to use them through the context with theme.useToken()
There was a problem hiding this comment.
Here the prop should probably be called disabled, as this component can be used in other places where disabling it doesn't mean that its read only
| const processContextPath = pathname.split('/').slice(0, -1).join('/'); // Component can be used in /processes/list or /processes/editor route | ||
| const isReadOnlyListView = processContextPath.includes('/list'); |
There was a problem hiding this comment.
I'm not so sure if this is the best way to go about, but its fine for now
There was a problem hiding this comment.
edit and delete buttons need to be disabled
|
|
||
| await waitForHydration(page); | ||
|
|
||
| await page.waitForTimeout(4000); |
There was a problem hiding this comment.
This should be removed (I forgot to take it out)
| {isReadOnly ? ( | ||
| <ActionButton | ||
| title={'Open Viewer'} | ||
| action={openEditor} | ||
| icon={<PiNotePencil />} | ||
| view | ||
| /> | ||
| ) : ( | ||
| <ActionButton | ||
| title={'Open Editor'} | ||
| action={openEditor} | ||
| icon={<PiNotePencil />} | ||
| update | ||
| /> | ||
| )} |
There was a problem hiding this comment.
This is more a personal opinion, disregard it if you don't like it.
On these buttons it would be cleaner to have the ternary operator on the title instead of the hole button.
Then the only issue would be the update/view prop, for that you could write the action button like this
const ActionButton: React.FC<ActionButtonProps> = ({
title,
action,
icon,
permission,
...actions
}) => {
if (permission) (actions as any)[permission] = true;
return (
<AuthCan {...resource} {...actions}>
<Tooltip placement="top" title={title}>
<Button
className={classNames(styles.ActionButton)}
type="text"
icon={icon}
onClick={() => action(record)}
/>
</Tooltip>
</AuthCan>
);
};There was a problem hiding this comment.
Here I'm not so sure if disabling the inputs is the right solution, I think the question should be how would the uesr open the Modal for copying/editing/importing if he is in the readOnly list, does this happen?
There was a problem hiding this comment.
To filter what is shown in the context menu you check if the component is being used in the list and you also don't pass in actions that modify processes. The second one is a bit redundant, you could just check wether you're in the list and based on that filter out actions that are unwanted.
There was a problem hiding this comment.
- This component takes in a
readOnlyprop and also has aisReadOnlyListViewvariable inside, do these refer to different things? - Although drag and drop doesn't work when readOnly=true, I think we should still disable it, I think this can be done in a future pr
|
|
||
| // For list view: load metadata first to check for redirect | ||
| if (isListView) { | ||
| const processMetadata = await getProcess(processId, false); |
There was a problem hiding this comment.
You could call
const process = await getProcess(processId, !selectedVersionId);Above the if statement, to avoid fetching the process twice, this is a tradeoff between
- Possibly fetching versions that are not needed
- Fetching the process twice when it does have versions
I think it's more common that the page is going to be opened when it has versions
|
@Ph4t3 Did you see Felipe's comments? |
+ New Structure with a [mode] slug and moved the [processId] folder into it as well to get rid of even more redundancy + 'No released process in this folder' message now properly uses ant design context + Changed the name of the boolean to disabled in image-upload + Changed the way it is determined if one is in /list or /editor view, not parsing the URL anymore and instead handing down the mode prop + Introduced new process-view-context and layout files to achieve this for components outside of [mode] folder + Disabled edit and delete buttons for variable definition + Removed Timeout from Test that was there for testing purposes + Deleted not-logged-in-fallback as it is not used + Refactored the way ActionButton is rendered to be more clean + Disabled the input fields in the process modal using ant design instead of simply disabling the inputs for the 'Change Meta Data' version of it + Currency is no longer changeable in the Properties Panel when in list view + Got rid of redundant filtering what gets passed down to the context menu and instead handle it all inside the component + Refactored components/processes/index to only have one readOnly boolean, did not disable drag-and-drop fully yet, it can still be done visibly but has no effect + Refactored fetching of the process in [processId]/page to avoid fetching the process twice + Disabled being able to edit the name in the header in [processId]/wrapper
be57c1a to
b19f4f6
Compare
This comment has been minimized.
This comment has been minimized.
…paths in some tests for new routes
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Some cases are missing:
- What is expected when going to /processes/, the redirect should check if process id is not "editor" or "list" and redirect
- No handling for when a space id is also in the url
Also, the rewrite that you wrote works, because then another rewrite changes /process/editor to /my/process/editor, I'm not so sure if that is the best way to go about it, because how it works isn't immediately obvious from reading the code.
There was a problem hiding this comment.
/processes/ is only left in temporarily because it is the current starting page and removing it will be done in a separate PR once a new starting page was built, so is it okay to just leave the redirects like this in the meantime? I will address the issue with the space id so that works correctly in the meantime though.
There was a problem hiding this comment.
Many files use this context to build urls, you could return processContextPath from here to avoid having to do a lot of comparisons in other places. Additionally, this makes it so that if we change urls again, we have to do less changes.
…ts using it, clean up some unnecessary re-naming
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
6f30ae3 to
a43ee35
Compare
This comment has been minimized.
This comment has been minimized.
|
✅ Successfully created Preview Deployment. |
Summary
Introduces new routes /processes/editor and /processes/list. /editor has the same functionality as /processes did before while processes still exists in it's former state and as it's own page but is subject to change later. /list is a new read-only view of the process-list, with changed buttons and filtering to only display processes with released versions.
Details
Addresses #431
/list is now a read-only version of /processes and /editor, with different buttons in the process list, not being able to move objects in the list, and when opening a process not being able to edit the process in the modeller. The properties panel in the modeller still displays but all functions are not clickable.
Only processes with a released version get shown in /list, but all folders do, no matter if they contain a released version or not.
A message in the top action bar is displayed if one is in a folder that does not contain a process with a released version. This message only pertains to the individual folder one is in, not to potential released versions in sub-folders of it.
Always open the last released version when opening a process in the /list view.
Introduced readOnly booleans to all necessary components to achieve the read-only capability while using the same components for /editor and /list.
As /processes still exists in it's former state, and /editor is just a copy of it, the current playwright test should still be sufficient. A new test that addresses the split between /editor and /list and makes the current one for /processes redundant will be handled in a separate PR, especially once /processes will be turned into a different kind of page.