Skip to content

Commit

Permalink
feat: config view in Iframe
Browse files Browse the repository at this point in the history
  • Loading branch information
st-vi committed Nov 17, 2023
1 parent 53e9d2f commit 8d4e549
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
22 changes: 22 additions & 0 deletions WebSocketClient/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,24 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" href="style.css">
<title>UVL Playground</title>
<style>
#iframeContainer {
height: 1000px;
width: '100%';
display: none;
}

iframe {
height: 100%;
width: 100%;
border: none; /* Remove iframe border */
}

#embeddedContentContainer {
height: 1000px;
width: 10000px;
}
</style>
</head>
<body>
<div class="header">
Expand All @@ -17,6 +35,10 @@ <h1>UVL Playground</h1>
</div>
<div class="graph"></div>
</div>
<div id="iframeContainer" class="config-view">
<iframe id="myIframe" title="Config"></iframe>
</div>

<div class="footer">
<p>The Universal Variability Language (UVL) is a community effort towards a widely adopted textual specification
for feature models. This playground provides the opportunity to get used to the language with
Expand Down
16 changes: 16 additions & 0 deletions WebSocketClient/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,22 @@ const createLanguageClient = (transports: MessageTransports): MonacoLanguageClie
handleMessage(message: Message, next: (message: Message) => void) {
if(Message.isRequest(message)){
console.log("Sending Request");
const m: any = message;
if(m.method === 'workspace/executeCommand' && m.params.command === 'uvls.open_web'){
const configUri: string = m.params.arguments[0].uri;
const url = new URL(configUri);
let protocoll = 'http';
if (window.location.protocol === "https:") {
protocoll = 'https';
}
console.log(window.location.protocol);
const newUrl: string = `${protocoll}://${config.languageServerHostName}${url.pathname}?port=${url.port}`;
console.log(newUrl);
const iframeContainer: any = document.getElementById('iframeContainer');
const myIframe: any = document.getElementById('myIframe');
iframeContainer.style.display = 'block';
myIframe.src = newUrl;
}
}
if(Message.isResponse(message)){
console.log("Receiving Response");
Expand Down

0 comments on commit 8d4e549

Please sign in to comment.