Skip to content

Commit

Permalink
Merge pull request #10 from Arrig0/feature/strapi-4.5
Browse files Browse the repository at this point in the history
Strapi >= 4.5
  • Loading branch information
am2222 committed May 5, 2023
2 parents 97f011f + 2507641 commit d20f397
Show file tree
Hide file tree
Showing 4 changed files with 10,754 additions and 5 deletions.
31 changes: 26 additions & 5 deletions admin/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,44 @@ const name = pluginPkg.strapi.name;
/*
Since strapi doesn't support custom fields in v4, we have to overwrite the current implementation
*/
import { intercept } from './utils/intercept';
import * as helperPlugin from '@strapi/helper-plugin';
intercept(helperPlugin, 'GenericInput', ({ args: [props], resolve }) => {
//import { intercept } from './utils/intercept';
//import * as helperPlugin from '@strapi/helper-plugin';
/*intercept(helperPlugin, 'GenericInput', ({ args: [props], resolve }) => {
const type = (props.attribute || {}).fieldRenderer || props.type;
return resolve({
...props,
type,
});
});
});*/


const handleTriggerDeployment = () => {
alert("hi")
}
export default {
register(app) {
app.addFields({ type: 'postgis', Component: Map });
app.customFields.register({
name: 'map',
pluginId,
type: 'json',
icon: PluginIcon,
intlLabel: {
id: 'postgis.label',
defaultMessage: 'postgis map',
},
intlDescription: {
id: 'postgis.description',
defaultMessage: 'postgis map description',
},
components: {
Input: async () => import(
'./components/Map'
),
},
options: {
},
});
//app.addFields({ type: 'postgis', Component: Map });
// app.addMenuLink({
// to: `/plugins/${pluginId}`,
// icon: PluginIcon,
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"@strapi/strapi": "^4.1.12",
"@turf/turf": "^6.5.0",
"axios": "^0.26.0",
"codemirror": "^5.65.13",
"knex": "^1.0.3",
"knex-postgis": "^0.14.3",
"leaflet": "^1.8.0",
Expand Down
6 changes: 6 additions & 0 deletions server/register.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ module.exports = async ({ strapi }) => {
strapi.log.info(`Error accessing POSTGIS`);
return;
}

strapi.customFields.register({
name: 'map',
plugin: 'postgis',
type: 'json',
});

pg.destroy()
strapi.postgis['enabled'] = true;
Expand Down
Loading

0 comments on commit d20f397

Please sign in to comment.