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

Cancel requested assets without checkin/out [ch-17606] #13219

Merged
merged 8 commits into from
Jun 29, 2023

Conversation

inietov
Copy link
Collaborator

@inietov inietov commented Jun 28, 2023

Description

I started working on this looking for a quick and easy win, oh boy! If I was mistaken...

Before we have the Requested Assets view like this:
image

And now I just added this little button here:
image

That's basically it, but I have to pass new variables to a route, and change a couple function firms to accept parameters that aren't needed before, I tested it extensively but I would love a couple of extra eyes before merging.

Fixes [ch-17606]

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Test Configuration:

  • PHP version: 8.1
  • MySQL version: 8.0.31
  • Webserver version: PHP dev server
  • OS version: Debian 11

@shortcut-integration
Copy link

This pull request has been linked to Shortcut Story #17606: Cancel requested asset without checkin/out.

@what-the-diff
Copy link

what-the-diff bot commented Jun 28, 2023

PR Summary

  • Enhancement of getRequestItem Method
    The getRequestItem method in the ViewAssetsController.php file is improved with the addition of two new parameters known as cancel_by_admin and requestingUser. These parameters will provide further control and flexibility in the handling of item request.

  • Update to the cancelRequest Method
    The cancelRequest method, situated in the Requestable.php file, now accepts a user ID parameter. The code logic has been updated in such a way that it can now cancel requests specifically for the user indicated by the provided ID.

  • Addition of Cancel Button in View
    A new button has been added to the hardware/requested.blade.php view file that will allow users to cancel an item request. Concomitantly, a corresponding form and route have also been included to facilitate this process.

  • Modification of Route Definition
    The change to the route definition request/{itemType}/{itemId} in the web.php file integrates the new optional parameters cancel_by_admin and requestingUser. This inclusion represents an extension to the originally defined pathway, lending more nuanced access and control to your admin operations.

Copy link
Collaborator

@marcusmoore marcusmoore left a comment

Choose a reason for hiding this comment

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

Nice! I have a couple minor requests / suggestions but the functionality works.


I noticed the table lost search and sorting somehow:
before and after


Side-note: Something that comes to mind is an Adam Wathan presentation called "Cruddy by Design" (I'm pretty sure it's this presentation where he talks about this concept). This controller method seems like it can be broken up into dedicated methods for each operation it handles. It would be easier to understand and more maintainable. It doesn't have to happen in this PR of course. Just something that came to mind.

resources/views/hardware/requested.blade.php Outdated Show resolved Hide resolved
resources/views/hardware/requested.blade.php Outdated Show resolved Hide resolved
Copy link
Owner

@snipe snipe left a comment

Choose a reason for hiding this comment

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

One small change, since we don't use that orange color anywhere else in the UI

resources/views/hardware/requested.blade.php Outdated Show resolved Hide resolved
@inietov
Copy link
Collaborator Author

inietov commented Jun 28, 2023

Ok, made the button change and add the translation string for the tooltip. Also I was struggling with that Form:: open/close functions... and ultimately got rid of it, because it was too hard to debug.

No, in reality I think it was a copy paste from other time, because it was for the Bulk edit feature, which is not used in this view, that's the real reason.

Copy link
Collaborator

@marcusmoore marcusmoore 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 to me 👍🏾

@snipe snipe merged commit a3096e1 into snipe:develop Jun 29, 2023
3 checks passed
@brianhoganm
Copy link

Description

I started working on this looking for a quick and easy win, oh boy! If I was mistaken...

Before we have the Requested Assets view like this: image

And now I just added this little button here: image

That's basically it, but I have to pass new variables to a route, and change a couple function firms to accept parameters that aren't needed before, I tested it extensively but I would love a couple of extra eyes before merging.

Fixes [ch-17606]

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Test Configuration:

  • PHP version: 8.1
  • MySQL version: 8.0.31
  • Webserver version: PHP dev server
  • OS version: Debian 11

Hi, I updated my SnipeIT to the latest version with this update. However, when I click on Requested I now get a 500 Server Error. I think this update might have broke this. Can anyone else confirm this? Thanks.

@brianhoganm brianhoganm mentioned this pull request Jul 10, 2023
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants