mirror of
https://github.com/plankanban/planka.git
synced 2025-07-19 05:09:43 +02:00
Add an import feature for import Trello board as JSON to Planka
This commit is contained in:
parent
a3d1a8a09a
commit
a729e11636
24 changed files with 925 additions and 10872 deletions
6
.idea/jsLibraryMappings.xml
generated
Normal file
6
.idea/jsLibraryMappings.xml
generated
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="JavaScriptLibraryMappings">
|
||||
<includedPredefinedLibrary name="Node.js Core" />
|
||||
</component>
|
||||
</project>
|
164
.idea/workspace.xml
generated
Normal file
164
.idea/workspace.xml
generated
Normal file
|
@ -0,0 +1,164 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AutoImportSettings">
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="1caf0577-5a29-440e-83bc-e061a28fd9bd" name="Default Changelist" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/client/src/assets/images/import-icon.svg" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/server/api/controllers/projects/import.js" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/server/api/helpers/download-import-data.js" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/server/api/helpers/get-color-from-trello.js" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/server/api/helpers/import-attachment-receiver.js" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/client/package-lock.json" beforeDir="false" afterPath="$PROJECT_DIR$/client/package-lock.json" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/client/src/actions/entry/project.js" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/actions/entry/project.js" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/client/src/actions/project.js" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/actions/project.js" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/client/src/api/projects.js" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/api/projects.js" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/client/src/components/Projects/Projects.jsx" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/components/Projects/Projects.jsx" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/client/src/constants/ActionTypes.js" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/constants/ActionTypes.js" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/client/src/constants/EntryActionTypes.js" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/constants/EntryActionTypes.js" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/client/src/containers/ProjectsContainer.js" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/containers/ProjectsContainer.js" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/client/src/locales/en/core.js" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/locales/en/core.js" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/client/src/sagas/core/requests/project.js" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/sagas/core/requests/project.js" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/client/src/sagas/core/services/project.js" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/sagas/core/services/project.js" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/client/src/sagas/core/watchers/project.js" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/sagas/core/watchers/project.js" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/server/api/helpers/create-project.js" beforeDir="false" afterPath="$PROJECT_DIR$/server/api/helpers/create-project.js" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/server/config/policies.js" beforeDir="false" afterPath="$PROJECT_DIR$/server/config/policies.js" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/server/config/routes.js" beforeDir="false" afterPath="$PROJECT_DIR$/server/config/routes.js" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/server/package-lock.json" beforeDir="false" afterPath="$PROJECT_DIR$/server/package-lock.json" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/server/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/server/package.json" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="JavaScript File" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="GitSEFilterConfiguration">
|
||||
<file-type-list>
|
||||
<filtered-out-file-type name="LOCAL_BRANCH" />
|
||||
<filtered-out-file-type name="REMOTE_BRANCH" />
|
||||
<filtered-out-file-type name="TAG" />
|
||||
<filtered-out-file-type name="COMMIT_BY_MESSAGE" />
|
||||
</file-type-list>
|
||||
</component>
|
||||
<component name="ProjectId" id="1nKo8aaBkVIUrr6v0k4kbcQNnFj" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
|
||||
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
|
||||
<property name="WebServerToolWindowFactoryState" value="true" />
|
||||
<property name="javascript.nodejs.core.library.configured.version" value="14.15.0" />
|
||||
<property name="javascript.nodejs.core.library.typings.version" value="14.14.22" />
|
||||
<property name="last_opened_file_path" value="$USER_HOME$/Documents/fr.dic" />
|
||||
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
|
||||
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
|
||||
<property name="nodejs_package_manager_path" value="npm" />
|
||||
<property name="settings.editor.selected.configurable" value="web.server" />
|
||||
<property name="vue.rearranger.settings.migration" value="true" />
|
||||
</component>
|
||||
<component name="RunManager" selected="npm.start">
|
||||
<configuration name="postinstall" type="js.build_tools.npm" temporary="true" nameIsGenerated="true">
|
||||
<package-json value="$PROJECT_DIR$/package.json" />
|
||||
<command value="run" />
|
||||
<scripts>
|
||||
<script value="postinstall" />
|
||||
</scripts>
|
||||
<node-interpreter value="project" />
|
||||
<envs />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<configuration name="server:db:init" type="js.build_tools.npm" temporary="true" nameIsGenerated="true">
|
||||
<package-json value="$PROJECT_DIR$/package.json" />
|
||||
<command value="run" />
|
||||
<scripts>
|
||||
<script value="server:db:init" />
|
||||
</scripts>
|
||||
<node-interpreter value="project" />
|
||||
<envs />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<configuration name="server:db:migrate" type="js.build_tools.npm" temporary="true" nameIsGenerated="true">
|
||||
<package-json value="$PROJECT_DIR$/package.json" />
|
||||
<command value="run" />
|
||||
<scripts>
|
||||
<script value="server:db:migrate" />
|
||||
</scripts>
|
||||
<node-interpreter value="project" />
|
||||
<envs />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<configuration name="server:db:seed" type="js.build_tools.npm" temporary="true" nameIsGenerated="true">
|
||||
<package-json value="$PROJECT_DIR$/package.json" />
|
||||
<command value="run" />
|
||||
<scripts>
|
||||
<script value="server:db:seed" />
|
||||
</scripts>
|
||||
<node-interpreter value="project" />
|
||||
<envs />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<configuration name="start" type="js.build_tools.npm" temporary="true" nameIsGenerated="true">
|
||||
<package-json value="$PROJECT_DIR$/package.json" />
|
||||
<command value="run" />
|
||||
<scripts>
|
||||
<script value="start" />
|
||||
</scripts>
|
||||
<node-interpreter value="project" />
|
||||
<envs />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="npm.start" />
|
||||
<item itemvalue="npm.server:db:seed" />
|
||||
<item itemvalue="npm.server:db:migrate" />
|
||||
<item itemvalue="npm.server:db:init" />
|
||||
<item itemvalue="npm.postinstall" />
|
||||
</list>
|
||||
</recent_temporary>
|
||||
</component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="1" Folder0="$USER_HOME$/Documents" CustomDictionaries="1" CustomDictionary0="$USER_HOME$/Documents/fr.dic" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="1caf0577-5a29-440e-83bc-e061a28fd9bd" name="Default Changelist" comment="" />
|
||||
<created>1611147987113</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1611147987113</updated>
|
||||
<workItem from="1611147990942" duration="24000" />
|
||||
<workItem from="1611148027002" duration="59000" />
|
||||
<workItem from="1611148112754" duration="1608000" />
|
||||
<workItem from="1611152887492" duration="1828000" />
|
||||
<workItem from="1616688042421" duration="3772000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="3" />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
<option name="TAB_STATES">
|
||||
<map>
|
||||
<entry key="MAIN">
|
||||
<value>
|
||||
<State />
|
||||
</value>
|
||||
</entry>
|
||||
</map>
|
||||
</option>
|
||||
<option name="oldMeFiltersMigrated" value="true" />
|
||||
</component>
|
||||
</project>
|
107
client/package-lock.json
generated
107
client/package-lock.json
generated
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "planka-client",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
<<<<<<< refs/remotes/origin/master
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "planka-client",
|
||||
|
@ -23999,6 +23999,9 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
=======
|
||||
"lockfileVersion": 1,
|
||||
>>>>>>> Add an import feature for import Trello board as JSON to Planka
|
||||
"dependencies": {
|
||||
"@babel/code-frame": {
|
||||
"version": "7.12.11",
|
||||
|
@ -25970,28 +25973,11 @@
|
|||
"resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.2.3.tgz",
|
||||
"integrity": "sha512-PijRCG/K3s3w1We6ynUKdxEc5AcuuH3NBmMDP8uvKVp6X43UY7NQlTzczakXP3DJR0F4dfNQIGjU2cUeRYs2AA=="
|
||||
},
|
||||
"@types/prop-types": {
|
||||
"version": "15.7.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.3.tgz",
|
||||
"integrity": "sha512-KfRL3PuHmqQLOG+2tGpRO26Ctg+Cq1E01D2DMriKEATHgWLfeNDmq9e29Q9WIky0dQ3NPkd1mzYH8Lm936Z9qw==",
|
||||
"peer": true
|
||||
},
|
||||
"@types/q": {
|
||||
"version": "1.5.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/q/-/q-1.5.4.tgz",
|
||||
"integrity": "sha512-1HcDas8SEj4z1Wc696tH56G8OlRaH/sqZOynNNB+HF0WOeXPaxTtbYzJY2oEfiUxjSKjhCKr+MvR7dCHcEelug=="
|
||||
},
|
||||
"@types/react": {
|
||||
"version": "17.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/react/-/react-17.0.3.tgz",
|
||||
"integrity": "sha512-wYOUxIgs2HZZ0ACNiIayItyluADNbONl7kt8lkLjVK8IitMH5QMyAh75Fwhmo37r1m7L2JaFj03sIfxBVDvRAg==",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"@types/prop-types": "*",
|
||||
"@types/scheduler": "*",
|
||||
"csstype": "^3.0.2"
|
||||
}
|
||||
},
|
||||
"@types/resolve": {
|
||||
"version": "0.0.8",
|
||||
"resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-0.0.8.tgz",
|
||||
|
@ -26000,12 +25986,6 @@
|
|||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"@types/scheduler": {
|
||||
"version": "0.16.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.1.tgz",
|
||||
"integrity": "sha512-EaCxbanVeyxDRTQBkdLb3Bvl/HK7PBK6UJjsSixB0iHKoWxE5uu2Q/DgtpOhPIojN0Zl1whvOd7PoHs2P0s5eA==",
|
||||
"peer": true
|
||||
},
|
||||
"@types/source-list-map": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/source-list-map/-/source-list-map-0.1.2.tgz",
|
||||
|
@ -26376,8 +26356,7 @@
|
|||
"acorn-jsx": {
|
||||
"version": "5.3.1",
|
||||
"resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz",
|
||||
"integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==",
|
||||
"requires": {}
|
||||
"integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng=="
|
||||
},
|
||||
"acorn-walk": {
|
||||
"version": "7.2.0",
|
||||
|
@ -26433,14 +26412,12 @@
|
|||
"ajv-errors": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/ajv-errors/-/ajv-errors-1.0.1.tgz",
|
||||
"integrity": "sha512-DCRfO/4nQ+89p/RK43i8Ezd41EqdGIU4ld7nGF8OQ14oc/we5rEntLCUa7+jrn3nn83BosfwZA0wb4pon2o8iQ==",
|
||||
"requires": {}
|
||||
"integrity": "sha512-DCRfO/4nQ+89p/RK43i8Ezd41EqdGIU4ld7nGF8OQ14oc/we5rEntLCUa7+jrn3nn83BosfwZA0wb4pon2o8iQ=="
|
||||
},
|
||||
"ajv-keywords": {
|
||||
"version": "3.5.2",
|
||||
"resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz",
|
||||
"integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==",
|
||||
"requires": {}
|
||||
"integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ=="
|
||||
},
|
||||
"alphanum-sort": {
|
||||
"version": "1.0.2",
|
||||
|
@ -26931,8 +26908,7 @@
|
|||
"babel-plugin-named-asset-import": {
|
||||
"version": "0.3.7",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-named-asset-import/-/babel-plugin-named-asset-import-0.3.7.tgz",
|
||||
"integrity": "sha512-squySRkf+6JGnvjoUtDEjSREJEBirnXi9NqP6rjSYsylxQxqBTz+pkmf395i9E2zsvmYUaI40BHo6SqZUdydlw==",
|
||||
"requires": {}
|
||||
"integrity": "sha512-squySRkf+6JGnvjoUtDEjSREJEBirnXi9NqP6rjSYsylxQxqBTz+pkmf395i9E2zsvmYUaI40BHo6SqZUdydlw=="
|
||||
},
|
||||
"babel-plugin-polyfill-corejs2": {
|
||||
"version": "0.1.10",
|
||||
|
@ -28783,12 +28759,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"csstype": {
|
||||
"version": "3.0.7",
|
||||
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.7.tgz",
|
||||
"integrity": "sha512-KxnUB0ZMlnUWCsx2Z8MUsr6qV6ja1w9ArPErJaJaF8a5SOWoHLIszeCTKGRGRgtLgYrs1E8CHkNSP1VZTTPc9g==",
|
||||
"peer": true
|
||||
},
|
||||
"currently-unhandled": {
|
||||
"version": "0.4.1",
|
||||
"resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz",
|
||||
|
@ -29848,8 +29818,7 @@
|
|||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-7.2.0.tgz",
|
||||
"integrity": "sha512-rV4Qu0C3nfJKPOAhFujFxB7RMP+URFyQqqOZW9DMRD7ZDTFyjaIlETU3xzHELt++4ugC0+Jm084HQYkkJe+Ivg==",
|
||||
"dev": true,
|
||||
"requires": {}
|
||||
"dev": true
|
||||
},
|
||||
"eslint-config-react-app": {
|
||||
"version": "6.0.0",
|
||||
|
@ -30031,8 +30000,7 @@
|
|||
"eslint-plugin-react-hooks": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.2.0.tgz",
|
||||
"integrity": "sha512-623WEiZJqxR7VdxFCKLI6d6LLpwJkGPYKODnkH3D7WpOG5KM8yWueBd8TLsNAetEJNF5iJmolaAKO3F8yzyVBQ==",
|
||||
"requires": {}
|
||||
"integrity": "sha512-623WEiZJqxR7VdxFCKLI6d6LLpwJkGPYKODnkH3D7WpOG5KM8yWueBd8TLsNAetEJNF5iJmolaAKO3F8yzyVBQ=="
|
||||
},
|
||||
"eslint-plugin-testing-library": {
|
||||
"version": "3.10.1",
|
||||
|
@ -32490,17 +32458,6 @@
|
|||
"istanbul-lib-report": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"jest": {
|
||||
"version": "26.6.3",
|
||||
"resolved": "https://registry.npmjs.org/jest/-/jest-26.6.3.tgz",
|
||||
"integrity": "sha512-lGS5PXGAzR4RF7V5+XObhqz2KZIDUA1yD0DG6pBVmy10eh0ZIXQImRuzocsI/N2XZ1GrLFwTS27In2i2jlpq1Q==",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"@jest/core": "^26.6.3",
|
||||
"import-local": "^3.0.2",
|
||||
"jest-cli": "^26.6.3"
|
||||
}
|
||||
},
|
||||
"jest-changed-files": {
|
||||
"version": "26.6.2",
|
||||
"resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-26.6.2.tgz",
|
||||
|
@ -33599,8 +33556,7 @@
|
|||
"jest-pnp-resolver": {
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.2.tgz",
|
||||
"integrity": "sha512-olV41bKSMm8BdnuMsewT4jqlZ8+3TCARAXjZGT9jcoSnrfUnRCqnMoF9XEeoWjbzObpqF9dRhHQj0Xb9QdF6/w==",
|
||||
"requires": {}
|
||||
"integrity": "sha512-olV41bKSMm8BdnuMsewT4jqlZ8+3TCARAXjZGT9jcoSnrfUnRCqnMoF9XEeoWjbzObpqF9dRhHQj0Xb9QdF6/w=="
|
||||
},
|
||||
"jest-regex-util": {
|
||||
"version": "26.0.0",
|
||||
|
@ -37327,8 +37283,7 @@
|
|||
"re-reselect": {
|
||||
"version": "3.4.0",
|
||||
"resolved": "https://registry.npmjs.org/re-reselect/-/re-reselect-3.4.0.tgz",
|
||||
"integrity": "sha512-JsecfN+JlckncVXTWFWjn0Vk6uInl8GSf4eEd9tTk5qXHlgqkPdILpnYpgZcISXNYAzvfvsCZviaDk8AxyS5sg==",
|
||||
"requires": {}
|
||||
"integrity": "sha512-JsecfN+JlckncVXTWFWjn0Vk6uInl8GSf4eEd9tTk5qXHlgqkPdILpnYpgZcISXNYAzvfvsCZviaDk8AxyS5sg=="
|
||||
},
|
||||
"react": {
|
||||
"version": "17.0.1",
|
||||
|
@ -37572,8 +37527,7 @@
|
|||
"react-onclickoutside": {
|
||||
"version": "6.10.0",
|
||||
"resolved": "https://registry.npmjs.org/react-onclickoutside/-/react-onclickoutside-6.10.0.tgz",
|
||||
"integrity": "sha512-7i2L3ef+0ILXpL6P+Hg304eCQswh4jl3ynwR71BSlMU49PE2uk31k8B2GkP6yE9s2D4jTGKnzuSpzWxu4YxfQQ==",
|
||||
"requires": {}
|
||||
"integrity": "sha512-7i2L3ef+0ILXpL6P+Hg304eCQswh4jl3ynwR71BSlMU49PE2uk31k8B2GkP6yE9s2D4jTGKnzuSpzWxu4YxfQQ=="
|
||||
},
|
||||
"react-popper": {
|
||||
"version": "1.3.11",
|
||||
|
@ -37840,9 +37794,7 @@
|
|||
"type-fest": {
|
||||
"version": "0.13.1",
|
||||
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.13.1.tgz",
|
||||
"integrity": "sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==",
|
||||
"optional": true,
|
||||
"peer": true
|
||||
"integrity": "sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg=="
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -40085,14 +40037,6 @@
|
|||
"resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz",
|
||||
"integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM="
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
|
||||
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
|
||||
"requires": {
|
||||
"safe-buffer": "~5.1.0"
|
||||
}
|
||||
},
|
||||
"string-length": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz",
|
||||
|
@ -40175,6 +40119,14 @@
|
|||
"define-properties": "^1.1.3"
|
||||
}
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
|
||||
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
|
||||
"requires": {
|
||||
"safe-buffer": "~5.1.0"
|
||||
}
|
||||
},
|
||||
"stringify-object": {
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmjs.org/stringify-object/-/stringify-object-3.3.0.tgz",
|
||||
|
@ -40897,12 +40849,6 @@
|
|||
"is-typedarray": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"typescript": {
|
||||
"version": "4.2.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.3.tgz",
|
||||
"integrity": "sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw==",
|
||||
"peer": true
|
||||
},
|
||||
"typescript-compare": {
|
||||
"version": "0.0.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript-compare/-/typescript-compare-0.0.2.tgz",
|
||||
|
@ -41207,8 +41153,7 @@
|
|||
"use-isomorphic-layout-effect": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/use-isomorphic-layout-effect/-/use-isomorphic-layout-effect-1.1.1.tgz",
|
||||
"integrity": "sha512-L7Evj8FGcwo/wpbv/qvSfrkHFtOpCzvM5yl2KVyDJoylVuSvzphiiasmjgQPttIGBAy2WKiBNR98q8w7PiNgKQ==",
|
||||
"requires": {}
|
||||
"integrity": "sha512-L7Evj8FGcwo/wpbv/qvSfrkHFtOpCzvM5yl2KVyDJoylVuSvzphiiasmjgQPttIGBAy2WKiBNR98q8w7PiNgKQ=="
|
||||
},
|
||||
"use-latest": {
|
||||
"version": "1.2.0",
|
||||
|
@ -41221,8 +41166,7 @@
|
|||
"use-memo-one": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/use-memo-one/-/use-memo-one-1.1.2.tgz",
|
||||
"integrity": "sha512-u2qFKtxLsia/r8qG0ZKkbytbztzRb317XCkT7yP8wxL0tZ/CzK2G+WWie5vWvpyeP7+YoPIwbJoIHJ4Ba4k0oQ==",
|
||||
"requires": {}
|
||||
"integrity": "sha512-u2qFKtxLsia/r8qG0ZKkbytbztzRb317XCkT7yP8wxL0tZ/CzK2G+WWie5vWvpyeP7+YoPIwbJoIHJ4Ba4k0oQ=="
|
||||
},
|
||||
"util": {
|
||||
"version": "0.11.1",
|
||||
|
@ -42815,8 +42759,7 @@
|
|||
"ws": {
|
||||
"version": "7.4.4",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-7.4.4.tgz",
|
||||
"integrity": "sha512-Qm8k8ojNQIMx7S+Zp8u/uHOx7Qazv3Yv4q68MiWWWOJhiwG5W3x7iqmRtJo8xxrciZUY4vRxUTJCKuRnF28ZZw==",
|
||||
"requires": {}
|
||||
"integrity": "sha512-Qm8k8ojNQIMx7S+Zp8u/uHOx7Qazv3Yv4q68MiWWWOJhiwG5W3x7iqmRtJo8xxrciZUY4vRxUTJCKuRnF28ZZw=="
|
||||
},
|
||||
"xml-name-validator": {
|
||||
"version": "3.0.0",
|
||||
|
|
|
@ -21,6 +21,13 @@ export const updateCurrentProjectBackgroundImage = (data) => ({
|
|||
},
|
||||
});
|
||||
|
||||
export const importProject = (file) => ({
|
||||
type: EntryActionTypes.IMPORT_PROJECT,
|
||||
payload: {
|
||||
file,
|
||||
},
|
||||
});
|
||||
|
||||
export const deleteCurrentProject = () => ({
|
||||
type: EntryActionTypes.CURRENT_PROJECT_DELETE,
|
||||
payload: {},
|
||||
|
|
|
@ -9,6 +9,13 @@ export const createProject = (data) => ({
|
|||
},
|
||||
});
|
||||
|
||||
export const importProject = (file) => ({
|
||||
type: ActionTypes.IMPORT_PROJECT,
|
||||
payload: {
|
||||
file,
|
||||
},
|
||||
});
|
||||
|
||||
export const updateProject = (id, data) => ({
|
||||
type: ActionTypes.PROJECT_UPDATE,
|
||||
payload: {
|
||||
|
@ -60,6 +67,40 @@ export const createProjectReceived = (project, users, projectMemberships, boards
|
|||
},
|
||||
});
|
||||
|
||||
export const importProjectSucceeded = (project, users, projectMemberships, boards) => ({
|
||||
type: ActionTypes.PROJECT_IMPORT_SUCCEEDED,
|
||||
payload: {
|
||||
project,
|
||||
users,
|
||||
projectMemberships,
|
||||
boards,
|
||||
},
|
||||
});
|
||||
|
||||
export const importProjectRequested = (file) => ({
|
||||
type: ActionTypes.PROJECT_IMPORT_REQUESTED,
|
||||
payload: {
|
||||
file,
|
||||
},
|
||||
});
|
||||
|
||||
export const importProjectFailed = (error) => ({
|
||||
type: ActionTypes.PROJECT_IMPORT_FAILED,
|
||||
payload: {
|
||||
error,
|
||||
},
|
||||
});
|
||||
|
||||
export const importProjectReceived = (project, users, projectMemberships, boards) => ({
|
||||
type: ActionTypes.PROJECT_IMPORT_RECEIVED,
|
||||
payload: {
|
||||
project,
|
||||
users,
|
||||
projectMemberships,
|
||||
boards,
|
||||
},
|
||||
});
|
||||
|
||||
export const updateProjectRequested = (id, data) => ({
|
||||
type: ActionTypes.PROJECT_UPDATE_REQUESTED,
|
||||
payload: {
|
||||
|
|
|
@ -9,6 +9,8 @@ const createProject = (data, headers) => socket.post('/projects', data, headers)
|
|||
|
||||
const updateProject = (id, data, headers) => socket.patch(`/projects/${id}`, data, headers);
|
||||
|
||||
const importProject = (data, headers) => http.post(`/projects/import`, data, headers);
|
||||
|
||||
const updateProjectBackgroundImage = (id, data, headers) =>
|
||||
http.post(`/projects/${id}/background-image`, data, headers);
|
||||
|
||||
|
@ -20,4 +22,5 @@ export default {
|
|||
updateProject,
|
||||
updateProjectBackgroundImage,
|
||||
deleteProject,
|
||||
importProject,
|
||||
};
|
||||
|
|
5
client/src/assets/images/import-icon.svg
Normal file
5
client/src/assets/images/import-icon.svg
Normal file
|
@ -0,0 +1,5 @@
|
|||
<svg viewBox="0 0 24 24">
|
||||
<path d="M11 5C11 4.44772 11.4477 4 12 4C12.5523 4 13 4.44772 13 5V12.1578L16.2428 8.91501L17.657 10.3292L12.0001 15.9861L6.34326 10.3292L7.75748 8.91501L11 12.1575V5Z"
|
||||
fill="currentColor"/>
|
||||
<path d="M4 14H6V18H18V14H20V18C20 19.1046 19.1046 20 18 20H6C4.89543 20 4 19.1046 4 18V14Z" fill="currentColor"/>
|
||||
</svg>
|
After Width: | Height: | Size: 357 B |
|
@ -10,11 +10,13 @@ import { Container, Grid } from 'semantic-ui-react';
|
|||
import Paths from '../../constants/Paths';
|
||||
import { ProjectBackgroundTypes } from '../../constants/Enums';
|
||||
import { ReactComponent as PlusIcon } from '../../assets/images/plus-icon.svg';
|
||||
import { ReactComponent as UploadIcon } from '../../assets/images/import-icon.svg';
|
||||
|
||||
import styles from './Projects.module.scss';
|
||||
import globalStyles from '../../styles.module.scss';
|
||||
import { FilePicker } from '../../lib/custom-ui';
|
||||
|
||||
const Projects = React.memo(({ items, isEditable, onAdd }) => {
|
||||
const Projects = React.memo(({ items, isEditable, onAdd, onImport }) => {
|
||||
const [t] = useTranslation();
|
||||
|
||||
return (
|
||||
|
@ -65,6 +67,20 @@ const Projects = React.memo(({ items, isEditable, onAdd }) => {
|
|||
</button>
|
||||
</Grid.Column>
|
||||
)}
|
||||
{isEditable && (
|
||||
<Grid.Column mobile={8} computer={4}>
|
||||
<FilePicker onSelect={onImport}>
|
||||
<button type="button" className={classNames(styles.card, styles.add)}>
|
||||
<div className={styles.addTitleWrapper}>
|
||||
<div className={styles.addTitle}>
|
||||
<UploadIcon className={styles.addGridIcon} />
|
||||
{t('action.uploadProject')}
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
</FilePicker>
|
||||
</Grid.Column>
|
||||
)}
|
||||
</Grid>
|
||||
</Container>
|
||||
);
|
||||
|
@ -74,6 +90,7 @@ Projects.propTypes = {
|
|||
items: PropTypes.array.isRequired, // eslint-disable-line react/forbid-prop-types
|
||||
isEditable: PropTypes.bool.isRequired,
|
||||
onAdd: PropTypes.func.isRequired,
|
||||
onImport: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
export default Projects;
|
||||
|
|
|
@ -77,12 +77,17 @@ export default {
|
|||
/* Project */
|
||||
|
||||
PROJECT_CREATE: 'PROJECT_CREATE',
|
||||
IMPORT_PROJECT: 'IMPORT_PROJECT',
|
||||
PROJECT_UPDATE: 'PROJECT_UPDATE',
|
||||
PROJECT_DELETE: 'PROJECT_DELETE',
|
||||
PROJECT_CREATE_REQUESTED: 'PROJECT_CREATE_REQUESTED',
|
||||
PROJECT_CREATE_SUCCEEDED: 'PROJECT_CREATE_SUCCEEDED',
|
||||
PROJECT_CREATE_FAILED: 'PROJECT_CREATE_FAILED',
|
||||
PROJECT_CREATE_RECEIVED: 'PROJECT_CREATE_RECEIVED',
|
||||
PROJECT_IMPORT_REQUESTED: 'PROJECT_IMPORT_REQUESTED',
|
||||
PROJECT_IMPORT_SUCCEEDED: 'PROJECT_IMPORT_SUCCEEDED',
|
||||
PROJECT_IMPORT_FAILED: 'PROJECT_IMPORT_FAILED',
|
||||
PROJECT_IMPORT_RECEIVED: 'PROJECT_IMPORT_RECEIVED',
|
||||
PROJECT_UPDATE_REQUESTED: 'PROJECT_UPDATE_REQUESTED',
|
||||
PROJECT_UPDATE_SUCCEEDED: 'PROJECT_UPDATE_SUCCEEDED',
|
||||
PROJECT_UPDATE_FAILED: 'PROJECT_UPDATE_FAILED',
|
||||
|
|
|
@ -38,6 +38,7 @@ export default {
|
|||
/* Project */
|
||||
|
||||
PROJECT_CREATE: `${PREFIX}/PROJECT_CREATE`,
|
||||
IMPORT_PROJECT: `${PREFIX}/PROJECT_IMPORT`,
|
||||
CURRENT_PROJECT_UPDATE: `${PREFIX}/CURRENT_PROJECT_UPDATE`,
|
||||
CURRENT_PROJECT_BACKGROUND_IMAGE_UPDATE: `${PREFIX}/CURRENT_PROJECT_BACKGROUND_IMAGE_UPDATE`,
|
||||
CURRENT_PROJECT_DELETE: `${PREFIX}/CURRENT_PROJECT_DELETE`,
|
||||
|
|
|
@ -2,7 +2,7 @@ import { bindActionCreators } from 'redux';
|
|||
import { connect } from 'react-redux';
|
||||
|
||||
import { currentUserSelector, projectsForCurrentUserSelector } from '../selectors';
|
||||
import { openProjectAddModal } from '../actions/entry';
|
||||
import { openProjectAddModal, importProject } from '../actions/entry';
|
||||
import Projects from '../components/Projects';
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
|
@ -19,6 +19,7 @@ const mapDispatchToProps = (dispatch) =>
|
|||
bindActionCreators(
|
||||
{
|
||||
onAdd: openProjectAddModal,
|
||||
onImport: importProject,
|
||||
},
|
||||
dispatch,
|
||||
);
|
||||
|
|
|
@ -147,6 +147,7 @@ export default {
|
|||
addTask: 'Add task',
|
||||
addToCard: 'Add to card',
|
||||
addUser: 'Add user',
|
||||
uploadProject: 'Import a project',
|
||||
createBoard: 'Create board',
|
||||
createFile: 'Create file',
|
||||
createLabel: 'Create label',
|
||||
|
|
|
@ -8,6 +8,9 @@ import {
|
|||
deleteProjectFailed,
|
||||
deleteProjectRequested,
|
||||
deleteProjectSucceeded,
|
||||
importProjectFailed,
|
||||
importProjectRequested,
|
||||
importProjectSucceeded,
|
||||
updateProjectBackgroundImageFailed,
|
||||
updateProjectBackgroundImageRequested,
|
||||
updateProjectBackgroundImageSucceeded,
|
||||
|
@ -44,6 +47,33 @@ export function* createProjectRequest(data) {
|
|||
}
|
||||
}
|
||||
|
||||
export function* importProjectRequest(data) {
|
||||
yield put(importProjectRequested(data));
|
||||
|
||||
try {
|
||||
const {
|
||||
item,
|
||||
included: { users, projectMemberships, boards },
|
||||
} = yield call(request, api.importProject, { file: data });
|
||||
|
||||
const action = importProjectSucceeded(item, users, projectMemberships, boards);
|
||||
yield put(action);
|
||||
|
||||
return {
|
||||
success: true,
|
||||
payload: action.payload,
|
||||
};
|
||||
} catch (error) {
|
||||
const action = importProjectFailed(error);
|
||||
yield put(action);
|
||||
|
||||
return {
|
||||
success: false,
|
||||
payload: action.payload,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export function* updateProjectRequest(id, data) {
|
||||
yield put(updateProjectRequested(id, data));
|
||||
|
||||
|
|
|
@ -3,12 +3,13 @@ import { call, put, select } from 'redux-saga/effects';
|
|||
import { goToProjectService, goToRootService } from './router';
|
||||
import {
|
||||
createProjectRequest,
|
||||
importProjectRequest,
|
||||
deleteProjectRequest,
|
||||
updateProjectBackgroundImageRequest,
|
||||
updateProjectRequest,
|
||||
} from '../requests';
|
||||
import { pathSelector } from '../../../selectors';
|
||||
import { createProject, deleteProject, updateProject } from '../../../actions';
|
||||
import { createProject, deleteProject, importProject, updateProject } from '../../../actions';
|
||||
|
||||
export function* createProjectService(data) {
|
||||
yield put(createProject(data));
|
||||
|
@ -23,6 +24,19 @@ export function* createProjectService(data) {
|
|||
}
|
||||
}
|
||||
|
||||
export function* importProjectService(file) {
|
||||
yield put(importProject(file));
|
||||
|
||||
const {
|
||||
success,
|
||||
payload: { project },
|
||||
} = yield call(importProjectRequest, file);
|
||||
|
||||
if (success) {
|
||||
yield call(goToProjectService, project.id);
|
||||
}
|
||||
}
|
||||
|
||||
export function* updateProjectService(id, data) {
|
||||
yield put(updateProject(id, data));
|
||||
yield call(updateProjectRequest, id, data);
|
||||
|
|
|
@ -3,6 +3,7 @@ import { all, takeLatest } from 'redux-saga/effects';
|
|||
import {
|
||||
createProjectService,
|
||||
deleteCurrentProjectService,
|
||||
importProjectService,
|
||||
updateCurrentProjectBackgroundImageService,
|
||||
updateCurrentProjectService,
|
||||
} from '../services';
|
||||
|
@ -13,6 +14,9 @@ export default function* projectWatchers() {
|
|||
takeLatest(EntryActionTypes.PROJECT_CREATE, ({ payload: { data } }) =>
|
||||
createProjectService(data),
|
||||
),
|
||||
takeLatest(EntryActionTypes.IMPORT_PROJECT, ({ payload: { file } }) =>
|
||||
importProjectService(file),
|
||||
),
|
||||
takeLatest(EntryActionTypes.CURRENT_PROJECT_UPDATE, ({ payload: { data } }) =>
|
||||
updateCurrentProjectService(data),
|
||||
),
|
||||
|
|
157
server/api/controllers/projects/import.js
Normal file
157
server/api/controllers/projects/import.js
Normal file
|
@ -0,0 +1,157 @@
|
|||
const got = require('got');
|
||||
|
||||
const Errors = {
|
||||
INVALID_IMPORT_FILE: {
|
||||
invalidImport: 'Invalid Import',
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
exits: {
|
||||
cardNotFound: {
|
||||
responseType: 'notFound',
|
||||
},
|
||||
uploadError: {
|
||||
responseType: 'unprocessableEntity',
|
||||
},
|
||||
},
|
||||
|
||||
async fn(inputs, exits) {
|
||||
const { currentUser } = this.req;
|
||||
|
||||
this.req.file('file').upload(sails.helpers.downloadImportData(), async (error, files) => {
|
||||
try {
|
||||
const data = JSON.parse(files[0].extra);
|
||||
const { project, projectMembership } = await sails.helpers.createProject(
|
||||
currentUser,
|
||||
{ name: data.name },
|
||||
this.req,
|
||||
true,
|
||||
false,
|
||||
);
|
||||
|
||||
// Création du tableau
|
||||
const board = await sails.helpers.createBoard(
|
||||
project,
|
||||
{ name: 'Premier tableau', position: 0, type: 'kanban' },
|
||||
this.req,
|
||||
);
|
||||
|
||||
// Création des labels
|
||||
const labels = new Map();
|
||||
/* eslint-disable no-await-in-loop */
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const l of data.labels) {
|
||||
labels.set(
|
||||
l.id,
|
||||
await sails.helpers.createLabel(board, {
|
||||
name: l.name || '?',
|
||||
color: await sails.helpers.getColorFromTrello(l.color),
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
// Création des listes
|
||||
const lists = new Map();
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const l of data.lists) {
|
||||
lists.set(
|
||||
l.id,
|
||||
await sails.helpers.createList(board, {
|
||||
name: l.name || '?',
|
||||
position: l.pos,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
// Création des cartes
|
||||
const cards = new Map();
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const c of data.cards) {
|
||||
const card = await sails.helpers.createCard(
|
||||
board,
|
||||
lists.get(c.idList),
|
||||
{
|
||||
position: Math.round(c.pos),
|
||||
name: c.name,
|
||||
description: c.desc || null,
|
||||
},
|
||||
currentUser,
|
||||
this.req,
|
||||
);
|
||||
cards.set(c.id, card);
|
||||
c.idLabels.forEach(async (l) => {
|
||||
await sails.helpers.createCardLabel(card, labels.get(l), this.req);
|
||||
});
|
||||
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const a of c.attachments) {
|
||||
if (a.url.startsWith('https://trello-attachments.s3.amazonaws.com/'))
|
||||
got
|
||||
.stream(a.url)
|
||||
.pipe(sails.helpers.importAttachmentReceiver(a, card, currentUser, {}, this.req));
|
||||
}
|
||||
}
|
||||
|
||||
// Création des commentaires
|
||||
const listOfComments = data.actions.filter((a) => a.type === 'commentCard');
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const comment of listOfComments) {
|
||||
const userName =
|
||||
data.members.find((u) => u.id === comment.idMemberCreator).fullName || 'Inconnu';
|
||||
await sails.helpers.createAction(
|
||||
cards.get(comment.data.card.id),
|
||||
currentUser,
|
||||
{
|
||||
type: 'commentCard',
|
||||
data: { text: `${userName} - ${comment.data.text}` },
|
||||
},
|
||||
this.req,
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const listOfTask of data.checklists) {
|
||||
const card = cards.get(listOfTask.idCard);
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const task of listOfTask.checkItems) {
|
||||
await sails.helpers.createTask(
|
||||
card,
|
||||
{
|
||||
name: task.name,
|
||||
isCompleted: task.state === 'complete',
|
||||
},
|
||||
this.req,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
sails.sockets.broadcast(
|
||||
`user:${projectMembership.userId}`,
|
||||
'projectCreate',
|
||||
{
|
||||
item: project,
|
||||
included: {
|
||||
users: [currentUser],
|
||||
projectMemberships: [projectMembership],
|
||||
boards: await sails.helpers.getBoardsForProject(project.id),
|
||||
},
|
||||
},
|
||||
this.req,
|
||||
);
|
||||
|
||||
return exits.success({
|
||||
item: project,
|
||||
included: {
|
||||
users: [currentUser],
|
||||
projectMemberships: [projectMembership],
|
||||
boards: await sails.helpers.getBoardsForProject(project.id),
|
||||
},
|
||||
});
|
||||
} catch (e) {
|
||||
throw Errors.INVALID_IMPORT_FILE;
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
|
@ -15,6 +15,10 @@ module.exports = {
|
|||
type: 'boolean',
|
||||
defaultsTo: false,
|
||||
},
|
||||
withBroadcast: {
|
||||
type: 'boolean',
|
||||
defaultsTo: true,
|
||||
},
|
||||
},
|
||||
|
||||
async fn(inputs, exits) {
|
||||
|
@ -25,6 +29,7 @@ module.exports = {
|
|||
userId: inputs.user.id,
|
||||
}).fetch();
|
||||
|
||||
if (inputs.withBroadcast)
|
||||
sails.sockets.broadcast(
|
||||
`user:${projectMembership.userId}`,
|
||||
'projectCreate',
|
||||
|
|
33
server/api/helpers/download-import-data.js
Normal file
33
server/api/helpers/download-import-data.js
Normal file
|
@ -0,0 +1,33 @@
|
|||
const util = require('util');
|
||||
const stream = require('stream');
|
||||
const streamToArray = require('stream-to-array');
|
||||
|
||||
module.exports = {
|
||||
sync: true,
|
||||
|
||||
fn(inputs, exits) {
|
||||
const receiver = stream.Writable({
|
||||
objectMode: true,
|
||||
});
|
||||
|
||||
let firstFileHandled = false;
|
||||
// eslint-disable-next-line no-underscore-dangle
|
||||
receiver._write = async (file, receiverEncoding, done) => {
|
||||
if (firstFileHandled) {
|
||||
file.pipe(new stream.Writable());
|
||||
|
||||
return done();
|
||||
}
|
||||
firstFileHandled = true;
|
||||
|
||||
const buffer = await streamToArray(file).then((parts) =>
|
||||
Buffer.concat(parts.map((part) => (util.isBuffer(part) ? part : Buffer.from(part)))),
|
||||
);
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
file.extra = buffer.toString('UTF-8');
|
||||
return done();
|
||||
};
|
||||
|
||||
return exits.success(receiver);
|
||||
},
|
||||
};
|
35
server/api/helpers/get-color-from-trello.js
Normal file
35
server/api/helpers/get-color-from-trello.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
module.exports = {
|
||||
inputs: {
|
||||
color: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
async fn(inputs, exits) {
|
||||
switch (inputs.color) {
|
||||
case 'green':
|
||||
return exits.success('bright-moss');
|
||||
case 'yellow':
|
||||
return exits.success('egg-yellow');
|
||||
case 'orange':
|
||||
return exits.success('pumpkin-orange');
|
||||
case 'red':
|
||||
return exits.success('berry-red');
|
||||
case 'purple':
|
||||
return exits.success('red-burgundy');
|
||||
case 'blue':
|
||||
return exits.success('lagoon-blue');
|
||||
case 'sky':
|
||||
return exits.success('morning-sky');
|
||||
case 'lime':
|
||||
return exits.success('sunny-grass');
|
||||
case 'pink':
|
||||
return exits.success('pink-tulip');
|
||||
case 'black':
|
||||
return exits.success('dark-granite');
|
||||
default:
|
||||
return exits.success('berry-red');
|
||||
}
|
||||
},
|
||||
};
|
81
server/api/helpers/import-attachment-receiver.js
Normal file
81
server/api/helpers/import-attachment-receiver.js
Normal file
|
@ -0,0 +1,81 @@
|
|||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const util = require('util');
|
||||
const { v4: uuid } = require('uuid');
|
||||
const sharp = require('sharp');
|
||||
|
||||
const writeFile = util.promisify(fs.writeFile);
|
||||
|
||||
module.exports = {
|
||||
sync: true,
|
||||
inputs: {
|
||||
attachment: {
|
||||
type: 'ref',
|
||||
required: true,
|
||||
},
|
||||
card: {
|
||||
type: 'ref',
|
||||
required: true,
|
||||
},
|
||||
user: {
|
||||
type: 'ref',
|
||||
required: true,
|
||||
},
|
||||
values: {
|
||||
type: 'json',
|
||||
required: true,
|
||||
},
|
||||
request: {
|
||||
type: 'ref',
|
||||
},
|
||||
},
|
||||
|
||||
fn(inputs, exits) {
|
||||
const dirname = uuid();
|
||||
const filename = inputs.attachment.fileName;
|
||||
const rootPath = path.join(sails.config.custom.attachmentsPath, dirname);
|
||||
fs.mkdirSync(rootPath);
|
||||
const writeStream = fs.createWriteStream(path.join(rootPath, filename));
|
||||
writeStream.on('finish', async () => {
|
||||
const image = sharp(fs.readFileSync(path.join(rootPath, filename)));
|
||||
let imageMetadata;
|
||||
|
||||
try {
|
||||
imageMetadata = await image.metadata();
|
||||
} catch (error) {} // eslint-disable-line no-empty
|
||||
|
||||
if (imageMetadata) {
|
||||
let cover256Buffer;
|
||||
if (imageMetadata.height > imageMetadata.width) {
|
||||
cover256Buffer = await image.resize(256, 320).jpeg().toBuffer();
|
||||
} else {
|
||||
cover256Buffer = await image
|
||||
.resize({
|
||||
width: 256,
|
||||
})
|
||||
.jpeg()
|
||||
.toBuffer();
|
||||
}
|
||||
|
||||
const thumbnailsPath = path.join(rootPath, 'thumbnails');
|
||||
fs.mkdirSync(thumbnailsPath);
|
||||
|
||||
await writeFile(path.join(thumbnailsPath, 'cover-256.jpg'), cover256Buffer);
|
||||
|
||||
await sails.helpers.createAttachment(
|
||||
inputs.card,
|
||||
inputs.user,
|
||||
{
|
||||
dirname,
|
||||
filename: inputs.attachment.name,
|
||||
isImage: !!imageMetadata,
|
||||
name: inputs.attachment.name,
|
||||
},
|
||||
null,
|
||||
inputs.request,
|
||||
);
|
||||
}
|
||||
});
|
||||
return exits.success(writeStream);
|
||||
},
|
||||
};
|
|
@ -26,6 +26,7 @@ module.exports.policies = {
|
|||
'projects/update': ['is-authenticated', 'is-admin'],
|
||||
'projects/update-background-image': ['is-authenticated', 'is-admin'],
|
||||
'projects/delete': ['is-authenticated', 'is-admin'],
|
||||
'projects/import': ['is-authenticated', 'is-admin'],
|
||||
|
||||
'project-memberships/create': ['is-authenticated', 'is-admin'],
|
||||
'project-memberships/delete': ['is-authenticated', 'is-admin'],
|
||||
|
|
|
@ -24,6 +24,7 @@ module.exports.routes = {
|
|||
'GET /api/projects': 'projects/index',
|
||||
'POST /api/projects': 'projects/create',
|
||||
'PATCH /api/projects/:id': 'projects/update',
|
||||
'POST /api/projects/import': 'projects/import',
|
||||
'POST /api/projects/:id/background-image': 'projects/update-background-image',
|
||||
'DELETE /api/projects/:id': 'projects/delete',
|
||||
|
||||
|
|
11047
server/package-lock.json
generated
11047
server/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -42,6 +42,7 @@
|
|||
"dotenv": "^8.2.0",
|
||||
"dotenv-cli": "^4.0.0",
|
||||
"filenamify": "^4.2.0",
|
||||
"got": "^11.8.2",
|
||||
"jsonwebtoken": "^8.5.1",
|
||||
"knex": "^0.21.17",
|
||||
"lodash": "^4.17.20",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue