Skip to content
Snippets Groups Projects
Commit 0be9db28 authored by Alexandra's avatar Alexandra
Browse files

support images in briefing and setup theia-full

parent b8673dc9
No related branches found
No related tags found
No related merge requests found
Pipeline #14188 passed
[1.2] 27/11/2020
* Image supports in briefing
* Set theia-full instead of theia-java (https://git.e-biz.fr/deadlock-public/deadlock-theia/-/issues/2)
[1.1] 27/11/2020
* preStop hook ok
* GitLens integration
......
FROM theiaide/theia-java:1.4.0
FROM theiaide/theia-full:1.7.0
USER root
......@@ -19,7 +19,7 @@ COPY recorder-out/dist/main.js deadlock/recorder.js
COPY recorder-out/dist/preStop.js deadlock/preStop.js
COPY .gitignore_recorder deadlock/.gitignore
RUN chmod 500 deadlock/ -R
RUN chmod 504 deadlock/ -R
RUN chmod 500 start.sh
ENTRYPOINT ["bash", "start.sh"]
......@@ -4,3 +4,5 @@ Vscode extension to show a panel with :
* adresses availables for the current challenge pulled from `/home/config/user-challenge.json`
* challenge instruction pulled from the `README.md`
## Run first the `setup-dev-env.sh` then you can start your plugin with `VsCode Run`.
{
"paths": {
"9090": "HXW3fnKwUULrfKS1-cdb",
"3000": "HXW3fnKwUULrfKS1-web",
"8080": "HXW3fnKwUULrfKS1-angular"
},
"host": "persist.dev.deadlock.io",
"token": "e75da487-9576-4427-be2d-8da4059adc7d",
"giteaHost": "deadlock.minikube",
"giteaSshPort": 32000,
"username": "toast",
"missionId": "code_persist_cdb_crud"
}
# Briefing dev sample
HELL0 WORLD!
![toast](image:toast.jpg)
plugins/deadlock-extension/dev/docs/toast.jpg

148 KiB

......@@ -5,25 +5,5 @@
mkdir -p /home/$USER/deadlock-extension/project
mkdir -p /home/$USER/deadlock-extension/project-theia
mkdir -p /home/$USER/deadlock-extension/config
mkdir -p /home/$USER/deadlock-extension/docs
echo '
# Briefing dev sample
HELL0 WORLD!
' > /home/$USER/deadlock-extension/docs/briefing.md
echo '
{
"paths": {
"9090":"HXW3fnKwUULrfKS1-cdb",
"3000":"HXW3fnKwUULrfKS1-web",
"8080":"HXW3fnKwUULrfKS1-angular"
},
"host":"persist.dev.deadlock.io",
"token":"e75da487-9576-4427-be2d-8da4059adc7d",
"giteaHost":"deadlock.minikube",
"giteaSshPort":32000,
"username":"toast",
"missionId":"code_persist_cdb_crud"
}
' > /home/$USER/deadlock-extension/config/user-challenge.json
\ No newline at end of file
cp -R ./dev/* /home/$USER/deadlock-extension
......@@ -12,7 +12,11 @@ export const userConfig = new UserConfigTheia();
export async function activate(context: vscode.ExtensionContext) {
try {
await userConfig.init();
} catch (e) {
console.error("Cannot init userConfig");
}
initViews();
......
......@@ -2,9 +2,10 @@ import View from "./view";
import * as vscode from "vscode";
import * as path from "path";
// eslint-disable-next-line @typescript-eslint/no-var-requires
const marked = require("marked");
const fs = require("fs");
import * as path from "path";
import { DOCS_PATH, BRIEFING_FILE_NAME } from "../core/config";
import { WebviewBase } from "./webviewBase";
......@@ -25,6 +26,27 @@ export default class BriefingView extends WebviewBase {
super(BRIEFING_ID, "Briefing", OPEN_BRIEFING_COMMAND);
}
toBase64(file: string) {
const re = fs.readFileSync(path.join(DOCS_PATH, file), {
encoding: "base64",
});
console.log("re", re);
return re;
}
setupImages(text: string) {
const imageRegex = /\!\[(.*?)\]\(\b(image:)(.*?\))?/g
return text.replace(imageRegex, (match, title, imagePrefix, img) => {
const fileName = img.replace(")", "");
const extension = fileName.split("\.");
return `![${title}](data:image/${
extension[extension.length - 1]
};base64,${this.toBase64(fileName)})`;
});
}
load(): void {
const intervalId = setInterval(() => {
if (vscode.workspace && !this.loadingBriefing) {
......@@ -37,7 +59,12 @@ export default class BriefingView extends WebviewBase {
)
.then(
(document) => {
this.briefingContent = document.getText();
try {
this.briefingContent = this.setupImages(document.getText());
} catch (e) {
console.error(e);
this.briefingContent = "Error while parsing your briefing."
}
this.show();
},
(error) => {
......@@ -93,7 +120,7 @@ export default class BriefingView extends WebviewBase {
if (key !== "3000") {
pathsLength++;
const path = paths[key];
if (userConfig.getHost() === 'localhost') {
if (userConfig.getHost() === "localhost") {
adresses += `<li>${key} binded on <a href="http://${userConfig.getHost()}:${path}">${path}</a></li>`;
} else {
adresses += `<li>${key} binded on <a href="https://${userConfig.getHost()}/${path}/">${path}</a></li>`;
......
......@@ -58,20 +58,21 @@ function start(port, host, argv) {
});
}
module.exports = (port, host, argv) => Promise.resolve()
.then(function () { return Promise.resolve(require('@theia/process/lib/common/process-common-module')).then(load) })
.then(function () { return Promise.resolve(require('@theia/process/lib/node/process-backend-module')).then(load) })
.then(function () { return Promise.resolve(require('@theia/filesystem/lib/node/filesystem-backend-module')).then(load) })
.then(function () { return Promise.resolve(require('@theia/filesystem/lib/node/download/file-download-backend-module')).then(load) })
.then(function () { return Promise.resolve(require('@theia/workspace/lib/node/workspace-backend-module')).then(load) })
.then(function () { return Promise.resolve(require('@theia/languages/lib/node/languages-backend-module')).then(load) })
.then(function () { return Promise.resolve(require('@theia/file-search/lib/node/file-search-backend-module')).then(load) })
.then(function () { return Promise.resolve(require('@theia/git/lib/node/git-backend-module')).then(load) })
.then(function () { return Promise.resolve(require('@theia/git/lib/node/env/git-env-module')).then(load) })
.then(function () { return Promise.resolve(require('@theia/process/lib/common/process-common-module')).then(load) })
.then(function () { return Promise.resolve(require('@theia/process/lib/node/process-backend-module')).then(load) })
.then(function () { return Promise.resolve(require('@theia/terminal/lib/node/terminal-backend-module')).then(load) })
.then(function () { return Promise.resolve(require('@theia/task/lib/node/task-backend-module')).then(load) })
.then(function () { return Promise.resolve(require('@theia/debug/lib/node/debug-backend-module')).then(load) })
.then(function () { return Promise.resolve(require('@theia/cpp-debug/lib/node/cpp-debug-backend-module')).then(load) })
.then(function () { return Promise.resolve(require('@theia/file-search/lib/node/file-search-backend-module')).then(load) })
.then(function () { return Promise.resolve(require('@theia/git/lib/node/git-backend-module')).then(load) })
.then(function () { return Promise.resolve(require('@theia/git/lib/node/env/git-env-module')).then(load) })
.then(function () { return Promise.resolve(require('@theia/metrics/lib/node/metrics-backend-module')).then(load) })
.then(function () { return Promise.resolve(require('@theia/mini-browser/lib/node/mini-browser-backend-module')).then(load) })
.then(function () { return Promise.resolve(require('@theia/search-in-workspace/lib/node/search-in-workspace-backend-module')).then(load) })
.then(function () { return Promise.resolve(require('@theia/plugin-ext/lib/plugin-ext-backend-module')).then(load) })
.then(function () { return Promise.resolve(require('@theia/plugin-ext-vscode/lib/node/plugin-vscode-backend-module')).then(load) })
......
......@@ -9,4 +9,4 @@ cp /tmp/.ssh/* ~/.ssh/
node deadlock/recorder.js &
# starting theia as THEIA
su theia --command "yarn theia start /home/project --hostname=0.0.0.0 --plugins=local-dir:/home/plugins"
\ No newline at end of file
su theia --command "node /home/theia/src-gen/backend/main.js /home/project --hostname=0.0.0.0 --plugins=local-dir:/home/plugins"
\ No newline at end of file
  • Alexandra @apuret

    mentioned in issue #2 (closed)

    By Alexandra on 2021-06-18T15:25:22 (imported from GitLab)

    ·

    mentioned in issue #2 (closed)

    By Alexandra on 2021-06-18T15:25:22 (imported from GitLab)

    Edited by Ghost User
    Toggle commit list
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment