From 1c046f1db26c50c506052c95a148bd631830385a Mon Sep 17 00:00:00 2001 From: cdujeu Date: Fri, 8 Apr 2016 11:48:23 +0200 Subject: [PATCH] Rewire missing action for deleting user-created workspace. --- .../res/js/ui/reactjs/jsx/LeftNavigation.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/core/src/plugins/gui.ajax/res/js/ui/reactjs/jsx/LeftNavigation.js b/core/src/plugins/gui.ajax/res/js/ui/reactjs/jsx/LeftNavigation.js index e0df0eb279..4ce9b13d9b 100644 --- a/core/src/plugins/gui.ajax/res/js/ui/reactjs/jsx/LeftNavigation.js +++ b/core/src/plugins/gui.ajax/res/js/ui/reactjs/jsx/LeftNavigation.js @@ -459,19 +459,29 @@ this.wrapper.remove(); }, + handleRemoveTplBasedWorkspace: function(event){ + event.stopPropagation(); + if(!global.confirm(this.props.pydio.MessageHash['424'])){ + return; + } + PydioApi.getClient().request({get_action:'user_delete_repository', repository_id:this.props.workspace.getId()}, function(transport){ + PydioApi.getClient().parseXmlMessage(transport.responseXML); + }); + }, + onClick:function() { this.props.pydio.triggerRepositoryChange(this.props.workspace.getId()); }, render:function(){ - var current = this.props.pydio.user.getActiveRepository(), + var current = (this.props.pydio.user.getActiveRepository() == this.props.workspace.getId()), currentClass="workspace-entry", messages = this.props.pydio.MessageHash, onHover, onOut, onClick, additionalAction, badge, badgeNum, newWorkspace; - if (current == this.props.workspace.getId()) { + if (current) { currentClass +=" workspace-current"; } @@ -512,14 +522,15 @@ if (this.props.workspace.getOwner() && !this.props.workspace.getAccessStatus() && !this.props.workspace.getLastConnection()) { newWorkspace = NEW; - // Dialog for remote shares if (this.props.workspace.getRepositoryType() == "remote") { onClick = this.handleOpenAlert.bind(this, 'new_share'); } - }else if(this.props.workspace.getRepositoryType() == "remote"){ + }else if(this.props.workspace.getRepositoryType() == "remote" && !current){ // Remote share but already accepted, add delete additionalAction = ; + }else if(this.props.workspace.userEditable && !current){ + additionalAction = ; } return (