Compare commits
5 Commits
fix/sync-p
...
fix/db-url
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
74933031c6 | ||
|
|
1cce117b0a | ||
|
|
abc7b4b6f3 | ||
|
|
05e32ef9e4 | ||
|
|
f0a1fc319c |
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hoppscotch-backend",
|
"name": "hoppscotch-backend",
|
||||||
"version": "2023.4.3",
|
"version": "2023.4.4",
|
||||||
"description": "",
|
"description": "",
|
||||||
"author": "",
|
"author": "",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import { emitGQLSchemaFile } from './gql-schema';
|
|||||||
async function bootstrap() {
|
async function bootstrap() {
|
||||||
console.log(`Running in production: ${process.env.PRODUCTION}`);
|
console.log(`Running in production: ${process.env.PRODUCTION}`);
|
||||||
console.log(`Port: ${process.env.PORT}`);
|
console.log(`Port: ${process.env.PORT}`);
|
||||||
console.log(`Database: ${process.env.DATABASE_URL}`);
|
|
||||||
|
|
||||||
const app = await NestFactory.create(AppModule);
|
const app = await NestFactory.create(AppModule);
|
||||||
|
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ export class TeamInvitationService {
|
|||||||
template: 'team-invitation',
|
template: 'team-invitation',
|
||||||
variables: {
|
variables: {
|
||||||
invitee: creator.displayName ?? 'A Hoppscotch User',
|
invitee: creator.displayName ?? 'A Hoppscotch User',
|
||||||
action_url: `https://hoppscotch.io/join-team?id=${invitation.id}`,
|
action_url: `${process.env.VITE_BASE_URL}/join-team?id=${invitation.id}`,
|
||||||
invite_team_name: team.name,
|
invite_team_name: team.name,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@hoppscotch/common",
|
"name": "@hoppscotch/common",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "2023.4.3",
|
"version": "2023.4.4",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "pnpm exec npm-run-all -p -l dev:*",
|
"dev": "pnpm exec npm-run-all -p -l dev:*",
|
||||||
"dev:vite": "vite",
|
"dev:vite": "vite",
|
||||||
|
|||||||
@@ -126,7 +126,7 @@
|
|||||||
/>
|
/>
|
||||||
<CollectionsEditRequest
|
<CollectionsEditRequest
|
||||||
:show="showModalEditRequest"
|
:show="showModalEditRequest"
|
||||||
v-bind:model-value="editingRequest ? editingRequest.name : ''"
|
:model-value="editingRequest ? editingRequest.name : ''"
|
||||||
:loading-state="modalLoadingState"
|
:loading-state="modalLoadingState"
|
||||||
@submit="updateEditingRequest"
|
@submit="updateEditingRequest"
|
||||||
@hide-modal="displayModalEditRequest(false)"
|
@hide-modal="displayModalEditRequest(false)"
|
||||||
|
|||||||
@@ -11,13 +11,14 @@
|
|||||||
class="bg-transparent border-b border-dividerLight select-wrapper"
|
class="bg-transparent border-b border-dividerLight select-wrapper"
|
||||||
>
|
>
|
||||||
<HoppButtonSecondary
|
<HoppButtonSecondary
|
||||||
v-if="selectedEnv.type !== 'NO_ENV_SELECTED'"
|
:icon="IconLayers"
|
||||||
:label="selectedEnv.name"
|
:label="
|
||||||
class="flex-1 !justify-start pr-8 rounded-none"
|
mdAndLarger
|
||||||
/>
|
? selectedEnv.type !== 'NO_ENV_SELECTED'
|
||||||
<HoppButtonSecondary
|
? selectedEnv.name
|
||||||
v-else
|
: `${t('environment.select')}`
|
||||||
:label="`${t('environment.select')}`"
|
: ''
|
||||||
|
"
|
||||||
class="flex-1 !justify-start pr-8 rounded-none"
|
class="flex-1 !justify-start pr-8 rounded-none"
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
@@ -58,6 +59,7 @@
|
|||||||
<HoppSmartItem
|
<HoppSmartItem
|
||||||
v-for="(gen, index) in myEnvironments"
|
v-for="(gen, index) in myEnvironments"
|
||||||
:key="`gen-${index}`"
|
:key="`gen-${index}`"
|
||||||
|
:icon="IconLayers"
|
||||||
:label="gen.name"
|
:label="gen.name"
|
||||||
:info-icon="index === selectedEnv.index ? IconCheck : undefined"
|
:info-icon="index === selectedEnv.index ? IconCheck : undefined"
|
||||||
:active-info-icon="index === selectedEnv.index"
|
:active-info-icon="index === selectedEnv.index"
|
||||||
@@ -99,6 +101,7 @@
|
|||||||
<HoppSmartItem
|
<HoppSmartItem
|
||||||
v-for="(gen, index) in teamEnvironmentList"
|
v-for="(gen, index) in teamEnvironmentList"
|
||||||
:key="`gen-team-${index}`"
|
:key="`gen-team-${index}`"
|
||||||
|
:icon="IconLayers"
|
||||||
:label="gen.environment.name"
|
:label="gen.environment.name"
|
||||||
:info-icon="
|
:info-icon="
|
||||||
gen.id === selectedEnv.teamEnvID ? IconCheck : undefined
|
gen.id === selectedEnv.teamEnvID ? IconCheck : undefined
|
||||||
@@ -148,6 +151,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, ref, watch } from "vue"
|
import { computed, ref, watch } from "vue"
|
||||||
import IconCheck from "~icons/lucide/check"
|
import IconCheck from "~icons/lucide/check"
|
||||||
|
import IconLayers from "~icons/lucide/layers"
|
||||||
import { TippyComponent } from "vue-tippy"
|
import { TippyComponent } from "vue-tippy"
|
||||||
import { useI18n } from "~/composables/i18n"
|
import { useI18n } from "~/composables/i18n"
|
||||||
import { GQLError } from "~/helpers/backend/GQLClient"
|
import { GQLError } from "~/helpers/backend/GQLClient"
|
||||||
@@ -160,6 +164,10 @@ import {
|
|||||||
import { workspaceStatus$ } from "~/newstore/workspace"
|
import { workspaceStatus$ } from "~/newstore/workspace"
|
||||||
import TeamEnvironmentAdapter from "~/helpers/teams/TeamEnvironmentAdapter"
|
import TeamEnvironmentAdapter from "~/helpers/teams/TeamEnvironmentAdapter"
|
||||||
import { useColorMode } from "@composables/theming"
|
import { useColorMode } from "@composables/theming"
|
||||||
|
import { breakpointsTailwind, useBreakpoints } from "@vueuse/core"
|
||||||
|
|
||||||
|
const breakpoints = useBreakpoints(breakpointsTailwind)
|
||||||
|
const mdAndLarger = breakpoints.greater("md")
|
||||||
|
|
||||||
const t = useI18n()
|
const t = useI18n()
|
||||||
|
|
||||||
|
|||||||
40
packages/hoppscotch-common/src/newstore/syncing.ts
Normal file
40
packages/hoppscotch-common/src/newstore/syncing.ts
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
import { distinctUntilChanged, pluck } from "rxjs"
|
||||||
|
import DispatchingStore, { defineDispatchers } from "./DispatchingStore"
|
||||||
|
|
||||||
|
type SyncState = {
|
||||||
|
isInitialSync: boolean
|
||||||
|
shouldSync: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
type CurrentSyncingState = {
|
||||||
|
currentSyncingItem: SyncState
|
||||||
|
}
|
||||||
|
|
||||||
|
const initialState: CurrentSyncingState = {
|
||||||
|
currentSyncingItem: {
|
||||||
|
isInitialSync: false,
|
||||||
|
shouldSync: false,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
const dispatchers = defineDispatchers({
|
||||||
|
changeCurrentSyncStatus(_, { syncItem }: { syncItem: SyncState }) {
|
||||||
|
return {
|
||||||
|
currentSyncingItem: syncItem,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
export const currentSyncStore = new DispatchingStore(initialState, dispatchers)
|
||||||
|
|
||||||
|
export const currentSyncingStatus$ = currentSyncStore.subject$.pipe(
|
||||||
|
pluck("currentSyncingItem"),
|
||||||
|
distinctUntilChanged()
|
||||||
|
)
|
||||||
|
|
||||||
|
export function changeCurrentSyncStatus(syncItem: SyncState) {
|
||||||
|
currentSyncStore.dispatch({
|
||||||
|
dispatcher: "changeCurrentSyncStatus",
|
||||||
|
payload: { syncItem },
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -66,8 +66,8 @@
|
|||||||
</template>
|
</template>
|
||||||
</AppPaneLayout>
|
</AppPaneLayout>
|
||||||
<CollectionsEditRequest
|
<CollectionsEditRequest
|
||||||
:show="showRenamingReqNameModal"
|
|
||||||
v-model="reqName"
|
v-model="reqName"
|
||||||
|
:show="showRenamingReqNameModal"
|
||||||
@submit="renameReqName"
|
@submit="renameReqName"
|
||||||
@hide-modal="showRenamingReqNameModal = false"
|
@hide-modal="showRenamingReqNameModal = false"
|
||||||
/>
|
/>
|
||||||
@@ -87,7 +87,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, onMounted, onBeforeUnmount, watch, onBeforeMount } from "vue"
|
import { ref, onMounted, onBeforeUnmount, onBeforeMount } from "vue"
|
||||||
import { safelyExtractRESTRequest } from "@hoppscotch/data"
|
import { safelyExtractRESTRequest } from "@hoppscotch/data"
|
||||||
import { translateExtURLParams } from "~/helpers/RESTExtURLParams"
|
import { translateExtURLParams } from "~/helpers/RESTExtURLParams"
|
||||||
import { useRoute } from "vue-router"
|
import { useRoute } from "vue-router"
|
||||||
@@ -123,6 +123,11 @@ import { useToast } from "~/composables/toast"
|
|||||||
import { PersistableRESTTabState } from "~/helpers/rest/tab"
|
import { PersistableRESTTabState } from "~/helpers/rest/tab"
|
||||||
import { watchDebounced } from "@vueuse/core"
|
import { watchDebounced } from "@vueuse/core"
|
||||||
import { oauthRedirect } from "~/helpers/oauth"
|
import { oauthRedirect } from "~/helpers/oauth"
|
||||||
|
import { useReadonlyStream } from "~/composables/stream"
|
||||||
|
import {
|
||||||
|
changeCurrentSyncStatus,
|
||||||
|
currentSyncingStatus$,
|
||||||
|
} from "~/newstore/syncing"
|
||||||
|
|
||||||
const savingRequest = ref(false)
|
const savingRequest = ref(false)
|
||||||
const confirmingCloseForTabID = ref<string | null>(null)
|
const confirmingCloseForTabID = ref<string | null>(null)
|
||||||
@@ -134,7 +139,10 @@ const toast = useToast()
|
|||||||
|
|
||||||
const tabs = getActiveTabs()
|
const tabs = getActiveTabs()
|
||||||
|
|
||||||
const confirmSync = ref(false)
|
const confirmSync = useReadonlyStream(currentSyncingStatus$, {
|
||||||
|
isInitialSync: false,
|
||||||
|
shouldSync: true,
|
||||||
|
})
|
||||||
const tabStateForSync = ref<PersistableRESTTabState | null>(null)
|
const tabStateForSync = ref<PersistableRESTTabState | null>(null)
|
||||||
|
|
||||||
function bindRequestToURLParams() {
|
function bindRequestToURLParams() {
|
||||||
@@ -229,29 +237,6 @@ const onSaveModalClose = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(confirmSync, (newValue) => {
|
|
||||||
if (newValue) {
|
|
||||||
toast.show(t("confirm.sync"), {
|
|
||||||
duration: 0,
|
|
||||||
action: [
|
|
||||||
{
|
|
||||||
text: `${t("action.yes")}`,
|
|
||||||
onClick: (_, toastObject) => {
|
|
||||||
syncTabState()
|
|
||||||
toastObject.goAway(0)
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: `${t("action.no")}`,
|
|
||||||
onClick: (_, toastObject) => {
|
|
||||||
toastObject.goAway(0)
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const syncTabState = () => {
|
const syncTabState = () => {
|
||||||
if (tabStateForSync.value) loadTabsFromPersistedState(tabStateForSync.value)
|
if (tabStateForSync.value) loadTabsFromPersistedState(tabStateForSync.value)
|
||||||
}
|
}
|
||||||
@@ -290,6 +275,35 @@ function startTabStateSync(): Subscription {
|
|||||||
return sub
|
return sub
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const showSyncToast = () => {
|
||||||
|
toast.show(t("confirm.sync"), {
|
||||||
|
duration: 0,
|
||||||
|
action: [
|
||||||
|
{
|
||||||
|
text: `${t("action.yes")}`,
|
||||||
|
onClick: (_, toastObject) => {
|
||||||
|
syncTabState()
|
||||||
|
changeCurrentSyncStatus({
|
||||||
|
isInitialSync: true,
|
||||||
|
shouldSync: true,
|
||||||
|
})
|
||||||
|
toastObject.goAway(0)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: `${t("action.no")}`,
|
||||||
|
onClick: (_, toastObject) => {
|
||||||
|
changeCurrentSyncStatus({
|
||||||
|
isInitialSync: true,
|
||||||
|
shouldSync: false,
|
||||||
|
})
|
||||||
|
toastObject.goAway(0)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function setupTabStateSync() {
|
function setupTabStateSync() {
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
|
||||||
@@ -305,9 +319,15 @@ function setupTabStateSync() {
|
|||||||
const tabStateFromSync =
|
const tabStateFromSync =
|
||||||
await platform.sync.tabState.loadTabStateFromSync()
|
await platform.sync.tabState.loadTabStateFromSync()
|
||||||
|
|
||||||
if (tabStateFromSync) {
|
if (tabStateFromSync && !confirmSync.value.isInitialSync) {
|
||||||
tabStateForSync.value = tabStateFromSync
|
tabStateForSync.value = tabStateFromSync
|
||||||
confirmSync.value = true
|
showSyncToast()
|
||||||
|
// Have to set isInitialSync to true here because the toast is shown
|
||||||
|
// and the user does not click on any of the actions
|
||||||
|
changeCurrentSyncStatus({
|
||||||
|
isInitialSync: true,
|
||||||
|
shouldSync: false,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@hoppscotch/selfhost-web",
|
"name": "@hoppscotch/selfhost-web",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "2023.4.3",
|
"version": "2023.4.4",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev:vite": "vite",
|
"dev:vite": "vite",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "hoppscotch-sh-admin",
|
"name": "hoppscotch-sh-admin",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "2023.4.3",
|
"version": "2023.4.4",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "pnpm exec npm-run-all -p -l dev:*",
|
"dev": "pnpm exec npm-run-all -p -l dev:*",
|
||||||
|
|||||||
@@ -100,7 +100,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="hasActions" class="w-64">
|
<div v-if="hasActions" :class="mdAndLarger ? 'w-64' : 'w-16'">
|
||||||
<slot name="actions" />
|
<slot name="actions" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -115,7 +115,7 @@
|
|||||||
}"
|
}"
|
||||||
:style="[
|
:style="[
|
||||||
`--thumb-width: ${scrollThumb.width}px`,
|
`--thumb-width: ${scrollThumb.width}px`,
|
||||||
`width: calc(100% - ${hasActions ? '19rem' : '3rem'})`,
|
`width: calc(100% - ${hasActions ? mdAndLarger ? '19rem' : '7rem' : '3rem'})`,
|
||||||
]"
|
]"
|
||||||
id="myRange"
|
id="myRange"
|
||||||
/>
|
/>
|
||||||
@@ -144,7 +144,7 @@ import {
|
|||||||
nextTick,
|
nextTick,
|
||||||
useSlots,
|
useSlots,
|
||||||
} from "vue"
|
} from "vue"
|
||||||
import { useElementSize } from "@vueuse/core"
|
import { breakpointsTailwind, useBreakpoints, useElementSize } from "@vueuse/core"
|
||||||
import type { Slot } from "vue"
|
import type { Slot } from "vue"
|
||||||
import draggable from "vuedraggable-es"
|
import draggable from "vuedraggable-es"
|
||||||
import { HoppUIPluginOptions, HOPP_UI_OPTIONS } from "./../../index"
|
import { HoppUIPluginOptions, HOPP_UI_OPTIONS } from "./../../index"
|
||||||
@@ -167,6 +167,9 @@ export type TabProvider = {
|
|||||||
removeTabEntry: (tabID: string) => void
|
removeTabEntry: (tabID: string) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const breakpoints = useBreakpoints(breakpointsTailwind)
|
||||||
|
const mdAndLarger = breakpoints.greater("md")
|
||||||
|
|
||||||
const { t } = inject<HoppUIPluginOptions>(HOPP_UI_OPTIONS) ?? {}
|
const { t } = inject<HoppUIPluginOptions>(HOPP_UI_OPTIONS) ?? {}
|
||||||
|
|
||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
|
|||||||
542
pnpm-lock.yaml
generated
542
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user