Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(console): add debug prefix #1973

Merged
merged 1 commit into from
Aug 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/console/ConsoleTableEntry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default class ConsoleTableEntry extends Mixins(BaseMixin) {
get entryStyle() {
const classes = ['ma-0', 'flex-nowrap']
classes.push(this.$store.state.gui.console.entryStyle ?? 'default')
if (this.event.type === 'action') classes.push('text--disabled')
if (['action', 'debug'].includes(this.event.type)) classes.push('text--disabled')

return classes
}
Expand All @@ -31,7 +31,7 @@ export default class ConsoleTableEntry extends Mixins(BaseMixin) {
get messageClass() {
const classes = ['console-message']

if (this.event.type === 'action') classes.push('text--disabled')
if (['action', 'debug'].includes(this.event.type)) classes.push('text--disabled')
else if (this.event.message.startsWith('!! ')) classes.push('error--text')
else classes.push('text--primary')

Expand Down
2 changes: 2 additions & 0 deletions src/plugins/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ export function formatConsoleMessage(message: string): string {
message = message.replace(/\n\/\/ /g, '\n')
// remove echo
message = message.replace(/^echo:/g, '')
// remove debug
message = message.replace(/^debug:/g, '')
// replace linebreaks with html <br>
message = message.replace('\n// ', '<br>')
message = message.replace(/\r\n|\r|\n/g, '<br>')
Expand Down
5 changes: 4 additions & 1 deletion src/store/server/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,10 @@ export const actions: ActionTree<ServerState, RootState> = {
else if ('error' in payload) message = message.error.message

let formatMessage = formatConsoleMessage(message)
if (type === 'response' && message.startsWith('// action:')) type = 'action'
if (type === 'response') {
if (message.startsWith('// action:')) type = 'action'
else if (message.startsWith('// debug:')) type = 'debug'
}

const filters = rootGetters['gui/console/getConsolefilterRules']
let boolImport = true
Expand Down
5 changes: 4 additions & 1 deletion src/store/server/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ export const mutations: MutationTree<ServerState> = {

let type = message.type
if (type === 'command') formatMessage = '<a class="command text--blue">' + formatMessage + '</a>'
if (type === 'response' && message.message.startsWith('// action:')) type = 'action'
if (type === 'response') {
if (message.message.startsWith('// action:')) type = 'action'
else if (message.message.startsWith('// debug:')) type = 'debug'
}

state.events.push({
date,
Expand Down
Loading