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

style(msg-left-item):modify topic color bar #1384

Merged
merged 1 commit into from
Aug 1, 2023
Merged
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
35 changes: 16 additions & 19 deletions src/components/MsgLeftItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,19 @@
>
</div>
<div v-if="msgError" class="msg-tag">
<el-tag size="mini">
<el-tag type="warning" size="mini">
<b style="color: #f56c6c">{{ msgError }}</b>
</el-tag>
</div>
<span
v-if="!functionName && !schemaName && !msgError"
class="topic-color"
:style="{
background: color,
height: 'calc(100% - 44px)',
top: '11px',
height: topicColorStyle.height,
top: topicColorStyle.top,
}"
>
</span>
<span
v-else
class="topic-color"
:style="{
background: color,
height:
((functionName || schemaName) && !msgError) || (msgError && !schemaName && !functionName)
? 'calc(100% - 62px)'
: 'calc(100% - 84px)',
top:
((functionName || schemaName) && !msgError) || (msgError && !schemaName && !functionName) ? '32px' : '55px',
}"
></span>
<div ref="leftPayload" class="left-payload payload" @contextmenu.prevent="customMenu($event)">
<p class="left-info">
<span class="topic">Topic: {{ topic }}</span>
Expand Down Expand Up @@ -100,12 +86,23 @@ export default class MsgLeftItem extends Vue {
@Prop({ required: false, default: false }) public retain!: boolean
@Prop({ required: false, default: () => ({}) }) public properties!: PushPropertiesModel
@Prop({ required: false, default: '' }) public color!: string
private hightlight: boolean = false
public hightlight: boolean = false

private customMenu(event: MouseEvent) {
public customMenu(event: MouseEvent) {
this.$emit('showmenu', this.payload, event)
}

get topicColorStyle() {
const hasFunctionOrSchema = this.functionName || this.schemaName
if (!hasFunctionOrSchema && !this.msgError) {
return { height: 'calc(100% - 44px)', top: '11px' }
} else if (hasFunctionOrSchema && this.msgError) {
return { height: 'calc(100% - 84px)', top: '55px' }
} else {
return { height: 'calc(100% - 62px)', top: '32px' }
}
}

get functionName() {
return this.meta ? JSON.parse(this.meta).functionName : null
}
Expand Down