feat: tippy menu for history and tab (#3220)

Co-authored-by: Liyas Thomas <liyascthomas@gmail.com>
This commit is contained in:
Nivedin
2023-08-08 13:23:11 +05:30
committed by GitHub
parent 05f2d8817b
commit 085fbb2a9b
10 changed files with 361 additions and 36 deletions

View File

@@ -105,6 +105,7 @@
@toggle-star="toggleStar(entry.entry)"
@delete-entry="deleteHistory(entry.entry)"
@use-entry="useHistory(toRaw(entry.entry))"
@add-to-collection="addToCollection(entry.entry)"
/>
</details>
</div>
@@ -176,7 +177,7 @@ import {
import HistoryRestCard from "./rest/Card.vue"
import HistoryGraphqlCard from "./graphql/Card.vue"
import { createNewTab } from "~/helpers/rest/tab"
import { defineActionHandler } from "~/helpers/actions"
import { defineActionHandler, invokeAction } from "~/helpers/actions"
type HistoryEntry = GQLHistoryEntry | RESTHistoryEntry
@@ -324,6 +325,14 @@ const deleteHistory = (entry: HistoryEntry) => {
toast.success(`${t("state.deleted")}`)
}
const addToCollection = (entry: HistoryEntry) => {
if (props.page === "rest") {
invokeAction("request.save-as", {
request: entry.request,
})
}
}
const toggleStar = (entry: HistoryEntry) => {
// History entry type specified because function does not know the type
if (props.page === "rest")