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

refactor(rule): modify some styles according to the requirements from PM #2649

Merged
merged 1 commit into from
May 10, 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
5 changes: 4 additions & 1 deletion src/api/ruleengine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,5 +145,8 @@ export function applyRuleTest(
ruleId: string,
context: Record<string, any>,
): Promise<Array<string>> {
return http.post(`/rules/${ruleId}/test`, { context, stop_action_after_template_rendering: true })
return http.post(`/rules/${ruleId}/test`, {
context,
stop_action_after_template_rendering: false,
})
}
3 changes: 3 additions & 0 deletions src/hooks/Rule/rule/useDebugRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ export default () => {
const logLastPositionMap: Map<string, number> = new Map()
const getCurrentTraceNodesMsg = async () => {
try {
if (!traceName) {
return Promise.reject()
}
const data = await getTraceNodesMsg(traceName)
const currentNodes = data.map(({ node }) => node)
logLastPositionMap.forEach((position, node) => {
Expand Down
43 changes: 34 additions & 9 deletions src/views/RuleEngine/components/LogDataDisplay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@
:class="getResultIconClass(item.result)"
/>
</el-icon>
<p>{{ getTriggerTitle(item.trigger.event || '') }}</p>
<p v-if="item.trigger.topic">{{ t('Base.topic') }}: {{ item.trigger.topic }}</p>
<div class="base-info event">
<p>{{ getTriggerTitle(item.trigger.event || '') }}</p>
</div>
<div class="base-info topic" v-if="item.trigger.topic">
<p>{{ t('Base.topic') }}: {{ item.trigger.topic }}</p>
</div>
</div>
<div class="execution-item-time">
{{ dateFormat(Number(timestamp)) }}
Expand Down Expand Up @@ -54,6 +58,7 @@
<el-radio-group
v-if="needTabsShowInfo(targetLogData.info)"
:modelValue="getSelectedBlock(logTarget)"
size="small"
@update:modelValue="setSelectedBlockValue(logTarget, $event)"
>
<el-radio-button
Expand All @@ -67,9 +72,9 @@
<p v-else>
{{ getLogItemTitle(targetLogData, getSelectedBlock(logTarget)) }}
</p>
<span class="log-time">
<!-- <span class="log-time">
{{ dateFormat(targetLogData.info[getSelectedBlock(logTarget)].time) }}
</span>
</span> -->
</div>
<div class="info-content">
<CodeView :code="getTargetLogContentCode(logTarget)" />
Expand Down Expand Up @@ -151,7 +156,7 @@ const { getEventList } = useRuleEvents()
const { savedAfterRuleChange } = useStatusController()

let eventInfoMap: Map<string, RuleEvent> = new Map()
const reg = /^\$events\/(\w+)_/
const reg = /^\$events\/([^._]+)_/
const convertToLogEvent = (e: string) => e.replace(reg, (a1: string, a2: string) => `${a2}.`)

;(async () => {
Expand Down Expand Up @@ -357,7 +362,7 @@ watch(
}
.execution-item {
align-items: center;
padding: 16px 24px;
padding: 12px 20px;
border-radius: 8px;
background: var(--color-bg-content);
cursor: pointer;
Expand All @@ -374,15 +379,35 @@ watch(
p {
margin-top: 0;
margin-bottom: 0;
&:not(:last-child) {
margin-right: 16px;
}
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.base-info {
overflow: hidden;
margin-right: 16px;
}
.event {
flex-grow: 2;
flex-shrink: 0;
}
.topic {
flex-grow: 1;
}
}
.execution-item-time,
.log-time {
color: var(--color-text-secondary);
}
$time-width: 130px;
.execution-item-time {
width: $time-width;
text-align: right;
flex-shrink: 0;
}
.execution-item-base {
width: calc(100% - #{$time-width} - 12px);
}

.el-collapse {
border-top: none;
Expand Down
1 change: 1 addition & 0 deletions src/views/RuleEngine/components/SQLTest.vue
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ const submitTestSQL = async () => {

onUnmounted(() => {
isTesting.value = false
testTarget.value = TestRuleTarget.SQL
})

watch(
Expand Down
Loading