Skip to content

Commit

Permalink
fix(plugins/plugin-client-common): add error icon for error blocks
Browse files Browse the repository at this point in the history
Fixes #4907
  • Loading branch information
myan9 authored and starpit committed Jun 18, 2020
1 parent c5e576f commit c5beb4a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,21 @@ import onKeyPress from './OnKeyPress'
import KuiContext from '../../../Client/context'
import { TabCompletionState } from './TabCompletion'
import ActiveISearch, { onKeyUp } from './ActiveISearch'
import { BlockModel, isActive, isProcessing, isFinished, hasCommand, isEmpty, hasUUID, hasValue } from './BlockModel'
import {
BlockModel,
isActive,
isProcessing,
isFinished,
hasCommand,
isEmpty,
isOops,
hasUUID,
hasValue
} from './BlockModel'
import { BlockViewTraits } from './'

import DropDown, { DropDownAction } from '../../../spi/DropDown'
import Icons from '../../../spi/Icons'

const strings = i18n('plugin-client-common')
const strings2 = i18n('plugin-client-common', 'screenshot')
Expand Down Expand Up @@ -375,6 +386,13 @@ export default class Input extends InputProvider {
}
}

/** error icon for error blocks */
private errorIcon() {
if (isOops(this.props.model)) {
return <Icons className="kui--repl-block-error-icon" icon="Error" data-mode="error" />
}
}

private removeAction(): DropDownAction[] {
return !this.props.willRemove
? []
Expand Down Expand Up @@ -435,6 +453,7 @@ export default class Input extends InputProvider {
return (
<span className="repl-prompt-right-elements">
{this.spinner()}
{this.errorIcon()}
{this.timestamp()}
{this.dropdown()}
</span>
Expand Down
13 changes: 4 additions & 9 deletions plugins/plugin-client-common/web/css/static/repl.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,6 @@
filter: grayscale(20%);
}

.repl-block.error {
.repl-prompt,
.repl-prompt-right-elements,
.kui--repl-block-timestamp {
color: var(--color-error);
font-weight: 700;
}
}

.repl-prompt-righty {
font-weight: 700;
text-shadow: 0 0 1px var(--color-text-02);
Expand Down Expand Up @@ -77,6 +68,10 @@
font-size: 1em;
font-weight: 700;
}
.kui--repl-block-error-icon {
fill: var(--color-error);
margin-right: 0.5em;
}
}

[kui-theme-style] .kui--repl-block-right-element {
Expand Down

0 comments on commit c5beb4a

Please sign in to comment.