forked from eclipse-cdt-cloud/theia-trace-extension
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Preference settings for trace configuration
Set the default values for the trace server preferences Read the trace server preference values and spawn the server from the path specified in the preferences fixes eclipse-cdt-cloud#191 fixes eclipse-cdt-cloud#184 Signed-off-by: Ankush Tyagi <ankush.tyagi@ericsson.com>
- Loading branch information
1 parent
5cf280c
commit 2a2d6b2
Showing
15 changed files
with
226 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,49 @@ | ||
{ | ||
"name": "theia-trace-viewer", | ||
"private": "true", | ||
"version": "0.0.0", | ||
"description": "Trace Compass trace viewer Theia Extension", | ||
"keywords": [ | ||
"theia-extension" | ||
], | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/theia-ide/theia-trace-extension" | ||
}, | ||
"files": [ | ||
"lib", | ||
"src" | ||
], | ||
"dependencies": { | ||
"@trace-viewer/base": "0.0.0", | ||
"@trace-viewer/react-components": "0.0.0", | ||
"@theia/core": "latest", | ||
"@theia/editor": "latest", | ||
"@theia/filesystem": "latest" | ||
}, | ||
"devDependencies": { | ||
"@typescript-eslint/eslint-plugin": "^3.4.0", | ||
"@typescript-eslint/parser": "^3.4.0", | ||
"eslint": "^7.3.0", | ||
"eslint-plugin-import": "^2.21.2", | ||
"eslint-plugin-no-null": "^1.0.2", | ||
"eslint-plugin-react": "^7.20.0", | ||
"rimraf": "latest", | ||
"typescript": "latest" | ||
}, | ||
"scripts": { | ||
"build": "tsc", | ||
"clean": "rimraf lib", | ||
"lint": "eslint .", | ||
"prepare": "yarn run clean && yarn run build", | ||
"test": "echo 'test'", | ||
"watch": "tsc -w" | ||
}, | ||
"theiaExtensions": [ | ||
{ | ||
"frontend": "lib/browser/trace-viewer/trace-viewer-frontend-module" | ||
} | ||
] | ||
} | ||
"name": "theia-trace-viewer", | ||
"private": "true", | ||
"version": "0.0.0", | ||
"description": "Trace Compass trace viewer Theia Extension", | ||
"keywords": [ | ||
"theia-extension" | ||
], | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/theia-ide/theia-trace-extension" | ||
}, | ||
"files": [ | ||
"lib", | ||
"src" | ||
], | ||
"dependencies": { | ||
"@trace-viewer/base": "0.0.0", | ||
"@trace-viewer/react-components": "0.0.0", | ||
"@theia/core": "latest", | ||
"@theia/editor": "latest", | ||
"@theia/filesystem": "latest" | ||
}, | ||
"devDependencies": { | ||
"@typescript-eslint/eslint-plugin": "^3.4.0", | ||
"@typescript-eslint/parser": "^3.4.0", | ||
"eslint": "^7.3.0", | ||
"eslint-plugin-import": "^2.21.2", | ||
"eslint-plugin-no-null": "^1.0.2", | ||
"eslint-plugin-react": "^7.20.0", | ||
"rimraf": "latest", | ||
"typescript": "latest" | ||
}, | ||
"scripts": { | ||
"build": "tsc", | ||
"clean": "rimraf lib", | ||
"lint": "eslint .", | ||
"prepare": "yarn run clean && yarn run build", | ||
"test": "echo 'test'", | ||
"watch": "tsc -w" | ||
}, | ||
"theiaExtensions": [ | ||
{ | ||
"frontend": "lib/browser/trace-viewer/trace-viewer-frontend-module", | ||
"backend": "lib/node/trace-server-backend-module" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { interfaces } from 'inversify'; | ||
import { PreferenceService, createPreferenceProxy, PreferenceContribution } from '@theia/core/lib/browser'; | ||
import { TracePreferences, ServerSchema } from './trace-server-preference'; | ||
|
||
export function bindTraceServerPreferences(bind: interfaces.Bind): void { | ||
bind(TracePreferences).toDynamicValue(ctx => { | ||
const preferences = ctx.container.get<PreferenceService>(PreferenceService); | ||
return createPreferenceProxy(preferences, ServerSchema); | ||
}).inSingletonScope(); | ||
|
||
bind(PreferenceContribution).toConstantValue({ | ||
schema: ServerSchema, | ||
}); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { PreferenceSchema, PreferenceProxy, PreferenceScope } from '@theia/core/lib/browser'; | ||
|
||
export const TRACE_PATH = 'trace-viewer.path'; | ||
export const TRACE_PORT = 'trace-viewer.port'; | ||
|
||
export const ServerSchema: PreferenceSchema = { | ||
type: 'object', | ||
properties: { | ||
[TRACE_PATH]: { | ||
'type': 'string', | ||
'default': '', | ||
'description': 'The path to trace-server executable, e.g.: /usr/bin/', | ||
}, | ||
[TRACE_PORT]: { | ||
'type': 'number', | ||
'default': '', | ||
'description': 'Specify the port on which you want to execute the server.', | ||
} | ||
|
||
}, | ||
scope: PreferenceScope.Folder, | ||
}; | ||
|
||
interface TracePreferenceContribution { | ||
[TRACE_PATH]: string; | ||
[TRACE_PORT]: number; | ||
} | ||
|
||
export const TracePreferences = Symbol('TracePreferences'); | ||
export type TracePreferences = PreferenceProxy<TracePreferenceContribution>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 9 additions & 4 deletions
13
viewer-prototype/src/browser/trace-server-url-provider-frontend-impl.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
export const traceServerPath = '/services/trace-server-config'; | ||
export const TraceServerConfigService = Symbol('TraceServerConfigService'); | ||
export interface TraceServerConfigService { | ||
/** | ||
* Spawn the trace server from a given path | ||
*/ | ||
startTraceServer(path: string | undefined, port: number | undefined): Promise<void>; | ||
|
||
/** | ||
* Stop the trace server | ||
*/ | ||
stopTraceServer(port: number | undefined): Promise<void>; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './trace-server-backend-module'; | ||
export * from './trace-server-service'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { ContainerModule } from 'inversify'; | ||
import { TraceServerServiceImpl } from './trace-server-service'; | ||
import { ConnectionHandler, JsonRpcConnectionHandler } from '@theia/core/lib/common'; | ||
import { traceServerPath } from '../common/trace-server-config'; | ||
import { TraceServerConfigService } from '../common/trace-server-config'; | ||
|
||
export default new ContainerModule(bind => { | ||
bind(TraceServerServiceImpl).toSelf().inSingletonScope(); | ||
|
||
bind(ConnectionHandler) | ||
.toDynamicValue(ctx => new JsonRpcConnectionHandler<TraceServerConfigService>( | ||
traceServerPath, | ||
() => ctx.container.get<TraceServerConfigService>(TraceServerServiceImpl), | ||
)).inSingletonScope(); | ||
|
||
}); |
Oops, something went wrong.