Skip to content

Commit

Permalink
CHE-715 change some workspace service paths
Browse files Browse the repository at this point in the history
  • Loading branch information
mshaposhnik committed Mar 21, 2016
1 parent 1c86fa2 commit 3134020
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.che.api.workspace.gwt.client;

import com.google.gwt.http.client.RequestBuilder;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.inject.Inject;

Expand Down Expand Up @@ -82,7 +83,7 @@ public void makeCall(AsyncCallback<UsersWorkspaceDto> callback) {
private void create(@NotNull WorkspaceConfigDto newWorkspace,
String accountId,
@NotNull AsyncCallback<UsersWorkspaceDto> callback) {
String url = baseHttpUrl + "/config";
String url = baseHttpUrl;
if (accountId != null) {
url += "?account=" + accountId;
}
Expand Down Expand Up @@ -150,12 +151,16 @@ public Promise<List<RuntimeWorkspaceDto>> getRuntimeWorkspaces(int skip, int lim

@Override
public Promise<UsersWorkspaceDto> update(String wsId, WorkspaceConfigDto newCfg) {
return null;
final String url = baseHttpUrl + '/' + wsId;
return asyncRequestFactory.createRequest(RequestBuilder.PUT, url, newCfg, true)
.send(dtoUnmarshallerFactory.newUnmarshaller(UsersWorkspaceDto.class));
}

@Override
public Promise<Void> delete(String wsId) {
return null;
final String url = baseHttpUrl + '/' + wsId;
return asyncRequestFactory.createDeleteRequest(url)
.send();
}

@Override
Expand Down
8 changes: 4 additions & 4 deletions dashboard/src/components/api/che-workspace.factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ export class CheWorkspace {
// remote call
this.remoteWorkspaceAPI = this.$resource('/api/workspace', {}, {
getDetails: {method: 'GET', url: '/api/workspace/:workspaceId'},
create: {method: 'POST', url: '/api/workspace/config?account=:accountId'},
deleteConfig: {method: 'DELETE', url: '/api/workspace/:workspaceId/config'},
updateConfig: {method: 'PUT', url : '/api/workspace/:workspaceId/config'},
create: {method: 'POST', url: '/api/workspace?account=:accountId'},
deleteConfig: {method: 'DELETE', url: '/api/workspace/:workspaceId'},
updateConfig: {method: 'PUT', url : '/api/workspace/:workspaceId'},
addProject: {method: 'POST', url : '/api/workspace/:workspaceId/project'},
getRuntime: {method: 'GET', url : '/api/workspace/:workspaceId/runtime'},
deleteRuntime: {method: 'DELETE', url : '/api/workspace/:workspaceId/runtime'},
Expand Down Expand Up @@ -155,7 +155,7 @@ export class CheWorkspace {


createWorkspace(accountId, workspaceName, recipeUrl, ram, attributes) {
// /api/workspace/config?account=accountId
// /api/workspace?account=accountId
let attr = attributes ? attributes : {};

let data = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class CheRemoteWorkspace {

// remote call
this.remoteWorkspaceAPI = this.$resource('', {}, {
create: {method: 'POST', url: authData.url + '/api/workspace/config?account=:accountId&token=' + authData.token},
create: {method: 'POST', url: authData.url + '/api/workspace?account=:accountId&token=' + authData.token},
startWorkspace: {method: 'POST', url : authData.url + '/api/workspace/:workspaceId/runtime?environment=:envName&token=' + authData.token}
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ public WorkspaceService(WorkspaceManager workspaceManager,
}

@POST
@Path("/config")
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@RolesAllowed("user")
Expand Down Expand Up @@ -216,7 +215,7 @@ public List<UsersWorkspaceDto> getWorkspaces(@ApiParam("The number of the items
}

@PUT
@Path("/{id}/config")
@Path("/{id}")
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@RolesAllowed("user")
Expand All @@ -243,7 +242,7 @@ public UsersWorkspaceDto update(@ApiParam("The workspace id")
}

@DELETE
@Path("/{id}/config")
@Path("/{id}")
@RolesAllowed("user")
@ApiOperation(value = "Removes the workspace",
notes = "This operation can be performed only by the workspace owner")
Expand Down

0 comments on commit 3134020

Please sign in to comment.