aboutsummaryrefslogtreecommitdiffstats
path: root/src/features
diff options
context:
space:
mode:
Diffstat (limited to 'src/features')
-rw-r--r--src/features/webControls/components/WebControls.js9
-rw-r--r--src/features/workspaces/components/EditWorkspaceForm.js1
-rw-r--r--src/features/workspaces/store.js38
3 files changed, 21 insertions, 27 deletions
diff --git a/src/features/webControls/components/WebControls.js b/src/features/webControls/components/WebControls.js
index 9a95eb2d2..bebf52c08 100644
--- a/src/features/webControls/components/WebControls.js
+++ b/src/features/webControls/components/WebControls.js
@@ -199,12 +199,17 @@ class WebControls extends Component {
199 }) 199 })
200 } 200 }
201 onFocus={event => { 201 onFocus={event => {
202 console.log('on focus event');
203 event.target.select(); 202 event.target.select();
204 this.setState({ 203 this.setState({
205 editUrl: true, 204 editUrl: true,
206 }); 205 });
207 }} 206 }}
207 onBlur={event => {
208 event.target.blur();
209 this.setState({
210 editUrl: false,
211 });
212 }}
208 onKeyDown={event => { 213 onKeyDown={event => {
209 if (event.key === 'Enter') { 214 if (event.key === 'Enter') {
210 this.setState({ 215 this.setState({
@@ -217,7 +222,7 @@ class WebControls extends Component {
217 editUrl: false, 222 editUrl: false,
218 inputUrl: url, 223 inputUrl: url,
219 }); 224 });
220 event.target.blur(); 225 this.inputRef.current.blur();
221 } 226 }
222 }} 227 }}
223 ref={this.inputRef} 228 ref={this.inputRef}
diff --git a/src/features/workspaces/components/EditWorkspaceForm.js b/src/features/workspaces/components/EditWorkspaceForm.js
index 0ff836cba..c97d4bd9c 100644
--- a/src/features/workspaces/components/EditWorkspaceForm.js
+++ b/src/features/workspaces/components/EditWorkspaceForm.js
@@ -224,6 +224,7 @@ class EditWorkspaceForm extends Component {
224 busy={isSaving} 224 busy={isSaving}
225 buttonType={isSaving ? 'secondary' : 'primary'} 225 buttonType={isSaving ? 'secondary' : 'primary'}
226 onClick={this.save.bind(this, form)} 226 onClick={this.save.bind(this, form)}
227 // TODO: Need to disable if no services have been added to this workspace
227 disabled={isSaving} 228 disabled={isSaving}
228 /> 229 />
229 </div> 230 </div>
diff --git a/src/features/workspaces/store.js b/src/features/workspaces/store.js
index 8c73516bc..ec9d7ee7f 100644
--- a/src/features/workspaces/store.js
+++ b/src/features/workspaces/store.js
@@ -155,38 +155,26 @@ export default class WorkspacesStore extends FeatureStore {
155 }; 155 };
156 156
157 @action _create = async ({ name }) => { 157 @action _create = async ({ name }) => {
158 // eslint-disable-next-line no-useless-catch 158 const workspace = await createWorkspaceRequest.execute(name);
159 try { 159 await getUserWorkspacesRequest.result.push(workspace);
160 const workspace = await createWorkspaceRequest.execute(name); 160 this._edit({ workspace });
161 await getUserWorkspacesRequest.result.push(workspace);
162 this._edit({ workspace });
163 } catch (error) {
164 throw error;
165 }
166 }; 161 };
167 162
168 @action _delete = async ({ workspace }) => { 163 @action _delete = async ({ workspace }) => {
169 // eslint-disable-next-line no-useless-catch 164 await deleteWorkspaceRequest.execute(workspace);
170 try { 165 await getUserWorkspacesRequest.result.remove(workspace);
171 await deleteWorkspaceRequest.execute(workspace); 166 this.stores.router.push('/settings/workspaces');
172 await getUserWorkspacesRequest.result.remove(workspace); 167 if (this.activeWorkspace === workspace) {
173 this.stores.router.push('/settings/workspaces'); 168 this._deactivateActiveWorkspace();
174 } catch (error) {
175 throw error;
176 } 169 }
177 }; 170 };
178 171
179 @action _update = async ({ workspace }) => { 172 @action _update = async ({ workspace }) => {
180 // eslint-disable-next-line no-useless-catch 173 await updateWorkspaceRequest.execute(workspace);
181 try { 174 // Path local result optimistically
182 await updateWorkspaceRequest.execute(workspace); 175 const localWorkspace = this._getWorkspaceById(workspace.id);
183 // Path local result optimistically 176 Object.assign(localWorkspace, workspace);
184 const localWorkspace = this._getWorkspaceById(workspace.id); 177 this.stores.router.push('/settings/workspaces');
185 Object.assign(localWorkspace, workspace);
186 this.stores.router.push('/settings/workspaces');
187 } catch (error) {
188 throw error;
189 }
190 }; 178 };
191 179
192 @action _setActiveWorkspace = ({ workspace }) => { 180 @action _setActiveWorkspace = ({ workspace }) => {