mirror of
https://github.com/Elysola/WebHooker.git
synced 2026-11-21 01:23:40 +00:00
feat(filters): fragment presets and code-block send log detail
This commit is contained in:
5 files changed
+105
-8
No files matched your search
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, reactive, ref, watch } from "vue";
|
||||
import type { Filter, FilterNode, NamedFragment, Route, RouteTarget, RouteTemplate } from "~/types";
|
||||
import { ROUTE_TEMPLATES } from "~/types";
|
||||
import { FRAGMENT_PRESETS, ROUTE_TEMPLATES } from "~/types";
|
||||
import type { NodeForm } from "~/composables/useFilterNode";
|
||||
import { blankLeafForm, blankNode, nodeToForm, nodeFormToRouteFilters, formToNode } from "~/composables/useFilterNode";
|
||||
|
||||
@@ -197,8 +197,8 @@ async function runTest(): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
function insertFragment(frag: NamedFragment): void {
|
||||
const child = nodeToForm(frag.node);
|
||||
function insertNode(node: FilterNode): void {
|
||||
const child = nodeToForm(node);
|
||||
if (root.value.kind === "all" || root.value.kind === "any") {
|
||||
root.value.children.push(child);
|
||||
} else {
|
||||
@@ -211,6 +211,10 @@ function insertFragment(frag: NamedFragment): void {
|
||||
}
|
||||
}
|
||||
|
||||
function insertFragment(frag: NamedFragment): void {
|
||||
insertNode(frag.node);
|
||||
}
|
||||
|
||||
async function saveAsFragment(): Promise<void> {
|
||||
fragmentError.value = "";
|
||||
const name = fragmentName.value.trim();
|
||||
@@ -407,6 +411,19 @@ watch(
|
||||
|
||||
<section v-if="groupId" class="editor-section">
|
||||
<h3 class="editor-section-title">{{ t("routeEditor.fragments") }}</h3>
|
||||
<div class="fragments-presets">
|
||||
<span class="hint">{{ t("routeEditor.fragmentsPresets") }}</span>
|
||||
<div v-for="preset in FRAGMENT_PRESETS" :key="preset.id" class="fragment-row">
|
||||
<span class="fragment-name">{{ t(preset.nameKey) }}</span>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-ghost fragment-action"
|
||||
@click="insertNode(preset.node)"
|
||||
>
|
||||
{{ t("routeEditor.fragmentsInsert") }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="fragments-list">
|
||||
<div v-if="!fragments.length" class="hint">{{ t("routeEditor.fragmentsEmpty") }}</div>
|
||||
<div v-for="frag in fragments" :key="frag.id" class="fragment-row">
|
||||
|
||||
Reference in new issue
Block a user