Compare commits

...
8 changed files with 42 additions and 11 deletions
+2 -1
View File
@@ -17,7 +17,7 @@ import { TerminalComponent } from './terminal/terminal.component';
import { AppRoutingModule } from './app-routing.module'; import { AppRoutingModule } from './app-routing.module';
import { TestmessengerComponent } from './testmessenger/testmessenger.component'; import { TestmessengerComponent } from './testmessenger/testmessenger.component';
import { DeploymentNotificationService } from './services/deployment-notification.service'; import { DeploymentNotificationService } from './services/deployment-notification.service';
import { SafePipe } from './pipes/safe.pipe'; import { SafePipe, SafeHtmlPipe } from './pipes/safe.pipe';
import { ConsoleComponent } from './console/console.component'; import { ConsoleComponent } from './console/console.component';
import { MonacoEditorModule } from 'ngx-monaco-editor'; import { MonacoEditorModule } from 'ngx-monaco-editor';
import { import {
@@ -41,6 +41,7 @@ import { LoaderComponent } from './loader/loader.component';
DashboardComponent, DashboardComponent,
TestmessengerComponent, TestmessengerComponent,
SafePipe, SafePipe,
SafeHtmlPipe,
ConsoleComponent, ConsoleComponent,
LoaderComponent LoaderComponent
], ],
+2 -1
View File
@@ -75,7 +75,8 @@
.loader { .loader {
border-radius: 50%; border-radius: 50%;
border: 2px solid; border: 2px solid $tao-warm-yellow-600;
border-top: 2px solid $tao-warm-yellow-200;
width: 15px; width: 15px;
height: 15px; height: 15px;
animation: spin 2s linear infinite; animation: spin 2s linear infinite;
+3 -1
View File
@@ -30,5 +30,7 @@ export const LanguageMap: { [extension: string]: string; } = {
css: 'css', css: 'css',
less: 'less', less: 'less',
scss: 'scss', scss: 'scss',
sh: 'shell' sh: 'shell',
kt: 'kotlin',
kts: 'kotlin'
}; };
+1
View File
@@ -4,6 +4,7 @@ export interface MessageData {
originator?: string; originator?: string;
timestamp?: Date; timestamp?: Date;
typing?: boolean; typing?: boolean;
command?: any;
message: string; message: string;
} }
+10 -7
View File
@@ -1,17 +1,20 @@
<div class="tfw-messages-main"> <div class="tfw-messages-main">
<div class="tfw-grid-message" <div class="tfw-grid-message"
*ngFor="let message of messages.slice(); let last = last" *ngFor="let message of messages.slice(); let last = last"
[class.highlighted-message]="last"> [class.highlighted-message]="last"
(click)="sendMessageCommand(message)">
<div class="tfw-grid-message-header"> <div class="tfw-grid-message-header">
<img class="tao-grid-center-left" src="images/avataobot.svg"/> <img class="tao-grid-center-left" src="images/avataobot.svg"/>
<div class="tao-grid-center-left originator">{{message.originator}}</div> <div class="tao-grid-center-left originator">{{message.originator}}</div>
<div class="timestamp tao-grid-center-right">{{message.timestamp | date:'HH:mm:ss'}}</div> <div class="timestamp tao-grid-center-right">{{message.timestamp | date:'HH:mm:ss'}}</div>
</div> </div>
<div class="tfw-grid-message-body" [innerHtml]="message.message"></div> <div class="tfw-grid-message-body" [innerHtml]="message.message | safeHtml"></div>
</div>
<div *ngIf="showTypingIndicator"
class="tfw-grid-message jumping-circle-container"
(click)="drainMessageQueue()">
<div class="jumping-circle" id="jc1"></div>
<div class="jumping-circle" id="jc2"></div>
<div class="jumping-circle" id="jc3"></div>
</div> </div>
<div *ngIf="showTypingIndicator" class="tfw-grid-message jumping-circle-container">
<div class="jumping-circle" id="jc1"></div>
<div class="jumping-circle" id="jc2"></div>
<div class="jumping-circle" id="jc3"></div>
</div>
</div> </div>
+12
View File
@@ -59,4 +59,16 @@ export class MessagesComponent implements OnInit {
convertMarkdownToHTML(text: string) { convertMarkdownToHTML(text: string) {
return this.markdownService.convertToHtml(text); return this.markdownService.convertToHtml(text);
} }
drainMessageQueue() {
this.websocketService.send({
'key': 'message.queue.drain'
});
}
sendMessageCommand(message: MessageData) {
if ('command' in message) {
this.websocketService.send(message.command);
}
}
} }
+11
View File
@@ -11,3 +11,14 @@ export class SafePipe implements PipeTransform {
return this.sanitizer.bypassSecurityTrustResourceUrl(value); return this.sanitizer.bypassSecurityTrustResourceUrl(value);
} }
} }
@Pipe({
name: 'safeHtml'
})
export class SafeHtmlPipe implements PipeTransform {
constructor(private sanitized: DomSanitizer) {}
transform(value) {
return this.sanitized.bypassSecurityTrustHtml(value);
}
}
+1 -1
View File
@@ -9,7 +9,7 @@ export class DashboardConfigService extends ConfigServiceBase {
layout = new BehaviorSubject<string>('terminal-ide-web'); layout = new BehaviorSubject<string>('terminal-ide-web');
hideMessages = new BehaviorSubject<boolean>(false); hideMessages = new BehaviorSubject<boolean>(false);
iframeUrl = new BehaviorSubject<string>('/webservice'); iframeUrl = new BehaviorSubject<string>('');
showUrlBar = new BehaviorSubject<boolean>(false); showUrlBar = new BehaviorSubject<boolean>(false);
terminalMenuItem = new BehaviorSubject<string>('terminal'); terminalMenuItem = new BehaviorSubject<string>('terminal');
reloadIframeOnDeploy = new BehaviorSubject<boolean>(false); reloadIframeOnDeploy = new BehaviorSubject<boolean>(false);