Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ When plugin has been installed, you need to allow access to the endpoints.
### Usage

Click for video demo:
[![Click for demo video](video_thumbnail.png)](https://youtu.be/NOFioYMKPJk)
[![Click for demo video](video_thumbnail.png)](https://youtu.be/NOFioYMKPJk)
2 changes: 0 additions & 2 deletions admin/src/components/MappingTable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ class MappingTable extends Component {
state = { mapping: {} };

changeMappingOptions = stat => options => {
console.log(stat, options);

let newState = _.cloneDeep(this.state);
for (let key in options) {
_.set(newState, `mapping[${stat.fieldName}][${key}]`, options[key]);
Expand Down
8 changes: 4 additions & 4 deletions admin/src/containers/App/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import { createStructuredSelector } from 'reselect';
import { Switch, Route } from 'react-router-dom';
import { compose } from 'redux';

import pluginId from 'pluginId';
import pluginId from '../../pluginId';

import HomePage from 'containers/HomePage';
import NotFoundPage from 'containers/NotFoundPage';
import CreateImportPage from 'containers/CreateImportPage';
import HomePage from '../HomePage';
import NotFoundPage from '../NotFoundPage';
import CreateImportPage from '../CreateImportPage';

import reducer from './reducer';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { Component, Fragment } from 'react';
import PropTypes from 'prop-types';
import { injectIntl } from 'react-intl';
import Label from 'components/Label';
import { Label } from 'strapi-helper-plugin';

import styles from './styles.scss';
import styles from './styles.css';

export class ExternalUrlForm extends Component {
state = {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.urlInput {
width: 400px;
margin-left: 10px;
background-color: #bbb;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import PropTypes from 'prop-types';
import { injectIntl } from 'react-intl';
import _ from 'lodash';

import Label from 'components/Label';
import styles from './styles.scss';
import { Label } from 'strapi-helper-plugin';
import styles from './styles.css';

export class InputFormatSettings extends Component {
onChangeOption = option => event => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.settingsInputField {
background-color: #fff;
margin-left: 10px;
margin-left: 15px;
width: 50px;
padding-left: 7px;
padding-right: 7px;
}
8 changes: 2 additions & 6 deletions admin/src/containers/CreateImportPage/RawInputForm/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import React, { Component, Fragment } from 'react';
import PropTypes from 'prop-types';
import { injectIntl } from 'react-intl';
import Label from 'components/Label';
import InputTextArea from 'components/InputTextArea';
import InputSelect from 'components/InputSelect';
import Button from 'components/Button';
import InputSpacer from 'components/InputSpacer';
import { Label, InputTextArea, InputSelect, Button, InputSpacer } from 'strapi-helper-plugin';

import styles from './styles.scss';
import styles from './styles.css';

export class RawInputForm extends Component {
state = {
Expand Down
5 changes: 5 additions & 0 deletions admin/src/containers/CreateImportPage/RawInputForm/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.rawTextInput {
width: 100%;
margin-left: 10px;
background-color: #bbb;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import React, { Component, Fragment } from 'react';
import PropTypes from 'prop-types';
import { injectIntl } from 'react-intl';

import Button from 'components/Button';
import Label from 'components/Label';
import InputSpacer from 'components/InputSpacer';
import { Button, Label, InputSpacer } from 'strapi-helper-plugin';

function readFileContent(file) {
const reader = new FileReader();
Expand Down
2 changes: 1 addition & 1 deletion admin/src/containers/CreateImportPage/constants.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import pluginId from "pluginId";
import pluginId from "../../pluginId";

const buildString = suffix => `${pluginId}/CreateImportPage/${suffix}`;

Expand Down
10 changes: 3 additions & 7 deletions admin/src/containers/CreateImportPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,17 @@ import { connect } from 'react-redux';
import { createStructuredSelector } from 'reselect';
import { injectIntl } from 'react-intl';
import { compose } from 'redux';
import pluginId from 'pluginId';
import pluginId from '../../pluginId';

import Button from 'components/Button';
import PluginHeader from 'components/PluginHeader';
import InputSelect from 'components/InputSelect';
import InputSpacer from 'components/InputSpacer';
import Label from 'components/Label';
import { Button, PluginHeader, InputSelect, InputSpacer, Label } from 'strapi-helper-plugin';

import ExternalUrlForm from './ExternalUrlForm';
import UploadFileForm from './UploadFileForm';
import RawInputForm from './RawInputForm';
import InputFormatSettings from './InputFormatSettings';
import MappingTable from '../../components/MappingTable';

import styles from './styles.scss';
import styles from './styles.css';
import { loadModels, preAnalyze, saveImportConfig } from './actions';
import {
makeSelectLoading,
Expand Down
5 changes: 3 additions & 2 deletions admin/src/containers/CreateImportPage/saga.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { fork, takeLatest, call, put } from "redux-saga/effects";
import request from "utils/request";
import { request } from "strapi-helper-plugin";

import {
loadModelsSuccess,
Expand All @@ -13,7 +13,8 @@ import { LOAD_MODELS, PRE_ANALYZE, SAVE_IMPORT_CONFIG } from "./constants";

export function* loadModels() {
try {
const { allModels } = yield call(request, "/content-type-builder/models", {
console.log(strapi.models)
const { allModels } = yield call(request, "/content-manager/content-types", {
method: "GET"
});

Expand Down
2 changes: 1 addition & 1 deletion admin/src/containers/CreateImportPage/selectors.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createSelector } from "reselect";
import pluginId from "pluginId";
import pluginId from "../../pluginId";

/**
* Direct selector to the examplePage state domain
Expand Down
6 changes: 6 additions & 0 deletions admin/src/containers/CreateImportPage/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

.createImportPage {
padding: 1.7rem 3rem;
background: rgba(14, 22, 34, 0.02);
min-height: calc(100vh - 6rem);
}
2 changes: 1 addition & 1 deletion admin/src/containers/HomePage/constants.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import pluginId from "pluginId";
import pluginId from "../../pluginId";

const buildString = suffix => `${pluginId}/HomePage/${suffix}`;

Expand Down
11 changes: 5 additions & 6 deletions admin/src/containers/HomePage/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import React, { Component } from 'react';
import Button from 'components/Button';
import IcoContainer from 'components/IcoContainer';
import { Button, IcoContainer } from 'strapi-helper-plugin';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { createStructuredSelector } from 'reselect';
import { injectIntl } from 'react-intl';
import { compose } from 'redux';
import pluginId from 'pluginId';
import pluginId from '../../pluginId';
import moment from 'moment';

import {
Expand All @@ -15,7 +14,7 @@ import {
selectImportConfigsLoading
} from './selectors';

import styles from './styles.scss';
import styles from './styles.css';

import { loadImportConfigs, undoImport, deleteImport } from './actions';
import reducer from './reducer';
Expand Down Expand Up @@ -97,12 +96,12 @@ export class HomePage extends Component {
? { icoType: 'spinner' }
: {
icoType: 'undo',
onClick: this.undoImport(item.id)
onClick: this.undoImport(item._id)
}
],
{
icoType: 'trash',
onClick: this.deleteImport(item.id)
onClick: this.deleteImport(item._id)
}
]}
/>
Expand Down
2 changes: 1 addition & 1 deletion admin/src/containers/HomePage/saga.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { fork, takeLatest, call, put } from "redux-saga/effects";
import request from "utils/request";
import { request } from "strapi-helper-plugin";

import {
loadImportConfigs,
Expand Down
2 changes: 1 addition & 1 deletion admin/src/containers/HomePage/selectors.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createSelector } from 'reselect';
import pluginId from 'pluginId';
import pluginId from '../../pluginId';
/**
* Direct selector to the homePage state domain
*/
Expand Down
14 changes: 14 additions & 0 deletions admin/src/containers/HomePage/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.homePage {
padding: 1.7rem 3rem;
background: rgba(14, 22, 34, 0.02);
min-height: calc(100vh - 6rem);
}

.inProgress {
background-color: rgba(180, 255, 180, 0.5);
}

th,
td {
padding-right: 15px;
}
26 changes: 26 additions & 0 deletions admin/src/containers/Initializer/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
*
* Initializer
*
*/

import { useEffect, useRef } from 'react';
import PropTypes from 'prop-types';
import pluginId from '../../pluginId';

const Initializer = ({ updatePlugin }) => {
const ref = useRef();
ref.current = updatePlugin;

useEffect(() => {
ref.current(pluginId, 'isReady', true);
}, []);

return null;
};

Initializer.propTypes = {
updatePlugin: PropTypes.func.isRequired,
};

export default Initializer;
2 changes: 1 addition & 1 deletion admin/src/containers/NotFoundPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import React from 'react';

import NotFound from 'components/NotFound';
import { NotFound } from 'strapi-helper-plugin';

export default class NotFoundPage extends React.Component {
render() {
Expand Down
52 changes: 52 additions & 0 deletions admin/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import pluginPkg from '../../package.json';
import pluginId from './pluginId';
import App from './containers/App';
import Initializer from './containers/Initializer';
import lifecycles from './lifecycles';
import trads from './translations';

export default strapi => {
const pluginDescription = pluginPkg.strapi.description || pluginPkg.description;
const icon = pluginPkg.strapi.icon;
const name = pluginPkg.strapi.name;

const plugin = {
blockerComponent: null,
blockerComponentProps: {},
description: pluginDescription,
icon,
id: pluginId,
initializer: Initializer,
injectedComponents: [],
isReady: false,
isRequired: pluginPkg.strapi.required || false,
layout: null,
lifecycles,
mainComponent: App,
name,
preventComponentRendering: false,
trads,
menu: {
pluginsSectionLinks: [
{
destination: `/plugins/${pluginId}`,
icon,
label: {
id: `${pluginId}.plugin.name`,
defaultMessage: name,
},
name,
permissions: [
// Uncomment to set the permissions of the plugin here
// {
// action: '', // the action name should be plugins::plugin-name.actionType
// subject: null,
// },
],
},
],
},
};

return strapi.registerPlugin(plugin);
};
3 changes: 3 additions & 0 deletions admin/src/lifecycles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function lifecycles() {}

export default lifecycles;
1 change: 1 addition & 0 deletions admin/src/translations/cs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions admin/src/translations/id.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
49 changes: 49 additions & 0 deletions admin/src/translations/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import ar from './ar.json';
import cs from './cs.json';
import de from './de.json';
import en from './en.json';
import es from './es.json';
import fr from './fr.json';
import id from './id.json';
import it from './it.json';
import ko from './ko.json';
import ms from './ms.json';
import nl from './nl.json';
import pl from './pl.json';
import ptBR from './pt-BR.json';
import pt from './pt.json';
import ru from './ru.json';
import th from './th.json';
import tr from './tr.json';
import uk from './uk.json';
import vi from './vi.json';
import zhHans from './zh-Hans.json';
import zh from './zh.json';
import sk from './sk.json';

const trads = {
ar,
cs,
de,
en,
es,
fr,
id,
it,
ko,
ms,
nl,
pl,
'pt-BR': ptBR,
pt,
ru,
th,
tr,
uk,
vi,
'zh-Hans': zhHans,
zh,
sk,
};

export default trads;
1 change: 1 addition & 0 deletions admin/src/translations/ms.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions admin/src/translations/ru.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions admin/src/translations/sk.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions admin/src/translations/th.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Loading