Skip to content

Commit

Permalink
fix: add shopware 6.6 compatiblity (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
shyim authored Jan 22, 2024
1 parent ae07406 commit 4273161
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 71 deletions.
10 changes: 0 additions & 10 deletions .devcontainer/devcontainer.json

This file was deleted.

3 changes: 3 additions & 0 deletions .shopware-extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,6 @@ build:
assets:
enable_es_build_for_admin: true
enable_es_build_for_storefront: true

changelog:
enabled: true
47 changes: 0 additions & 47 deletions CHANGELOG_en-GB.md

This file was deleted.

6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "frosh/adminer-platform",
"version": "1.0.1",
"version": "2.0.0",
"type": "shopware-platform-plugin",
"keywords": ["adminer", "shopware", "frosh"],
"description": "Adminer for Shopware",
Expand All @@ -17,8 +17,8 @@
}
},
"require": {
"shopware/core": "~6.5",
"shopware/administration": "~6.5"
"shopware/core": "~6.6",
"shopware/administration": "~6.6"
},
"extra": {
"shopware-plugin-class": "Frosh\\Adminer\\FroshPlatformAdminer",
Expand Down
8 changes: 4 additions & 4 deletions src/Controller/AdminerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Attribute\Route;

class AdminerController extends AbstractController
{
#[Route(path: '/api/frosh_adminer/login', name: 'api.frosh_adminer', methods: ['GET'], defaults: ['_acl' => ['system.frosh_adminer'], '_routeScope' => ['api']])]
#[Route(path: '/api/frosh_adminer/login', name: 'api.frosh_adminer', defaults: ['_acl' => ['system.frosh_adminer'], '_routeScope' => ['api']], methods: ['GET'])]
public function login(Request $request): JsonResponse
{
error_reporting(0);
Expand Down Expand Up @@ -48,8 +48,8 @@ public function login(Request $request): JsonResponse
return $response;
}

#[Route(path: '/%shopware_administration.path_name%/adminer', name: 'administration.frosh_adminer', methods: ['GET', 'POST'], defaults: ['auth_required' => false, '_routeScope' => ['administration']])]
public function index()
#[Route(path: '/%shopware_administration.path_name%/adminer', name: 'administration.frosh_adminer', defaults: ['auth_required' => false, '_routeScope' => ['administration']], methods: ['GET', 'POST'])]
public function index(): Response
{
unset($_POST['auth']);
require __DIR__ . '/../Adminer/index.php';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<sw-page class="adminer">
<template slot="smart-bar-header">
<template #smart-bar-header>
<h2>Adminer</h2>
</template>

<template slot="content">
<template #content>
<iframe v-if="apiAdminerUrl" :src="apiAdminerUrl" width="100%" height="99%" frameborder="0"></iframe>
</template>

<template slot="smart-bar-actions">
<template #smart-bar-actions>
<sw-button variant="primary" v-if="apiAdminerUrl" @click="openNewTab">
{{ $tc('frosh-adminer.openInNewTab') }}
</sw-button>
Expand Down
4 changes: 2 additions & 2 deletions src/Resources/config/routes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
xsi:schemaLocation="http://symfony.com/schema/routing
http://symfony.com/schema/routing/routing-1.0.xsd">

<import resource="../../Controller" type="annotation" />
</routes>
<import resource="../../Controller" type="attribute" />
</routes>
1 change: 0 additions & 1 deletion src/Resources/public/administration/js/adminer.js

This file was deleted.

17 changes: 16 additions & 1 deletion src/Resources/public/administration/js/frosh-platform-adminer.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p=(window.__sw__.assetPath + '/bundles/froshplatformadminer/'),r(r.s="rVCN")}({cgKg:function(e,t){Shopware.Service("privileges").addPrivilegeMappingEntry({category:"additional_permissions",parent:null,key:"system",roles:{frosh_adminer:{privileges:[],dependencies:[]}}})},rVCN:function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,(i=o.key,a=void 0,a=function(e,t){if("object"!==n(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(i,"string"),"symbol"===n(a)?a:String(a)),o)}var i,a}function a(e,t){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function u(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=l(e);if(t){var o=l(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}function c(e,t){if(t&&("object"===n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}r.r(t);var f=Shopware.Classes.ApiService,s=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t)}(l,e);var t,r,n,c=u(l);function l(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"frosh_adminer";return o(this,l),c.call(this,e,t,r)}return t=l,(r=[{key:"loginToAdminer",value:function(){var e="".concat(this.getApiBasePath(),"/login");return this.httpClient.get(e,{headers:this.getBasicHeaders()}).then((function(e){return f.handleResponse(e)}))}}])&&i(t.prototype,r),n&&i(t,n),Object.defineProperty(t,"prototype",{writable:!1}),l}(f),p=Shopware.Application;p.addServiceProvider("AdminerService",(function(e){var t=p.getContainer("init");return new s(t.httpClient,e.loginService)}));r("cgKg");Shopware.Component.register("frosh-adminer-view",{template:'<sw-page class="adminer">\n <template slot="smart-bar-header">\n <h2>Adminer</h2>\n </template>\n\n <template slot="content">\n <iframe v-if="apiAdminerUrl" :src="apiAdminerUrl" width="100%" height="99%" frameborder="0"></iframe>\n </template>\n\n <template slot="smart-bar-actions">\n <sw-button variant="primary" v-if="apiAdminerUrl" @click="openNewTab">\n {{ $tc(\'frosh-adminer.openInNewTab\') }}\n </sw-button>\n </template>\n</sw-page>\n',inject:["AdminerService"],created:function(){this.createdComponent()},data:function(){return{apiAdminerUrl:!1}},methods:{createdComponent:function(){var e=this;this.AdminerService.loginToAdminer().then((function(t){e.apiAdminerUrl=t.url}))},openNewTab:function(){window.open(this.apiAdminerUrl)}}}),Shopware.Module.register("frosh-adminer",{type:"plugin",name:"frosh-adminer.title",description:"frosh-adminer.title",color:"#9AA8B5",icon:"regular-database",favicon:"icon-module-settings.png",routes:{list:{component:"frosh-adminer-view",path:"list",privilege:"system.frosh_adminer"}},settingsItem:[{group:"plugins",to:"frosh.adminer.list",icon:"regular-database",label:"frosh-adminer.title",privilege:"system.frosh_adminer"}],extensionEntryRoute:{extensionName:"FroshPlatformAdminer",route:"frosh.adminer.list"}})}});
(()=>{var n=Shopware.Classes.ApiService,t=class extends n{constructor(e,i,m="frosh_adminer"){super(e,i,m)}loginToAdminer(){let e=`${this.getApiBasePath()}/login`;return this.httpClient.get(e,{headers:this.getBasicHeaders()}).then(i=>n.handleResponse(i))}},a=t;var{Application:o}=Shopware;o.addServiceProvider("AdminerService",r=>{let e=o.getContainer("init");return new a(e.httpClient,r.loginService)});Shopware.Service("privileges").addPrivilegeMappingEntry({category:"additional_permissions",parent:null,key:"system",roles:{frosh_adminer:{privileges:[],dependencies:[]}}});var s=`<sw-page class="adminer">
<template #smart-bar-header>
<h2>Adminer</h2>
</template>
<template #content>
<iframe v-if="apiAdminerUrl" :src="apiAdminerUrl" width="100%" height="99%" frameborder="0"></iframe>
</template>
<template #smart-bar-actions>
<sw-button variant="primary" v-if="apiAdminerUrl" @click="openNewTab">
{{ $tc('frosh-adminer.openInNewTab') }}
</sw-button>
</template>
</sw-page>
`;var{Component:d}=Shopware;d.register("frosh-adminer-view",{template:s,inject:["AdminerService"],created(){this.createdComponent()},data(){return{apiAdminerUrl:!1}},methods:{createdComponent(){this.AdminerService.loginToAdminer().then(r=>{this.apiAdminerUrl=r.url})},openNewTab(){window.open(this.apiAdminerUrl)}}});var{Module:l}=Shopware;l.register("frosh-adminer",{type:"plugin",name:"frosh-adminer.title",description:"frosh-adminer.title",color:"#9AA8B5",icon:"regular-database",favicon:"icon-module-settings.png",routes:{list:{component:"frosh-adminer-view",path:"list",privilege:"system.frosh_adminer"}},settingsItem:[{group:"plugins",to:"frosh.adminer.list",icon:"regular-database",label:"frosh-adminer.title",privilege:"system.frosh_adminer"}],extensionEntryRoute:{extensionName:"FroshPlatformAdminer",route:"frosh.adminer.list"}});})();

0 comments on commit 4273161

Please sign in to comment.