diff --git a/src/app/app.component.html b/src/app/app.component.html index 15f42b9..f8c302a 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -37,7 +37,7 @@
- +
diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 2a48950..4254add 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,29 +1,33 @@ -import { Component } from '@angular/core'; -import { Observable } from 'rxjs'; +import {Component, OnDestroy} from '@angular/core'; -import { Output } from '@app/shared/models/response.interface'; -import { Pattern } from '@app/shared/models/pattern.interface'; -import { CommandService } from '@app/core/services/command.service'; -import { PatternService } from '@app/core/services/pattern.service'; -import { RedisConnectService } from '@app/core/services/redis-connect.service'; +import {Output} from '@app/shared/models/response.interface'; +import {Pattern} from '@app/shared/models/pattern.interface'; +import {CommandService} from '@app/core/services/command.service'; +import {PatternService} from '@app/core/services/pattern.service'; +import {RedisConnectService} from '@app/core/services/redis-connect.service'; + +import {Observable, Subscription} from 'rxjs'; @Component({ selector: 'tr-root', templateUrl: './app.component.html' }) -export class AppComponent { +export class AppComponent implements OnDestroy { + private responseSub: Subscription = Subscription.EMPTY; + responses: Output[] = []; selectedDoc: string; activePattern: Pattern; newCommandForInput: string; resetCommand$: Observable = this.redisConnectService.execCommandTime$; + constructor( public commandService: CommandService, public patternService: PatternService, private redisConnectService: RedisConnectService) { - this.redisConnectService.response$.subscribe((response: Output) => this.updateResponses(response)); - } + this.responseSub = this.redisConnectService.response$.subscribe((response: Output) => this.updateResponses(response)); + } /** * Set current command as the active one @@ -63,9 +67,21 @@ export class AppComponent { this.selectActiveCommand(first); } + /** + * reset responses + * + */ + clearOutput(): void { + this.responses = []; + } + private updateResponses(command: Output) { const commands = []; Object.assign(commands, [...this.responses, command]); this.responses = commands; } + + ngOnDestroy(): void { + this.responseSub.unsubscribe(); + } } diff --git a/src/app/features/command/command-output/command-output.component.html b/src/app/features/command/command-output/command-output.component.html index 1301173..372c237 100644 --- a/src/app/features/command/command-output/command-output.component.html +++ b/src/app/features/command/command-output/command-output.component.html @@ -1,4 +1,12 @@ -

Redis Responses

+

+ Redis Responses + +

+
    @@ -9,4 +17,4 @@

    Redis Responses

-
+ \ No newline at end of file diff --git a/src/app/features/command/command-output/command-output.component.scss b/src/app/features/command/command-output/command-output.component.scss index 68f9d09..942ea0a 100644 --- a/src/app/features/command/command-output/command-output.component.scss +++ b/src/app/features/command/command-output/command-output.component.scss @@ -1,12 +1,12 @@ ul { list-style: none; - padding: .5rem; + padding: 0.5rem; li { &.command { color: #736767; - font-size: .7rem; - padding-top: .6rem; + font-size: 0.7rem; + padding-top: 0.6rem; span { font-style: italic; @@ -14,7 +14,7 @@ ul { } &.response { - padding-bottom: .6rem; + padding-bottom: 0.6rem; border-bottom: 1px solid #ccc; .run-command { @@ -24,7 +24,7 @@ ul { span { display: inline-block; - padding: 0 .25rem; + padding: 0 0.25rem; margin-bottom: 0; } } @@ -40,4 +40,27 @@ ul { padding-bottom: 2rem !important; } } +.flex-box { + display: flex; + flex-direction: row; + flex-wrap: wrap; + justify-content: space-between; + align-content: stretch; + align-items: flex-start; + .flex-button, + .flex-span { + flex: 0 1 auto; + align-self: auto; + background-color: transparent; + border-color: transparent; + } + + .flex-span { + align-self: flex-end; + } + + button:focus { + outline: 0; + } +} diff --git a/src/app/features/command/command-output/command-output.component.ts b/src/app/features/command/command-output/command-output.component.ts index 1486ad7..d4adf0c 100644 --- a/src/app/features/command/command-output/command-output.component.ts +++ b/src/app/features/command/command-output/command-output.component.ts @@ -1,6 +1,6 @@ -import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; +import {ChangeDetectionStrategy, Component, Input, EventEmitter, Output} from '@angular/core'; -import { Output } from '@app/shared/models/response.interface'; +import {Output as OutputItf} from '@app/shared/models/response.interface'; @Component({ selector: 'tr-command-output', @@ -9,5 +9,11 @@ import { Output } from '@app/shared/models/response.interface'; changeDetection: ChangeDetectionStrategy.OnPush }) export class CommandOutputComponent { - @Input() commandsOutput: Array = []; + @Input() commandsOutput: Array = []; + @Output() + clearEvt: EventEmitter = new EventEmitter(); + + clear(): void { + this.clearEvt.emit(); + } } diff --git a/src/styles/styles.scss b/src/styles/styles.scss index bca2811..8fb3772 100644 --- a/src/styles/styles.scss +++ b/src/styles/styles.scss @@ -1,12 +1,13 @@ @import "./variables"; @import "./../../node_modules/bootstrap/scss/bootstrap.scss"; -@import url('https://fonts.googleapis.com/css?family=Open+Sans:400,600,700&display=swap'); +@import url("https://fonts.googleapis.com/css?family=Open+Sans:400,600,700&display=swap"); -html,body{ - height:100%; - font-size: .9rem; - font-family: 'Open Sans', sans-serif; +html, +body { + height: 100%; + font-size: 0.9rem; + font-family: "Open Sans", sans-serif; } .scroll-box-container { @@ -28,7 +29,7 @@ html,body{ .col-center { background: #ebebeb; - border-color: #ccc!important; + border-color: #ccc !important; } code { @@ -39,26 +40,29 @@ code { font-size: 0.8rem; text-transform: uppercase; border-bottom: 1px solid #ccc; - padding-bottom: .5rem; + padding-bottom: 0.5rem; } +.h7, h3.h4 { color: #7a0c00; font-weight: bolder; } - +.h7 { + font-size: 1rem; +} tr-pattern-content h1 { - font-size: 1.3rem!important; + font-size: 1.3rem !important; font-weight: bold; } tr-pattern-content h2 { - font-size: 1.1rem!important; + font-size: 1.1rem !important; font-weight: bold; } tr-command-documentation h2 { - font-size: 1.1rem!important; + font-size: 1.1rem !important; font-weight: bold; } @@ -73,7 +77,6 @@ tr-pattern-content { box-shadow: 0; } - .scroll-box::-webkit-scrollbar { -webkit-appearance: none; } @@ -89,7 +92,7 @@ tr-pattern-content { .scroll-box::-webkit-scrollbar-thumb { border-radius: 8px; border: 2px solid white; /* should match background, can't be transparent */ - background-color: rgba(0, 0, 0, .5); + background-color: rgba(0, 0, 0, 0.5); } .scroll-box::-webkit-scrollbar-track { @@ -107,6 +110,10 @@ tr-pattern-content { } @keyframes spin { - 0% { transform: rotate(0deg); } - 100% { transform: rotate(360deg); } + 0% { + transform: rotate(0deg); + } + 100% { + transform: rotate(360deg); + } }