Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit 1c046f1

Browse files
committed
Rewire missing action for deleting user-created workspace.
1 parent 58627f0 commit 1c046f1

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

core/src/plugins/gui.ajax/res/js/ui/reactjs/jsx/LeftNavigation.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -459,19 +459,29 @@
459459
this.wrapper.remove();
460460
},
461461

462+
handleRemoveTplBasedWorkspace: function(event){
463+
event.stopPropagation();
464+
if(!global.confirm(this.props.pydio.MessageHash['424'])){
465+
return;
466+
}
467+
PydioApi.getClient().request({get_action:'user_delete_repository', repository_id:this.props.workspace.getId()}, function(transport){
468+
PydioApi.getClient().parseXmlMessage(transport.responseXML);
469+
});
470+
},
471+
462472
onClick:function() {
463473
this.props.pydio.triggerRepositoryChange(this.props.workspace.getId());
464474
},
465475

466476
render:function(){
467-
var current = this.props.pydio.user.getActiveRepository(),
477+
var current = (this.props.pydio.user.getActiveRepository() == this.props.workspace.getId()),
468478
currentClass="workspace-entry",
469479
messages = this.props.pydio.MessageHash,
470480
onHover, onOut, onClick,
471481
additionalAction,
472482
badge, badgeNum, newWorkspace;
473483

474-
if (current == this.props.workspace.getId()) {
484+
if (current) {
475485
currentClass +=" workspace-current";
476486
}
477487

@@ -512,14 +522,15 @@
512522

513523
if (this.props.workspace.getOwner() && !this.props.workspace.getAccessStatus() && !this.props.workspace.getLastConnection()) {
514524
newWorkspace = <span className="workspace-new">NEW</span>;
515-
516525
// Dialog for remote shares
517526
if (this.props.workspace.getRepositoryType() == "remote") {
518527
onClick = this.handleOpenAlert.bind(this, 'new_share');
519528
}
520-
}else if(this.props.workspace.getRepositoryType() == "remote"){
529+
}else if(this.props.workspace.getRepositoryType() == "remote" && !current){
521530
// Remote share but already accepted, add delete
522531
additionalAction = <span className="workspace-additional-action mdi mdi-close" onClick={this.handleOpenAlert.bind(this, 'reject_accepted')} title={messages['550']}/>;
532+
}else if(this.props.workspace.userEditable && !current){
533+
additionalAction = <span className="workspace-additional-action mdi mdi-close" onClick={this.handleRemoveTplBasedWorkspace} title={messages['423']}/>;
523534
}
524535

525536
return (

0 commit comments

Comments
 (0)