feat: add generate data schema option in spotlight searcher (#4356)
This commit is contained in:
parent
062b0fdda0
commit
421e6b76c9
1 changed files with 10 additions and 0 deletions
|
|
@ -9,6 +9,7 @@ import {
|
|||
|
||||
import IconDownload from "~icons/lucide/download"
|
||||
import IconCopy from "~icons/lucide/copy"
|
||||
import IconNetwork from "~icons/lucide/network"
|
||||
import { Container } from "dioc"
|
||||
|
||||
type Doc = {
|
||||
|
|
@ -40,6 +41,8 @@ export class ResponseSpotlightSearcherService extends StaticSpotlightSearcherSer
|
|||
"response.file.download"
|
||||
)
|
||||
|
||||
private dataSchemaActionEnabled = isActionBound("response.schema.toggle")
|
||||
|
||||
private documents: Record<string, Doc> = reactive({
|
||||
copy_response: {
|
||||
text: this.t("spotlight.response.copy"),
|
||||
|
|
@ -55,6 +58,12 @@ export class ResponseSpotlightSearcherService extends StaticSpotlightSearcherSer
|
|||
() => !this.downloadResponseActionEnabled.value
|
||||
),
|
||||
},
|
||||
generate_data_schema: {
|
||||
text: this.t("response.generate_data_schema"),
|
||||
alternates: ["generate", "data", "schema", "typescript", "response"],
|
||||
icon: markRaw(IconNetwork),
|
||||
excludeFromSearch: computed(() => !this.dataSchemaActionEnabled.value),
|
||||
},
|
||||
})
|
||||
|
||||
// TODO: Constructors are no longer recommended as of dioc > 3, move to onServiceInit
|
||||
|
|
@ -87,5 +96,6 @@ export class ResponseSpotlightSearcherService extends StaticSpotlightSearcherSer
|
|||
public onDocSelected(id: string): void {
|
||||
if (id === "copy_response") invokeAction(`response.copy`)
|
||||
if (id === "download_response") invokeAction(`response.file.download`)
|
||||
if (id === "generate_data_schema") invokeAction(`response.schema.toggle`)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue