fix: minor spotlight related issues (#3271)
Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com>
This commit is contained in:
@@ -610,7 +610,7 @@
|
|||||||
"head_method": "Select HEAD method",
|
"head_method": "Select HEAD method",
|
||||||
"rename": "Rename Current Request",
|
"rename": "Rename Current Request",
|
||||||
"import_curl": "Import cURL",
|
"import_curl": "Import cURL",
|
||||||
"show_code": "Show generated code",
|
"show_code": "Generate code snippet",
|
||||||
"method": "Method",
|
"method": "Method",
|
||||||
"next_method": "Select Next method",
|
"next_method": "Select Next method",
|
||||||
"post_method": "Select POST method",
|
"post_method": "Select POST method",
|
||||||
@@ -695,7 +695,7 @@
|
|||||||
},
|
},
|
||||||
"tab": {
|
"tab": {
|
||||||
"close_current": "Close current tab",
|
"close_current": "Close current tab",
|
||||||
"close_others": "Close others tab",
|
"close_others": "Close other tabs",
|
||||||
"new_tab": "Open a new tab",
|
"new_tab": "Open a new tab",
|
||||||
"title": "Tabs"
|
"title": "Tabs"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -254,8 +254,10 @@ import TeamListAdapter from "~/helpers/teams/TeamListAdapter"
|
|||||||
import { onLoggedIn } from "~/composables/auth"
|
import { onLoggedIn } from "~/composables/auth"
|
||||||
import { GetMyTeamsQuery } from "~/helpers/backend/graphql"
|
import { GetMyTeamsQuery } from "~/helpers/backend/graphql"
|
||||||
import { getPlatformSpecialKey } from "~/helpers/platformutils"
|
import { getPlatformSpecialKey } from "~/helpers/platformutils"
|
||||||
|
import { useToast } from "~/composables/toast"
|
||||||
|
|
||||||
const t = useI18n()
|
const t = useI18n()
|
||||||
|
const toast = useToast()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Once the PWA code is initialized, this holds a method
|
* Once the PWA code is initialized, this holds a method
|
||||||
@@ -372,6 +374,8 @@ const handleTeamEdit = () => {
|
|||||||
editingTeamID.value = workspace.value.teamID
|
editingTeamID.value = workspace.value.teamID
|
||||||
editingTeamName.value = { name: selectedTeam.value.name }
|
editingTeamName.value = { name: selectedTeam.value.name }
|
||||||
displayModalEdit(true)
|
displayModalEdit(true)
|
||||||
|
} else {
|
||||||
|
noPermission()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -382,12 +386,7 @@ const settings = ref<any | null>(null)
|
|||||||
const logout = ref<any | null>(null)
|
const logout = ref<any | null>(null)
|
||||||
const accountActions = ref<any | null>(null)
|
const accountActions = ref<any | null>(null)
|
||||||
|
|
||||||
defineActionHandler("modals.team.edit", () => {
|
defineActionHandler("modals.team.edit", handleTeamEdit)
|
||||||
// TODO: Remove this hack
|
|
||||||
setTimeout(() => {
|
|
||||||
handleTeamEdit()
|
|
||||||
}, 100)
|
|
||||||
})
|
|
||||||
|
|
||||||
defineActionHandler("modals.team.invite", () => {
|
defineActionHandler("modals.team.invite", () => {
|
||||||
if (
|
if (
|
||||||
@@ -395,6 +394,8 @@ defineActionHandler("modals.team.invite", () => {
|
|||||||
selectedTeam.value?.myRole === "EDITOR"
|
selectedTeam.value?.myRole === "EDITOR"
|
||||||
) {
|
) {
|
||||||
inviteTeam({ name: selectedTeam.value.name }, selectedTeam.value.id)
|
inviteTeam({ name: selectedTeam.value.name }, selectedTeam.value.id)
|
||||||
|
} else {
|
||||||
|
noPermission()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -405,4 +406,8 @@ defineActionHandler(
|
|||||||
},
|
},
|
||||||
computed(() => !currentUser.value)
|
computed(() => !currentUser.value)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const noPermission = () => {
|
||||||
|
toast.error(`${t("profile.no_permission")}`)
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -458,12 +458,7 @@ defineActionHandler("rest.request.open", ({ doc }) => {
|
|||||||
createNewTab(doc)
|
createNewTab(doc)
|
||||||
})
|
})
|
||||||
|
|
||||||
defineActionHandler("rest.request.rename", () => {
|
defineActionHandler("rest.request.rename", openReqRenameModal)
|
||||||
// TODO: Fix this hack to open the modal
|
|
||||||
setTimeout(() => {
|
|
||||||
openReqRenameModal()
|
|
||||||
}, 100)
|
|
||||||
})
|
|
||||||
|
|
||||||
const inspectionService = useService(InspectionService)
|
const inspectionService = useService(InspectionService)
|
||||||
useService(HeaderInspectorService)
|
useService(HeaderInspectorService)
|
||||||
|
|||||||
@@ -71,7 +71,9 @@ export class EnvironmentsSpotlightSearcherService extends StaticSpotlightSearche
|
|||||||
|
|
||||||
private selectedEnvIndex = useStreamStatic(
|
private selectedEnvIndex = useStreamStatic(
|
||||||
selectedEnvironmentIndex$,
|
selectedEnvironmentIndex$,
|
||||||
null,
|
{
|
||||||
|
type: "NO_ENV_SELECTED",
|
||||||
|
},
|
||||||
() => {
|
() => {
|
||||||
/* noop */
|
/* noop */
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export class TabSpotlightSearcherService extends StaticSpotlightSearcherService<
|
|||||||
alternates: ["tab", "close", "close tab"],
|
alternates: ["tab", "close", "close tab"],
|
||||||
icon: markRaw(IconWindow),
|
icon: markRaw(IconWindow),
|
||||||
},
|
},
|
||||||
close_others_tab: {
|
close_other_tabs: {
|
||||||
text: this.t("spotlight.tab.close_others"),
|
text: this.t("spotlight.tab.close_others"),
|
||||||
alternates: ["tab", "close", "close all"],
|
alternates: ["tab", "close", "close all"],
|
||||||
icon: markRaw(IconWindow),
|
icon: markRaw(IconWindow),
|
||||||
@@ -81,7 +81,7 @@ export class TabSpotlightSearcherService extends StaticSpotlightSearcherService<
|
|||||||
|
|
||||||
public onDocSelected(id: string): void {
|
public onDocSelected(id: string): void {
|
||||||
if (id === "close_current_tab") closeTab(currentTabID.value)
|
if (id === "close_current_tab") closeTab(currentTabID.value)
|
||||||
if (id === "close_others_tab") closeOtherTabs(currentTabID.value)
|
if (id === "close_other_tabs") closeOtherTabs(currentTabID.value)
|
||||||
if (id === "open_new_tab")
|
if (id === "open_new_tab")
|
||||||
createNewTab({
|
createNewTab({
|
||||||
request: getDefaultRESTRequest(),
|
request: getDefaultRESTRequest(),
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
ref,
|
ref,
|
||||||
watch,
|
watch,
|
||||||
} from "vue"
|
} from "vue"
|
||||||
import { invokeAction } from "~/helpers/actions"
|
import { activeActions$, invokeAction } from "~/helpers/actions"
|
||||||
import { getI18n } from "~/modules/i18n"
|
import { getI18n } from "~/modules/i18n"
|
||||||
import {
|
import {
|
||||||
SpotlightSearcher,
|
SpotlightSearcher,
|
||||||
@@ -66,6 +66,14 @@ export class WorkspaceSpotlightSearcherService extends StaticSpotlightSearcherSe
|
|||||||
}
|
}
|
||||||
)[0]
|
)[0]
|
||||||
|
|
||||||
|
private activeActions = useStreamStatic(activeActions$, [], () => {
|
||||||
|
/* noop */
|
||||||
|
})[0]
|
||||||
|
|
||||||
|
private isLoggedInUser = computed(() =>
|
||||||
|
this.activeActions.value.includes("user.logout")
|
||||||
|
)
|
||||||
|
|
||||||
private isTeamSelected = computed(
|
private isTeamSelected = computed(
|
||||||
() =>
|
() =>
|
||||||
this.workspace.value.type === "team" &&
|
this.workspace.value.type === "team" &&
|
||||||
@@ -77,6 +85,7 @@ export class WorkspaceSpotlightSearcherService extends StaticSpotlightSearcherSe
|
|||||||
text: this.t("spotlight.workspace.new"),
|
text: this.t("spotlight.workspace.new"),
|
||||||
alternates: ["new", "team", "workspace"],
|
alternates: ["new", "team", "workspace"],
|
||||||
icon: markRaw(IconUsers),
|
icon: markRaw(IconUsers),
|
||||||
|
excludeFromSearch: computed(() => !this.isLoggedInUser.value),
|
||||||
},
|
},
|
||||||
edit_team: {
|
edit_team: {
|
||||||
text: this.t("spotlight.workspace.edit"),
|
text: this.t("spotlight.workspace.edit"),
|
||||||
|
|||||||
@@ -3,12 +3,12 @@
|
|||||||
<input
|
<input
|
||||||
:id="inputID"
|
:id="inputID"
|
||||||
class="input"
|
class="input"
|
||||||
|
ref="inputRef"
|
||||||
:class="inputStyles"
|
:class="inputStyles"
|
||||||
v-model="inputText"
|
v-model="inputText"
|
||||||
v-focus
|
v-focus
|
||||||
:placeholder="placeholder"
|
:placeholder="placeholder"
|
||||||
:type="type"
|
:type="type"
|
||||||
@keyup.enter="emit('submit')"
|
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
required
|
required
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
@@ -31,8 +31,8 @@ let inputIDCounter = 564275
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useVModel } from "@vueuse/core"
|
import { onKeyStroke, useVModel } from "@vueuse/core"
|
||||||
import { defineProps } from "vue"
|
import { defineProps, ref } from "vue"
|
||||||
|
|
||||||
// Unique ID for input
|
// Unique ID for input
|
||||||
const inputID = `input-${inputIDCounter++}`
|
const inputID = `input-${inputIDCounter++}`
|
||||||
@@ -65,5 +65,13 @@ const emit = defineEmits<{
|
|||||||
(e: "update:modelValue", v: string): void
|
(e: "update:modelValue", v: string): void
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
const inputRef = ref()
|
||||||
|
|
||||||
const inputText = useVModel(props, "modelValue", emit)
|
const inputText = useVModel(props, "modelValue", emit)
|
||||||
|
|
||||||
|
onKeyStroke("Enter", (e) => {
|
||||||
|
if (!e.repeat) {
|
||||||
|
return emit("submit")
|
||||||
|
}
|
||||||
|
}, { target: inputRef, eventName: "keydown" })
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user