|
459 | 459 | this.wrapper.remove();
|
460 | 460 | },
|
461 | 461 |
|
| 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 | + |
462 | 472 | onClick:function() {
|
463 | 473 | this.props.pydio.triggerRepositoryChange(this.props.workspace.getId());
|
464 | 474 | },
|
465 | 475 |
|
466 | 476 | render:function(){
|
467 |
| - var current = this.props.pydio.user.getActiveRepository(), |
| 477 | + var current = (this.props.pydio.user.getActiveRepository() == this.props.workspace.getId()), |
468 | 478 | currentClass="workspace-entry",
|
469 | 479 | messages = this.props.pydio.MessageHash,
|
470 | 480 | onHover, onOut, onClick,
|
471 | 481 | additionalAction,
|
472 | 482 | badge, badgeNum, newWorkspace;
|
473 | 483 |
|
474 |
| - if (current == this.props.workspace.getId()) { |
| 484 | + if (current) { |
475 | 485 | currentClass +=" workspace-current";
|
476 | 486 | }
|
477 | 487 |
|
|
512 | 522 |
|
513 | 523 | if (this.props.workspace.getOwner() && !this.props.workspace.getAccessStatus() && !this.props.workspace.getLastConnection()) {
|
514 | 524 | newWorkspace = <span className="workspace-new">NEW</span>;
|
515 |
| - |
516 | 525 | // Dialog for remote shares
|
517 | 526 | if (this.props.workspace.getRepositoryType() == "remote") {
|
518 | 527 | onClick = this.handleOpenAlert.bind(this, 'new_share');
|
519 | 528 | }
|
520 |
| - }else if(this.props.workspace.getRepositoryType() == "remote"){ |
| 529 | + }else if(this.props.workspace.getRepositoryType() == "remote" && !current){ |
521 | 530 | // Remote share but already accepted, add delete
|
522 | 531 | 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']}/>; |
523 | 534 | }
|
524 | 535 |
|
525 | 536 | return (
|
|
0 commit comments