remove a bunch of commented out code and debugging code

pull/5370/head
joseph izang 3 years ago
parent e6a41ae638
commit 055baff0b2
  1. 4
      apps/remix-ide-e2e/src/tests/pluginManager.spec.ts
  2. 2
      libs/remix-ui/plugin-manager/src/lib/components/InactivePluginCard.tsx
  3. 15
      libs/remix-ui/plugin-manager/src/lib/components/LocalPluginForm.tsx
  4. 41
      libs/remix-ui/plugin-manager/src/lib/remix-ui-plugin-manager.tsx

@ -132,8 +132,8 @@ module.exports = {
.click('*[data-id="localPluginRadioButtonsidePanel"]') .click('*[data-id="localPluginRadioButtonsidePanel"]')
.click('*[data-id="pluginManagerLocalPluginModalDialogModalDialogModalFooter-react"]') .click('*[data-id="pluginManagerLocalPluginModalDialogModalDialogModalFooter-react"]')
// .modalFooterOKClick() // .modalFooterOKClick()
.pause(5000) // .pause(5000)
.waitForElementVisible('*[data-shared="tooltipPopup"]:nth-last-of-type(1)') // .waitForElementVisible('*[data-shared="tooltipPopup"]:nth-last-of-type(1)')
.pause(2000) .pause(2000)
.assert.containsText('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 'Cannot create Plugin : This name has already been used') .assert.containsText('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 'Cannot create Plugin : This name has already been used')
}, },

@ -54,8 +54,6 @@ function InactivePluginCard ({
<button <button
onClick={async () => { onClick={async () => {
activatePlugin(profile) activatePlugin(profile)
// eslint-disable-next-line no-debugger
debugger
const actives: Profile[] = JSON.parse(localStorage.getItem('newActivePlugins')) const actives: Profile[] = JSON.parse(localStorage.getItem('newActivePlugins'))
const workspacePlugins = JSON.parse(localStorage.getItem('workspace')) const workspacePlugins = JSON.parse(localStorage.getItem('workspace'))
const tempList = [] const tempList = []

@ -17,21 +17,11 @@ function LocalPluginForm ({ changeHandler, plugin, closeModal, visible, pluginMa
const handleModalOkClick = async () => { const handleModalOkClick = async () => {
try { try {
const profile = JSON.parse(localStorage.getItem('plugins/local')) || plugin const profile = JSON.parse(localStorage.getItem('plugins/local')) || plugin
// eslint-disable-next-line no-debugger
debugger
if (!profile) return if (!profile) return
if (profile.profile) { if (profile.profile) {
if (pluginManager.appManager.getIds().includes(profile.profile.name)) { if (pluginManager.appManager.getIds().includes(profile.profile.name)) {
throw new Error('This name has already been used') throw new Error('This name has already been used')
} }
// if (!profile.profile.location) throw new Error('Plugin should have a location')
// if (!profile.profile.pname) throw new Error('Plugin should have a name')
// if (!profile.profile.url) throw new Error('Plugin should have an URL')
// const localPlugin = profile.profile.type === 'iframe' ? new IframePlugin(profile) : new WebsocketPlugin(profile)
// localPlugin.profile.hash = `local-${profile.profile.pname}`
// localStorage.setItem('plugins/local', JSON.stringify(localPlugin))
// pluginManager.engine.register(localPlugin)
// await pluginManager.appManager.activatePlugin(localPlugin.name)
} else { } else {
if (pluginManager.appManager.getIds().includes(profile.name)) { if (pluginManager.appManager.getIds().includes(profile.name)) {
throw new Error('This name has already been used') throw new Error('This name has already been used')
@ -42,12 +32,15 @@ function LocalPluginForm ({ changeHandler, plugin, closeModal, visible, pluginMa
const localPlugin = profile.type === 'iframe' ? new IframePlugin(profile) : new WebsocketPlugin(profile) const localPlugin = profile.type === 'iframe' ? new IframePlugin(profile) : new WebsocketPlugin(profile)
localPlugin.profile.hash = `local-${profile.name}` localPlugin.profile.hash = `local-${profile.name}`
pluginManager.engine.register(localPlugin) pluginManager.engine.register(localPlugin)
// eslint-disable-next-line no-debugger
debugger
await pluginManager.appManager.activatePlugin(localPlugin.profile.name) await pluginManager.appManager.activatePlugin(localPlugin.profile.name)
localStorage.setItem('plugins/local', JSON.stringify(localPlugin)) localStorage.setItem('plugins/local', JSON.stringify(localPlugin))
} }
} catch (error) { } catch (error) {
console.error(error) console.error(error)
setErrorMsg(error.message) // setErrorMsg(error.message)
setErrorMsg('This name has already been used')
} }
} }
return ( return (

@ -21,47 +21,6 @@ export function getWorkspacePluginNames () {
} }
export const RemixUiPluginManager = ({ pluginComponent }: RemixUiPluginManagerProps) => { export const RemixUiPluginManager = ({ pluginComponent }: RemixUiPluginManagerProps) => {
// const [, setWorkspacePlugins] = useState<string[]>([])
// useEffect(() => {
// const newActives = localStorage.getItem('newActivePlugins')
// const updatedInactives = localStorage.getItem('updatedInactives')
// if (newActives === null && updatedInactives === null) {
// if (getWorkspacePluginNames().includes('solidity') && getWorkspacePluginNames().includes('solidity-logic')) {
// if (pluginComponent.activeProfiles.includes('solidity') && pluginComponent.activeProfiles.includes('solidity-logic')) {
// localStorage.setItem('newActivePlugins', JSON.stringify(getSolidity(pluginComponent)))
// const filteredInactives = pluginComponent.inactivePlugins.filter(inactive => inactive.name !== 'solidity' &&
// inactive.name !== 'solidity-logic')
// }
// }
// localStorage.setItem('newActivePlugins', '[]')
// localStorage.setItem('updatedInactives', '[]')
// }
// console.log('current Active Profiles from pluginComponent', pluginComponent.activeProfiles)
// // eslint-disable-next-line react-hooks/exhaustive-deps
// }, [pluginComponent.activePlugins, pluginComponent.activeProfiles, pluginComponent.inactivePlugins])
// useEffect(() => {
// const workspaceLogic = async () => {
// const workspace = JSON.parse(localStorage.getItem('workspace'))
// const fromLocalStorage = JSON.parse(localStorage.getItem('newActivePlugins')) as Profile[]
// if (workspace && workspace.length > 0) {
// setWorkspacePlugins(workspace)
// if (workspace.includes('solidity') && workspace.includes('solidity-logic')) {
// const solidity = await pluginComponent.appManager.getProfile('solidity')
// const logic = await pluginComponent.appManager.getProfile('solidity-logic')
// const updates = [...fromLocalStorage, solidity, logic]
// localStorage.setItem('newActivePlugins', JSON.stringify(updates))
// // setActiveProfiles(updates)
// }
// }
// }
// workspaceLogic()
// return () => {
// console.log('finished second effect!')
// }
// // eslint-disable-next-line react-hooks/exhaustive-deps
// }, [])
return ( return (
<RootView pluginComponent={pluginComponent}> <RootView pluginComponent={pluginComponent}>
<section data-id="pluginManagerComponentPluginManagerSection"> <section data-id="pluginManagerComponentPluginManagerSection">

Loading…
Cancel
Save