DEV: Modernize and fix x-console
This commit is contained in:
parent
7d7b067b98
commit
6d031cd67a
|
@ -0,0 +1,7 @@
|
|||
<div
|
||||
class="console-logs"
|
||||
{{did-insert this.scrollToBottom}}
|
||||
{{did-update this.scrollToBottom @output}}
|
||||
>
|
||||
{{~@output~}}
|
||||
</div>
|
|
@ -0,0 +1,12 @@
|
|||
import Component from "@glimmer/component";
|
||||
import { bind } from "discourse-common/utils/decorators";
|
||||
|
||||
export default class Console extends Component {
|
||||
@bind
|
||||
scrollToBottom() {
|
||||
if (this.args.followOutput) {
|
||||
const element = document.querySelector(".console-logs");
|
||||
element.scrollTop = element.scrollHeight;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
<div class="logs">
|
||||
{{output}}
|
||||
</div>
|
|
@ -1,22 +0,0 @@
|
|||
import Component from "@ember/component";
|
||||
import { observer } from "@ember/object";
|
||||
import { scheduleOnce } from "@ember/runloop";
|
||||
|
||||
export default Component.extend({
|
||||
tagName: "",
|
||||
|
||||
_outputChanged: observer("output", function () {
|
||||
scheduleOnce("afterRender", this, "_scrollBottom");
|
||||
}),
|
||||
|
||||
_scrollBottom() {
|
||||
if (this.get("followOutput")) {
|
||||
this.element.scrollTop = this.element.scrollHeight;
|
||||
}
|
||||
},
|
||||
|
||||
didInsertElement() {
|
||||
this._super(...arguments);
|
||||
this._scrollBottom();
|
||||
},
|
||||
});
|
|
@ -1 +1 @@
|
|||
{{x-console output=model.output}}
|
||||
<Console @output={{model.output}} />
|
||||
|
|
|
@ -30,4 +30,4 @@
|
|||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{x-console output=output followOutput=true}}
|
||||
<Console @output={{this.output}} @followOutput={{true}} />
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
.docker-manager {
|
||||
div.logs {
|
||||
margin-top: 20px;
|
||||
overflow-x: scroll;
|
||||
height: 400px;
|
||||
white-space: pre;
|
||||
font-family: monospace;
|
||||
.console-logs {
|
||||
background-color: black;
|
||||
color: #ddd;
|
||||
font-family: monospace;
|
||||
height: 400px;
|
||||
margin-top: 20px;
|
||||
overflow-x: scroll;
|
||||
padding: 10px;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
.check-circle {
|
||||
|
|
Loading…
Reference in New Issue