Skip to content
This repository has been archived by the owner on Apr 20, 2023. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: gobrightspot/nova-detached-actions
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.1.1
Choose a base ref
...
head repository: gobrightspot/nova-detached-actions
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
Showing with 19,606 additions and 13,737 deletions.
  1. +28 −120 README.md
  2. +1 −1 composer.json
  3. +6 −0 dist/js/card.js
  4. +1 −1 dist/js/tool.js
  5. +8 −0 dist/js/tool.js.LICENSE.txt
  6. +33 −0 nova.mix.js
  7. +13,404 −6,275 package-lock.json
  8. +13 −10 package.json
  9. +8 −2 resources/js/components/ActionButton.vue
  10. +0 −43 resources/js/components/CustomDetailToolbar.vue
  11. +0 −43 resources/js/components/CustomIndexToolbar.vue
  12. +58 −0 resources/js/components/DetailActions.vue
  13. +0 −233 resources/js/components/Heroicons.js
  14. +1 −1 resources/js/components/Heroicons/Announcement.vue
  15. +1 −1 resources/js/components/Heroicons/Archive.vue
  16. +1 −1 resources/js/components/Heroicons/ArrowDown.vue
  17. +1 −1 resources/js/components/Heroicons/ArrowLeft.vue
  18. +1 −1 resources/js/components/Heroicons/ArrowRight.vue
  19. +1 −1 resources/js/components/Heroicons/ArrowUp.vue
  20. +1 −1 resources/js/components/Heroicons/AtSymbol.vue
  21. +1 −1 resources/js/components/Heroicons/Book.vue
  22. +1 −1 resources/js/components/Heroicons/Bookmark.vue
  23. +1 −1 resources/js/components/Heroicons/Briefcase.vue
  24. +1 −1 resources/js/components/Heroicons/Browser.vue
  25. +1 −1 resources/js/components/Heroicons/Building.vue
  26. +1 −1 resources/js/components/Heroicons/Calendar.vue
  27. +1 −1 resources/js/components/Heroicons/Call.vue
  28. +1 −1 resources/js/components/Heroicons/CallIncoming.vue
  29. +1 −1 resources/js/components/Heroicons/CallOutgoing.vue
  30. +1 −1 resources/js/components/Heroicons/Camera.vue
  31. +1 −1 resources/js/components/Heroicons/Cart.vue
  32. +1 −1 resources/js/components/Heroicons/Chat.vue
  33. +1 −1 resources/js/components/Heroicons/CheckCircle.vue
  34. +1 −1 resources/js/components/Heroicons/CheveronDown.vue
  35. +1 −1 resources/js/components/Heroicons/CheveronLeft.vue
  36. +1 −1 resources/js/components/Heroicons/CheveronRight.vue
  37. +1 −1 resources/js/components/Heroicons/CheveronUp.vue
  38. +1 −1 resources/js/components/Heroicons/Clip.vue
  39. +1 −1 resources/js/components/Heroicons/Clipboard.vue
  40. +1 −1 resources/js/components/Heroicons/Clock.vue
  41. +1 −1 resources/js/components/Heroicons/Code.vue
  42. +1 −1 resources/js/components/Heroicons/Cog.vue
  43. +1 −1 resources/js/components/Heroicons/Comment.vue
  44. +1 −1 resources/js/components/Heroicons/Compass.vue
  45. +1 −1 resources/js/components/Heroicons/CurrencyDollar.vue
  46. +1 −1 resources/js/components/Heroicons/Dashboard.vue
  47. +1 −1 resources/js/components/Heroicons/Desktop.vue
  48. +1 −1 resources/js/components/Heroicons/Discount.vue
  49. +1 −1 resources/js/components/Heroicons/Download.vue
  50. +1 −1 resources/js/components/Heroicons/Duplicate.vue
  51. +1 −1 resources/js/components/Heroicons/Edit.vue
  52. +1 −1 resources/js/components/Heroicons/EmotionHappy.vue
  53. +1 −1 resources/js/components/Heroicons/EmotionSad.vue
  54. +1 −1 resources/js/components/Heroicons/Exclamation.vue
  55. +1 −1 resources/js/components/Heroicons/ExternalLink.vue
  56. +1 −1 resources/js/components/Heroicons/File.vue
  57. +1 −1 resources/js/components/Heroicons/FileBlank.vue
  58. +1 −1 resources/js/components/Heroicons/FileMinus.vue
  59. +1 −1 resources/js/components/Heroicons/FilePlus.vue
  60. +1 −1 resources/js/components/Heroicons/Film.vue
  61. +1 −1 resources/js/components/Heroicons/Filter.vue
  62. +1 −1 resources/js/components/Heroicons/Flag.vue
  63. +1 −1 resources/js/components/Heroicons/Folder.vue
  64. +1 −1 resources/js/components/Heroicons/FolderMinus.vue
  65. +1 −1 resources/js/components/Heroicons/FolderPlus.vue
  66. +1 −1 resources/js/components/Heroicons/Globe.vue
  67. +1 −1 resources/js/components/Heroicons/GraphBar.vue
  68. +1 −1 resources/js/components/Heroicons/Grid.vue
  69. +1 −1 resources/js/components/Heroicons/Group.vue
  70. +1 −1 resources/js/components/Heroicons/Hashtag.vue
  71. +1 −1 resources/js/components/Heroicons/Heart.vue
  72. +1 −1 resources/js/components/Heroicons/Help.vue
  73. +1 −1 resources/js/components/Heroicons/Home.vue
  74. +1 −1 resources/js/components/Heroicons/Image.vue
  75. +1 −1 resources/js/components/Heroicons/Inbox.vue
  76. +1 −1 resources/js/components/Heroicons/Information.vue
  77. +1 −1 resources/js/components/Heroicons/Key.vue
  78. +1 −1 resources/js/components/Heroicons/Link.vue
  79. +1 −1 resources/js/components/Heroicons/Location.vue
  80. +1 −1 resources/js/components/Heroicons/LockClosed.vue
  81. +1 −1 resources/js/components/Heroicons/LockOpen.vue
  82. +1 −1 resources/js/components/Heroicons/Mail.vue
  83. +1 −1 resources/js/components/Heroicons/Map.vue
  84. +1 −1 resources/js/components/Heroicons/Menu.vue
  85. +1 −1 resources/js/components/Heroicons/Microphone.vue
  86. +1 −1 resources/js/components/Heroicons/Minus.vue
  87. +1 −1 resources/js/components/Heroicons/MinusCircle.vue
  88. +1 −1 resources/js/components/Heroicons/MinusSquare.vue
  89. +1 −1 resources/js/components/Heroicons/Mobile.vue
  90. +1 −1 resources/js/components/Heroicons/Moon.vue
  91. +1 −1 resources/js/components/Heroicons/MoreHoriz.vue
  92. +1 −1 resources/js/components/Heroicons/Music.vue
  93. +1 −1 resources/js/components/Heroicons/News.vue
  94. +1 −1 resources/js/components/Heroicons/Notification.vue
  95. +1 −1 resources/js/components/Heroicons/Plus.vue
  96. +1 −1 resources/js/components/Heroicons/PlusCircle.vue
  97. +1 −1 resources/js/components/Heroicons/PlusSquare.vue
  98. +1 −1 resources/js/components/Heroicons/Print.vue
  99. +1 −1 resources/js/components/Heroicons/Puzzle.vue
  100. +1 −1 resources/js/components/Heroicons/Refresh.vue
  101. +1 −1 resources/js/components/Heroicons/Repeat.vue
  102. +1 −1 resources/js/components/Heroicons/Rocket.vue
  103. +1 −1 resources/js/components/Heroicons/Search.vue
  104. +1 −1 resources/js/components/Heroicons/Server.vue
  105. +1 −1 resources/js/components/Heroicons/Speaker.vue
  106. +1 −1 resources/js/components/Heroicons/Star.vue
  107. +1 −1 resources/js/components/Heroicons/Store.vue
  108. +1 −1 resources/js/components/Heroicons/Tablet.vue
  109. +1 −1 resources/js/components/Heroicons/Tag.vue
  110. +1 −1 resources/js/components/Heroicons/ThumbDown.vue
  111. +1 −1 resources/js/components/Heroicons/ThumbUp.vue
  112. +1 −1 resources/js/components/Heroicons/Trash.vue
  113. +1 −1 resources/js/components/Heroicons/TrendingDown.vue
  114. +1 −1 resources/js/components/Heroicons/TrendingUp.vue
  115. +1 −1 resources/js/components/Heroicons/Trophy.vue
  116. +1 −1 resources/js/components/Heroicons/Upload.vue
  117. +1 −1 resources/js/components/Heroicons/User.vue
  118. +1 −1 resources/js/components/Heroicons/UserCheck.vue
  119. +1 −1 resources/js/components/Heroicons/UserMinus.vue
  120. +1 −1 resources/js/components/Heroicons/UserPlus.vue
  121. +1 −1 resources/js/components/Heroicons/Video.vue
  122. +1 −1 resources/js/components/Heroicons/View.vue
  123. +1 −1 resources/js/components/Heroicons/X.vue
  124. +1 −1 resources/js/components/Heroicons/XCircle.vue
  125. +1 −1 resources/js/components/Heroicons/XSquare.vue
  126. +1 −1 resources/js/components/Heroicons/ZoomIn.vue
  127. +1 −1 resources/js/components/Heroicons/ZoomOut.vue
  128. +60 −0 resources/js/components/IndexActions.vue
  129. +48 −34 resources/js/components/InvisibleActions.vue
  130. +3 −3 resources/js/mixins/DetachedAction.js
  131. +100 −0 resources/js/nova-components/ResourceDetail.vue
  132. +133 −0 resources/js/nova-components/ResourceTableToolbar.vue
  133. +29 −16 resources/js/tool.js
  134. +7 −7 src/DetachedAction.php
  135. +4 −1 src/ToolServiceProvider.php
  136. +16 −11 webpack.mix.js
  137. +5,532 −6,823 yarn.lock
148 changes: 28 additions & 120 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
# Laravel Nova Detached Actions Tool

![Status: ABANDONED](https://img.shields.io/badge/Status-ABANDONED-red.svg?style=flat)
[![No Maintenance Intended](http://unmaintained.tech/badge.svg)](http://unmaintained.tech/)

## Deprecation Notice :warning:

> GoBrightspot is no longer maintaining this project. Please fork it to continue development.
## Intro

A Laravel Nova tool to allow for placing actions in the Nova toolbar, detached from the checkbox selection mechanism.

:warning: Keep in mind, since the action is detached from the row selection checkboxes in the resource table, you will not have a collection of models to iterate over. Detached actions are intended to be independent of the selection in the table.

:warning: Also, keep in mind, pivot actions are not supported and have not been tested.

![screenshot](https://i.imgur.com/S8GrNFI.png)
@@ -107,6 +117,21 @@ public function actions(Request $request)
}
```

## Chunking and repetitive calls to the handle()
If you initiate an action on the background Nova will chunk up the total amount of records and call the `handle()` function of your DetachedAction for each chunk. This could have unexpected performance impact as the system will perform your action for each chunk of records.
This happens in the `handleRequest()` function of `\Laravel\Nova\Actions\Action.php`.

To prevent this the simplest way is to overrule this function in your `DetachedAction`. this is a bare example dispatching just a job without any checks or other logic:

```php
/** @return array<int,string> */
public function handleRequest(ActionRequest $request): array
{
dispatch(new GenerateTicketReport($request->resolveFields()));
return DetachedAction::message('Nice job!');
}
```

### Display on different screens

##### `showOnIndexToolbar()`
@@ -222,139 +247,22 @@ return [

### Adding an icon

You can use any of the 104 Heroicon icons by specifying the icon name in lowercase, prefixed with `hero-`:
You can use any of the 104 Heroicon icons by specifying the icon name in lowercase:

```php
return [
(new ImportUsers)->icon('hero-add')
(new ImportUsers)->icon('add')
];
```

You can also customize the display of that icon using `iconClasses`:

```php
return [
(new ImportUsers)->icon('hero-upload')->iconClasses('mr-3 -ml-2')
(new ImportUsers)->icon('upload')->iconClasses('mr-3 -ml-2')
];
```

#### Supported icon types

##### Heroicons

- hero-announcement
- hero-archive
- hero-arrow-down
- hero-arrow-left
- hero-arrow-right
- hero-arrow-up
- hero-at-symbol
- hero-book
- hero-bookmark
- hero-briefcase
- hero-browser
- hero-building
- hero-calander
- hero-call-incoming
- hero-call-outgoing
- hero-call
- hero-camera
- hero-cart
- hero-chat
- hero-check-circle
- hero-cheveron-down
- hero-cheveron-left
- hero-cheveron-right
- hero-cheveron-up
- hero-clip
- hero-clipboard
- hero-clock
- hero-code
- hero-cog
- hero-comment
- hero-compass
- hero-currency-dollar
- hero-dashboard
- hero-desktop
- hero-download
- hero-duplicate
- hero-edit
- hero-emotion-happy
- hero-emotion-sad
- hero-exclamation
- hero-external-link
- hero-file-blank
- hero-file-minus
- hero-file-plus
- hero-file
- hero-film
- hero-filter
- hero-flag
- hero-folder-minus
- hero-folder-plus
- hero-folder
- hero-globe
- hero-graph-bar
- hero-grid
- hero-group
- hero-hashtag
- hero-heart
- hero-help
- hero-home
- hero-image
- hero-inbox
- hero-information
- hero-key
- hero-link
- hero-location
- hero-lock-closed
- hero-lock-open
- hero-mail
- hero-map
- hero-menu
- hero-microphone
- hero-minus-circle
- hero-minus-square
- hero-minus
- hero-mobile
- hero-moon
- hero-more-horiz
- hero-music
- hero-news
- hero-notification
- hero-plus-circle
- hero-plus-square
- hero-plus
- hero-print
- hero-puzzle
- hero-refresh
- hero-repeat
- hero-rocket
- hero-search
- hero-server
- hero-speaker
- hero-star
- hero-store
- hero-tablet
- hero-tag
- hero-thumb-down
- hero-thumb-up
- hero-trash
- hero-trending-down
- hero-trending-up
- hero-trophy
- hero-upload
- hero-user-check
- hero-user-minus
- hero-user-plus
- hero-user
- hero-video
- hero-view
- hero-x-circle
- hero-x-square
- hero-x
- hero-zoom-in
- hero-zoom-out

![screenshot](https://i.imgur.com/9PaOxZC.png)

2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
"license": "MIT",
"require": {
"php": ">=7.1.0",
"laravel/nova": "^3.0"
"laravel/nova": "^4.0"
},
"autoload": {
"psr-4": {
6 changes: 6 additions & 0 deletions dist/js/card.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/
/******/
/******/ })()
;
2 changes: 1 addition & 1 deletion dist/js/tool.js

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions dist/js/tool.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/*!
* vuex v4.0.2
* (c) 2021 Evan You
* @license MIT
*/

/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */

/**
* @license
* Lodash <https://lodash.com/>
33 changes: 33 additions & 0 deletions nova.mix.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const mix = require('laravel-mix')
const webpack = require('webpack')
const path = require('path')

class NovaExtension {
name() {
return 'nova-extension'
}

register(name) {
this.name = name
}

webpackConfig(webpackConfig) {
webpackConfig.externals = {
vue: 'Vue',
}

webpackConfig.resolve.alias = {
...(webpackConfig.resolve.alias || {}),
'laravel-nova': path.join(
__dirname,
'../../vendor/laravel/nova/resources/js/mixins/packages.js'
),
}

webpackConfig.output = {
uniqueName: this.name,
}
}
}

mix.extend('nova', new NovaExtension())
Loading