1
0
mirror of https://github.com/amir20/dozzle.git synced 2025-12-27 07:31:46 +01:00

Change Jump to Context menu to be a dropdown menu

I extracted the dropdown portion of the LogActionsToolbar into a separate DropdownMenu component so that it can be reused for Jump to Context.

Other Changes:
- Remove unused style in LogActionsToolbar
This commit is contained in:
Coteh
2022-01-30 19:49:44 -05:00
parent 69e28e3723
commit 94de10d54c
4 changed files with 109 additions and 107 deletions

View File

@@ -2,36 +2,38 @@
// We suggest you to commit this file into source control // We suggest you to commit this file into source control
// Read more: https://github.com/vuejs/vue-next/pull/3399 // Read more: https://github.com/vuejs/vue-next/pull/3399
declare module "vue" { declare module 'vue' {
export interface GlobalComponents { export interface GlobalComponents {
CarbonCaretDown: typeof import("~icons/carbon/caret-down")["default"]; CarbonCaretDown: typeof import('~icons/carbon/caret-down')['default']
CilColumns: typeof import("~icons/cil/columns")["default"]; CilColumns: typeof import('~icons/cil/columns')['default']
ContainerStat: typeof import("./components/ContainerStat.vue")["default"]; CilFindInPage: typeof import('~icons/cil/find-in-page')['default']
ContainerTitle: typeof import("./components/ContainerTitle.vue")["default"]; ContainerStat: typeof import('./components/ContainerStat.vue')['default']
FuzzySearchModal: typeof import("./components/FuzzySearchModal.vue")["default"]; ContainerTitle: typeof import('./components/ContainerTitle.vue')['default']
InfiniteLoader: typeof import("./components/InfiniteLoader.vue")["default"]; DropdownMenu: typeof import('./components/DropdownMenu.vue')['default']
LogActionsToolbar: typeof import("./components/LogActionsToolbar.vue")["default"]; FuzzySearchModal: typeof import('./components/FuzzySearchModal.vue')['default']
LogContainer: typeof import("./components/LogContainer.vue")["default"]; InfiniteLoader: typeof import('./components/InfiniteLoader.vue')['default']
LogEventSource: typeof import("./components/LogEventSource.vue")["default"]; LogActionsToolbar: typeof import('./components/LogActionsToolbar.vue')['default']
LogViewer: typeof import("./components/LogViewer.vue")["default"]; LogContainer: typeof import('./components/LogContainer.vue')['default']
LogViewerWithSource: typeof import("./components/LogViewerWithSource.vue")["default"]; LogEventSource: typeof import('./components/LogEventSource.vue')['default']
MdiDotsVertical: typeof import("~icons/mdi/dots-vertical")["default"]; LogViewer: typeof import('./components/LogViewer.vue')['default']
MdiLightChevronDoubleDown: typeof import("~icons/mdi-light/chevron-double-down")["default"]; LogViewerWithSource: typeof import('./components/LogViewerWithSource.vue')['default']
MdiLightChevronLeft: typeof import("~icons/mdi-light/chevron-left")["default"]; MdiDotsVertical: typeof import('~icons/mdi/dots-vertical')['default']
MdiLightChevronRight: typeof import("~icons/mdi-light/chevron-right")["default"]; MdiLightChevronDoubleDown: typeof import('~icons/mdi-light/chevron-double-down')['default']
MdiLightCog: typeof import("~icons/mdi-light/cog")["default"]; MdiLightChevronLeft: typeof import('~icons/mdi-light/chevron-left')['default']
MdiLightMagnify: typeof import("~icons/mdi-light/magnify")["default"]; MdiLightChevronRight: typeof import('~icons/mdi-light/chevron-right')['default']
MobileMenu: typeof import("./components/MobileMenu.vue")["default"]; MdiLightCog: typeof import('~icons/mdi-light/cog')['default']
OcticonContainer24: typeof import("~icons/octicon/container24")["default"]; MdiLightMagnify: typeof import('~icons/mdi-light/magnify')['default']
OcticonDownload24: typeof import("~icons/octicon/download24")["default"]; MobileMenu: typeof import('./components/MobileMenu.vue')['default']
OcticonTrash24: typeof import("~icons/octicon/trash24")["default"]; OcticonContainer24: typeof import('~icons/octicon/container24')['default']
PastTime: typeof import("./components/PastTime.vue")["default"]; OcticonDownload24: typeof import('~icons/octicon/download24')['default']
RelativeTime: typeof import("./components/RelativeTime.vue")["default"]; OcticonTrash24: typeof import('~icons/octicon/trash24')['default']
ScrollableView: typeof import("./components/ScrollableView.vue")["default"]; PastTime: typeof import('./components/PastTime.vue')['default']
ScrollProgress: typeof import("./components/ScrollProgress.vue")["default"]; RelativeTime: typeof import('./components/RelativeTime.vue')['default']
Search: typeof import("./components/Search.vue")["default"]; ScrollableView: typeof import('./components/ScrollableView.vue')['default']
SideMenu: typeof import("./components/SideMenu.vue")["default"]; ScrollProgress: typeof import('./components/ScrollProgress.vue')['default']
Search: typeof import('./components/Search.vue')['default']
SideMenu: typeof import('./components/SideMenu.vue')['default']
} }
} }
export {}; export { }

View File

@@ -0,0 +1,27 @@
<template>
<div class="dropdown is-hoverable">
<div class="dropdown-trigger">
<button class="button" aria-haspopup="true" aria-controls="dropdown-menu">
<span class="icon">
<mdi-dots-vertical />
</span>
</button>
</div>
<div class="dropdown-menu" id="dropdown-menu" role="menu">
<div class="dropdown-content">
<slot></slot>
</div>
</div>
</div>
</template>
<script lang="ts" setup></script>
<style lang="scss" scoped>
.is-top .dropdown-menu {
top: 0;
}
.is-small {
transform: scale(75%);
}
</style>

View File

@@ -1,54 +1,43 @@
<template> <template>
<div class="dropdown is-right is-hoverable"> <dropdown-menu class="is-right">
<div class="dropdown-trigger"> <a class="dropdown-item" @click="onClearClicked">
<button class="button" aria-haspopup="true" aria-controls="dropdown-menu"> <div class="level is-justify-content-start">
<span class="icon"> <div class="level-left">
<mdi-dots-vertical /> <div class="level-item">
</span> <octicon-trash-24 class="mr-4" />
</button>
</div>
<div class="dropdown-menu" id="dropdown-menu" role="menu">
<div class="dropdown-content">
<a class="dropdown-item" @click="onClearClicked">
<div class="level is-justify-content-start">
<div class="level-left">
<div class="level-item">
<octicon-trash-24 class="mr-4" />
</div>
</div>
<div class="level-right">
<div class="level-item">Clear</div>
</div>
</div> </div>
</a> </div>
<a class="dropdown-item" :href="`${base}/api/logs/download?id=${container.id}`"> <div class="level-right">
<div class="level is-justify-content-start"> <div class="level-item">Clear</div>
<div class="level-left"> </div>
<div class="level-item">
<octicon-download-24 class="mr-4" />
</div>
</div>
<div class="level-right">
<div class="level-item">Download</div>
</div>
</div>
</a>
<hr class="dropdown-divider" />
<a class="dropdown-item" @click="showSearch = true">
<div class="level is-justify-content-start">
<div class="level-left">
<div class="level-item">
<mdi-light-magnify class="mr-4" />
</div>
</div>
<div class="level-right">
<div class="level-item">Search</div>
</div>
</div>
</a>
</div> </div>
</div> </a>
</div> <a class="dropdown-item" :href="`${base}/api/logs/download?id=${container.id}`">
<div class="level is-justify-content-start">
<div class="level-left">
<div class="level-item">
<octicon-download-24 class="mr-4" />
</div>
</div>
<div class="level-right">
<div class="level-item">Download</div>
</div>
</div>
</a>
<hr class="dropdown-divider" />
<a class="dropdown-item" @click="showSearch = true">
<div class="level is-justify-content-start">
<div class="level-left">
<div class="level-item">
<mdi-light-magnify class="mr-4" />
</div>
</div>
<div class="level-right">
<div class="level-item">Search</div>
</div>
</div>
</a>
</dropdown-menu>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
@@ -94,27 +83,4 @@ onUnmounted(() => hotkeys.unbind("shift+command+l, shift+ctrl+l", onHotkey));
border-color: var(--primary-color); border-color: var(--primary-color);
} }
} }
.toolbar {
position: absolute;
left: 50%;
transform: translateX(-50%);
width: 200px;
background-color: var(--action-toolbar-background-color);
border-radius: 8em;
margin-top: 0.5em;
& > div {
margin: 0 2em;
padding: 0.5em 0;
}
.button {
background-color: rgba(0, 0, 0, 0) !important;
&.is-small {
font-size: 0.65rem;
}
}
}
</style> </style>

View File

@@ -8,13 +8,20 @@
:class="item.selected ? 'selected' : ''" :class="item.selected ? 'selected' : ''"
> >
<div class="line-options" v-if="isSearching()"> <div class="line-options" v-if="isSearching()">
<o-tooltip label="Jump to context" position="right" delay="500"> <dropdown-menu class="is-top is-small">
<button class="jump" @click="jumpToLine"> <a class="dropdown-item" @click="jumpToLine">
<span class="icon"> <div class="level is-justify-content-start">
<mdi-dots-vertical /> <div class="level-left">
</span> <div class="level-item">
</button> <cil-find-in-page class="mr-4" />
</o-tooltip> </div>
</div>
<div class="level-right">
<div class="level-item">Jump to Context</div>
</div>
</div>
</a>
</dropdown-menu>
</div> </div>
<div class="line"> <div class="line">
<span class="date" v-if="showTimestamp"> <relative-time :date="item.date"></relative-time></span> <span class="date" v-if="showTimestamp"> <relative-time :date="item.date"></relative-time></span>