style: Fix eslint warnings
parent
d5b8b0b719
commit
10c361b27e
|
@ -112,6 +112,8 @@
|
||||||
|
|
||||||
"no-cond-assign": "warn",
|
"no-cond-assign": "warn",
|
||||||
|
|
||||||
|
"no-confusing-arrow": "off",
|
||||||
|
|
||||||
"no-console": "off",
|
"no-console": "off",
|
||||||
|
|
||||||
"no-constant-condition": "warn",
|
"no-constant-condition": "warn",
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import ReactDiffViewer, { DiffMethod } from 'react-diff-viewer';
|
import ReactDiffViewer, { DiffMethod } from 'react-diff-viewer';
|
||||||
|
|
||||||
import { ModalLayout, ModalFooter, ModalBody, ModalHeader } from '@strapi/parts/ModalLayout';
|
import { ModalLayout, ModalBody, ModalHeader } from '@strapi/parts/ModalLayout';
|
||||||
import { ButtonText } from '@strapi/parts/Text';
|
import { ButtonText } from '@strapi/parts/Text';
|
||||||
import { Button } from '@strapi/parts/Button';
|
|
||||||
|
|
||||||
const ConfigDiff = ({ isOpen, onClose, onToggle, oldValue, newValue, configName }) => {
|
const ConfigDiff = ({ isOpen, onClose, oldValue, newValue, configName }) => {
|
||||||
if (!isOpen) {
|
if (!isOpen) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -30,13 +29,8 @@ const ConfigDiff = ({ isOpen, onClose, onToggle, oldValue, newValue, configName
|
||||||
/>
|
/>
|
||||||
</section>
|
</section>
|
||||||
</ModalBody>
|
</ModalBody>
|
||||||
<ModalFooter>
|
|
||||||
<section style={{ alignItems: 'center' }}>
|
|
||||||
|
|
||||||
</section>
|
|
||||||
</ModalFooter>
|
|
||||||
</ModalLayout>
|
</ModalLayout>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
export default ConfigDiff;
|
export default ConfigDiff;
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import styled from 'styled-components';
|
|
||||||
|
|
||||||
const CustomRow = ({ row }) => {
|
const CustomRow = ({ row }) => {
|
||||||
const { config_name, config_type, state, onClick } = row;
|
const { configName, configType, state, onClick } = row;
|
||||||
|
|
||||||
const stateStyle = (state) => {
|
const stateStyle = (stateStr) => {
|
||||||
const style = {
|
const style = {
|
||||||
display: 'inline-flex',
|
display: 'inline-flex',
|
||||||
padding: '0 10px',
|
padding: '0 10px',
|
||||||
|
@ -14,17 +13,17 @@ const CustomRow = ({ row }) => {
|
||||||
fontWeight: '500',
|
fontWeight: '500',
|
||||||
};
|
};
|
||||||
|
|
||||||
if (state === 'Only in DB') {
|
if (stateStr === 'Only in DB') {
|
||||||
style.backgroundColor = '#cbf2d7';
|
style.backgroundColor = '#cbf2d7';
|
||||||
style.color = '#1b522b';
|
style.color = '#1b522b';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state === 'Only in sync dir') {
|
if (stateStr === 'Only in sync dir') {
|
||||||
style.backgroundColor = '#f0cac7';
|
style.backgroundColor = '#f0cac7';
|
||||||
style.color = '#3d302f';
|
style.color = '#3d302f';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state === 'Different') {
|
if (stateStr === 'Different') {
|
||||||
style.backgroundColor = '#e8e6b7';
|
style.backgroundColor = '#e8e6b7';
|
||||||
style.color = '#4a4934';
|
style.color = '#4a4934';
|
||||||
}
|
}
|
||||||
|
@ -33,12 +32,12 @@ const CustomRow = ({ row }) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<tr onClick={() => onClick(config_type, config_name)}>
|
<tr onClick={() => onClick(configType, configName)}>
|
||||||
<td>
|
<td>
|
||||||
<p>{config_name}</p>
|
<p>{configName}</p>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<p>{config_type}</p>
|
<p>{configType}</p>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<p style={stateStyle(state)}>{state}</p>
|
<p style={stateStyle(state)}>{state}</p>
|
||||||
|
|
|
@ -1,12 +1,8 @@
|
||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
import { isEmpty } from 'lodash';
|
import { isEmpty } from 'lodash';
|
||||||
|
|
||||||
import { NoContent } from '@strapi/helper-plugin';
|
import { Table, Thead, Tbody, Tr, Th } from '@strapi/parts/Table';
|
||||||
import AddIcon from '@strapi/icons/AddIcon';
|
|
||||||
import { VisuallyHidden } from '@strapi/parts/VisuallyHidden';
|
|
||||||
import { Table, Thead, Tbody, Tr, Th, TFooter } from '@strapi/parts/Table';
|
|
||||||
import { TableLabel } from '@strapi/parts/Text';
|
import { TableLabel } from '@strapi/parts/Text';
|
||||||
import { Button } from '@strapi/parts/Button';
|
|
||||||
|
|
||||||
import ConfigDiff from '../ConfigDiff';
|
import ConfigDiff from '../ConfigDiff';
|
||||||
import FirstExport from '../FirstExport';
|
import FirstExport from '../FirstExport';
|
||||||
|
@ -16,25 +12,25 @@ const ConfigList = ({ diff, isLoading }) => {
|
||||||
const [openModal, setOpenModal] = useState(false);
|
const [openModal, setOpenModal] = useState(false);
|
||||||
const [originalConfig, setOriginalConfig] = useState({});
|
const [originalConfig, setOriginalConfig] = useState({});
|
||||||
const [newConfig, setNewConfig] = useState({});
|
const [newConfig, setNewConfig] = useState({});
|
||||||
const [configName, setConfigName] = useState('');
|
const [cName, setCname] = useState('');
|
||||||
const [rows, setRows] = useState([]);
|
const [rows, setRows] = useState([]);
|
||||||
|
|
||||||
const getConfigState = (configName) => {
|
const getConfigState = (configName) => {
|
||||||
if (
|
if (
|
||||||
diff.fileConfig[configName] &&
|
diff.fileConfig[configName]
|
||||||
diff.databaseConfig[configName]
|
&& diff.databaseConfig[configName]
|
||||||
) {
|
) {
|
||||||
return 'Different'
|
return 'Different';
|
||||||
} else if (
|
} else if (
|
||||||
diff.fileConfig[configName] &&
|
diff.fileConfig[configName]
|
||||||
!diff.databaseConfig[configName]
|
&& !diff.databaseConfig[configName]
|
||||||
) {
|
) {
|
||||||
return 'Only in sync dir'
|
return 'Only in sync dir';
|
||||||
} else if (
|
} else if (
|
||||||
!diff.fileConfig[configName] &&
|
!diff.fileConfig[configName]
|
||||||
diff.databaseConfig[configName]
|
&& diff.databaseConfig[configName]
|
||||||
) {
|
) {
|
||||||
return 'Only in DB'
|
return 'Only in DB';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -44,21 +40,21 @@ const ConfigList = ({ diff, isLoading }) => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let formattedRows = [];
|
const formattedRows = [];
|
||||||
Object.keys(diff.diff).map((configName) => {
|
Object.keys(diff.diff).map((name) => {
|
||||||
const type = configName.split('.')[0]; // Grab the first part of the filename.
|
const type = name.split('.')[0]; // Grab the first part of the filename.
|
||||||
const name = configName.split(/\.(.+)/)[1]; // Grab the rest of the filename minus the file extension.
|
const formattedName = name.split(/\.(.+)/)[1]; // Grab the rest of the filename minus the file extension.
|
||||||
|
|
||||||
formattedRows.push({
|
formattedRows.push({
|
||||||
config_name: name,
|
configName: formattedName,
|
||||||
config_type: type,
|
configType: type,
|
||||||
state: getConfigState(configName),
|
state: getConfigState(name),
|
||||||
onClick: (config_type, config_name) => {
|
onClick: (configType, configName) => {
|
||||||
setOriginalConfig(diff.fileConfig[`${config_type}.${config_name}`]);
|
setOriginalConfig(diff.fileConfig[`${configType}.${configName}`]);
|
||||||
setNewConfig(diff.databaseConfig[`${config_type}.${config_name}`]);
|
setNewConfig(diff.databaseConfig[`${configType}.${configName}`]);
|
||||||
setConfigName(`${config_type}.${config_name}`);
|
setCname(`${configType}.${configName}`);
|
||||||
setOpenModal(true);
|
setOpenModal(true);
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -68,7 +64,7 @@ const ConfigList = ({ diff, isLoading }) => {
|
||||||
const closeModal = () => {
|
const closeModal = () => {
|
||||||
setOriginalConfig({});
|
setOriginalConfig({});
|
||||||
setNewConfig({});
|
setNewConfig({});
|
||||||
setConfigName('');
|
setCname('');
|
||||||
setOpenModal(false);
|
setOpenModal(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -83,8 +79,7 @@ const ConfigList = ({ diff, isLoading }) => {
|
||||||
oldValue={originalConfig}
|
oldValue={originalConfig}
|
||||||
newValue={newConfig}
|
newValue={newConfig}
|
||||||
onClose={closeModal}
|
onClose={closeModal}
|
||||||
onToggle={closeModal}
|
configName={cName}
|
||||||
configName={configName}
|
|
||||||
/>
|
/>
|
||||||
<Table colCount={4} rowCount={rows.length + 1}>
|
<Table colCount={4} rowCount={rows.length + 1}>
|
||||||
<Thead>
|
<Thead>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import pluginId from './pluginId';
|
import pluginId from './pluginId';
|
||||||
|
|
||||||
const getTrad = id => `${pluginId}.${id}`;
|
const getTrad = (id) => `${pluginId}.${id}`;
|
||||||
|
|
||||||
export default getTrad;
|
export default getTrad;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
const pluginPkg = require('../../../package.json');
|
const pluginPkg = require('../../../package.json');
|
||||||
|
|
||||||
const pluginId = pluginPkg.name.replace(
|
const pluginId = pluginPkg.name.replace(
|
||||||
/^strapi-plugin-/i,
|
/^strapi-plugin-/i,
|
||||||
''
|
''
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const types = require('./types');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An asynchronous bootstrap function that runs before
|
* An asynchronous bootstrap function that runs before
|
||||||
|
@ -14,8 +13,6 @@ const types = require('./types');
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module.exports = async () => {
|
module.exports = async () => {
|
||||||
// console.log(await types['core-store'].exportAll());
|
|
||||||
|
|
||||||
if (strapi.plugins['config-sync'].config.importOnBootstrap) {
|
if (strapi.plugins['config-sync'].config.importOnBootstrap) {
|
||||||
if (fs.existsSync(strapi.plugins['config-sync'].config.destination)) {
|
if (fs.existsSync(strapi.plugins['config-sync'].config.destination)) {
|
||||||
await strapi.plugins['config-sync'].services.main.importAllConfig();
|
await strapi.plugins['config-sync'].services.main.importAllConfig();
|
||||||
|
|
Loading…
Reference in New Issue