-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
595 additions
and
25 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import Transport from 'winston-transport' | ||
import { send } from '../ipc' | ||
|
||
export type LogRecord = { | ||
level: 'debug' | 'info' | 'warn' | 'error' | ||
message: string | ||
timestamp: string | ||
} | ||
|
||
export default class extends Transport { | ||
constructor(opts?: Transport.TransportStreamOptions) { | ||
super(opts) | ||
} | ||
|
||
public log(data: LogRecord, next: () => void) { | ||
send('log', `${data.timestamp} [${data.level}] ${data.message}`) | ||
next() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<template> | ||
<div class="w-full bg-slate-900 rounded-xl p-5"> | ||
<header class="bg-slate-700 w-full p-2 font-semibold text-2xl rounded-t-xl">Terminal</header> | ||
<ScrollComponent axis="vertical" class="h-[25vh]"> | ||
<p v-for="(logRecord, index) in logRecords" :key="index">{{ logRecord }}</p> | ||
</ScrollComponent> | ||
<input | ||
ref="in" | ||
type="text" | ||
class="w-full p-2 bg-slate-950 rounded-b-xl" | ||
:placeholder="inputPlaceholder" | ||
/> | ||
</div> | ||
</template> | ||
<script lang="ts"> | ||
import { defineComponent } from 'vue' | ||
import ScrollComponent from './ScrollComponent.vue' | ||
import { on } from '@renderer/ipc' | ||
import Config from '@shared/Config' | ||
export type TerminalComponentType = { addLogRecord: (logRecord: string) => void } | ||
export default defineComponent({ | ||
components: { ScrollComponent }, | ||
data() { | ||
return { | ||
logRecords: [] as string[], | ||
inputPlaceholder: Config.TERMINAL_INPUT_PLACEHOLDER | ||
} | ||
}, | ||
mounted() { | ||
const inputField = this.$refs.in as HTMLInputElement | ||
inputField.focus() | ||
on('log', (_ev, logRecord: string) => { | ||
this.addLogRecord(logRecord) | ||
}) | ||
}, | ||
methods: { | ||
addLogRecord(logRecord: string) { | ||
this.logRecords.push(logRecord) | ||
} | ||
} | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<template> | ||
<TerminalComponent ref="tc" /> | ||
</template> | ||
<script lang="ts"> | ||
import TerminalComponent, { | ||
TerminalComponentType | ||
} from '@renderer/components/TerminalComponent.vue' | ||
import { defineComponent } from 'vue' | ||
export default defineComponent({ | ||
components: { | ||
TerminalComponent | ||
}, | ||
mounted() { | ||
const tc = this.$refs.tc as TerminalComponentType | ||
for (let i = 0; i < 100; i++) { | ||
tc.addLogRecord('07.10.2023 | 18:11:35 [info] enabling the browser window') | ||
} | ||
} | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export default { | ||
MAX_PREVIEW_FILE_SIZE: 0.5 * 1024 * 1024, // = 0.5mb | ||
GITIGNORE_RECOMMENDED: ['node_modules', '.idea', '.vscode', '.DS_Store', 'target'] | ||
GITIGNORE_RECOMMENDED: ['node_modules', '.idea', '.vscode', '.DS_Store', 'target'], | ||
TERMINAL_INPUT_PLACEHOLDER: 'Enter a command...' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters