Commit 18524240 authored by zeroleak's avatar zeroleak
Browse files

cleanup

parent 6aca0e20
......@@ -47,27 +47,29 @@ export default function TableGeneric({ columns, data, size='sm', /*onFetchData,
useSortBy,
useRowSelect,
hooks => {
hooks.visibleColumns.push(columns => [
// Let's make a column for selection
{
id: 'selection',
// The header can use the table's getToggleAllRowsSelectedProps method
// to render a checkbox
Header: ({ getToggleAllRowsSelectedProps }) => (
<div>
<IndeterminateCheckbox {...getToggleAllRowsSelectedProps()} />
</div>
),
// The cell can use the individual row's getToggleRowSelectedProps method
// to the render a checkbox
Cell: ({ row }) => (
<div>
<IndeterminateCheckbox {...row.getToggleRowSelectedProps()} />
</div>
),
},
...columns,
])
if (onSelect && onSelect.actions) {
hooks.visibleColumns.push(columns => [
// Let's make a column for selection
{
id: 'selection',
// The header can use the table's getToggleAllRowsSelectedProps method
// to render a checkbox
Header: ({ getToggleAllRowsSelectedProps }) => (
<div>
<IndeterminateCheckbox {...getToggleAllRowsSelectedProps()} />
</div>
),
// The cell can use the individual row's getToggleRowSelectedProps method
// to the render a checkbox
Cell: ({ row }) => (
<div>
<IndeterminateCheckbox {...row.getToggleRowSelectedProps()} />
</div>
),
},
...columns,
])
}
},
);
......
......@@ -44,7 +44,7 @@ const computeUtxosActions = utxos => {
}
/* eslint-disable react/prefer-stateless-function */
const UtxosTable = ({ controls, pool, mixs, account, utxos, tableKey }) => {
const UtxosTable = ({ controls, pool, mixs, account, utxos, tableKey, actions }) => {
const [showReadOnly, setShowReadOnly] = useState(false)
......@@ -186,7 +186,7 @@ const UtxosTable = ({ controls, pool, mixs, account, utxos, tableKey }) => {
onSelect={{
label: 'utxos',
labelDetails: utxos => '('+utils.toBtc(utils.sumUtxos(utxos))+' btc)',
actions: computeUtxosActions
actions: actions ? computeUtxosActions : undefined
}}
/>
{visibleUtxos.length == 0 && <div className='text-center text-muted'><small>No utxo yet</small></div>}
......
......@@ -165,15 +165,6 @@ export default class ConfigPage extends Component<Props> {
<code>socks://host:port</code> or <code>http://host:port</code>
</label>
</div>
<div className="form-group row">
<label htmlFor="tx0FakeOutputRandomFactor" className="col-sm-2 col-form-label">TX0 obfuscation</label>
<input type="number" className='form-control col-sm-3' onChange={e => {
const myValue = parseInt(e.target.value)
myThis.onChangeCliConfig(cliConfig => cliConfig.mix.tx0FakeOutputRandomFactor = myValue)
}} defaultValue={cliConfig.mix.tx0FakeOutputRandomFactor} id="tx0FakeOutputRandomFactor" disabled={isTestnet}/>
<label className='col-form-label col-sm-5 text-muted'><strong>Experimental</strong> (testnet only): random factor for simulating a multi-user TX0 with a second change output (0 = never, 1 = always, 2 = 1/2 probability, 3 = 1/3 probability...).</label>
</div>
</Card.Body>
</Card>
......@@ -201,13 +192,22 @@ export default class ConfigPage extends Component<Props> {
<label className='col-form-label col-sm-5 text-muted'>Max simultaneous mixing clients per pool</label>
</div>}
<div className="form-group row">
<label htmlFor="tx0FakeOutputRandomFactor" className="col-sm-2 col-form-label">TX0 obfuscation</label>
<input type="number" className='form-control col-sm-3' onChange={e => {
const myValue = parseInt(e.target.value)
myThis.onChangeCliConfig(cliConfig => cliConfig.mix.tx0FakeOutputRandomFactor = myValue)
}} defaultValue={cliConfig.mix.tx0FakeOutputRandomFactor} id="tx0FakeOutputRandomFactor" disabled={!isTestnet}/>
<label className='col-form-label col-sm-5 text-muted'><strong>Experimental</strong> (testnet only) TX0 fake output (0 = never, 1 = always).</label>
</div>
<div className="form-group row">
<label htmlFor="tx0FakeOutputMinValue" className="col-sm-2 col-form-label">TX0 min change</label>
<input type="number" className='form-control col-sm-3' onChange={e => {
const myValue = parseInt(e.target.value)
myThis.onChangeCliConfig(cliConfig => cliConfig.mix.tx0FakeOutputMinValue = myValue)
}} defaultValue={cliConfig.mix.tx0FakeOutputMinValue} id="tx0FakeOutputMinValue"/>
<label className='col-form-label col-sm-5 text-muted'>Minimum value per change output when using TX0 fake output</label>
}} defaultValue={cliConfig.mix.tx0FakeOutputMinValue} id="tx0FakeOutputMinValue" disabled={!isTestnet}/>
<label className='col-form-label col-sm-5 text-muted'><strong>Experimental</strong> (testnet only) minimum value per fake change output</label>
</div>
</Card.Body>}
......
......@@ -37,7 +37,7 @@ class DepositPage extends Component {
</div>
<div className='row h-100 d-flex flex-column'>
<div className='col-sm-12 flex-grow-1 tablescroll'>
<UtxosTable tableKey='DepositPage' utxos={utxos} pool={false} mixs={false} controls={true} account={false}/>
<UtxosTable tableKey='DepositPage' utxos={utxos} pool={false} mixs={false} controls={true} account={false} actions={true}/>
</div>
</div>
</div>
......
......@@ -39,7 +39,7 @@ class LastActivityPage extends Component {
</div>
<div className='row h-100 d-flex flex-column'>
<div className='col-sm-12 flex-grow-1 tablescroll'>
<UtxosTable tableKey='LastActivityPage' utxos={utxos} pool={true} mixs={true} controls={false} account={true}/>
<UtxosTable tableKey='LastActivityPage' utxos={utxos} pool={true} mixs={true} controls={false} account={true} actions={false}/>
</div>
</div>
</div>
......
......@@ -32,7 +32,7 @@ export default class PostmixPage extends Component<Props> {
</div>
<div className='row h-100 d-flex flex-column'>
<div className='col-sm-12 flex-grow-1 tablescroll'>
<UtxosTable tableKey='PostmixPage' utxos={utxos} pool={true} mixs={true} controls={true} account={false}/>
<UtxosTable tableKey='PostmixPage' utxos={utxos} pool={true} mixs={true} controls={true} account={false} actions={false}/>
</div>
</div>
</div>
......
......@@ -32,7 +32,7 @@ export default class PremixPage extends Component<Props> {
</div>
<div className='row h-100 d-flex flex-column'>
<div className='col-sm-12 flex-grow-1 tablescroll'>
<UtxosTable tableKey='PremixPage' utxos={utxos} pool={true} mixs={false} controls={true} account={false}/>
<UtxosTable tableKey='PremixPage' utxos={utxos} pool={true} mixs={false} controls={true} account={false} actions={false}/>
</div>
</div>
</div>
......
......@@ -33,6 +33,7 @@ export class CliConfigService {
return backendService.cli.setConfig(cliConfig).then(() => {
logger.info('Save CLI configuration: success')
cliLocalService.reload()
cliService.setStartTime()
cliService.fetchState()
}).catch(e => {
logger.error('Save CLI configuration: failed', e)
......
......@@ -24,7 +24,7 @@ class CliService {
this.refreshTimeout = undefined
this.servicesStarted = false
this.startTime = new Date().getTime()
this.setStartTime()
this.cliUrl = undefined
this.apiKey = undefined
this.cliLocal = undefined
......@@ -49,6 +49,7 @@ class CliService {
start() {
if (this.refreshTimeout === undefined) {
this.setStartTime()
this.refreshTimeout = setInterval(this.fetchState.bind(this), REFRESH_RATE)
return this.fetchState()
}
......@@ -113,6 +114,9 @@ class CliService {
// save configuration
this.saveConfig(cliUrl, apiKey, cliLocal)
// CLI auto-restarts
this.setStartTime()
})
}
......@@ -165,8 +169,12 @@ class CliService {
this.doResetGUIConfig()
}
restart() {
setStartTime() {
this.startTime = new Date().getTime()
}
restart() {
this.setStartTime()
backendService.cli.restart()
// force refresh
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment