Commit 33588ae0 authored by ioedeveloper's avatar ioedeveloper

register context menu after workspace initialization

parent c5057116
...@@ -469,8 +469,13 @@ class App { ...@@ -469,8 +469,13 @@ class App {
await appManager.activatePlugin(['sidePanel']) // activating host plugin separately await appManager.activatePlugin(['sidePanel']) // activating host plugin separately
await appManager.activatePlugin(['home']) await appManager.activatePlugin(['home'])
await appManager.activatePlugin(['settings']) await appManager.activatePlugin(['settings'])
await appManager.activatePlugin(['hiddenPanel', 'filePanel', 'pluginManager', 'contextualListener', 'terminal', 'blockchain', 'fetchAndCompile', 'contentImport']) await appManager.activatePlugin(['hiddenPanel', 'pluginManager', 'contextualListener', 'terminal', 'blockchain', 'fetchAndCompile', 'contentImport'])
await appManager.registerContextMenuItems() await appManager.registerContextMenuItems()
appManager.on('filePanel', 'workspaceInitializationCompleted', async () => {
await appManager.registerContextMenuItems()
})
await appManager.activatePlugin(['filePanel'])
// Set workspace after initial activation // Set workspace after initial activation
appManager.on('editor', 'editorMounted', () => { appManager.on('editor', 'editorMounted', () => {
if (Array.isArray(workspace)) { if (Array.isArray(workspace)) {
......
...@@ -143,7 +143,6 @@ module.exports = class Filepanel extends ViewPlugin { ...@@ -143,7 +143,6 @@ module.exports = class Filepanel extends ViewPlugin {
} }
setWorkspace (workspace) { setWorkspace (workspace) {
console.log('workspace: ', workspace)
const workspaceProvider = this.fileProviders.workspace const workspaceProvider = this.fileProviders.workspace
this.currentWorkspaceMetadata = { name: workspace.name, isLocalhost: workspace.isLocalhost, absolutePath: `${workspaceProvider.workspacesPath}/${workspace.name}` } this.currentWorkspaceMetadata = { name: workspace.name, isLocalhost: workspace.isLocalhost, absolutePath: `${workspaceProvider.workspacesPath}/${workspace.name}` }
......
...@@ -135,27 +135,25 @@ export class RemixAppManager extends PluginManager { ...@@ -135,27 +135,25 @@ export class RemixAppManager extends PluginManager {
} }
async registerContextMenuItems () { async registerContextMenuItems () {
this.on('filePanel', 'workspaceInitializationCompleted', async () => { await this.call('filePanel', 'registerContextMenuItem', {
await this.call('filePanel', 'registerContextMenuItem', { id: 'flattener',
id: 'flattener', name: 'flattenFileCustomAction',
name: 'flattenFileCustomAction', label: 'Flatten',
label: 'Flatten', type: [],
type: [], extension: ['.sol'],
extension: ['.sol'], path: [],
path: [], pattern: [],
pattern: [], sticky: true
sticky: true })
}) await this.call('filePanel', 'registerContextMenuItem', {
await this.call('filePanel', 'registerContextMenuItem', { id: 'optimism-compiler',
id: 'optimism-compiler', name: 'compileCustomAction',
name: 'compileCustomAction', label: 'Compile with Optimism',
label: 'Compile with Optimism', type: [],
type: [], extension: ['.sol'],
extension: ['.sol'], path: [],
path: [], pattern: [],
pattern: [], sticky: true
sticky: true
})
}) })
} }
} }
......
...@@ -11,8 +11,10 @@ export interface BrowserState { ...@@ -11,8 +11,10 @@ export interface BrowserState {
workspaces: string[], workspaces: string[],
files: { [x: string]: Record<string, FileType> }, files: { [x: string]: Record<string, FileType> },
expandPath: string[] expandPath: string[]
isRequesting: boolean, isRequestingDirectory: boolean,
isSuccessful: boolean, isSuccessfulDirectory: boolean,
isRequestingWorkspace: boolean,
isSuccessfulWorkspace: boolean,
error: string, error: string,
contextMenu: { contextMenu: {
registeredMenuItems: action[], registeredMenuItems: action[],
...@@ -24,8 +26,10 @@ export interface BrowserState { ...@@ -24,8 +26,10 @@ export interface BrowserState {
sharedFolder: string, sharedFolder: string,
files: { [x: string]: Record<string, FileType> }, files: { [x: string]: Record<string, FileType> },
expandPath: string[], expandPath: string[],
isRequesting: boolean, isRequestingDirectory: boolean,
isSuccessful: boolean, isSuccessfulDirectory: boolean,
isRequestingLocalhost: boolean,
isSuccessfulLocalhost: boolean,
error: string, error: string,
contextMenu: { contextMenu: {
registeredMenuItems: action[], registeredMenuItems: action[],
...@@ -54,8 +58,10 @@ export const browserInitialState: BrowserState = { ...@@ -54,8 +58,10 @@ export const browserInitialState: BrowserState = {
workspaces: [], workspaces: [],
files: {}, files: {},
expandPath: [], expandPath: [],
isRequesting: false, isRequestingDirectory: false,
isSuccessful: false, isSuccessfulDirectory: false,
isRequestingWorkspace: false,
isSuccessfulWorkspace: false,
error: null, error: null,
contextMenu: { contextMenu: {
registeredMenuItems: [], registeredMenuItems: [],
...@@ -67,8 +73,10 @@ export const browserInitialState: BrowserState = { ...@@ -67,8 +73,10 @@ export const browserInitialState: BrowserState = {
sharedFolder: '', sharedFolder: '',
files: {}, files: {},
expandPath: [], expandPath: [],
isRequesting: false, isRequestingDirectory: false,
isSuccessful: false, isSuccessfulDirectory: false,
isRequestingLocalhost: false,
isSuccessfulLocalhost: false,
error: null, error: null,
contextMenu: { contextMenu: {
registeredMenuItems: [], registeredMenuItems: [],
...@@ -133,14 +141,14 @@ export const browserReducer = (state = browserInitialState, action: Action) => { ...@@ -133,14 +141,14 @@ export const browserReducer = (state = browserInitialState, action: Action) => {
...state, ...state,
browser: { browser: {
...state.browser, ...state.browser,
isRequesting: state.mode === 'browser', isRequestingDirectory: state.mode === 'browser',
isSuccessful: false, isSuccessfulDirectory: false,
error: null error: null
}, },
localhost: { localhost: {
...state.localhost, ...state.localhost,
isRequesting: state.mode === 'localhost', isRequestingDirectory: state.mode === 'localhost',
isSuccessful: false, isSuccessfulDirectory: false,
error: null error: null
} }
} }
...@@ -154,15 +162,15 @@ export const browserReducer = (state = browserInitialState, action: Action) => { ...@@ -154,15 +162,15 @@ export const browserReducer = (state = browserInitialState, action: Action) => {
browser: { browser: {
...state.browser, ...state.browser,
files: state.mode === 'browser' ? fetchDirectoryContent(state, payload) : state.browser.files, files: state.mode === 'browser' ? fetchDirectoryContent(state, payload) : state.browser.files,
isRequesting: false, isRequestingDirectory: false,
isSuccessful: true, isSuccessfulDirectory: true,
error: null error: null
}, },
localhost: { localhost: {
...state.localhost, ...state.localhost,
files: state.mode === 'localhost' ? fetchDirectoryContent(state, payload) : state.localhost.files, files: state.mode === 'localhost' ? fetchDirectoryContent(state, payload) : state.localhost.files,
isRequesting: false, isRequestingDirectory: false,
isSuccessful: true, isSuccessfulDirectory: true,
error: null error: null
} }
} }
...@@ -173,14 +181,14 @@ export const browserReducer = (state = browserInitialState, action: Action) => { ...@@ -173,14 +181,14 @@ export const browserReducer = (state = browserInitialState, action: Action) => {
...state, ...state,
browser: { browser: {
...state.browser, ...state.browser,
isRequesting: false, isRequestingDirectory: false,
isSuccessful: false, isSuccessfulDirectory: false,
error: state.mode === 'browser' ? action.payload : null error: state.mode === 'browser' ? action.payload : null
}, },
localhost: { localhost: {
...state.localhost, ...state.localhost,
isRequesting: false, isRequestingDirectory: false,
isSuccessful: false, isSuccessfulDirectory: false,
error: state.mode === 'localhost' ? action.payload : null error: state.mode === 'localhost' ? action.payload : null
} }
} }
...@@ -191,14 +199,14 @@ export const browserReducer = (state = browserInitialState, action: Action) => { ...@@ -191,14 +199,14 @@ export const browserReducer = (state = browserInitialState, action: Action) => {
...state, ...state,
browser: { browser: {
...state.browser, ...state.browser,
isRequesting: state.mode === 'browser', isRequestingWorkspace: state.mode === 'browser',
isSuccessful: false, isSuccessfulWorkspace: false,
error: null error: null
}, },
localhost: { localhost: {
...state.localhost, ...state.localhost,
isRequesting: state.mode === 'localhost', isRequestingWorkspace: state.mode === 'localhost',
isSuccessful: false, isSuccessfulWorkspace: false,
error: null error: null
} }
} }
...@@ -212,15 +220,15 @@ export const browserReducer = (state = browserInitialState, action: Action) => { ...@@ -212,15 +220,15 @@ export const browserReducer = (state = browserInitialState, action: Action) => {
browser: { browser: {
...state.browser, ...state.browser,
files: state.mode === 'browser' ? fetchWorkspaceDirectoryContent(state, payload) : state.browser.files, files: state.mode === 'browser' ? fetchWorkspaceDirectoryContent(state, payload) : state.browser.files,
isRequesting: false, isRequestingWorkspace: false,
isSuccessful: true, isSuccessfulWorkspace: true,
error: null error: null
}, },
localhost: { localhost: {
...state.localhost, ...state.localhost,
files: state.mode === 'localhost' ? fetchWorkspaceDirectoryContent(state, payload) : state.localhost.files, files: state.mode === 'localhost' ? fetchWorkspaceDirectoryContent(state, payload) : state.localhost.files,
isRequesting: false, isRequestingWorkspace: false,
isSuccessful: true, isSuccessfulWorkspace: true,
error: null error: null
} }
} }
...@@ -231,14 +239,14 @@ export const browserReducer = (state = browserInitialState, action: Action) => { ...@@ -231,14 +239,14 @@ export const browserReducer = (state = browserInitialState, action: Action) => {
...state, ...state,
browser: { browser: {
...state.browser, ...state.browser,
isRequesting: false, isRequestingWorkspace: false,
isSuccessful: false, isSuccessfulWorkspace: false,
error: state.mode === 'browser' ? action.payload : null error: state.mode === 'browser' ? action.payload : null
}, },
localhost: { localhost: {
...state.localhost, ...state.localhost,
isRequesting: false, isRequestingWorkspace: false,
isSuccessful: false, isSuccessfulWorkspace: false,
error: state.mode === 'localhost' ? action.payload : null error: state.mode === 'localhost' ? action.payload : null
} }
} }
...@@ -397,8 +405,8 @@ export const browserReducer = (state = browserInitialState, action: Action) => { ...@@ -397,8 +405,8 @@ export const browserReducer = (state = browserInitialState, action: Action) => {
...state, ...state,
browser: { browser: {
...state.browser, ...state.browser,
isRequesting: true, isRequestingWorkspace: true,
isSuccessful: false, isSuccessfulWorkspace: false,
error: null error: null
} }
} }
...@@ -414,8 +422,8 @@ export const browserReducer = (state = browserInitialState, action: Action) => { ...@@ -414,8 +422,8 @@ export const browserReducer = (state = browserInitialState, action: Action) => {
...state.browser, ...state.browser,
currentWorkspace: payload, currentWorkspace: payload,
workspaces: workspaces.filter(workspace => workspace), workspaces: workspaces.filter(workspace => workspace),
isRequesting: false, isRequestingWorkspace: false,
isSuccessful: true, isSuccessfulWorkspace: true,
error: null error: null
} }
} }
...@@ -426,8 +434,8 @@ export const browserReducer = (state = browserInitialState, action: Action) => { ...@@ -426,8 +434,8 @@ export const browserReducer = (state = browserInitialState, action: Action) => {
...state, ...state,
browser: { browser: {
...state.browser, ...state.browser,
isRequesting: false, isRequestingWorkspace: false,
isSuccessful: false, isSuccessfulWorkspace: false,
error: action.payload error: action.payload
} }
} }
...@@ -538,8 +546,8 @@ export const browserReducer = (state = browserInitialState, action: Action) => { ...@@ -538,8 +546,8 @@ export const browserReducer = (state = browserInitialState, action: Action) => {
...state, ...state,
localhost: { localhost: {
...state.localhost, ...state.localhost,
isRequesting: true, isRequestingLocalhost: true,
isSuccessful: false, isSuccessfulLocalhost: false,
error: null error: null
} }
} }
...@@ -550,8 +558,8 @@ export const browserReducer = (state = browserInitialState, action: Action) => { ...@@ -550,8 +558,8 @@ export const browserReducer = (state = browserInitialState, action: Action) => {
...state, ...state,
localhost: { localhost: {
...state.localhost, ...state.localhost,
isRequesting: false, isRequestingLocalhost: false,
isSuccessful: true, isSuccessfulLocalhost: true,
error: null error: null
} }
} }
...@@ -564,8 +572,8 @@ export const browserReducer = (state = browserInitialState, action: Action) => { ...@@ -564,8 +572,8 @@ export const browserReducer = (state = browserInitialState, action: Action) => {
...state, ...state,
localhost: { localhost: {
...state.localhost, ...state.localhost,
isRequesting: false, isRequestingLocalhost: false,
isSuccessful: false, isSuccessfulLocalhost: false,
error: payload error: payload
} }
} }
......
...@@ -209,9 +209,9 @@ export function Workspace () { ...@@ -209,9 +209,9 @@ export function Workspace () {
} }
</div> </div>
{ {
global.fs.localhost.isRequesting ? <div className="text-center py-5"><i className="fas fa-spinner fa-pulse fa-2x"></i></div> global.fs.localhost.isRequestingLocalhost ? <div className="text-center py-5"><i className="fas fa-spinner fa-pulse fa-2x"></i></div>
: <div className='pl-2 filesystemexplorer remixui_treeview'> : <div className='pl-2 filesystemexplorer remixui_treeview'>
{ global.fs.mode === 'localhost' && global.fs.localhost.isSuccessful && { global.fs.mode === 'localhost' && global.fs.localhost.isSuccessfulLocalhost &&
<FileExplorer <FileExplorer
name='localhost' name='localhost'
menuItems={['createNewFile', 'createNewFolder']} menuItems={['createNewFile', 'createNewFolder']}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment