From 73948443d565818c746e5670b077d870c199cfb6 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 1 Apr 2019 10:52:39 +0200 Subject: [PATCH 1/8] warn when plugin try using setFile --- src/app/files/fileManager.js | 20 ++++++++++++++++++-- src/app/ui/tooltip.js | 21 ++++++++++++++++----- 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/src/app/files/fileManager.js b/src/app/files/fileManager.js index c4cc3a9d63..ee21c03efc 100644 --- a/src/app/files/fileManager.js +++ b/src/app/files/fileManager.js @@ -1,9 +1,11 @@ 'use strict' +import { ApiFactory } from 'remix-plugin' +import yo from 'yo-yo' const EventEmitter = require('events') var globalRegistry = require('../../global/registry') var CompilerImport = require('../compiler/compiler-imports') -import { ApiFactory } from 'remix-plugin' +var toaster = require('../ui/tooltip') /* attach to files event (removed renamed) @@ -129,7 +131,21 @@ class FileManager extends ApiFactory { }) } - setFile (path, content) { + async setFile (path, content) { + if (this.currentRequest) { + let reject = false + const actions = yo`
+ +
` + await toaster(`${this.currentRequest.from} is modyfing to ${path}`, actions, { time: 140000 }) + if (reject) { + throw new Error(`set file operation on ${path} aborted by user.`) + } + } + this._setFileInternal(path, content) + } + + _setFileInternal (path, content) { const provider = this.fileProviderOf(path) if (!provider) throw new Error(`${path} not availble`) // TODO : Add permission diff --git a/src/app/ui/tooltip.js b/src/app/ui/tooltip.js index b93a637025..3634650023 100644 --- a/src/app/ui/tooltip.js +++ b/src/app/ui/tooltip.js @@ -6,14 +6,25 @@ var css = require('./styles/tooltip-styles') * @param {string} tooltipText The text shown by the tooltip * @param {HTMLElement} [action] An HTMLElement to display for action */ -module.exports = function addTooltip (tooltipText, action) { +module.exports = function addTooltip (tooltipText, action, opts) { + opts = defaultOptions(opts) var tooltip = yo`
${tooltipText} ${action}
` - document.body.appendChild(tooltip) - setTimeout(function () { - document.body.removeChild(tooltip) - }, 7000) + return new Promise((resolve, reject) => { + document.body.appendChild(tooltip) + setTimeout(function () { + document.body.removeChild(tooltip) + resolve() + }, opts.time) + }) +} + +let defaultOptions = (opts) => { + opts = opts || {} + return { + time: opts.time || 70000 + } } From d5e74f79aaf9bd5f6440d99d2564f32c8d0fd9f2 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 1 Apr 2019 11:24:44 +0200 Subject: [PATCH 2/8] fix permissionhandler --- src/persmission-handler.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/persmission-handler.js b/src/persmission-handler.js index 5d84a9493b..6b565d352e 100644 --- a/src/persmission-handler.js +++ b/src/persmission-handler.js @@ -68,7 +68,10 @@ export class PermissionHandler { label: 'Accept', fn: () => { if (this.permissions[to.name][from.name]) { - this.permissions[to.name][from.name].allow = true + this.permissions[to.name][from.name] = { + allow: true, + hash: from.hash + } this.persistPermissions() } resolve() @@ -78,7 +81,10 @@ export class PermissionHandler { label: 'Decline', fn: () => { if (this.permissions[to.name][from.name]) { - this.permissions[to.name][from.name].allow = false + this.permissions[to.name][from.name] = { + allow: false, + hash: from.hash + } this.persistPermissions() } reject(notAllowWarning(from, to)) From a3afa5107c19c63b4a9d4765f43ac9e442dbdc22 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 1 Apr 2019 16:08:03 +0200 Subject: [PATCH 3/8] force location on plugin profile & set icon to fileManager --- .../components/plugin-manager-component.js | 3 ++- .../components/vertical-icons-component.js | 2 +- src/app/files/fileManager.js | 23 +++++++++++++------ src/app/panels/file-panel.js | 3 ++- src/app/tabs/analysis-tab.js | 3 ++- src/app/tabs/compile-tab.js | 3 ++- src/app/tabs/debugger-tab.js | 3 ++- src/app/tabs/run-tab.js | 3 ++- src/app/tabs/test-tab.js | 3 ++- src/remixAppManager.js | 3 ++- 10 files changed, 33 insertions(+), 16 deletions(-) diff --git a/src/app/components/plugin-manager-component.js b/src/app/components/plugin-manager-component.js index f8bf6d0689..5be1d9a220 100644 --- a/src/app/components/plugin-manager-component.js +++ b/src/app/components/plugin-manager-component.js @@ -55,7 +55,8 @@ class PluginManagerComponent extends ApiFactory { events: [], icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNzU1IDQ1M3EzNyAzOCAzNyA5MC41dC0zNyA5MC41bC00MDEgNDAwIDE1MCAxNTAtMTYwIDE2MHEtMTYzIDE2My0zODkuNSAxODYuNXQtNDExLjUtMTAwLjVsLTM2MiAzNjJoLTE4MXYtMTgxbDM2Mi0zNjJxLTEyNC0xODUtMTAwLjUtNDExLjV0MTg2LjUtMzg5LjVsMTYwLTE2MCAxNTAgMTUwIDQwMC00MDFxMzgtMzcgOTEtMzd0OTAgMzcgMzcgOTAuNS0zNyA5MC41bC00MDAgNDAxIDIzNCAyMzQgNDAxLTQwMHEzOC0zNyA5MS0zN3Q5MCAzN3oiLz48L3N2Zz4=', description: 'start/stop services, modules and plugins', - kind: 'settings' + kind: 'settings', + location: 'swapPanel' } } diff --git a/src/app/components/vertical-icons-component.js b/src/app/components/vertical-icons-component.js index 2ba596b807..5d417b8bac 100644 --- a/src/app/components/vertical-icons-component.js +++ b/src/app/components/vertical-icons-component.js @@ -18,7 +18,7 @@ class VerticalIconComponent { this.store.event.on('activate', (name) => { const api = this.store.getOne(name) if (!api.profile.icon) return - if (api.profile.location === this.name || !api.profile.location) { + if (api.profile.location === this.name) { this.addIcon(api.profile) this.listenOnStatus(api) } diff --git a/src/app/files/fileManager.js b/src/app/files/fileManager.js index ee21c03efc..a12507fa1c 100644 --- a/src/app/files/fileManager.js +++ b/src/app/files/fileManager.js @@ -49,7 +49,8 @@ class FileManager extends ApiFactory { methods: ['getFilesFromPath', 'getCurrentFile', 'getFile', 'setFile'], events: ['currentFileChanged'], description: 'service - read/write to any files or folders, require giving permissions', - permission: true + permission: true, + icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNjk2IDM4NHE0MCAwIDY4IDI4dDI4IDY4djEyMTZxMCA0MC0yOCA2OHQtNjggMjhoLTk2MHEtNDAgMC02OC0yOHQtMjgtNjh2LTI4OGgtNTQ0cS00MCAwLTY4LTI4dC0yOC02OHYtNjcycTAtNDAgMjAtODh0NDgtNzZsNDA4LTQwOHEyOC0yOCA3Ni00OHQ4OC0yMGg0MTZxNDAgMCA2OCAyOHQyOCA2OHYzMjhxNjgtNDAgMTI4LTQwaDQxNnptLTU0NCAyMTNsLTI5OSAyOTloMjk5di0yOTl6bS02NDAtMzg0bC0yOTkgMjk5aDI5OXYtMjk5em0xOTYgNjQ3bDMxNi0zMTZ2LTQxNmgtMzg0djQxNnEwIDQwLTI4IDY4dC02OCAyOGgtNDE2djY0MGg1MTJ2LTI1NnEwLTQwIDIwLTg4dDQ4LTc2em05NTYgODA0di0xMTUyaC0zODR2NDE2cTAgNDAtMjggNjh0LTY4IDI4aC00MTZ2NjQwaDg5NnoiLz48L3N2Zz4=', } } @@ -134,13 +135,21 @@ class FileManager extends ApiFactory { async setFile (path, content) { if (this.currentRequest) { let reject = false - const actions = yo`
- + let savedAsAnotherFile = false + const actions = yo`
+ +
` - await toaster(`${this.currentRequest.from} is modyfing to ${path}`, actions, { time: 140000 }) - if (reject) { - throw new Error(`set file operation on ${path} aborted by user.`) - } + await toaster(yo`
${this.currentRequest.from} is modyfing to ${path}
`, actions, { time: 4000 }) + if (reject) throw new Error(`set file operation on ${path} aborted by user.`) + if (savedAsAnotherFile) return } this._setFileInternal(path, content) } diff --git a/src/app/panels/file-panel.js b/src/app/panels/file-panel.js index 04f69ea2b0..5a42d28a2f 100644 --- a/src/app/panels/file-panel.js +++ b/src/app/panels/file-panel.js @@ -141,7 +141,8 @@ module.exports = class Filepanel extends ApiFactory { events: [], icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNjk2IDM4NHE0MCAwIDY4IDI4dDI4IDY4djEyMTZxMCA0MC0yOCA2OHQtNjggMjhoLTk2MHEtNDAgMC02OC0yOHQtMjgtNjh2LTI4OGgtNTQ0cS00MCAwLTY4LTI4dC0yOC02OHYtNjcycTAtNDAgMjAtODh0NDgtNzZsNDA4LTQwOHEyOC0yOCA3Ni00OHQ4OC0yMGg0MTZxNDAgMCA2OCAyOHQyOCA2OHYzMjhxNjgtNDAgMTI4LTQwaDQxNnptLTU0NCAyMTNsLTI5OSAyOTloMjk5di0yOTl6bS02NDAtMzg0bC0yOTkgMjk5aDI5OXYtMjk5em0xOTYgNjQ3bDMxNi0zMTZ2LTQxNmgtMzg0djQxNnEwIDQwLTI4IDY4dC02OCAyOGgtNDE2djY0MGg1MTJ2LTI1NnEwLTQwIDIwLTg4dDQ4LTc2em05NTYgODA0di0xMTUyaC0zODR2NDE2cTAgNDAtMjggNjh0LTY4IDI4aC00MTZ2NjQwaDg5NnoiLz48L3N2Zz4=', description: ' - ', - kind: 'fileexplorer' + kind: 'fileexplorer', + location: 'swapPanel' } } } diff --git a/src/app/tabs/analysis-tab.js b/src/app/tabs/analysis-tab.js index 2b663cf594..321189e0ea 100644 --- a/src/app/tabs/analysis-tab.js +++ b/src/app/tabs/analysis-tab.js @@ -23,7 +23,8 @@ class AnalysisTab extends ApiFactory { events: [], icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMjA0OCIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMjA0OCAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0yMDQ4IDE1MzZ2MTI4aC0yMDQ4di0xNTM2aDEyOHYxNDA4aDE5MjB6bS0xMjgtMTI0OHY0MzVxMCAyMS0xOS41IDI5LjV0LTM1LjUtNy41bC0xMjEtMTIxLTYzMyA2MzNxLTEwIDEwLTIzIDEwdC0yMy0xMGwtMjMzLTIzMy00MTYgNDE2LTE5Mi0xOTIgNTg1LTU4NXExMC0xMCAyMy0xMHQyMyAxMGwyMzMgMjMzIDQ2NC00NjQtMTIxLTEyMXEtMTYtMTYtNy41LTM1LjV0MjkuNS0xOS41aDQzNXExNCAwIDIzIDl0OSAyM3oiLz48L3N2Zz4=', description: ' - ', - kind: 'analysis' + kind: 'analysis', + location: 'swapPanel' } } diff --git a/src/app/tabs/compile-tab.js b/src/app/tabs/compile-tab.js index e1ee1bf85b..4e5680b838 100644 --- a/src/app/tabs/compile-tab.js +++ b/src/app/tabs/compile-tab.js @@ -66,7 +66,8 @@ class CompileTab extends ApiFactory { icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE2LjAuMywgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPgo8c3ZnIHZlcnN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jA2OCwzNjcuNjF6Ii8+CgkJCTxwYXRoIGlkPSJTaGFwZV8yXyIgb3BhY2l0eT0iMC44IiBlbmFibGUtYmFja2dyb3VuZD0ibmV3ICAgICIgZD0iTTExMC40NTYsNTk5LjgyMkwyNDEuMDY4LDM2Ny42MUwxMTAuNDU2LDEzNS4zMDgKCQkJCUwtMjAuMTU4LDM2Ny42MUwxMTAuNDU2LDU5OS44MjJ6Ii8+CgkJCTxwYXRoIGlkPSJTaGFwZV8zXyIgb3BhY2l0eT0iMC40NSIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAgICAiIGQ9Ik0xMTEuNzIxLDk0OC4yNzVsMTMwLjcwNC0yMzIuMzAzaDI2MS4zMThMMzczLjAzOCw5NDguMjc1CgkJCQlIMTExLjcyMSIvPgoJCQk8cGF0aCBpZD0iU2hhcGVfNF8iIG9wYWNpdHk9IjAuNiIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAgICAiIGQ9Ik0yNDIuNDI0LDcxNS45NzNILTE4Ljg5M2wxMzAuNjEzLDIzMi4zMDNoMjYxLjMxNwoJCQkJTDI0Mi40MjQsNzE1Ljk3M3oiLz4KCQkJPHBhdGggaWQ9IlNoYXBlXzVfIiBvcGFjaXR5PSIwLjgiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgICAgIiBkPSJNMzczLjAzOCw0ODMuNzYxTDI0Mi40MjQsNzE1Ljk3M2wxMzAuNjE0LDIzMi4zMDMKCQkJCWwxMzAuNzA0LTIzMi4zMDNMMzczLjAzOCw0ODMuNzYxeiIvPgoJCTwvZz4KCTwvZz4KPC9nPgo8L3N2Zz4K', description: 'compile solidity contracts', kind: 'compile', - permission: true + permission: true, + location: 'swapPanel' } } diff --git a/src/app/tabs/debugger-tab.js b/src/app/tabs/debugger-tab.js index 78d2790861..5e1c3cb4ac 100644 --- a/src/app/tabs/debugger-tab.js +++ b/src/app/tabs/debugger-tab.js @@ -20,7 +20,8 @@ class DebuggerTab extends ApiFactory { events: [], icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNjk2IDk2MHEwIDI2LTE5IDQ1dC00NSAxOWgtMjI0cTAgMTcxLTY3IDI5MGwyMDggMjA5cTE5IDE5IDE5IDQ1dC0xOSA0NXEtMTggMTktNDUgMTl0LTQ1LTE5bC0xOTgtMTk3cS01IDUtMTUgMTN0LTQyIDI4LjUtNjUgMzYuNS04MiAyOS05NyAxM3YtODk2aC0xMjh2ODk2cS01MSAwLTEwMS41LTEzLjV0LTg3LTMzLTY2LTM5LTQzLjUtMzIuNWwtMTUtMTQtMTgzIDIwN3EtMjAgMjEtNDggMjEtMjQgMC00My0xNi0xOS0xOC0yMC41LTQ0LjV0MTUuNS00Ni41bDIwMi0yMjdxLTU4LTExNC01OC0yNzRoLTIyNHEtMjYgMC00NS0xOXQtMTktNDUgMTktNDUgNDUtMTloMjI0di0yOTRsLTE3My0xNzNxLTE5LTE5LTE5LTQ1dDE5LTQ1IDQ1LTE5IDQ1IDE5bDE3MyAxNzNoODQ0bDE3My0xNzNxMTktMTkgNDUtMTl0NDUgMTkgMTkgNDUtMTkgNDVsLTE3MyAxNzN2Mjk0aDIyNHEyNiAwIDQ1IDE5dDE5IDQ1em0tNDgwLTU3NmgtNjQwcTAtMTMzIDkzLjUtMjI2LjV0MjI2LjUtOTMuNSAyMjYuNSA5My41IDkzLjUgMjI2LjV6Ii8+PC9zdmc+', description: 'debug transactions', - kind: 'debugging' + kind: 'debugging', + location: 'swapPanel' } } diff --git a/src/app/tabs/run-tab.js b/src/app/tabs/run-tab.js index d7de0575c1..ca6ebc8765 100644 --- a/src/app/tabs/run-tab.js +++ b/src/app/tabs/run-tab.js @@ -36,7 +36,8 @@ class RunTab extends ApiFactory { events: [], icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNTc2IDkyN2wtMTMyOCA3MzhxLTIzIDEzLTM5LjUgM3QtMTYuNS0zNnYtMTQ3MnEwLTI2IDE2LjUtMzZ0MzkuNSAzbDEzMjggNzM4cTIzIDEzIDIzIDMxdC0yMyAzMXoiLz48L3N2Zz4=', description: 'execute and save transactions', - kind: 'run' + kind: 'run', + location: 'swapPanel' } } diff --git a/src/app/tabs/test-tab.js b/src/app/tabs/test-tab.js index cdf1a30aa4..97efc68c93 100644 --- a/src/app/tabs/test-tab.js +++ b/src/app/tabs/test-tab.js @@ -27,7 +27,8 @@ module.exports = class TestTab extends ApiFactory { methods: [], events: [], icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMjMwNCIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMjMwNCAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNzI4IDQ0OGwtMzg0IDcwNGg3Njh6bS0xMjgwIDBsLTM4NCA3MDRoNzY4em04MjEtMTkycS0xNCA0MC00NS41IDcxLjV0LTcxLjUgNDUuNXYxMjkxaDYwOHExNCAwIDIzIDl0OSAyM3Y2NHEwIDE0LTkgMjN0LTIzIDloLTEzNDRxLTE0IDAtMjMtOXQtOS0yM3YtNjRxMC0xNCA5LTIzdDIzLTloNjA4di0xMjkxcS00MC0xNC03MS41LTQ1LjV0LTQ1LjUtNzEuNWgtNDkxcS0xNCAwLTIzLTl0LTktMjN2LTY0cTAtMTQgOS0yM3QyMy05aDQ5MXEyMS01NyA3MC05Mi41dDExMS0zNS41IDExMSAzNS41IDcwIDkyLjVoNDkxcTE0IDAgMjMgOXQ5IDIzdjY0cTAgMTQtOSAyM3QtMjMgOWgtNDkxem0tMTgxIDE2cTMzIDAgNTYuNS0yMy41dDIzLjUtNTYuNS0yMy41LTU2LjUtNTYuNS0yMy41LTU2LjUgMjMuNS0yMy41IDU2LjUgMjMuNSA1Ni41IDU2LjUgMjMuNXptMTA4OCA4ODBxMCA3My00Ni41IDEzMXQtMTE3LjUgOTEtMTQ0LjUgNDkuNS0xMzkuNSAxNi41LTEzOS41LTE2LjUtMTQ0LjUtNDkuNS0xMTcuNS05MS00Ni41LTEzMXEwLTExIDM1LTgxdDkyLTE3NC41IDEwNy0xOTUuNSAxMDItMTg0IDU2LTEwMHExOC0zMyA1Ni0zM3Q1NiAzM3E0IDcgNTYgMTAwdDEwMiAxODQgMTA3IDE5NS41IDkyIDE3NC41IDM1IDgxem0tMTI4MCAwcTAgNzMtNDYuNSAxMzF0LTExNy41IDkxLTE0NC41IDQ5LjUtMTM5LjUgMTYuNS0xMzkuNS0xNi41LTE0NC41LTQ5LjUtMTE3LjUtOTEtNDYuNS0xMzFxMC0xMSAzNS04MXQ5Mi0xNzQuNSAxMDctMTk1LjUgMTAyLTE4NCA1Ni0xMDBxMTgtMzMgNTYtMzN0NTYgMzNxNCA3IDU2IDEwMHQxMDIgMTg0IDEwNyAxOTUuNSA5MiAxNzQuNSAzNSA4MXoiLz48L3N2Zz4=', - description: ' - ' + description: ' - ', + location: 'swapPanel' } } diff --git a/src/remixAppManager.js b/src/remixAppManager.js index 73ee4e1d22..34de083d79 100644 --- a/src/remixAppManager.js +++ b/src/remixAppManager.js @@ -61,7 +61,8 @@ export class RemixAppManager extends AppManagerApi { url: 'https://remix-vyper.surge.sh/', description: 'compile vyper contracts', kind: 'compile', - icon: 'data:image/svg+x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xMiA4ODYuODEgNzY4IDQ0My40MSA1MTIgMCIgc3R5bGU9ImZpbGw6IzhjOGM4YyIvPiAgPHBvbHlsaW5lIHBvaW50cz0iMjA0OCAwIDE1MzYgMCAxNzkyIDQ0My40IDIwNDggMCIgc3R5bGU9ImZpbGw6I2IyYjJiMiIvPiAgPHBvbHlsaW5lIHBvaW50cz0iNTEyIDAgMCAwIDI1NiA0NDMuNCA1MTIgMCIgc3R5bGU9ImZpbGw6I2IyYjJiMiIvPjwvc3ZnPg==', + location: 'swapPanel' } var pipeline = { displayName: 'pipeline', From 1d68a42886c20e6d4dae944ad10cee5cc6e4bbd8 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 1 Apr 2019 16:12:54 +0200 Subject: [PATCH 4/8] fix toaster behavior upon setFile --- src/app/files/fileManager.js | 6 ++- src/app/ui/styles/tooltip-styles.js | 32 +++++++++----- src/app/ui/tooltip.js | 67 +++++++++++++++++++++++------ 3 files changed, 79 insertions(+), 26 deletions(-) diff --git a/src/app/files/fileManager.js b/src/app/files/fileManager.js index a12507fa1c..1142eff426 100644 --- a/src/app/files/fileManager.js +++ b/src/app/files/fileManager.js @@ -136,8 +136,9 @@ class FileManager extends ApiFactory { if (this.currentRequest) { let reject = false let savedAsAnotherFile = false + let warnToaster const actions = yo`
- +
` - await toaster(yo`
${this.currentRequest.from} is modyfing to ${path}
`, actions, { time: 4000 }) + warnToaster = await toaster(yo`
${this.currentRequest.from} is modyfing to ${path}
`, actions, { time: 4000 }) if (reject) throw new Error(`set file operation on ${path} aborted by user.`) if (savedAsAnotherFile) return } diff --git a/src/app/ui/styles/tooltip-styles.js b/src/app/ui/styles/tooltip-styles.js index 36af565a8c..fc669e4d07 100644 --- a/src/app/ui/styles/tooltip-styles.js +++ b/src/app/ui/styles/tooltip-styles.js @@ -9,30 +9,42 @@ var css = csjs` position: fixed; color: var(--primary) min-height: 50px; - min-width: 290px; padding: 16px 24px 12px; border-radius: 3px; bottom: -300; left: 40%; font-size: 12px; text-align: center; - -webkit-animation-name: animatebottom; - -webkit-animation-duration: 6s; - animation-name: animatebottom; - animation-duration: 6s + bottom: 0; } @-webkit-keyframes animatebottom { 0% {bottom: -300px} - 20% {bottom: 0} - 50% {bottom: 0} - 100% {bottom: -300px} + 100% {bottom: 0} } @keyframes animatebottom { 0% {bottom: -300px} - 20% {bottom: 0} - 50% {bottom: 0} + 100% {bottom: 0} + } + @-webkit-keyframes animatetop { + 0% {bottom: 0} + 100% {bottom: -300px} + } + @keyframes animatetop { + 0% {bottom: 0} 100% {bottom: -300px} } + .animateTop { + -webkit-animation-name: animatetop; + -webkit-animation-duration: 2s; + animation-name: animatetop; + animation-duration: 2s; + } + .animateBottom { + -webkit-animation-name: animatebottom; + -webkit-animation-duration: 2s; + animation-name: animatebottom; + animation-duration: 2s; + } ` module.exports = css diff --git a/src/app/ui/tooltip.js b/src/app/ui/tooltip.js index 3634650023..bf8b3f1a87 100644 --- a/src/app/ui/tooltip.js +++ b/src/app/ui/tooltip.js @@ -7,24 +7,63 @@ var css = require('./styles/tooltip-styles') * @param {HTMLElement} [action] An HTMLElement to display for action */ module.exports = function addTooltip (tooltipText, action, opts) { - opts = defaultOptions(opts) - var tooltip = yo` -
- ${tooltipText} - ${action} -
` - return new Promise((resolve, reject) => { - document.body.appendChild(tooltip) - setTimeout(function () { - document.body.removeChild(tooltip) - resolve() - }, opts.time) - }) + let t = new Toaster() + t.render(tooltipText, action, opts) + return t +} + +class Toaster { + hide () { + if (this.id) clearTimeout(this.id) + setTimeout(() => { + // remove from body after the animation is finished + if (this.tooltip.parentElement) this.tooltip.parentElement.removeChild(this.tooltip) + }, 2000) + animation(this.tooltip, css.animateTop.className) + } + render (tooltipText, action, opts) { + opts = defaultOptions(opts) + + return new Promise((resolve, reject) => { + this.tooltip = yo` +
{ over() }} onmouseleave=${() => { out() }}> + ${tooltipText} + ${action} +
` + let timeOut = () => { + return setTimeout(() => { + if (this.id) { + this.hide() + resolve() + } + }, opts.time) + } + let over = () => { + if (this.id) { + clearTimeout(this.id) + this.id = null + } + } + let out = () => { + if (!this.id) this.id = timeOut() + } + this.id = timeOut() + document.body.appendChild(this.tooltip) + animation(this.tooltip, css.animateBottom.className) + }) + } } let defaultOptions = (opts) => { opts = opts || {} return { - time: opts.time || 70000 + time: opts.time || 7000 } } + +let animation = (tooltip, anim) => { + tooltip.classList.remove(css.animateTop.className) + tooltip.classList.remove(css.animateBottom.className) + void tooltip.offsetWidth // trick for restarting the animation + tooltip.classList.add(anim) +} From 7f799fdaeb35e6c673cd9d722584badaa9e1efe8 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 1 Apr 2019 16:13:11 +0200 Subject: [PATCH 5/8] standard --- src/app/files/fileManager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/files/fileManager.js b/src/app/files/fileManager.js index 1142eff426..245e7533be 100644 --- a/src/app/files/fileManager.js +++ b/src/app/files/fileManager.js @@ -50,7 +50,7 @@ class FileManager extends ApiFactory { events: ['currentFileChanged'], description: 'service - read/write to any files or folders, require giving permissions', permission: true, - icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNjk2IDM4NHE0MCAwIDY4IDI4dDI4IDY4djEyMTZxMCA0MC0yOCA2OHQtNjggMjhoLTk2MHEtNDAgMC02OC0yOHQtMjgtNjh2LTI4OGgtNTQ0cS00MCAwLTY4LTI4dC0yOC02OHYtNjcycTAtNDAgMjAtODh0NDgtNzZsNDA4LTQwOHEyOC0yOCA3Ni00OHQ4OC0yMGg0MTZxNDAgMCA2OCAyOHQyOCA2OHYzMjhxNjgtNDAgMTI4LTQwaDQxNnptLTU0NCAyMTNsLTI5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mon, 8 Apr 2019 16:31:45 +0200 Subject: [PATCH 6/8] alpha.43 of remix-plugin --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9ba9270a65..0769de9901 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ }, "dependencies": { "http-server": "0.9.0", - "remix-plugin": "0.0.1-alpha.39", + "remix-plugin": "0.0.1-alpha.43", "remixd": "0.1.8-alpha.6" }, "repository": { From bb9f3b6a249d04eb803f009cf7d7ae8b692cadc7 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 8 Apr 2019 17:41:10 +0200 Subject: [PATCH 7/8] force location --- src/app/components/local-plugin.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/components/local-plugin.js b/src/app/components/local-plugin.js index d760eb0714..67f6df8135 100644 --- a/src/app/components/local-plugin.js +++ b/src/app/components/local-plugin.js @@ -36,7 +36,8 @@ module.exports = class LocalPlugin { icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xMjYyIDEwNzVxLTM3IDEyMS0xMzggMTk1dC0yMjggNzQtMjI4LTc0LTEzOC0xOTVxLTgtMjUgNC00OC41dDM4LTMxLjVxMjUtOCA0OC41IDR0MzEuNSAzOHEyNSA4MCA5Mi41IDEyOS41dDE1MS41IDQ5LjUgMTUxLjUtNDkuNSA5Mi41LTEyOS41cTgtMjYgMzItMzh0NDktNCAzNyAzMS41IDQgNDguNXptLTQ5NC00MzVxMCA1My0zNy41IDkwLjV0LTkwLjUgMzcuNS05MC41LTM3LjUtMzcuNS05MC41IDM3LjUtOTAuNSA5MC41LTM3LjUgOTAuNSAzNy41IDM3LjUgOTAuNXptNTEyIDBxMCA1My0zNy41IDkwLjV0LTkwLjUgMzcuNS05MC41LTM3LjUtMzcuNS05MC41IDM3LjUtOTAuNSA5MC41LTM3LjUgOTAuNSAzNy41IDM3LjUgOTAuNXptMjU2IDI1NnEwLTEzMC01MS0yNDguNXQtMTM2LjUtMjA0LTIwNC0xMzYuNS0yNDguNS01MS0yNDguNSA1MS0yMDQgMTM2LjUtMTM2LjUgMjA0LTUxIDI0OC41IDUxIDI0OC41IDEzNi41IDIwNCAyMDQgMTM2LjUgMjQ4LjUgNTEgMjQ4LjUtNTEgMjA0LTEzNi41IDEzNi41LTIwNCA1MS0yNDguNXptMTI4IDBxMCAyMDktMTAzIDM4NS41dC0yNzkuNSAyNzkuNS0zODUuNSAxMDMtMzg1LjUtMTAzLTI3OS41LTI3OS41LTEwMy0zODUuNSAxMDMtMzg1LjUgMjc5LjUtMjc5LjUgMzg1LjUtMTAzIDM4NS41IDEwMyAyNzkuNSAyNzkuNSAxMDMgMzg1LjV6Ii8+PC9zdmc+', methods: [], events: [], - hash: `local-${this.profile.name}` + hash: `local-${this.profile.name}`, + location: 'swapPanel' } if (!this.profile.name) throw new Error('Plugin should have a name') if (!this.profile.url) throw new Error('Plugin should have an URL') From d58f293ab8a7213d3a8d277eab408037708852d0 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 8 Apr 2019 17:41:22 +0200 Subject: [PATCH 8/8] change label & timeout --- src/app/files/fileManager.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/files/fileManager.js b/src/app/files/fileManager.js index 245e7533be..0ed8a3395d 100644 --- a/src/app/files/fileManager.js +++ b/src/app/files/fileManager.js @@ -147,9 +147,9 @@ class FileManager extends ApiFactory { this.switchFile(newPath) e.target.innerHTML = 'Saved' warnToaster.hide() - }}>Save As Another + }}>Save As Copy
` - warnToaster = await toaster(yo`
${this.currentRequest.from} is modyfing to ${path}
`, actions, { time: 4000 }) + warnToaster = await toaster(yo`
${this.currentRequest.from} is modyfing ${path}
`, actions, { time: 6000 }) if (reject) throw new Error(`set file operation on ${path} aborted by user.`) if (savedAsAnotherFile) return }