-
Notifications
You must be signed in to change notification settings - Fork 182
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
The icon correct groups files #4114
Conversation
color="primary" | ||
/> | ||
</EuiToolTip> | ||
{ | ||
item.filename === 'agent.conf' && | ||
<WzButtonPermissions |
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.
thought: I was researching and the button appears in a cell of a table with the group's files. The required permission to read the file is:
- action:
group:read
- resource:
group:id:<group_id>
I didn't see more specific permission to read this file, so we could use a button component that doesn't check the user's permissions. If for any reason, the user's permissions changed and the table was rerender by some reason, the WzButtonPermission could avoid to the user that click on and cause a request error getting the content.
this.showFile = async(item) => { | ||
let result = await this.groupsHandler.getFileContent( | ||
`/groups/${itemDetail.name}/files/${item.filename}/xml` | ||
); | ||
|
||
if (Object.keys(result).length == 0) { | ||
result = ''; | ||
} | ||
|
||
const data = typeof result === 'object' | ||
? JSON.stringify(result, null, 2) | ||
: result.toString() | ||
|
||
const file = { | ||
name: item.filename, | ||
content: data, | ||
isEditable: false, | ||
groupName: itemDetail.name | ||
}; | ||
|
||
this.tableProps.updateFileContent(file); | ||
} | ||
|
||
this.editFile = async (item) => { | ||
|
||
let result = await this.groupsHandler.getFileContent( | ||
`/groups/${itemDetail.name}/files/${item.filename}/xml` | ||
); | ||
if (Object.keys(result).length == 0) { | ||
result = ''; | ||
} | ||
|
||
const data = this.autoFormat(result); | ||
|
||
const file = { | ||
name: 'agent.conf', | ||
content: data, | ||
isEditable: true, | ||
groupName: itemDetail.name, | ||
}; | ||
|
||
this.tableProps.updateFileContent(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.
nitpick: These 2 methods seem to be similar, maybe we could refactor them to share the logic.
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.
CR OK ✅
TEST OK ✅
Grabacion.de.pantalla.2022-04-29.a.la.s.11.06.36.mov
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.
review:
Code review ✔️
Testing ✔️
|
Description:
In the groups file table, there was a file (agent.conf) that showed you the only read icon and sent you to the view to edit the file, so I separated the show and edit function and added the edit button
Issue:
Test:
agent.conf
fileScreenshot: