Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions apps/remix-ide-e2e/src/tests/template_exp_modal.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ module.exports = {
.waitForElementVisible('*[data-id="treeViewLitreeViewItem.github/workflows"]')
.waitForElementVisible('*[data-id="treeViewLitreeViewItem.github/workflows/run-js-test.yml"]')
.click('*[data-id="treeViewLitreeViewItem.github/workflows/run-js-test.yml"]')
.pause(1500)
.getEditorValue((content) => {
browser.assert.ok(content.indexOf(`name: Running Mocha Chai Solidity Unit Tests`) !== -1,
'Correct content')
Expand All @@ -259,6 +260,7 @@ module.exports = {
.waitForElementVisible('*[data-id="treeViewLitreeViewItem.github/workflows"]')
.waitForElementVisible('*[data-id="treeViewLitreeViewItem.github/workflows/run-slither-action.yml"]')
.click('*[data-id="treeViewLitreeViewItem.github/workflows/run-slither-action.yml"]')
.pause(1500)
.getEditorValue((content) => {
browser.assert.ok(content.indexOf(`name: Slither Analysis`) !== -1,
'Correct content')
Expand All @@ -276,6 +278,7 @@ module.exports = {
.click('*[data-id="template-card-contractCreate2Factory-0"]')
.waitForElementVisible('*[data-id="treeViewLitreeViewItemcontracts/libs"]')
.click('*[data-id="treeViewLitreeViewItemcontracts/libs/create2-factory.sol"]')
.pause(1500)
.getEditorValue((content) => {
browser.assert.ok(content.indexOf(`contract Create2Factory {`) !== -1,
'Correct content')
Expand All @@ -293,6 +296,7 @@ module.exports = {
.click('*[data-id="template-card-contractDeployerScripts-1"]')
.waitForElementVisible('*[data-id="treeViewLitreeViewItemscripts"]')
.click('*[data-id="treeViewLitreeViewItemscripts/contract-deployer/basic-contract-deploy.ts"]')
.pause(1500)
.getEditorValue((content) => {
browser.assert.ok(content.indexOf(`export const deploy = async (contractName: string, args: Array<any>, accountIndex?: number): Promise<ethers.Contract> => {`) !== -1,
'Correct content')
Expand All @@ -311,6 +315,7 @@ module.exports = {
.waitForElementVisible('*[data-id="treeViewLitreeViewItemscripts/etherscan"]')
.waitForElementVisible('*[data-id="treeViewLitreeViewItemscripts/etherscan/receiptGuidScript.ts"]')
.click('*[data-id="treeViewLitreeViewItemscripts/etherscan/receiptGuidScript.ts"]')
.pause(1500)
.getEditorValue((content) => {
browser.assert.ok(content.indexOf(`export const receiptStatus = async (apikey: string, guid: string, isProxyContract?: boolean) => {`) !== -1,
'Correct content')
Expand Down
17 changes: 12 additions & 5 deletions libs/remix-api/src/lib/plugins/matomo/events/file-events.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
/**
* File Events - File explorer and workspace management tracking events
*
*
* This file contains all file management related Matomo events.
*/

import { MatomoEventBase } from '../core/base-types';

export interface FileExplorerEvent extends MatomoEventBase {
category: 'fileExplorer';
action:
action:
| 'contextMenu'
| 'createMenuButtonOpen'
| 'createBlankFile'
| 'createNewFile'
| 'createNewFolder'
| 'importFromIpfs'
| 'importFromLocalFileSystem'
| 'importFromHttps'
| 'workspaceMenu'
| 'fileAction'
| 'deleteKey'
Expand All @@ -22,22 +29,22 @@ export interface FileExplorerEvent extends MatomoEventBase {

export interface WorkspaceEvent extends MatomoEventBase {
category: 'workspace';
action:
action:
| 'switchWorkspace'
| 'template'
| 'GIT';
}

export interface StorageEvent extends MatomoEventBase {
category: 'Storage';
action:
action:
| 'activate'
| 'error';
}

export interface BackupEvent extends MatomoEventBase {
category: 'Backup';
action:
action:
| 'create'
| 'restore'
| 'error'
Expand Down
7 changes: 6 additions & 1 deletion libs/remix-api/src/lib/plugins/matomo/events/tools-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,17 @@ export interface TemplateExplorerModalEvent extends MatomoEventBase {
| 'topCardCreateFileWithAi'
| 'topCardImportFiles'
| 'topCardCreateContractWithWizard'
| 'topCardCreateBlank'
| 'topCardContractWizardCreateFile'
| 'clearFilterButtonClick'
| 'tagSelected'
| 'topCardCreateBlankWorkspace'
| 'topCardCreateBlankFile'
| 'createWorkspaceWithBasicTemplate'
| 'contractTypeSelectedInContractWizard'
| 'initializeAsGitRepoSelectedInContractWizard'
| 'initializeAsGitRepoSelectedInOtherTemplates'
| 'createWorkspaceWithContractWizard'
| 'createFileWithContractWizard'
| 'createWorkspaceWithGenericTemplate'
| 'importFiles'
| 'importHttps'
Expand Down
3 changes: 3 additions & 0 deletions libs/remix-core-plugin/src/lib/compiler-content-imports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ export class CompilerImports extends Plugin {
await this.setToken()
resolved = await this.urlResolver.resolve(url, [], force)
const { content, cleanUrl, type } = resolved
if (content && (content as string).includes('500 Internal server error') ) {
return cb(new Error('500 Internal server error'))
}
cb(null, content, cleanUrl, type, url)
} catch (e) {
return cb(new Error('not found ' + url))
Expand Down
2 changes: 1 addition & 1 deletion libs/remix-ui/git/src/lib/listeners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class AsyncDebouncedQueue {

enqueue(callback: AsyncCallback, customDelay?: number): void {
if (this.queues.has(callback)) {
clearTimeout(this.queues.get(callback)!.timer);
clearTimeout(this.queues.get(callback)?.timer);
}

const timer = setTimeout(async () => {
Expand Down
1 change: 1 addition & 0 deletions libs/remix-ui/run-tab/src/lib/actions/account.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import { shortenAddress } from "@remix-ui/helper"
import { RunTab } from "../types/run-tab"
import { trackMatomoEvent } from '@remix-api'
Expand Down
14 changes: 11 additions & 3 deletions libs/remix-ui/settings/src/lib/mcp-server-manager.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import React, { useState, useEffect } from 'react'
import { ViewPlugin } from '@remixproject/engine-web'
import { IMCPServer } from '@remix/remix-ai-core'
Expand Down Expand Up @@ -86,10 +87,17 @@ export const IMCPServerManager: React.FC<IMCPServerManagerProps> = ({ plugin })
try {
setIsSaving(true)

// Validate required fields
if (!formData.name || !formData.transport) {
console.error('Name and transport are required fields')
setIsSaving(false)
return
}

const server: IMCPServer = {
name: formData.name!,
name: formData.name,
description: formData.description,
transport: formData.transport!,
transport: formData.transport,
command: formData.transport === 'stdio' ? formData.command : undefined,
args: formData.transport === 'stdio' ? formData.args : undefined,
url: formData.transport !== 'stdio' ? formData.url : undefined,
Expand Down Expand Up @@ -493,4 +501,4 @@ export const IMCPServerManager: React.FC<IMCPServerManagerProps> = ({ plugin })
</div>
</div>
)
}
}
1 change: 1 addition & 0 deletions libs/remix-ui/tabs/src/lib/components/DropdownMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import React, { useState, useRef, useEffect } from 'react'
import './DropdownMenu.css'
import { ArrowRightSm } from '@remix-ui/tabs'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export function ContractWizard () {

dispatch({ type: TemplateExplorerWizardAction.SET_WORKSPACE_NAME, payload: value.toUpperCase() })
dispatch({ type: TemplateExplorerWizardAction.SET_WORKSPACE_TEMPLATE, payload: templateMap[value] })
trackMatomoEvent({ category: MatomoCategories.TEMPLATE_EXPLORER_MODAL, action: 'contractTypeSelectedInContractWizard', name: value.toUpperCase(), isClick: true })
}

const validateAndCreateWorkspace = async () => {
Expand All @@ -122,7 +123,7 @@ export function ContractWizard () {
contractContent: state.contractCode,
contractName: state.tokenName
})
trackMatomoEvent({ category: MatomoCategories.TEMPLATE_EXPLORER_MODAL, action: 'createWorkspaceWithContractWizard', name: 'success' })
trackMatomoEvent({ category: MatomoCategories.TEMPLATE_EXPLORER_MODAL, action: 'createWorkspaceWithContractWizard', name: state.workspaceTemplateChosen.value, isClick: true })
facade.closeWizard()
}

Expand All @@ -132,7 +133,7 @@ export function ContractWizard () {
await facade.plugin.call('fileManager', 'mkdir', 'contracts')
}
await facade.plugin.call('fileManager', 'writeFileNoRewrite', `/contracts/${state.contractName}.sol`, state.contractCode)
trackMatomoEvent({ category: MatomoCategories.TEMPLATE_EXPLORER_MODAL, action: 'addContractFileToWorkspace' })
trackMatomoEvent({ category: MatomoCategories.TEMPLATE_EXPLORER_MODAL, action: 'addContractFileToWorkspace', name: state.contractName, isClick: true })
facade.closeWizard()
await facade.plugin.call('fileManager', 'open', `/contracts/${state.contractName}.sol`)
await facade.plugin.call('notification', 'toast', 'Contract file created successfully')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,22 @@ export function GenerateWorkspaceWithAi() {
}

await plugin.call('remixaiassistant', 'handleExternalMessage', 'Please wait while the workspace is being generated!')
trackMatomoEvent({ category: MatomoCategories.TEMPLATE_EXPLORER_MODAL, action: 'createWorkspaceWithAiRequestSent', name: state.workspaceName })
trackMatomoEvent({ category: MatomoCategories.TEMPLATE_EXPLORER_MODAL, action: 'createWorkspaceWithAiRequestSent', name: state.workspaceName, isClick: true })
const result = await plugin.call('remixAI' as any, 'generate', state.workspaceName, statusCallback)
if (result.includes('No payload')) {
await plugin.call('remixaiassistant', 'handleExternalMessage', 'Unfortunately, the workspace generation failed. Please try again with a different prompt.')
trackMatomoEvent({ category: MatomoCategories.TEMPLATE_EXPLORER_MODAL, action: 'createWorkspaceWithAiFailed', name: state.workspaceName })
trackMatomoEvent({ category: MatomoCategories.TEMPLATE_EXPLORER_MODAL, action: 'createWorkspaceWithAiFailed', name: state.workspaceName, isClick: true })
return
}

if (result.toLowerCase().includes('failed') && result.toLowerCase().includes('please try again with')) {
await plugin.call('remixaiassistant', 'handleExternalMessage', 'Unfortunately, the workspace generation failed. Please try again with a different prompt.')
trackMatomoEvent({ category: MatomoCategories.TEMPLATE_EXPLORER_MODAL, action: 'createWorkspaceWithAiFailed', name: state.workspaceName })
trackMatomoEvent({ category: MatomoCategories.TEMPLATE_EXPLORER_MODAL, action: 'createWorkspaceWithAiFailed', name: state.workspaceName, isClick: true })
return
}

await plugin.call('remixaiassistant', 'handleExternalMessage', 'The workspace has been generated successfully!')
trackMatomoEvent({ category: MatomoCategories.TEMPLATE_EXPLORER_MODAL, action: 'createWorkspaceWithAiSucceeded', name: state.workspaceName })
trackMatomoEvent({ category: MatomoCategories.TEMPLATE_EXPLORER_MODAL, action: 'createWorkspaceWithAiSucceeded', name: state.workspaceName, isClick: true })
}}>
<i className="fa-solid fa-magic me-2"></i>
Generate my Workspace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ export function GenericWorkspaceTemplate() {
<input data-id={`initializeAsGitRepo-${state.workspaceTemplateChosen.value}`} className="form-check-input" type="checkbox" id="initGit" checked={state.initializeAsGitRepo}
onChange={(e) => {
dispatch({ type: ContractWizardAction.INITIALIZE_AS_GIT_REPO_UPDATE, payload: e.target.checked })
trackMatomoEvent({ category: MatomoCategories.TEMPLATE_EXPLORER_MODAL, action: 'initializeAsGitRepoSelectedInOtherTemplates', name: 'success' })
}} />
<label className="form-check-label" htmlFor="initGit">Initialize as a Git repository</label>
</>
Expand All @@ -106,7 +105,7 @@ export function GenericWorkspaceTemplate() {
contractContent: state.contractCode,
contractName: state.tokenName
})
trackMatomoEvent({ category: MatomoCategories.TEMPLATE_EXPLORER_MODAL, action: 'createWorkspaceWithGenericTemplate', name: 'success' })
trackMatomoEvent({ category: MatomoCategories.TEMPLATE_EXPLORER_MODAL, action: 'createWorkspaceWithGenericTemplate', name: state.workspaceTemplateChosen.value, isClick: true })
facade.closeWizard()
}}>Finish</button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function ImportFromIpfs(props: any) {
const type = externalResourceName.startsWith('ipfs://') ? 'ipfs' : 'https'
await facade.processLoadingExternalUrls(externalResourceName, type)
facade.closeWizard()
trackMatomoEvent({ category: MatomoCategories.TEMPLATE_EXPLORER_MODAL, action: 'importFiles', name: externalResourceName.startsWith('ipf') ? 'importFromIpfs' : 'importFromHttps' })
trackMatomoEvent({ category: MatomoCategories.TEMPLATE_EXPLORER_MODAL, action: 'importFiles', name: externalResourceName.startsWith('ipf') ? 'importFromIpfs' : 'importFromHttps', isClick: true })
}}
disabled={externalResourceName.length < 7}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { TemplateExplorer } from './template-explorer'
import { TopCards } from './topCards'
import { TemplateExplorerContext } from '../../context/template-explorer-context'
import { NotFound } from './notfound'
import { MatomoCategories } from '@remix-api'

export function TemplateExplorerBody() {
const { selectedTag, allTags, handleTagClick, clearFilter, dedupedTemplates, state, theme, trackMatomoEvent } = useContext(TemplateExplorerContext)
Expand Down Expand Up @@ -30,7 +31,10 @@ export function TemplateExplorerBody() {
<span
key={tag as any}
className={`template-tag badge rounded-pill p-2 fw-light ${selectedTag === tag ? 'badge rounded-pill text-info p-2 fw-light' : 'badge rounded-pill text-bg-light p-2 fw-light'}`}
onClick={() => handleTagClick(tag as any)}
onClick={() => {
handleTagClick(tag as any)
trackMatomoEvent({ category: MatomoCategories.TEMPLATE_EXPLORER_MODAL, action: 'tagSelected', name: tag, isClick: true })
}}
>
{tag as any}
</span>
Expand All @@ -39,7 +43,10 @@ export function TemplateExplorerBody() {
<small>
<span
className="p-0 ms-2 text-warning fw-light"
onClick={clearFilter}
onClick={() => {
clearFilter()
trackMatomoEvent({ category: MatomoCategories.TEMPLATE_EXPLORER_MODAL, action: 'clearFilterButtonClick', isClick: true })
}}
>
Clear filter
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ export function TemplateExplorer() {
if (item.value === 'cookbook') {
await plugin.call('manager', 'activatePlugin', 'cookbookdev')
await plugin.call('sidePanel', 'focus', 'cookbookdev')
trackMatomoEvent({ category: 'templateExplorerModal', action: 'selectWorkspaceTemplate', value: item.value })
trackMatomoEvent({ category: 'templateExplorerModal', action: 'selectWorkspaceTemplate', value: item.value, isClick: true })
facade.closeWizard()
return
}
dispatch({ type: TemplateExplorerWizardAction.SET_WORKSPACE_TEMPLATE_TYPE, payload: item.value })
facade.switchWizardScreen(dispatch, item, template, templateCategoryStrategy)
trackMatomoEvent({ category: MatomoCategories.TEMPLATE_EXPLORER_MODAL, action: 'selectWorkspaceTemplate', name: item.value })
trackMatomoEvent({ category: MatomoCategories.TEMPLATE_EXPLORER_MODAL, action: 'selectWorkspaceTemplate', name: item.value, isClick: true })
if (item.displayName.toLowerCase().includes('ai')) {
await plugin.call('sidePanel', 'pinView', await plugin.call('remixaiassistant', 'getProfile'))
}
Expand Down
Loading