From 985090ebbf48d932bab2d2e6d2e14a378530cc9b Mon Sep 17 00:00:00 2001 From: Conrad S Date: Tue, 2 May 2017 11:06:03 -0400 Subject: [PATCH 1/2] Create folder structure on load of building in dashboard --- .../BuildingOverview/folderStructure.js | 30 +++++++++++++++++++ src/components/BuildingOverview/index.js | 6 ++-- src/components/DocumentCardViewer/index.js | 2 -- src/containers/Documents/actions.js | 3 +- src/containers/Documents/sagas.js | 5 ++-- 5 files changed, 39 insertions(+), 7 deletions(-) create mode 100644 src/components/BuildingOverview/folderStructure.js diff --git a/src/components/BuildingOverview/folderStructure.js b/src/components/BuildingOverview/folderStructure.js new file mode 100644 index 00000000..9aefc3e5 --- /dev/null +++ b/src/components/BuildingOverview/folderStructure.js @@ -0,0 +1,30 @@ +const defaultStructure = { + Utility_Bills: null, + 'Site Visit Media': null, + Reports: null, + Notes: null, + 'Building-Level Financial Documents': null, + 'Building-Level Engineering Analysis': null, + Sensors: null, + Projects: { + '"Projects" Template': { + 'Financial Analysis': null, + 'Engineering Analysis': null, + Notes: null, + Reports: null, + 'Contracts and Legal Documents': null, + 'Proposals and Price Quotes': null, + 'Construction Management Documents': { + Permits: null, + 'Contractor Agreements': null, + 'Contractor Insurance Documents': null, + 'Contractor Quotes': { + 'Reference Quotes (We Did Not Use)': null, + 'Active Quotes (We Used)': null, + }, + }, + }, + }, +}; + +export default defaultStructure; diff --git a/src/components/BuildingOverview/index.js b/src/components/BuildingOverview/index.js index 45014d37..e95df713 100644 --- a/src/components/BuildingOverview/index.js +++ b/src/components/BuildingOverview/index.js @@ -3,6 +3,7 @@ import documentsPropType from '../../containers/Documents/propTypes'; import DocumentCardViewer from '../../components/DocumentCardViewer'; import LinkBarDetail from '../../components/LinkBarDetail'; import ProjectCard from '../ProjectCard'; +import folderStructure from './folderStructure'; import { completeProjectPropTypes, completeOverviewPropTypes, @@ -22,7 +23,7 @@ export default class BuildingOverview extends Component { } componentDidMount() { - this.props.getFolderUrl(this.state.documentPath); + this.props.getFolderUrl(this.state.documentPath, folderStructure); } renderProjects = () => { @@ -42,6 +43,7 @@ export default class BuildingOverview extends Component { } render() { + const loadingFolder = this.props.documents.folderUrl === '#' || !this.props.documents.folderUrl; return (
{ @@ -111,5 +110,4 @@ DocumentCardViewer.propTypes = { documents: documentsPropType.isRequired, getDocuments: PropTypes.func.isRequired, uploadDocument: PropTypes.func.isRequired, - getFolderUrl: PropTypes.func.isRequired, }; diff --git a/src/containers/Documents/actions.js b/src/containers/Documents/actions.js index 52a86b1c..062d68dc 100644 --- a/src/containers/Documents/actions.js +++ b/src/containers/Documents/actions.js @@ -80,10 +80,11 @@ export function documentUploadError(error) { }; } -export function loadFolderUrl(folderPath) { +export function loadFolderUrl(folderPath, folderStructure = {}) { return { type: LOAD_FOLDER_URL, folderPath, + folderStructure, }; } diff --git a/src/containers/Documents/sagas.js b/src/containers/Documents/sagas.js index 468af8ee..7150f547 100644 --- a/src/containers/Documents/sagas.js +++ b/src/containers/Documents/sagas.js @@ -155,11 +155,12 @@ function* deleteDocument(action) { } function* getFolderUrl(action) { - const { folderPath } = action; + const { folderPath, folderStructure } = action; + const structure = JSON.stringify(folderStructure); const res = yield call( request, - `${documentURL}?path=${folderPath}&folder=true`, { + `${documentURL}?path=${folderPath}&structure=${structure}&folder=true`, { method: 'GET', headers: getHeaders(), } -- GitLab From 03caf2401e1774cdfc22d37f78e1058f40177d49 Mon Sep 17 00:00:00 2001 From: Conrad S Date: Wed, 3 May 2017 17:37:02 -0400 Subject: [PATCH 2/2] Changes folder names for consistency --- .../BuildingOverview/folderStructure.js | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/components/BuildingOverview/folderStructure.js b/src/components/BuildingOverview/folderStructure.js index 9aefc3e5..8add0f48 100644 --- a/src/components/BuildingOverview/folderStructure.js +++ b/src/components/BuildingOverview/folderStructure.js @@ -1,26 +1,26 @@ const defaultStructure = { Utility_Bills: null, - 'Site Visit Media': null, + Site_Visit_Media: null, Reports: null, Notes: null, - 'Building-Level Financial Documents': null, - 'Building-Level Engineering Analysis': null, + 'Building-Level_Financial_Documents': null, + 'Building-Level_Engineering_Analysis': null, Sensors: null, Projects: { - '"Projects" Template': { - 'Financial Analysis': null, - 'Engineering Analysis': null, + '"Projects"_Template': { + Financial_Analysis: null, + Engineering_Analysis: null, Notes: null, Reports: null, - 'Contracts and Legal Documents': null, - 'Proposals and Price Quotes': null, - 'Construction Management Documents': { + Contracts_and_Legal_Documents: null, + Proposals_and_Price_Quotes: null, + Construction_Management_Documents: { Permits: null, - 'Contractor Agreements': null, - 'Contractor Insurance Documents': null, - 'Contractor Quotes': { - 'Reference Quotes (We Did Not Use)': null, - 'Active Quotes (We Used)': null, + Contractor_Agreements: null, + Contractor_Insurance_Documents: null, + Contractor_Quotes: { + 'Reference_Quotes_(We_Did_Not_Use)': null, + 'Active_Quotes_(We_Used)': null, }, }, }, -- GitLab