diff options
Diffstat (limited to 'src/features')
-rw-r--r-- | src/features/announcements/components/AnnouncementScreen.js | 1 | ||||
-rw-r--r-- | src/features/announcements/index.js | 1 | ||||
-rw-r--r-- | src/features/delayApp/index.js | 1 | ||||
-rw-r--r-- | src/features/planSelection/components/PlanItem.js | 1 | ||||
-rw-r--r-- | src/features/publishDebugInfo/Component.js | 1 | ||||
-rw-r--r-- | src/features/serviceLimit/components/LimitReachedInfobox.js | 1 | ||||
-rw-r--r-- | src/features/todos/components/TodosWebview.js | 51 | ||||
-rw-r--r-- | src/features/trialStatusBar/containers/TrialStatusBarScreen.js | 20 | ||||
-rw-r--r-- | src/features/workspaces/components/EditWorkspaceForm.js | 23 | ||||
-rw-r--r-- | src/features/workspaces/components/WorkspacesDashboard.js | 8 | ||||
-rw-r--r-- | src/features/workspaces/containers/EditWorkspaceScreen.js | 4 | ||||
-rw-r--r-- | src/features/workspaces/store.js | 47 |
12 files changed, 82 insertions, 77 deletions
diff --git a/src/features/announcements/components/AnnouncementScreen.js b/src/features/announcements/components/AnnouncementScreen.js index 659cb4961..21964b108 100644 --- a/src/features/announcements/components/AnnouncementScreen.js +++ b/src/features/announcements/components/AnnouncementScreen.js | |||
@@ -185,7 +185,6 @@ const styles = theme => ({ | |||
185 | }, | 185 | }, |
186 | }); | 186 | }); |
187 | 187 | ||
188 | |||
189 | @inject('stores', 'actions') @injectSheet(styles) @observer | 188 | @inject('stores', 'actions') @injectSheet(styles) @observer |
190 | class AnnouncementScreen extends Component { | 189 | class AnnouncementScreen extends Component { |
191 | static propTypes = { | 190 | static propTypes = { |
diff --git a/src/features/announcements/index.js b/src/features/announcements/index.js index 369ded1b2..28f0b10ed 100644 --- a/src/features/announcements/index.js +++ b/src/features/announcements/index.js | |||
@@ -7,7 +7,6 @@ export const GA_CATEGORY_ANNOUNCEMENTS = 'Announcements'; | |||
7 | 7 | ||
8 | export const announcementsStore = new AnnouncementsStore(); | 8 | export const announcementsStore = new AnnouncementsStore(); |
9 | 9 | ||
10 | |||
11 | export default function initAnnouncements(stores, actions) { | 10 | export default function initAnnouncements(stores, actions) { |
12 | const { features } = stores; | 11 | const { features } = stores; |
13 | 12 | ||
diff --git a/src/features/delayApp/index.js b/src/features/delayApp/index.js index 5ef01a47e..f0c2bdc82 100644 --- a/src/features/delayApp/index.js +++ b/src/features/delayApp/index.js | |||
@@ -59,7 +59,6 @@ export default function init(stores) { | |||
59 | 59 | ||
60 | setVisibility(true); | 60 | setVisibility(true); |
61 | 61 | ||
62 | |||
63 | setTimeout(() => { | 62 | setTimeout(() => { |
64 | debug('Resetting app delay'); | 63 | debug('Resetting app delay'); |
65 | 64 | ||
diff --git a/src/features/planSelection/components/PlanItem.js b/src/features/planSelection/components/PlanItem.js index 3855fedf1..e90532dec 100644 --- a/src/features/planSelection/components/PlanItem.js +++ b/src/features/planSelection/components/PlanItem.js | |||
@@ -111,7 +111,6 @@ const styles = theme => ({ | |||
111 | }, | 111 | }, |
112 | }); | 112 | }); |
113 | 113 | ||
114 | |||
115 | export default @observer @injectSheet(styles) class PlanItem extends Component { | 114 | export default @observer @injectSheet(styles) class PlanItem extends Component { |
116 | static propTypes = { | 115 | static propTypes = { |
117 | name: PropTypes.string.isRequired, | 116 | name: PropTypes.string.isRequired, |
diff --git a/src/features/publishDebugInfo/Component.js b/src/features/publishDebugInfo/Component.js index 4308b8f09..e7949a0be 100644 --- a/src/features/publishDebugInfo/Component.js +++ b/src/features/publishDebugInfo/Component.js | |||
@@ -13,7 +13,6 @@ import { DEBUG_API } from '../../config'; | |||
13 | import AppStore from '../../stores/AppStore'; | 13 | import AppStore from '../../stores/AppStore'; |
14 | import ServicesStore from '../../stores/ServicesStore'; | 14 | import ServicesStore from '../../stores/ServicesStore'; |
15 | 15 | ||
16 | |||
17 | const messages = defineMessages({ | 16 | const messages = defineMessages({ |
18 | title: { | 17 | title: { |
19 | id: 'feature.publishDebugInfo.title', | 18 | id: 'feature.publishDebugInfo.title', |
diff --git a/src/features/serviceLimit/components/LimitReachedInfobox.js b/src/features/serviceLimit/components/LimitReachedInfobox.js index 83aec4c40..424c92990 100644 --- a/src/features/serviceLimit/components/LimitReachedInfobox.js +++ b/src/features/serviceLimit/components/LimitReachedInfobox.js | |||
@@ -34,7 +34,6 @@ const styles = theme => ({ | |||
34 | }, | 34 | }, |
35 | }); | 35 | }); |
36 | 36 | ||
37 | |||
38 | @inject('stores', 'actions') @injectSheet(styles) @observer | 37 | @inject('stores', 'actions') @injectSheet(styles) @observer |
39 | class LimitReachedInfobox extends Component { | 38 | class LimitReachedInfobox extends Component { |
40 | static propTypes = { | 39 | static propTypes = { |
diff --git a/src/features/todos/components/TodosWebview.js b/src/features/todos/components/TodosWebview.js index dccb818a6..ca8460f94 100644 --- a/src/features/todos/components/TodosWebview.js +++ b/src/features/todos/components/TodosWebview.js | |||
@@ -7,7 +7,7 @@ import classnames from 'classnames'; | |||
7 | 7 | ||
8 | import { TODOS_PARTITION_ID } from '../../../config'; | 8 | import { TODOS_PARTITION_ID } from '../../../config'; |
9 | 9 | ||
10 | const styles = theme => ({ | 10 | const styles = (theme) => ({ |
11 | root: { | 11 | root: { |
12 | background: theme.colorBackground, | 12 | background: theme.colorBackground, |
13 | position: 'relative', | 13 | position: 'relative', |
@@ -34,7 +34,6 @@ const styles = theme => ({ | |||
34 | width: 5, | 34 | width: 5, |
35 | zIndex: 400, | 35 | zIndex: 400, |
36 | background: theme.todos.dragIndicator.background, | 36 | background: theme.todos.dragIndicator.background, |
37 | |||
38 | }, | 37 | }, |
39 | premiumContainer: { | 38 | premiumContainer: { |
40 | display: 'flex', | 39 | display: 'flex', |
@@ -68,7 +67,8 @@ const styles = theme => ({ | |||
68 | }, | 67 | }, |
69 | }); | 68 | }); |
70 | 69 | ||
71 | @injectSheet(styles) @observer | 70 | @injectSheet(styles) |
71 | @observer | ||
72 | class TodosWebview extends Component { | 72 | class TodosWebview extends Component { |
73 | static propTypes = { | 73 | static propTypes = { |
74 | classes: PropTypes.object.isRequired, | 74 | classes: PropTypes.object.isRequired, |
@@ -89,15 +89,11 @@ class TodosWebview extends Component { | |||
89 | width: 300, | 89 | width: 300, |
90 | }; | 90 | }; |
91 | 91 | ||
92 | componentWillMount() { | 92 | componentDidMount() { |
93 | const { width } = this.props; | ||
94 | |||
95 | this.setState({ | 93 | this.setState({ |
96 | width, | 94 | width: this.props.width, |
97 | }); | 95 | }); |
98 | } | ||
99 | 96 | ||
100 | componentDidMount() { | ||
101 | this.node.addEventListener('mousemove', this.resizePanel.bind(this)); | 97 | this.node.addEventListener('mousemove', this.resizePanel.bind(this)); |
102 | this.node.addEventListener('mouseup', this.stopResize.bind(this)); | 98 | this.node.addEventListener('mouseup', this.stopResize.bind(this)); |
103 | this.node.addEventListener('mouseleave', this.stopResize.bind(this)); | 99 | this.node.addEventListener('mouseleave', this.stopResize.bind(this)); |
@@ -114,10 +110,7 @@ class TodosWebview extends Component { | |||
114 | resizePanel(e) { | 110 | resizePanel(e) { |
115 | const { minWidth } = this.props; | 111 | const { minWidth } = this.props; |
116 | 112 | ||
117 | const { | 113 | const { isDragging, initialPos } = this.state; |
118 | isDragging, | ||
119 | initialPos, | ||
120 | } = this.state; | ||
121 | 114 | ||
122 | if (isDragging && Math.abs(e.clientX - window.innerWidth) > minWidth) { | 115 | if (isDragging && Math.abs(e.clientX - window.innerWidth) > minWidth) { |
123 | const delta = e.clientX - initialPos; | 116 | const delta = e.clientX - initialPos; |
@@ -129,16 +122,9 @@ class TodosWebview extends Component { | |||
129 | } | 122 | } |
130 | 123 | ||
131 | stopResize() { | 124 | stopResize() { |
132 | const { | 125 | const { resize, minWidth } = this.props; |
133 | resize, | ||
134 | minWidth, | ||
135 | } = this.props; | ||
136 | 126 | ||
137 | const { | 127 | const { isDragging, delta, width } = this.state; |
138 | isDragging, | ||
139 | delta, | ||
140 | width, | ||
141 | } = this.state; | ||
142 | 128 | ||
143 | if (isDragging) { | 129 | if (isDragging) { |
144 | let newWidth = width + (delta < 0 ? Math.abs(delta) : -Math.abs(delta)); | 130 | let newWidth = width + (delta < 0 ? Math.abs(delta) : -Math.abs(delta)); |
@@ -176,11 +162,7 @@ class TodosWebview extends Component { | |||
176 | isTodoUrlValid, | 162 | isTodoUrlValid, |
177 | } = this.props; | 163 | } = this.props; |
178 | 164 | ||
179 | const { | 165 | const { width, delta, isDragging } = this.state; |
180 | width, | ||
181 | delta, | ||
182 | isDragging, | ||
183 | } = this.state; | ||
184 | 166 | ||
185 | let displayedWidth = isVisible ? width : 0; | 167 | let displayedWidth = isVisible ? width : 0; |
186 | if (isTodosServiceActive) { | 168 | if (isTodosServiceActive) { |
@@ -197,13 +179,18 @@ class TodosWebview extends Component { | |||
197 | })} | 179 | })} |
198 | style={{ width: displayedWidth }} | 180 | style={{ width: displayedWidth }} |
199 | onMouseUp={() => this.stopResize()} | 181 | onMouseUp={() => this.stopResize()} |
200 | ref={(node) => { this.node = node; }} | 182 | ref={(node) => { |
183 | this.node = node; | ||
184 | }} | ||
201 | id="todos-panel" | 185 | id="todos-panel" |
202 | > | 186 | > |
203 | <div | 187 | <div |
204 | className={classes.resizeHandler} | 188 | className={classes.resizeHandler} |
205 | style={Object.assign({ left: delta }, isDragging ? { width: 600, marginLeft: -200 } : {})} // This hack is required as resizing with webviews beneath behaves quite bad | 189 | style={{ |
206 | onMouseDown={e => this.startResize(e)} | 190 | left: delta, |
191 | ...(isDragging ? { width: 600, marginLeft: -200 } : {}), | ||
192 | }} // This hack is required as resizing with webviews beneath behaves quite bad | ||
193 | onMouseDown={(e) => this.startResize(e)} | ||
207 | /> | 194 | /> |
208 | {isDragging && ( | 195 | {isDragging && ( |
209 | <div | 196 | <div |
@@ -221,7 +208,9 @@ class TodosWebview extends Component { | |||
221 | }} | 208 | }} |
222 | partition={TODOS_PARTITION_ID} | 209 | partition={TODOS_PARTITION_ID} |
223 | preload="./features/todos/preload.js" | 210 | preload="./features/todos/preload.js" |
224 | ref={(webview) => { this.webview = webview ? webview.view : null; }} | 211 | ref={(webview) => { |
212 | this.webview = webview ? webview.view : null; | ||
213 | }} | ||
225 | useragent={userAgent} | 214 | useragent={userAgent} |
226 | src={todoUrl} | 215 | src={todoUrl} |
227 | /> | 216 | /> |
diff --git a/src/features/trialStatusBar/containers/TrialStatusBarScreen.js b/src/features/trialStatusBar/containers/TrialStatusBarScreen.js index 715251854..e0f5ab5f2 100644 --- a/src/features/trialStatusBar/containers/TrialStatusBarScreen.js +++ b/src/features/trialStatusBar/containers/TrialStatusBarScreen.js | |||
@@ -12,7 +12,8 @@ import { trialStatusBarStore } from '..'; | |||
12 | import { i18nPlanName } from '../../../helpers/plan-helpers'; | 12 | import { i18nPlanName } from '../../../helpers/plan-helpers'; |
13 | import PaymentStore from '../../../stores/PaymentStore'; | 13 | import PaymentStore from '../../../stores/PaymentStore'; |
14 | 14 | ||
15 | @inject('stores', 'actions') @observer | 15 | @inject('stores', 'actions') |
16 | @observer | ||
16 | class TrialStatusBarScreen extends Component { | 17 | class TrialStatusBarScreen extends Component { |
17 | static contextTypes = { | 18 | static contextTypes = { |
18 | intl: intlShape, | 19 | intl: intlShape, |
@@ -41,7 +42,9 @@ class TrialStatusBarScreen extends Component { | |||
41 | 42 | ||
42 | calculateRestTime() { | 43 | calculateRestTime() { |
43 | const { trialEndTime } = trialStatusBarStore; | 44 | const { trialEndTime } = trialStatusBarStore; |
44 | const percent = Math.abs(100 - Math.abs(trialEndTime.asMilliseconds()) * 100 / ms('14d')).toFixed(2); | 45 | const percent = ( |
46 | Math.abs(100 - Math.abs(trialEndTime.asMilliseconds()) * 100) / ms('14d') | ||
47 | ).toFixed(2); | ||
45 | const restTime = trialEndTime.humanize(); | 48 | const restTime = trialEndTime.humanize(); |
46 | const hasEnded = trialEndTime.asMilliseconds() > 0; | 49 | const hasEnded = trialEndTime.asMilliseconds() > 0; |
47 | 50 | ||
@@ -58,18 +61,19 @@ class TrialStatusBarScreen extends Component { | |||
58 | }); | 61 | }); |
59 | } | 62 | } |
60 | 63 | ||
61 | |||
62 | render() { | 64 | render() { |
63 | const { intl } = this.context; | 65 | const { intl } = this.context; |
64 | 66 | ||
65 | const { | 67 | const { |
66 | showOverlay, | 68 | showOverlay, percent, restTime, hasEnded, |
67 | percent, | ||
68 | restTime, | ||
69 | hasEnded, | ||
70 | } = this.state; | 69 | } = this.state; |
71 | 70 | ||
72 | if (!trialStatusBarStore || !trialStatusBarStore.isFeatureActive || !showOverlay || !trialStatusBarStore.showTrialStatusBarOverlay) { | 71 | if ( |
72 | !trialStatusBarStore | ||
73 | || !trialStatusBarStore.isFeatureActive | ||
74 | || !showOverlay | ||
75 | || !trialStatusBarStore.showTrialStatusBarOverlay | ||
76 | ) { | ||
73 | return null; | 77 | return null; |
74 | } | 78 | } |
75 | 79 | ||
diff --git a/src/features/workspaces/components/EditWorkspaceForm.js b/src/features/workspaces/components/EditWorkspaceForm.js index f23bc6cbf..0ff836cba 100644 --- a/src/features/workspaces/components/EditWorkspaceForm.js +++ b/src/features/workspaces/components/EditWorkspaceForm.js | |||
@@ -40,7 +40,8 @@ const messages = defineMessages({ | |||
40 | }, | 40 | }, |
41 | keepLoadedInfo: { | 41 | keepLoadedInfo: { |
42 | id: 'settings.workspace.form.keepLoadedInfo', | 42 | id: 'settings.workspace.form.keepLoadedInfo', |
43 | defaultMessage: '!!!*This option will be overwritten by the global "Keep all workspaces loaded" option.', | 43 | defaultMessage: |
44 | '!!!*This option will be overwritten by the global "Keep all workspaces loaded" option.', | ||
44 | }, | 45 | }, |
45 | servicesInWorkspaceHeadline: { | 46 | servicesInWorkspaceHeadline: { |
46 | id: 'settings.workspace.form.servicesInWorkspaceHeadline', | 47 | id: 'settings.workspace.form.servicesInWorkspaceHeadline', |
@@ -68,7 +69,8 @@ const styles = () => ({ | |||
68 | }, | 69 | }, |
69 | }); | 70 | }); |
70 | 71 | ||
71 | @injectSheet(styles) @observer | 72 | @injectSheet(styles) |
73 | @observer | ||
72 | class EditWorkspaceForm extends Component { | 74 | class EditWorkspaceForm extends Component { |
73 | static contextTypes = { | 75 | static contextTypes = { |
74 | intl: intlShape, | 76 | intl: intlShape, |
@@ -86,6 +88,7 @@ class EditWorkspaceForm extends Component { | |||
86 | 88 | ||
87 | form = this.prepareWorkspaceForm(this.props.workspace); | 89 | form = this.prepareWorkspaceForm(this.props.workspace); |
88 | 90 | ||
91 | // eslint-disable-next-line react/no-deprecated | ||
89 | componentWillReceiveProps(nextProps) { | 92 | componentWillReceiveProps(nextProps) { |
90 | const { workspace } = this.props; | 93 | const { workspace } = this.props; |
91 | if (workspace.id !== nextProps.workspace.id) { | 94 | if (workspace.id !== nextProps.workspace.id) { |
@@ -164,16 +167,14 @@ class EditWorkspaceForm extends Component { | |||
164 | </Link> | 167 | </Link> |
165 | </span> | 168 | </span> |
166 | <span className="separator" /> | 169 | <span className="separator" /> |
167 | <span className="settings__header-item"> | 170 | <span className="settings__header-item">{workspace.name}</span> |
168 | {workspace.name} | ||
169 | </span> | ||
170 | </div> | 171 | </div> |
171 | <div className="settings__body"> | 172 | <div className="settings__body"> |
172 | <div className={classes.nameInput}> | 173 | <div className={classes.nameInput}> |
173 | <Input {...form.$('name').bind()} /> | 174 | <Input {...form.$('name').bind()} /> |
174 | <Toggle field={form.$('keepLoaded')} /> | 175 | <Toggle field={form.$('keepLoaded')} /> |
175 | <p className={`${classes.keepLoadedInfo} franz-form__label`}> | 176 | <p className={`${classes.keepLoadedInfo} franz-form__label`}> |
176 | { intl.formatMessage(messages.keepLoadedInfo) } | 177 | {intl.formatMessage(messages.keepLoadedInfo)} |
177 | </p> | 178 | </p> |
178 | </div> | 179 | </div> |
179 | <h2>{intl.formatMessage(messages.servicesInWorkspaceHeadline)}</h2> | 180 | <h2>{intl.formatMessage(messages.servicesInWorkspaceHeadline)}</h2> |
@@ -187,11 +188,13 @@ class EditWorkspaceForm extends Component { | |||
187 | </span> | 188 | </span> |
188 | {intl.formatMessage(messages.noServicesAdded)} | 189 | {intl.formatMessage(messages.noServicesAdded)} |
189 | </p> | 190 | </p> |
190 | <Link to="/settings/recipes" className="button">{intl.formatMessage(messages.discoverServices)}</Link> | 191 | <Link to="/settings/recipes" className="button"> |
192 | {intl.formatMessage(messages.discoverServices)} | ||
193 | </Link> | ||
191 | </div> | 194 | </div> |
192 | ) : ( | 195 | ) : ( |
193 | <Fragment> | 196 | <> |
194 | {services.map(s => ( | 197 | {services.map((s) => ( |
195 | <WorkspaceServiceListItem | 198 | <WorkspaceServiceListItem |
196 | key={s.id} | 199 | key={s.id} |
197 | service={s} | 200 | service={s} |
@@ -199,7 +202,7 @@ class EditWorkspaceForm extends Component { | |||
199 | onToggle={() => this.toggleService(s)} | 202 | onToggle={() => this.toggleService(s)} |
200 | /> | 203 | /> |
201 | ))} | 204 | ))} |
202 | </Fragment> | 205 | </> |
203 | )} | 206 | )} |
204 | </div> | 207 | </div> |
205 | </div> | 208 | </div> |
diff --git a/src/features/workspaces/components/WorkspacesDashboard.js b/src/features/workspaces/components/WorkspacesDashboard.js index a90bb37e9..cfaacd56e 100644 --- a/src/features/workspaces/components/WorkspacesDashboard.js +++ b/src/features/workspaces/components/WorkspacesDashboard.js | |||
@@ -184,7 +184,7 @@ class WorkspacesDashboard extends Component { | |||
184 | {getUserWorkspacesRequest.isExecuting ? ( | 184 | {getUserWorkspacesRequest.isExecuting ? ( |
185 | <Loader /> | 185 | <Loader /> |
186 | ) : ( | 186 | ) : ( |
187 | <Fragment> | 187 | <> |
188 | {/* ===== Workspace could not be loaded error ===== */} | 188 | {/* ===== Workspace could not be loaded error ===== */} |
189 | {getUserWorkspacesRequest.error ? ( | 189 | {getUserWorkspacesRequest.error ? ( |
190 | <Infobox | 190 | <Infobox |
@@ -197,7 +197,7 @@ class WorkspacesDashboard extends Component { | |||
197 | {intl.formatMessage(messages.workspacesRequestFailed)} | 197 | {intl.formatMessage(messages.workspacesRequestFailed)} |
198 | </Infobox> | 198 | </Infobox> |
199 | ) : ( | 199 | ) : ( |
200 | <Fragment> | 200 | <> |
201 | {workspaces.length === 0 ? ( | 201 | {workspaces.length === 0 ? ( |
202 | <div className="align-middle settings__empty-state"> | 202 | <div className="align-middle settings__empty-state"> |
203 | {/* ===== Workspaces empty state ===== */} | 203 | {/* ===== Workspaces empty state ===== */} |
@@ -222,9 +222,9 @@ class WorkspacesDashboard extends Component { | |||
222 | </tbody> | 222 | </tbody> |
223 | </table> | 223 | </table> |
224 | )} | 224 | )} |
225 | </Fragment> | 225 | </> |
226 | )} | 226 | )} |
227 | </Fragment> | 227 | </> |
228 | )} | 228 | )} |
229 | </> | 229 | </> |
230 | )} | 230 | )} |
diff --git a/src/features/workspaces/containers/EditWorkspaceScreen.js b/src/features/workspaces/containers/EditWorkspaceScreen.js index 5eca71259..ba7606031 100644 --- a/src/features/workspaces/containers/EditWorkspaceScreen.js +++ b/src/features/workspaces/containers/EditWorkspaceScreen.js | |||
@@ -32,9 +32,7 @@ class EditWorkspaceScreen extends Component { | |||
32 | const { workspaceBeingEdited } = workspaceStore; | 32 | const { workspaceBeingEdited } = workspaceStore; |
33 | const { actions } = this.props; | 33 | const { actions } = this.props; |
34 | const workspace = new Workspace( | 34 | const workspace = new Workspace( |
35 | Object.assign({ | 35 | ({ saving: true, ...workspaceBeingEdited, ...values }), |
36 | saving: true, | ||
37 | }, workspaceBeingEdited, values), | ||
38 | ); | 36 | ); |
39 | actions.workspaces.update({ workspace }); | 37 | actions.workspaces.update({ workspace }); |
40 | }; | 38 | }; |
diff --git a/src/features/workspaces/store.js b/src/features/workspaces/store.js index bddcb6eb4..632f3c299 100644 --- a/src/features/workspaces/store.js +++ b/src/features/workspaces/store.js | |||
@@ -1,8 +1,4 @@ | |||
1 | import { | 1 | import { computed, observable, action } from 'mobx'; |
2 | computed, | ||
3 | observable, | ||
4 | action, | ||
5 | } from 'mobx'; | ||
6 | import localStorage from 'mobx-localstorage'; | 2 | import localStorage from 'mobx-localstorage'; |
7 | import { matchRoute } from '../../helpers/routing-helpers'; | 3 | import { matchRoute } from '../../helpers/routing-helpers'; |
8 | import { workspaceActions } from './actions'; | 4 | import { workspaceActions } from './actions'; |
@@ -105,7 +101,10 @@ export default class WorkspacesStore extends FeatureStore { | |||
105 | [workspaceActions.update, this._update], | 101 | [workspaceActions.update, this._update], |
106 | [workspaceActions.activate, this._setActiveWorkspace], | 102 | [workspaceActions.activate, this._setActiveWorkspace], |
107 | [workspaceActions.deactivate, this._deactivateActiveWorkspace], | 103 | [workspaceActions.deactivate, this._deactivateActiveWorkspace], |
108 | [workspaceActions.toggleKeepAllWorkspacesLoadedSetting, this._toggleKeepAllWorkspacesLoadedSetting], | 104 | [ |
105 | workspaceActions.toggleKeepAllWorkspacesLoadedSetting, | ||
106 | this._toggleKeepAllWorkspacesLoadedSetting, | ||
107 | ], | ||
109 | ]); | 108 | ]); |
110 | this._allActions = this._freeUserActions.concat(this._premiumUserActions); | 109 | this._allActions = this._freeUserActions.concat(this._premiumUserActions); |
111 | this._registerActions(this._allActions); | 110 | this._registerActions(this._allActions); |
@@ -124,7 +123,9 @@ export default class WorkspacesStore extends FeatureStore { | |||
124 | this._activateLastUsedWorkspaceReaction, | 123 | this._activateLastUsedWorkspaceReaction, |
125 | this._setWorkspaceBeingEditedReaction, | 124 | this._setWorkspaceBeingEditedReaction, |
126 | ]); | 125 | ]); |
127 | this._allReactions = this._freeUserReactions.concat(this._premiumUserReactions); | 126 | this._allReactions = this._freeUserReactions.concat( |
127 | this._premiumUserReactions, | ||
128 | ); | ||
128 | 129 | ||
129 | this._registerReactions(this._allReactions); | 130 | this._registerReactions(this._allReactions); |
130 | 131 | ||
@@ -157,12 +158,12 @@ export default class WorkspacesStore extends FeatureStore { | |||
157 | 158 | ||
158 | getWorkspaceServices(workspace) { | 159 | getWorkspaceServices(workspace) { |
159 | const { services } = this.stores; | 160 | const { services } = this.stores; |
160 | return workspace.services.map(id => services.one(id)).filter(s => !!s); | 161 | return workspace.services.map((id) => services.one(id)).filter((s) => !!s); |
161 | } | 162 | } |
162 | 163 | ||
163 | // ========== PRIVATE METHODS ========= // | 164 | // ========== PRIVATE METHODS ========= // |
164 | 165 | ||
165 | _getWorkspaceById = id => this.workspaces.find(w => w.id === id); | 166 | _getWorkspaceById = (id) => this.workspaces.find((w) => w.id === id); |
166 | 167 | ||
167 | _updateSettings = (changes) => { | 168 | _updateSettings = (changes) => { |
168 | localStorage.setItem('workspaces', { | 169 | localStorage.setItem('workspaces', { |
@@ -178,6 +179,7 @@ export default class WorkspacesStore extends FeatureStore { | |||
178 | }; | 179 | }; |
179 | 180 | ||
180 | @action _create = async ({ name }) => { | 181 | @action _create = async ({ name }) => { |
182 | // eslint-disable-next-line no-useless-catch | ||
181 | try { | 183 | try { |
182 | const workspace = await createWorkspaceRequest.execute(name); | 184 | const workspace = await createWorkspaceRequest.execute(name); |
183 | await getUserWorkspacesRequest.result.push(workspace); | 185 | await getUserWorkspacesRequest.result.push(workspace); |
@@ -188,6 +190,7 @@ export default class WorkspacesStore extends FeatureStore { | |||
188 | }; | 190 | }; |
189 | 191 | ||
190 | @action _delete = async ({ workspace }) => { | 192 | @action _delete = async ({ workspace }) => { |
193 | // eslint-disable-next-line no-useless-catch | ||
191 | try { | 194 | try { |
192 | await deleteWorkspaceRequest.execute(workspace); | 195 | await deleteWorkspaceRequest.execute(workspace); |
193 | await getUserWorkspacesRequest.result.remove(workspace); | 196 | await getUserWorkspacesRequest.result.remove(workspace); |
@@ -198,6 +201,7 @@ export default class WorkspacesStore extends FeatureStore { | |||
198 | }; | 201 | }; |
199 | 202 | ||
200 | @action _update = async ({ workspace }) => { | 203 | @action _update = async ({ workspace }) => { |
204 | // eslint-disable-next-line no-useless-catch | ||
201 | try { | 205 | try { |
202 | await updateWorkspaceRequest.execute(workspace); | 206 | await updateWorkspaceRequest.execute(workspace); |
203 | // Path local result optimistically | 207 | // Path local result optimistically |
@@ -235,7 +239,9 @@ export default class WorkspacesStore extends FeatureStore { | |||
235 | this.activeWorkspace = null; | 239 | this.activeWorkspace = null; |
236 | }, 100); | 240 | }, 100); |
237 | // Indicate that we are done switching to the default workspace | 241 | // Indicate that we are done switching to the default workspace |
238 | setTimeout(() => { this.isSwitchingWorkspace = false; }, 1000); | 242 | setTimeout(() => { |
243 | this.isSwitchingWorkspace = false; | ||
244 | }, 1000); | ||
239 | }; | 245 | }; |
240 | 246 | ||
241 | @action _toggleWorkspaceDrawer = () => { | 247 | @action _toggleWorkspaceDrawer = () => { |
@@ -255,7 +261,9 @@ export default class WorkspacesStore extends FeatureStore { | |||
255 | }; | 261 | }; |
256 | 262 | ||
257 | _toggleKeepAllWorkspacesLoadedSetting = async () => { | 263 | _toggleKeepAllWorkspacesLoadedSetting = async () => { |
258 | this._updateSettings({ keepAllWorkspacesLoaded: !this.settings.keepAllWorkspacesLoaded }); | 264 | this._updateSettings({ |
265 | keepAllWorkspacesLoaded: !this.settings.keepAllWorkspacesLoaded, | ||
266 | }); | ||
259 | }; | 267 | }; |
260 | 268 | ||
261 | // Reactions | 269 | // Reactions |
@@ -309,7 +317,9 @@ export default class WorkspacesStore extends FeatureStore { | |||
309 | 317 | ||
310 | _openDrawerWithSettingsReaction = () => { | 318 | _openDrawerWithSettingsReaction = () => { |
311 | const { router } = this.stores; | 319 | const { router } = this.stores; |
312 | const isWorkspaceSettingsRoute = router.location.pathname.includes(WORKSPACES_ROUTES.ROOT); | 320 | const isWorkspaceSettingsRoute = router.location.pathname.includes( |
321 | WORKSPACES_ROUTES.ROOT, | ||
322 | ); | ||
313 | const isSwitchingToSettingsRoute = !this.isSettingsRouteActive && isWorkspaceSettingsRoute; | 323 | const isSwitchingToSettingsRoute = !this.isSettingsRouteActive && isWorkspaceSettingsRoute; |
314 | const isLeavingSettingsRoute = !isWorkspaceSettingsRoute && this.isSettingsRouteActive; | 324 | const isLeavingSettingsRoute = !isWorkspaceSettingsRoute && this.isSettingsRouteActive; |
315 | 325 | ||
@@ -321,7 +331,10 @@ export default class WorkspacesStore extends FeatureStore { | |||
321 | } | 331 | } |
322 | } else if (isLeavingSettingsRoute) { | 332 | } else if (isLeavingSettingsRoute) { |
323 | this.isSettingsRouteActive = false; | 333 | this.isSettingsRouteActive = false; |
324 | if (!this._wasDrawerOpenBeforeSettingsRoute && this.isWorkspaceDrawerOpen) { | 334 | if ( |
335 | !this._wasDrawerOpenBeforeSettingsRoute | ||
336 | && this.isWorkspaceDrawerOpen | ||
337 | ) { | ||
325 | workspaceActions.toggleWorkspaceDrawer(); | 338 | workspaceActions.toggleWorkspaceDrawer(); |
326 | } | 339 | } |
327 | } | 340 | } |
@@ -334,7 +347,11 @@ export default class WorkspacesStore extends FeatureStore { | |||
334 | // Loop through all workspaces and remove invalid service ids (locally) | 347 | // Loop through all workspaces and remove invalid service ids (locally) |
335 | this.workspaces.forEach((workspace) => { | 348 | this.workspaces.forEach((workspace) => { |
336 | workspace.services.forEach((serviceId) => { | 349 | workspace.services.forEach((serviceId) => { |
337 | if (servicesHaveBeenLoaded && !services.one(serviceId) && serviceId !== KEEP_WS_LOADED_USID) { | 350 | if ( |
351 | servicesHaveBeenLoaded | ||
352 | && !services.one(serviceId) | ||
353 | && serviceId !== KEEP_WS_LOADED_USID | ||
354 | ) { | ||
338 | workspace.services.remove(serviceId); | 355 | workspace.services.remove(serviceId); |
339 | } | 356 | } |
340 | }); | 357 | }); |
@@ -351,5 +368,5 @@ export default class WorkspacesStore extends FeatureStore { | |||
351 | this._startActions(this._premiumUserActions); | 368 | this._startActions(this._premiumUserActions); |
352 | this._startReactions(this._premiumUserReactions); | 369 | this._startReactions(this._premiumUserReactions); |
353 | } | 370 | } |
354 | } | 371 | }; |
355 | } | 372 | } |