From c4c55a73cbc214ef849546d7263a82a31daeac3f Mon Sep 17 00:00:00 2001 From: EdeMeijer Date: Tue, 21 Apr 2015 17:35:01 +0200 Subject: [PATCH] Use APC cache for Docker and fix bug with changing component sort order By default, the file cache is used, but this breaks the throttling detection when authenticating. The APC cache is tagged and will allow you to log in again after installation. --- When changing the sort order, a form with hidden inputs for every component was serialized. The hidden inputs had names in the form of `component[id]`. When you removed components, there would be holes in this ID sequence, yielding a serialized array with empty values (since JS arrays always have every index until the highest one, even if you don't specify a value). This is fixed by just passing an array of component IDs in the desired sort order to the API endpoint. The API will then update the components based on the implicit given sort order. Much simpler. --- app/Http/Controllers/Admin/ApiController.php | 6 +-- docker/php-fpm-pool.conf | 1 + public/build/dist/js/all-1ee9c181.js | 14 ------ public/build/dist/js/all-73562b00.js | 21 ++++++++ public/build/rev-manifest.json | 2 +- resources/assets/js/app.js | 16 +++--- .../dashboard/components/index.blade.php | 49 +++++++++---------- 7 files changed, 55 insertions(+), 54 deletions(-) delete mode 100644 public/build/dist/js/all-1ee9c181.js create mode 100644 public/build/dist/js/all-73562b00.js diff --git a/app/Http/Controllers/Admin/ApiController.php b/app/Http/Controllers/Admin/ApiController.php index 1443437e..62b5f573 100644 --- a/app/Http/Controllers/Admin/ApiController.php +++ b/app/Http/Controllers/Admin/ApiController.php @@ -46,11 +46,9 @@ class ApiController extends AbstractController public function postUpdateComponentOrder() { $componentData = Binput::all(); - unset($componentData['component'][0]); // Remove random 0 index. - - foreach ($componentData['component'] as $componentId => $order) { + foreach ($componentData['ids'] as $order => $componentId) { $component = Component::find($componentId); - $component->update(['order' => $order]); + $component->update(['order' => $order + 1]); // Ordering should be 1-based, data comes in 0-based } return $componentData; diff --git a/docker/php-fpm-pool.conf b/docker/php-fpm-pool.conf index e946bf00..39a92559 100644 --- a/docker/php-fpm-pool.conf +++ b/docker/php-fpm-pool.conf @@ -18,6 +18,7 @@ env[DB_HOST] = $DB_HOST env[DB_DATABASE] = $DB_DATABASE env[DB_USERNAME] = $DB_USERNAME env[DB_PASSWORD] = $DB_PASSWORD +env[CACHE_DRIVER] = apc [global] diff --git a/public/build/dist/js/all-1ee9c181.js b/public/build/dist/js/all-1ee9c181.js deleted file mode 100644 index 8d02e026..00000000 --- a/public/build/dist/js/all-1ee9c181.js +++ /dev/null @@ -1,14 +0,0 @@ -if(function(e,t){"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){function n(e){var t=e.length,n=K.type(e);return"function"===n||K.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e}function i(e,t,n){if(K.isFunction(t))return K.grep(e,function(e,i){return!!t.call(e,i,e)!==n});if(t.nodeType)return K.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(ot.test(t))return K.filter(t,e,n);t=K.filter(t,e)}return K.grep(e,function(e){return U.call(t,e)>=0!==n})}function a(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}function r(e){var t=pt[e]={};return K.each(e.match(ft)||[],function(e,n){t[n]=!0}),t}function s(){Q.removeEventListener("DOMContentLoaded",s,!1),e.removeEventListener("load",s,!1),K.ready()}function o(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=K.expando+o.uid++}function l(e,t,n){var i;if(void 0===n&&1===e.nodeType)if(i="data-"+t.replace(Mt,"-$1").toLowerCase(),n=e.getAttribute(i),"string"==typeof n){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:vt.test(n)?K.parseJSON(n):n}catch(a){}yt.set(e,t,n)}else n=void 0;return n}function u(){return!0}function d(){return!1}function c(){try{return Q.activeElement}catch(e){}}function h(e,t){return K.nodeName(e,"table")&&K.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function f(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function p(e){var t=Wt.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function m(e,t){for(var n=0,i=e.length;i>n;n++)gt.set(e[n],"globalEval",!t||gt.get(t[n],"globalEval"))}function _(e,t){var n,i,a,r,s,o,l,u;if(1===t.nodeType){if(gt.hasData(e)&&(r=gt.access(e),s=gt.set(t,r),u=r.events)){delete s.handle,s.events={};for(a in u)for(n=0,i=u[a].length;i>n;n++)K.event.add(t,a,u[a][n])}yt.hasData(e)&&(o=yt.access(e),l=K.extend({},o),yt.set(t,l))}}function g(e,t){var n=e.getElementsByTagName?e.getElementsByTagName(t||"*"):e.querySelectorAll?e.querySelectorAll(t||"*"):[];return void 0===t||t&&K.nodeName(e,t)?K.merge([e],n):n}function y(e,t){var n=t.nodeName.toLowerCase();"input"===n&&Tt.test(e.type)?t.checked=e.checked:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}function v(t,n){var i,a=K(n.createElement(t)).appendTo(n.body),r=e.getDefaultComputedStyle&&(i=e.getDefaultComputedStyle(a[0]))?i.display:K.css(a[0],"display");return a.detach(),r}function M(e){var t=Q,n=$t[e];return n||(n=v(e,t),"none"!==n&&n||(zt=(zt||K("