|
| 1 | +<template> |
| 2 | + <div class="tw-flex tw-flex-row tw-gap-x-8 tw-justify-between tw-w-full sm:tw-flex-row"> |
| 3 | + <!-- Email log type tabs - only shown for email category --> |
| 4 | + <div |
| 5 | + v-if="isEmailCategory" |
| 6 | + class="tw-flex tw-items-center tw-gap-2 tw-bg-gray-100 tw-rounded-lg tw-p-1" |
| 7 | + > |
| 8 | + <RouterLink |
| 9 | + to="/email/errors" |
| 10 | + class="tw-rounded-lg tw-px-3 tw-py-2 tw-text-base" |
| 11 | + :class="tabClasses('errors')" |
| 12 | + > |
| 13 | + {{ $t('Error Logs') }} |
| 14 | + </RouterLink> |
| 15 | + <RouterLink |
| 16 | + to="/email/matched" |
| 17 | + class="tw-rounded-lg tw-px-3 tw-py-2 tw-text-base" |
| 18 | + :class="tabClasses('matched')" |
| 19 | + > |
| 20 | + {{ $t('Matched Logs') }} |
| 21 | + </RouterLink> |
| 22 | + <RouterLink |
| 23 | + to="/email/total" |
| 24 | + class="tw-rounded-lg tw-px-3 tw-py-2 tw-text-base" |
| 25 | + :class="tabClasses('total')" |
| 26 | + > |
| 27 | + {{ $t('Total Logs') }} |
| 28 | + </RouterLink> |
| 29 | + </div> |
| 30 | + |
| 31 | + <!-- Agents category tabs --> |
| 32 | + <div |
| 33 | + v-else-if="isAgentsCategory" |
| 34 | + class="tw-flex tw-items-center tw-gap-2 tw-bg-gray-100 tw-rounded-lg tw-p-1" |
| 35 | + > |
| 36 | + <RouterLink |
| 37 | + to="/agents/design" |
| 38 | + class="tw-rounded-lg tw-px-3 tw-py-2 tw-text-base" |
| 39 | + :class="tabClasses('design')" |
| 40 | + > |
| 41 | + {{ $t('Design Mode Logs') }} |
| 42 | + </RouterLink> |
| 43 | + <RouterLink |
| 44 | + to="/agents/execution" |
| 45 | + class="tw-rounded-lg tw-px-3 tw-py-2 tw-text-base" |
| 46 | + :class="tabClasses('execution')" |
| 47 | + > |
| 48 | + {{ $t('Execution Logs') }} |
| 49 | + </RouterLink> |
| 50 | + </div> |
| 51 | + |
| 52 | + <!-- Empty placeholder for other categories --> |
| 53 | + <div v-else /> |
| 54 | + |
| 55 | + <div class="tw-flex tw-flex-1 tw-items-center tw-gap-1 tw-w-auto tw-border tw-border-zinc-200 tw-rounded-lg tw-p-1 tw-px-3"> |
| 56 | + <div class="tw-relative tw-w-full tw-flex tw-items-center tw-gap-1"> |
| 57 | + <i class="fas fa-search" /> |
| 58 | + <input |
| 59 | + ref="searchInput" |
| 60 | + type="text" |
| 61 | + class=" |
| 62 | + tw-h-8 |
| 63 | + tw-w-full |
| 64 | + tw-pl-3 |
| 65 | + tw-pr-3 |
| 66 | + tw-text-sm |
| 67 | + tw-outline-none |
| 68 | + tw-ring-0 |
| 69 | + placeholder:tw-text-zinc-400 |
| 70 | + " |
| 71 | + :placeholder="$t('Search here')" |
| 72 | + :value="value" |
| 73 | + @input="onInput" |
| 74 | + @keypress="onKeypress" |
| 75 | + > |
| 76 | + </div> |
| 77 | + </div> |
| 78 | + </div> |
| 79 | +</template> |
| 80 | + |
| 81 | +<script> |
| 82 | +export default { |
| 83 | + props: { |
| 84 | + value: { type: String, default: '' }, |
| 85 | + }, |
| 86 | + computed: { |
| 87 | + isEmailCategory() { |
| 88 | + return this.$route.path.startsWith('/email'); |
| 89 | + }, |
| 90 | + isAgentsCategory() { |
| 91 | + return this.$route.path.startsWith('/agents'); |
| 92 | + }, |
| 93 | + }, |
| 94 | + watch: { |
| 95 | + '$route.path': { |
| 96 | + handler() { |
| 97 | + // reset input value in search when route changes |
| 98 | + this.$emit('input', ''); |
| 99 | + }, |
| 100 | + immediate: true, |
| 101 | + }, |
| 102 | + }, |
| 103 | + methods: { |
| 104 | + tabClasses(tab) { |
| 105 | + const currentRoute = this.$route.params.logType; |
| 106 | +
|
| 107 | + return currentRoute === tab |
| 108 | + ? 'tw-bg-white tw-font-semibold tw-text-zinc-900' |
| 109 | + : 'tw-text-zinc-700 hover:tw-bg-zinc-50'; |
| 110 | + }, |
| 111 | + onInput(event) { |
| 112 | + this.$emit('input', event.target.value); |
| 113 | + }, |
| 114 | + onKeypress(event) { |
| 115 | + if (event.charCode === 13) { |
| 116 | + this.$emit('search'); |
| 117 | + } |
| 118 | + }, |
| 119 | + }, |
| 120 | +}; |
| 121 | +</script> |
| 122 | + |
0 commit comments