mirror of
https://github.com/ascribe/onion.git
synced 2025-01-03 10:25:08 +01:00
now committing the remove contract
This commit is contained in:
parent
ae21686f26
commit
501d7ac7c0
@ -38,6 +38,21 @@ class ContractListActions {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
removeContract(contract){
|
||||||
|
return Q.Promise((resolve, reject) => {
|
||||||
|
OwnershipFetcher.deleteContract(contract)
|
||||||
|
.then((res) => {
|
||||||
|
console.log('Contract deleted');
|
||||||
|
resolve(res);
|
||||||
|
})
|
||||||
|
.catch( (err) => {
|
||||||
|
console.log('Error while deleting');
|
||||||
|
console.logGlobal(err);
|
||||||
|
reject(err);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default alt.createActions(ContractListActions);
|
export default alt.createActions(ContractListActions);
|
||||||
|
@ -36,9 +36,18 @@ let ContractSettings = React.createClass({
|
|||||||
ContractListActions.makeContractPublic(contract)
|
ContractListActions.makeContractPublic(contract)
|
||||||
.then(( ) => ContractListActions.fetchContractList())
|
.then(( ) => ContractListActions.fetchContractList())
|
||||||
.catch((error)=>{console.log('Error ', error);
|
.catch((error)=>{console.log('Error ', error);
|
||||||
let notification = new GlobalNotificationModel('Service is unavailable', 'danger', 10000);
|
let notification = new GlobalNotificationModel('Service is unavailable', 'danger', 10000);
|
||||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
removeContract(contract){
|
||||||
|
console.log(contract);
|
||||||
|
ContractListActions.removeContract(contract)
|
||||||
|
.then(( ) => ContractListActions.fetchContractList())
|
||||||
|
.catch((error) => {console.log('Error', error);
|
||||||
|
let notification = new GlobalNotificationModel('Service is unavailable', 'danger', 10000);
|
||||||
|
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
getPublicContracts(){
|
getPublicContracts(){
|
||||||
return this.state.contractList.filter((contract) => contract.public);
|
return this.state.contractList.filter((contract) => contract.public);
|
||||||
@ -70,10 +79,11 @@ let ContractSettings = React.createClass({
|
|||||||
(contract) => {
|
(contract) => {
|
||||||
return (
|
return (
|
||||||
<ActionPanel title = {contract.name}
|
<ActionPanel title = {contract.name}
|
||||||
content = {this.getblobEndName(contract)}
|
content = {contract.name}
|
||||||
buttons = {<span>
|
buttons = {<span>
|
||||||
<button className="btn btn-default btn-sm margin-left-2px">UPDATE</button>
|
<button className="btn btn-default btn-sm margin-left-2px">UPDATE</button>
|
||||||
<button className="btn btn-default btn-sm margin-left-2px">REMOVE</button>
|
<button className="btn btn-default btn-sm margin-left-2px"
|
||||||
|
onClick={this.removeContract.bind(this, contract)}>REMOVE</button>
|
||||||
</span>}
|
</span>}
|
||||||
/>);
|
/>);
|
||||||
}
|
}
|
||||||
@ -87,9 +97,10 @@ let ContractSettings = React.createClass({
|
|||||||
(contract) => {
|
(contract) => {
|
||||||
return (
|
return (
|
||||||
<ActionPanel title = {contract.name}
|
<ActionPanel title = {contract.name}
|
||||||
content = {this.getblobEndName(contract)}
|
content = {contract.name}
|
||||||
buttons = {<span> <button className="btn btn-default btn-sm margin-left-2px">UPDATE</button>
|
buttons = {<span> <button className="btn btn-default btn-sm margin-left-2px">UPDATE</button>
|
||||||
<button className="btn btn-default btn-sm margin-left-2px" >REMOVE</button>
|
<button className="btn btn-default btn-sm margin-left-2px"
|
||||||
|
onClick={this.removeContract.bind(this, contract)}> REMOVE </button>
|
||||||
<button className="btn btn-default btn-sm margin-left-2px"
|
<button className="btn btn-default btn-sm margin-left-2px"
|
||||||
onClick={this.makeContractPublic.bind(this, contract)}>MAKE PUBLIC</button> </span>}
|
onClick={this.makeContractPublic.bind(this, contract)}>MAKE PUBLIC</button> </span>}
|
||||||
/>);
|
/>);
|
||||||
|
@ -48,7 +48,7 @@ let ApiUrls = {
|
|||||||
'ownership_unconsigns_deny': AppConstants.apiEndpoint + 'ownership/unconsigns/deny/',
|
'ownership_unconsigns_deny': AppConstants.apiEndpoint + 'ownership/unconsigns/deny/',
|
||||||
'ownership_unconsigns_request': AppConstants.apiEndpoint + 'ownership/unconsigns/request/',
|
'ownership_unconsigns_request': AppConstants.apiEndpoint + 'ownership/unconsigns/request/',
|
||||||
'ownership_contract': AppConstants.apiEndpoint + 'ownership/contracts/${contract_id}/',
|
'ownership_contract': AppConstants.apiEndpoint + 'ownership/contracts/${contract_id}/',
|
||||||
"ownership_contract_list": AppConstants.apiEndpoint + 'ownership/contracts/',
|
'ownership_contract_list': AppConstants.apiEndpoint + 'ownership/contracts/',
|
||||||
'piece': AppConstants.apiEndpoint + 'pieces/${piece_id}/',
|
'piece': AppConstants.apiEndpoint + 'pieces/${piece_id}/',
|
||||||
'piece_extradata': AppConstants.apiEndpoint + 'pieces/${piece_id}/extradata/',
|
'piece_extradata': AppConstants.apiEndpoint + 'pieces/${piece_id}/extradata/',
|
||||||
'piece_first_edition_id': AppConstants.apiEndpoint + 'pieces/${piece_id}/edition_index/',
|
'piece_first_edition_id': AppConstants.apiEndpoint + 'pieces/${piece_id}/edition_index/',
|
||||||
|
@ -25,6 +25,10 @@ let OwnershipFetcher = {
|
|||||||
|
|
||||||
makeContractPublic(contractObj){
|
makeContractPublic(contractObj){
|
||||||
return requests.put('ownership_contract', { body: contractObj, contract_id: contractObj.id });
|
return requests.put('ownership_contract', { body: contractObj, contract_id: contractObj.id });
|
||||||
|
},
|
||||||
|
|
||||||
|
deleteContract(contractObj){
|
||||||
|
return requests.delete('ownership_contract', {body: contractObj, contract_id: contractObj.id});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user