|
@@ -1,6 +1,6 @@
|
1
|
1
|
import React from 'react'
|
2
|
2
|
import { connect } from 'react-redux'
|
3
|
|
-import { withRouter, Route } from 'react-router-dom'
|
|
3
|
+import { withRouter } from 'react-router-dom'
|
4
|
4
|
import appFactory from '../appFactory.js'
|
5
|
5
|
import { PAGE } from '../helper.js'
|
6
|
6
|
import Sidebar from './Sidebar.jsx'
|
|
@@ -64,7 +64,7 @@ class WorkspaceContent extends React.Component {
|
64
|
64
|
const { workspaceIdInUrl } = this.state
|
65
|
65
|
const { user, workspaceList, app, contentType, match, location, dispatch } = this.props
|
66
|
66
|
|
67
|
|
- console.log('componentDidMount')
|
|
67
|
+ console.log('<WorkspaceContent> componentDidMount')
|
68
|
68
|
|
69
|
69
|
if (app.length === 0) {
|
70
|
70
|
const fetchGetAppList = await dispatch(getAppList())
|
|
@@ -100,16 +100,25 @@ class WorkspaceContent extends React.Component {
|
100
|
100
|
else dispatch(newFlashMessage('Error while loading workspace', 'danger'))
|
101
|
101
|
}
|
102
|
102
|
|
103
|
|
- componentDidUpdate (prevProps, prevState) {
|
104
|
|
- console.log('componentDidUpdate')
|
|
103
|
+ async componentDidUpdate (prevProps, prevState) {
|
|
104
|
+ const { match, location, dispatch } = this.props
|
|
105
|
+
|
|
106
|
+ console.log('<WorkspaceContent> componentDidUpdate')
|
105
|
107
|
|
106
|
108
|
if (this.state.workspaceIdInUrl === null) return
|
107
|
109
|
|
108
|
|
- const idWorkspace = parseInt(this.props.match.params.idws)
|
|
110
|
+ const idWorkspace = parseInt(match.params.idws)
|
109
|
111
|
|
110
|
112
|
if (isNaN(idWorkspace)) return
|
111
|
113
|
|
112
|
|
- if (prevState.workspaceIdInUrl !== idWorkspace) this.setState({workspaceIdInUrl: idWorkspace})
|
|
114
|
+ if (prevState.workspaceIdInUrl !== idWorkspace) {
|
|
115
|
+ this.setState({workspaceIdInUrl: idWorkspace})
|
|
116
|
+
|
|
117
|
+ const wsContent = await dispatch(getWorkspaceContentList(idWorkspace, 0))
|
|
118
|
+
|
|
119
|
+ if (wsContent.status === 200) dispatch(setWorkspaceContent(wsContent.json, qs.parse(location.search).type))
|
|
120
|
+ else dispatch(newFlashMessage('Error while loading workspace', 'danger'))
|
|
121
|
+ }
|
113
|
122
|
|
114
|
123
|
// if (user.user_id !== -1 && prevProps.user.id !== user.id) dispatch(getWorkspaceList(user.user_id, idWorkspace))
|
115
|
124
|
}
|
|
@@ -183,9 +192,7 @@ class WorkspaceContent extends React.Component {
|
183
|
192
|
<div className='sidebarpagecontainer'>
|
184
|
193
|
<Sidebar />
|
185
|
194
|
|
186
|
|
- <Route path={`${match.url}/:type/:idcts`} render={() =>
|
187
|
|
- <OpenContentApp idWorkspace={match.params.idws} appOpened={this.state.appOpened} updateAppOpened={this.handleUpdateAppOpened} />}
|
188
|
|
- />
|
|
195
|
+ <OpenContentApp idWorkspace={match.params.idws} appOpened={this.state.appOpened} updateAppOpened={this.handleUpdateAppOpened} />
|
189
|
196
|
|
190
|
197
|
<PageWrapper customeClass='workspace'>
|
191
|
198
|
<PageTitle
|