Skip to content
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

resources actions #19

Merged
merged 82 commits into from
May 26, 2023
Merged

resources actions #19

merged 82 commits into from
May 26, 2023

Conversation

petrKavulok
Copy link
Contributor

@petrKavulok petrKavulok commented Feb 9, 2023

@petrKavulok petrKavulok self-assigned this Feb 9, 2023
@petrKavulok
Copy link
Contributor Author

  • czech translation in prompt not working

@petrKavulok
Copy link
Contributor Author

Screen.Recording.2023-02-23.at.14.47.52.mp4

@petrKavulok petrKavulok marked this pull request as ready for review February 23, 2023 07:07
@petrKavulok petrKavulok requested a review from Pe5h4 April 26, 2023 09:45
Copy link
Collaborator

@Pe5h4 Pe5h4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@petrKavulok So far so good, minor updates request

},
"ResourcesDeletedDetailContainer": {
"Resource": "Zdroj",
"Hard-delete": "Navždy odstranit",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@petrKavulok I would choose something like Trvale odstranit, it sounds better to me (just a subjective note)

"Failed to hard-delete this resource": "Nepodařilo se navždy odstranit tento zdroj",
"Failed to retrieve resource": "Obnova zdroje se nezdařila",
"Resource retrieved successfuly": "Obnova zdroje proběhla úspěšně",
"Resource was successfully hard-deleted": "Zdroj byl úspěšně navždy odstranit",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@petrKavulok use trvale instead of navzdy

"Hard-delete": "Navždy odstranit",
"Retrieve": "Obnovit zdroj",
"Can't fetch resource details": "Nepodařilo se načíst zdroj",
"Failed to hard-delete this resource": "Nepodařilo se navždy odstranit tento zdroj",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@petrKavulok use trvale instead of navzdy

"Failed to retrieve resource": "Obnova zdroje se nezdařila",
"Resource retrieved successfuly": "Obnova zdroje proběhla úspěšně",
"Resource was successfully hard-deleted": "Zdroj byl úspěšně navždy odstranit",
"Do you really want to hard-delete this resource": "Opravdu si přejete navždy odstranit zdroj?",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@petrKavulok use trvale instead of navzdy

path: '/auth/resources-deleted',
exact: true,
name: 'Deleted resources',
component: ResourcesDeletedListContainer
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@petrKavulok You should update your branch from main and then add a correct resource here

path: '/auth/resources-deleted/:resource_id',
exact: true,
name: 'Deleted resource detail',
component: DeletedResourceDetailContainer
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@petrKavulok As per my comment above, add a correct resource

const [editMode, setEditMode] = useState(false);
const { resource_id } = props.match.params;

const editResource = "authz:superuser";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@petrKavulok check the resources by the document on sharepoint and ask Robin, what resources should be implemented for any action we are providing to user regarding resources removal

{editMode ?
<>
<ButtonGroup>
<Button color="primary" type="submit" >{t("Save")}</Button>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@petrKavulok I bet this button should be ButtonWithAuthz with some particular resource

<i className="cil-code pr-2"></i>
JSON
<div className='actions-right'>
<Button color="danger" type="button" onClick={() => terminateResourceForm(resource._id)}>{t("ResourcesDetailContainer|Delete resource")}</Button>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@petrKavulok Again, this should be ButtonWithAuthz I suppose

@@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next';
import { useSelector } from 'react-redux';

import { DataTable, ButtonWithAuthz } from 'asab-webui';
import { Container } from 'reactstrap';
import { Container, Button } from 'reactstrap';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@petrKavulok You dont use Button in the ResourcesListContainer, so it does not have to be loaded

@petrKavulok petrKavulok requested a review from Pe5h4 May 8, 2023 13:55
@petrKavulok petrKavulok mentioned this pull request May 12, 2023
4 tasks
const [count, setCount] = useState(0);
const [page, setPage] = useState(1);
const [loading, setLoading] = useState(true);
const [show, setShow] = useState(false);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@petrKavulok I think this is not needed. I think its ok if the content loader appears only for a second. You are adding jsut too much logic to this considering we dont use it elsewhere. But if you want to do it this way, then we should update it in other parts of app.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my subjective point of view, I think its enough to handle it just with loading state


useEffect(()=>{
setShow(false);
if (resources.length === 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@petrKavulok as my comment above

@@ -19,6 +19,7 @@ function ResourcesListContainer(props) {
const ref = useRef(null);
const { t } = useTranslation();

const deleteResource = "seacat:resource:edit";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@petrKavulok do you really need it? take a look a line below, just use the resource on line 23, its the same

@petrKavulok petrKavulok requested a review from Pe5h4 May 22, 2023 15:53
Copy link
Collaborator

@Pe5h4 Pe5h4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@petrKavulok Just small renaming comment, otherwise it looks good from my point of view

exact: true,
name: 'Deleted resources',
component: ResourcesDeletedListContainer,
resource: 'seacat:resource:access'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@petrKavulok Clarify with @byewokko if this screen shouldnt be accessed only by superuser

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@petrKavulok Then also other actions regarding hard deleting resource(s) will be only for superusers I guess (and not seacat:resource:edit)

exact: true,
name: 'Deleted resource detail',
component: DeletedResourceDetailContainer,
resource: 'seacat:resource:access'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@petrKavulok As per my comment above

const ref = useRef(null);
const { t } = useTranslation();

const retrieveButtonResource = "seacat:resource:edit";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@petrKavulok Rename to retrieveResource - I think here its just fine

@petrKavulok petrKavulok requested a review from Pe5h4 May 24, 2023 09:17
app.Router.addRoute({
path: '/auth/resources/:resource_id',
exact: true,
name: 'Resource detail',
component: ResourcesDetailContainer,
resource: "seacat:resource:access"
resource: "authz:superuser"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@petrKavulok Oh, this resource should have stayed as it was, please put it back

Copy link
Contributor Author

@petrKavulok petrKavulok May 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Pe5h4 oh, right, sorry, my mistake

exact: true,
name: 'Deleted resources',
component: ResourcesDeletedListContainer,
resource: 'seacat:resource:access'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@petrKavulok This resource should be superuser

@petrKavulok petrKavulok requested a review from Pe5h4 May 25, 2023 11:52
Copy link
Collaborator

@Pe5h4 Pe5h4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@petrKavulok petrKavulok merged commit a262085 into main May 26, 2023
@petrKavulok petrKavulok deleted the feature/resource-actions branch May 26, 2023 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deleting and renaming resources
3 participants