38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
import { storeJson } from '../fileModels/storeJson'
|
|
import { i18n } from '../i18n'
|
|
import { sdk } from '../sdk'
|
|
|
|
export const enableExplorer = sdk.Action.withoutInput(
|
|
// id
|
|
'enable-explorer',
|
|
|
|
// metadata
|
|
async ({ effects }) => {
|
|
const current = await storeJson.read((s) => s.enableExplorer).once()
|
|
return {
|
|
name: i18n('Enable Embedded Explorer'),
|
|
description: i18n(
|
|
'Turn on the embedded PostgreSQL + Go indexer. Spaces protocol data (blocks, transactions, spaces, rollouts) will be indexed locally for use by the future explorer web UI. Service restarts automatically.',
|
|
),
|
|
warning: null,
|
|
allowedStatuses: 'any',
|
|
group: null,
|
|
visibility: current === true ? 'hidden' : 'enabled',
|
|
}
|
|
},
|
|
|
|
// run
|
|
async ({ effects }) => {
|
|
await storeJson.merge(effects, { enableExplorer: true })
|
|
|
|
return {
|
|
version: '1',
|
|
title: i18n('Success'),
|
|
message: i18n(
|
|
'Embedded explorer enabled. The service is restarting; the indexer will begin fetching blocks shortly. First-time start can take several minutes for the Go build.',
|
|
),
|
|
result: null,
|
|
}
|
|
},
|
|
)
|