diff --git a/packages/embark-ui/src/actions/index.js b/packages/embark-ui/src/actions/index.js index 77f590682..37fcb8430 100644 --- a/packages/embark-ui/src/actions/index.js +++ b/packages/embark-ui/src/actions/index.js @@ -1,3 +1,6 @@ +import {EMBARK_PROCESS_NAME} from '../constants'; +import {ansiToHtml} from '../utils/utils'; + export const REQUEST = 'REQUEST'; export const SUCCESS = 'SUCCESS'; export const FAILURE = 'FAILURE'; @@ -118,7 +121,17 @@ export const COMMANDS = createRequestTypes('COMMANDS'); export const commands = { post: (command) => action(COMMANDS[REQUEST], {command}), success: (command, payload) => { - return action(COMMANDS[SUCCESS], {}); + return action(COMMANDS[SUCCESS], { + processLogs: [ + { + timestamp: new Date().getTime(), + name: EMBARK_PROCESS_NAME, + msg: `${ansiToHtml(command.result || '')}`, + command: `console> ${payload.command}
`, + result: command.result + } + ] + }); }, failure: (error) => action(COMMANDS[FAILURE], {error}) }; diff --git a/packages/embark/src/lib/modules/console/index.ts b/packages/embark/src/lib/modules/console/index.ts index d5d51854a..172264e25 100644 --- a/packages/embark/src/lib/modules/console/index.ts +++ b/packages/embark/src/lib/modules/console/index.ts @@ -96,7 +96,6 @@ class Console { private registerApi() { const plugin = this.plugins.createPlugin("consoleApi", {}); plugin.registerAPICall("post", "/embark-api/command", (req: any, res: any) => { - this.logger.info(`Cockpit> ${req.body.command}`.cyan); this.executeCmd(req.body.command, (err: any, result: any) => { if (err) { return res.send({ result: err.message || err }); @@ -104,10 +103,8 @@ class Console { let response = result; if (typeof result !== "string") { response = stringify(result, utils.jsonFunctionReplacer, 2); - this.logger.info(response); } else { // Avoid HTML injection in the Cockpit - this.logger.info(response); response = escapeHtml(response); } return res.send({ result: response });