Merge branch 'master' into ImproveAnnotation

pull/876/head
EthereumRemix 4 years ago committed by GitHub
commit 95039cb3a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 24
      apps/remix-ide-e2e/src/commands/addAtAddressInstance.ts
  2. 16
      apps/remix-ide/index.html
  3. 15
      apps/remix-ide/src/app/components/plugin-manager-component.js
  4. 5
      apps/remix-ide/src/app/tabs/runTab/contractDropdown.js
  5. 7
      apps/remix-ide/src/app/tabs/runTab/model/dropdownlogic.js
  6. 30
      apps/remix-ide/src/app/tabs/settings-tab.js
  7. 16
      apps/remix-ide/src/app/ui/landing-page/landing-page.js
  8. 3
      apps/remix-ide/src/remixAppManager.js

@ -15,21 +15,15 @@ class addAtAddressInstance extends EventEmitter {
function addInstance (browser: NightwatchBrowser, address: string, isValidFormat: boolean, isValidChecksum: boolean, callback: VoidFunction) {
browser.clickLaunchIcon('udapp').clearValue('.ataddressinput').setValue('.ataddressinput', address, function () {
browser.click('button[id^="runAndDeployAtAdressButton"]')
.execute(function () {
const ret = document.querySelector('div[class^="modal-body"] div').innerHTML
const modal = document.querySelector('#modal-footer-ok') as HTMLElement
modal.click()
return ret
}, [], function (result) {
if (!isValidFormat) {
browser.assert.equal(result.value, 'Invalid address.')
} else if (!isValidChecksum) {
browser.assert.equal(result.value, 'Invalid checksum address.')
}
callback()
})
if (!isValidFormat || !isValidChecksum) browser.assert.elementPresent('button[id^="runAndDeployAtAdressButton"]:disabled')
else {
browser.click('button[id^="runAndDeployAtAdressButton"]')
.execute(function () {
const modal = document.querySelector('#modal-footer-ok') as HTMLElement
modal.click()
})
}
callback()
})
}

@ -32,6 +32,22 @@
<link rel="icon" type="x-icon" href="assets/img/icon.png">
<script src="assets/js/browserfs.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<!-- Matomo -->
<script type="text/javascript">
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['disableCookies']);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="https://matomo.ethereum.org/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '27']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Matomo Code -->
</head>
<body>
<script>

@ -6,6 +6,7 @@ const csjs = require('csjs-inject')
const EventEmitter = require('events')
const LocalPlugin = require('./local-plugin')
const addToolTip = require('../ui/tooltip')
const _paq = window._paq = window._paq || []
const css = csjs`
.pluginSearch {
@ -101,6 +102,16 @@ class PluginManagerComponent extends ViewPlugin {
return this.appManager.actives.includes(name)
}
activateP (name) {
this.appManager.activatePlugin(name)
_paq.push(['trackEvent', 'manager', 'activate', name])
}
deactivateP (name) {
this.appManager.deactivatePlugin(name)
_paq.push(['trackEvent', 'manager', 'deactivate', name])
}
renderItem (profile) {
const displayName = (profile.displayName) ? profile.displayName : profile.name
@ -118,7 +129,7 @@ class PluginManagerComponent extends ViewPlugin {
const activationButton = this.isActive(profile.name)
? yo`
<button
onclick="${_ => this.appManager.deactivatePlugin(profile.name)}"
onclick="${() => this.deactivateP(profile.name)}"
class="btn btn-secondary btn-sm" data-id="pluginManagerComponentDeactivateButton${profile.name}"
>
Deactivate
@ -126,7 +137,7 @@ class PluginManagerComponent extends ViewPlugin {
`
: yo`
<button
onclick="${_ => this.appManager.activatePlugin(profile.name)}"
onclick="${() => this.activateP(profile.name)}"
class="btn btn-success btn-sm" data-id="pluginManagerComponentActivateButton${profile.name}"
>
Activate

@ -1,6 +1,6 @@
import publishToStorage from '../../../publishToStorage'
const yo = require('yo-yo')
const ethJSUtil = require('ethereumjs-util')
const css = require('../styles/run-tab-styles')
const modalDialogCustom = require('../../ui/modal-dialog-custom')
const remixLib = require('@remix-project/remix-lib')
@ -97,7 +97,8 @@ class ContractDropdownUI {
enableAtAddress (enable) {
if (enable) {
if (this.atAddressButtonInput.value === '') return
const address = this.atAddressButtonInput.value
if (!address || !ethJSUtil.isValidChecksumAddress(address)) return
this.atAddress.removeAttribute('disabled')
this.atAddress.setAttribute('title', 'Interact with the given contract.')
} else {

@ -1,4 +1,3 @@
var ethJSUtil = require('ethereumjs-util')
var remixLib = require('@remix-project/remix-lib')
var txHelper = remixLib.execution.txHelper
var CompilerAbstract = require('../../../compiler/compiler-abstract')
@ -43,12 +42,6 @@ class DropdownLogic {
}
loadContractFromAddress (address, confirmCb, cb) {
if (!ethJSUtil.isValidAddress(address)) {
return cb('Invalid address.')
}
if (/[a-f]/.test(address) && /[A-F]/.test(address) && !ethJSUtil.isValidChecksumAddress(address)) {
return cb('Invalid checksum address.')
}
if (/.(.abi)$/.exec(this.config.get('currentFile'))) {
confirmCb(() => {
var abi

@ -37,6 +37,9 @@ module.exports = class SettingsTab extends ViewPlugin {
optionVMLabel: null,
personal: null,
personalLabel: null,
useMatomoAnalytics: null,
useMatomoAnalyticsLabel: null,
useMatomoAnalyticsMode: null,
warnPersonalMode: null,
generateContractMetadata: null,
generateContractMetadataLabel: null,
@ -117,6 +120,17 @@ module.exports = class SettingsTab extends ViewPlugin {
if (this.config.get('settings/personal-mode')) this._view.personal.setAttribute('checked', '')
elementStateChanged(self._view.personalLabel, !this.config.get('settings/personal-mode'))
this._view.useMatomoAnalytics = yo`<input onchange=${onchangeMatomoAnalytics} id="settingsMatomoAnalytics" type="checkbox" class="custom-control-input">`
this._view.useMatomoAnalyticsMode = yo`<i class="${css.icon} fas fa-exclamation-triangle text-warning" aria-hidden="true"></i>`
this._view.useMatomoAnalyticsLabel = yo`
<label class="form-check-label custom-control-label text-secondary align-middle" for="settingsMatomoAnalytics">
<span>${this._view.useMatomoAnalyticsMode} Enable Matomo Analytics. The statystics we are collecting is helping to improve plugins usage. We choose Matomo Analytics which is </span>
<a target="_blank" href="https://matomo.org/free-software">open source</a>
</label>
`
if (this.config.get('settings/matomo-analytics')) this._view.useMatomoAnalytics.setAttribute('checked', '')
elementStateChanged(self._view.personalLabel, !this.config.get('settings/matomo-analytics'))
this._view.generateContractMetadata = yo`<input onchange=${onchangeGenerateContractMetadata} id="generatecontractmetadata" data-id="settingsTabGenerateContractMetadata" type="checkbox" class="custom-control-input">`
this._view.generateContractMetadataLabel = yo`<label class="form-check-label custom-control-label align-middle" data-id="settingsTabGenerateContractMetadataLabel" for="generatecontractmetadata">Generate contract metadata. Generate a JSON file in the contract folder. Allows to specify library addresses the contract depends on. If nothing is specified, Remix deploys libraries automatically.</label>`
if (this.config.get('settings/generate-contract-metadata') === undefined) this.config.set('settings/generate-contract-metadata', true)
@ -145,9 +159,13 @@ module.exports = class SettingsTab extends ViewPlugin {
${this._view.textWrapLabel}
</div>
<div class="custom-control custom-checkbox mb-1">
${this._view.personal}>
${this._view.personal}
${this._view.personalLabel}
</div>
<div class="custom-control custom-checkbox mb-1">
${this._view.useMatomoAnalytics}
${this._view.useMatomoAnalyticsLabel}
</div>
</div>
</div>
`
@ -200,6 +218,16 @@ module.exports = class SettingsTab extends ViewPlugin {
self.config.set('settings/personal-mode', !isChecked)
elementStateChanged(self._view.personalLabel, isChecked)
}
function onchangeMatomoAnalytics (event) {
elementStateChanged(self._view.useMatomoAnalyticsLabel, event.target.checked)
const _paq = window._paq = window._paq || []
if (this.checked) {
_paq.push(['forgetUserOptOut'])
} else {
_paq.push(['optUserOut'])
}
}
function elementStateChanged (el, isChanged) {
if (isChanged) {
el.classList.remove('text-dark')

@ -5,10 +5,11 @@ const yo = require('yo-yo')
const csjs = require('csjs-inject')
const globalRegistry = require('../../../global/registry')
const CompilerImport = require('../../compiler/compiler-imports')
var modalDialogCustom = require('../modal-dialog-custom')
var tooltip = require('../tooltip')
var GistHandler = require('../../../lib/gist-handler')
var QueryParams = require('../../../lib/query-params.js')
const modalDialogCustom = require('../modal-dialog-custom')
const tooltip = require('../tooltip')
const GistHandler = require('../../../lib/gist-handler')
const QueryParams = require('../../../lib/query-params.js')
const _paq = window._paq = window._paq || []
const css = csjs`
.text {
@ -219,10 +220,12 @@ export class LandingPage extends ViewPlugin {
this.mediumPanel.classList.remove('d-block')
this.mediumPanel.classList.add('d-none')
this.twitterPanel.classList.toggle('d-block')
_paq.push(['trackEvent', 'pluginManager', 'media', 'twitter'])
} else {
this.twitterPanel.classList.remove('d-block')
this.twitterPanel.classList.add('d-none')
this.mediumPanel.classList.toggle('d-block')
_paq.push(['trackEvent', 'pluginManager', 'media', 'medium'])
}
}
@ -258,22 +261,27 @@ export class LandingPage extends ViewPlugin {
const startSolidity = async () => {
await this.appManager.activatePlugin(['solidity', 'udapp', 'solidityStaticAnalysis', 'solidityUnitTesting'])
this.verticalIcons.select('solidity')
_paq.push(['trackEvent', 'pluginManager', 'userActivate', 'solidity'])
}
const startDebugger = async () => {
await this.appManager.activatePlugin('debugger')
this.verticalIcons.select('debugger')
_paq.push(['trackEvent', 'pluginManager', 'userActivate', 'debugger'])
}
const startSolhint = async () => {
await this.appManager.activatePlugin(['solidity', 'solhint'])
this.verticalIcons.select('solhint')
_paq.push(['trackEvent', 'pluginManager', 'userActivate', 'solhint'])
}
const startLearnEth = async () => {
await this.appManager.activatePlugin(['solidity', 'LearnEth', 'solidityUnitTesting'])
this.verticalIcons.select('LearnEth')
_paq.push(['trackEvent', 'pluginManager', 'userActivate', 'learnEth'])
}
const startSourceVerify = async () => {
await this.appManager.activatePlugin(['solidity', 'source-verification'])
this.verticalIcons.select('source-verification')
_paq.push(['trackEvent', 'pluginManager', 'userActivate', 'source-verification'])
}
const startPluginManager = async () => {
await this.appManager.activatePlugin('pluginManager')

@ -4,6 +4,7 @@ import { IframePlugin } from '@remixproject/engine-web'
import { EventEmitter } from 'events'
import QueryParams from './lib/query-params'
import { PermissionHandler } from './app/ui/persmission-handler'
const _paq = window._paq = window._paq || []
const requiredModules = [ // services + layout views + system views
'manager', 'compilerArtefacts', 'compilerMetadata', 'contextualListener', 'editor', 'offsetToLineColumnConverter', 'network', 'theme',
@ -65,6 +66,7 @@ export class RemixAppManager extends PluginManager {
onPluginActivated (plugin) {
this.pluginLoader.set(plugin, this.actives)
this.event.emit('activate', plugin)
_paq.push(['trackEvent', 'pluginManager', 'activate', plugin.name])
}
getAll () {
@ -80,6 +82,7 @@ export class RemixAppManager extends PluginManager {
onPluginDeactivated (plugin) {
this.pluginLoader.set(plugin, this.actives)
this.event.emit('deactivate', plugin)
_paq.push(['trackEvent', 'pluginManager', 'deactivate', plugin.name])
}
isRequired (name) {

Loading…
Cancel
Save