Skip to content

Commit 650c540

Browse files
committed
reset instead of delete
1 parent 35276f8 commit 650c540

File tree

4 files changed

+27
-22
lines changed

4 files changed

+27
-22
lines changed

apps/remix-dapp/src/locales/en/udapp.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,11 @@
5454
"udapp.forkVmStateDesc1":"Forking state will create a new environment with same state as selected environment",
5555
"udapp.forkVmStateDesc2":"New environment will be pinned, which can be unpinned or deleted using Envionment Explorer",
5656
"udapp.fork": "Fork",
57-
"udapp.deleteVmStateTitle": "Delete VM state",
58-
"udapp.deleteVmStateDesc1": "Deleting the state of this VM will delete the associated transaction details in this Workspace.",
59-
"udapp.deleteVmStateDesc2": "It will also delete the data of contracts deployed and pinned in this Workspace.",
60-
"udapp.deleteVmStateDesc3": "Do you want to continue?",
57+
"udapp.resetVmStateTitle": "Reset VM state",
58+
"udapp.resetVmStateDesc1": "Resetting the state of this VM will delete the associated transaction details in this Workspace.",
59+
"udapp.resetVmStateDesc2": "It will also delete the data of contracts deployed and pinned in this Workspace.",
60+
"udapp.resetVmStateDesc3": "Do you want to continue?",
61+
"udapp.reset": "Reset",
6162
"udapp.delete": "Delete",
6263
"udapp.injectedTitle": "Unfortunately it's not possible to create an account using injected provider. Please create the account directly from your provider (i.e metamask or other of the same type).",
6364
"udapp.createNewAccount": "Create a new account",

apps/remix-ide-e2e/src/tests/vm_state.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const tests = {
3333
.click('*[data-id="delete-state-icon"]')
3434
.waitForElementVisible(
3535
{
36-
selector: "//*[@data-shared='tooltipPopup' and contains(.,'State not available to delete')]",
36+
selector: "//*[@data-shared='tooltipPopup' and contains(.,'State not available to reset')]",
3737
locateStrategy: 'xpath'
3838
}
3939
)
@@ -140,7 +140,7 @@ const tests = {
140140
.modalFooterOKClick('udappNotify')
141141
.waitForElementVisible('*[data-shared="tooltipPopup"]', 10000)
142142
// check if toaster is shown
143-
.assert.textContains('*[data-shared="tooltipPopup"]', `VM state deleted successfully.`)
143+
.assert.textContains('*[data-shared="tooltipPopup"]', `VM state reset successfully.`)
144144
// check that there are no instances
145145
.assert.textContains('*[data-id="deployedContractsBadge"]', '0')
146146
// check if state file is deleted

apps/remix-ide/src/app/tabs/locales/en/udapp.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,11 @@
5454
"udapp.forkVmStateDesc1":"Forking state will create a new environment with same state as selected environment",
5555
"udapp.forkVmStateDesc2":"After forking, new environment will be pinned and selected automatically. It can be unpinned or deleted using Envionment Explorer",
5656
"udapp.fork": "Fork",
57-
"udapp.deleteVmStateTitle": "Delete VM state",
58-
"udapp.deleteVmStateDesc1": "Deleting the state of this VM will delete the associated transaction details in this Workspace.",
59-
"udapp.deleteVmStateDesc2": "It will also delete the data of contracts deployed and pinned in this Workspace.",
60-
"udapp.deleteVmStateDesc3": "Do you want to continue?",
57+
"udapp.resetVmStateTitle": "Reset VM state",
58+
"udapp.resetVmStateDesc1": "Resetting the state of this VM will delete the associated transaction details in this Workspace.",
59+
"udapp.resetVmStateDesc2": "It will also delete the data of contracts deployed and pinned in this Workspace.",
60+
"udapp.resetVmStateDesc3": "Do you want to continue?",
61+
"udapp.reset": "Reset",
6162
"udapp.delete": "Delete",
6263
"udapp.injectedTitle": "Unfortunately it's not possible to create an account using injected provider. Please create the account directly from your provider (i.e metamask or other of the same type).",
6364
"udapp.createNewAccount": "Create new account",

libs/remix-ui/run-tab/src/lib/components/environment.tsx

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ export function EnvironmentUI(props: EnvironmentProps) {
5353
return (
5454
<div data-id="deleteVmStateModal">
5555
<ul className='ml-3'>
56-
<li><FormattedMessage id="udapp.deleteVmStateDesc1"/></li>
57-
<li><FormattedMessage id="udapp.deleteVmStateDesc2"/></li>
56+
<li><FormattedMessage id="udapp.resetVmStateDesc1"/></li>
57+
<li><FormattedMessage id="udapp.resetVmStateDesc2"/></li>
5858
</ul>
59-
<FormattedMessage id="udapp.deleteVmStateDesc3"/>
59+
<FormattedMessage id="udapp.resetVmStateDesc3"/>
6060
</div>
6161
)
6262
}
@@ -87,15 +87,15 @@ export function EnvironmentUI(props: EnvironmentProps) {
8787
} else props.runTabPlugin.call('notification', 'toast', `State not available to fork, as no transactions have been made for selected environment & selected workspace.`)
8888
}
8989

90-
const deleteVmState = async() => {
90+
const resetVmState = async() => {
9191
_paq.push(['trackEvent', 'udapp', 'deleteState', `deleteState clicked`])
9292
const context = currentProvider.name
9393
const contextExists = await props.runTabPlugin.call('fileManager', 'exists', `.states/${context}/state.json`)
9494
if (contextExists) {
9595
props.modal(
96-
intl.formatMessage({ id: 'udapp.deleteVmStateTitle' }),
96+
intl.formatMessage({ id: 'udapp.resetVmStateTitle' }),
9797
deleteVmStatePrompt(),
98-
intl.formatMessage({ id: 'udapp.delete' }),
98+
intl.formatMessage({ id: 'udapp.reset' }),
9999
async () => {
100100
const currentProvider = await props.runTabPlugin.call('blockchain', 'getCurrentProvider')
101101
// Reset environment blocks and account data
@@ -107,25 +107,28 @@ export function EnvironmentUI(props: EnvironmentProps) {
107107
// If there are pinned contracts, delete pinned contracts folder
108108
const isPinnedContracts = await props.runTabPlugin.call('fileManager', 'exists', `.deploys/pinned-contracts/${context}`)
109109
if (isPinnedContracts) await props.runTabPlugin.call('fileManager', 'remove', `.deploys/pinned-contracts/${context}`)
110-
props.runTabPlugin.call('notification', 'toast', `VM state deleted successfully.`)
111-
_paq.push(['trackEvent', 'udapp', 'deleteState', `VM state deleted`])
110+
props.runTabPlugin.call('notification', 'toast', `VM state reset successfully.`)
111+
_paq.push(['trackEvent', 'udapp', 'deleteState', `VM state reset`])
112112
},
113113
intl.formatMessage({ id: 'udapp.cancel' }),
114114
null
115115
)
116-
} else props.runTabPlugin.call('notification', 'toast', `State not available to delete, as no transactions have been made for selected environment & selected workspace.`)
116+
} else props.runTabPlugin.call('notification', 'toast', `State not available to reset, as no transactions have been made for selected environment & selected workspace.`)
117117
}
118118

119119
const isL2 = (providerDisplayName: string) => providerDisplayName && (providerDisplayName.startsWith('L2 - Optimism') || providerDisplayName.startsWith('L2 - Arbitrum'))
120120
return (
121121
<div className="udapp_crow">
122-
<label id="selectExEnv" className="udapp_settingsLabel">
122+
<label id="selectExEnv" className="udapp_settingsLabel w-100">
123123
<FormattedMessage id="udapp.environment" />
124124
{ currentProvider && currentProvider.isVM && isSaveEvmStateChecked && <CustomTooltip placement={'auto-end'} tooltipClasses="text-wrap" tooltipId="forkStatetooltip" tooltipText={<FormattedMessage id="udapp.forkStateTitle" />}>
125125
<i className="udapp_infoDeployAction ml-2 fas fa-code-branch" style={{ cursor: 'pointer' }} onClick={forkState} data-id="fork-state-icon"></i>
126126
</CustomTooltip> }
127-
{ currentProvider && currentProvider.isVM && isSaveEvmStateChecked && <CustomTooltip placement={'auto-end'} tooltipClasses="text-wrap" tooltipId="deleteVMStatetooltip" tooltipText={<FormattedMessage id="udapp.deleteVmStateTitle" />}>
128-
<i className="udapp_infoDeployAction ml-2 fas fa-trash" style={{ cursor: 'pointer' }} onClick={deleteVmState} data-id="delete-state-icon"></i>
127+
{ currentProvider && currentProvider.isVM && isSaveEvmStateChecked && <CustomTooltip placement={'auto-end'} tooltipClasses="text-wrap" tooltipId="deleteVMStatetooltip" tooltipText={<FormattedMessage id="udapp.resetVmStateTitle" />}>
128+
<span onClick={resetVmState} style={{ cursor: 'pointer', float: 'right', textTransform: 'none' }}>
129+
<i className="udapp_infoDeployAction ml-2 fas fa-refresh" data-id="delete-state-icon"></i>
130+
<span className="ml-1" style = {{textTransform: 'none', fontSize: '13px' }}>Reset State</span>
131+
</span>
129132
</CustomTooltip> }
130133
</label>
131134
<div className="udapp_environment" data-id={`selected-provider-${currentProvider && currentProvider.name}`}>

0 commit comments

Comments
 (0)