fix: app problems post release qa (#5554)
* fix: app problems post release qa * fix: lint * fix: dont prefill * fix: toggle gap * feat: macs thing * fix: lint
This commit is contained in:
@@ -147,6 +147,7 @@ provideModalBehavior({
|
||||
|
||||
const {
|
||||
installationModal,
|
||||
fetchExistingInstanceNames,
|
||||
handleCreate,
|
||||
handleBrowseModpacks,
|
||||
searchModpacks,
|
||||
@@ -945,6 +946,7 @@ provideAppUpdateDownloadProgress(appUpdateDownload)
|
||||
ref="installationModal"
|
||||
type="instance"
|
||||
show-snapshot-toggle
|
||||
:fetch-existing-instance-names="fetchExistingInstanceNames"
|
||||
:search-modpacks="searchModpacks"
|
||||
:get-project-versions="getProjectVersions"
|
||||
@create="handleCreate"
|
||||
|
||||
@@ -109,6 +109,7 @@ watch(
|
||||
const removing = ref(false)
|
||||
async function removeProfile() {
|
||||
removing.value = true
|
||||
const path = props.instance.path
|
||||
|
||||
trackEvent('InstanceRemove', {
|
||||
loader: props.instance.loader,
|
||||
@@ -116,7 +117,7 @@ async function removeProfile() {
|
||||
})
|
||||
|
||||
await router.push({ path: '/' })
|
||||
await remove(props.instance.path).catch(handleError)
|
||||
await remove(path).catch(handleError)
|
||||
}
|
||||
|
||||
const messages = defineMessages({
|
||||
|
||||
@@ -246,7 +246,6 @@
|
||||
:options="options"
|
||||
:offline="offline"
|
||||
:playing="playing"
|
||||
:versions="modrinthVersions"
|
||||
:installed="instance.install_stage !== 'installed'"
|
||||
:is-server-instance="isServerInstance"
|
||||
:open-settings="() => settingsModal?.show(1)"
|
||||
@@ -332,7 +331,7 @@ import InstanceSettingsModal from '@/components/ui/modal/InstanceSettingsModal.v
|
||||
import UpdateToPlayModal from '@/components/ui/modal/UpdateToPlayModal.vue'
|
||||
import NavTabs from '@/components/ui/NavTabs.vue'
|
||||
import { trackEvent } from '@/helpers/analytics'
|
||||
import { get_project_v3, get_version_many } from '@/helpers/cache.js'
|
||||
import { get_project_v3 } from '@/helpers/cache.js'
|
||||
import { process_listener, profile_listener } from '@/helpers/events'
|
||||
import { get_by_profile_path } from '@/helpers/process'
|
||||
import { finish_install, get, get_full_path, kill, run } from '@/helpers/profile'
|
||||
@@ -362,7 +361,6 @@ window.addEventListener('online', () => {
|
||||
})
|
||||
|
||||
const instance = ref<GameInstance>()
|
||||
const modrinthVersions = ref<Labrinth.Versions.v2.Version[]>([])
|
||||
const playing = ref(false)
|
||||
const loading = ref(false)
|
||||
const exportModal = ref<InstanceType<typeof ExportModal>>()
|
||||
@@ -385,7 +383,6 @@ const loadingServerPing = ref(false)
|
||||
async function fetchInstance() {
|
||||
isServerInstance.value = false
|
||||
linkedProjectV3.value = undefined
|
||||
modrinthVersions.value = []
|
||||
ping.value = undefined
|
||||
playersOnline.value = undefined
|
||||
loadingServerPing.value = false
|
||||
@@ -402,14 +399,6 @@ async function fetchInstance() {
|
||||
if (linkedProjectV3.value?.minecraft_server != null) {
|
||||
isServerInstance.value = true
|
||||
}
|
||||
|
||||
if (linkedProjectV3.value && linkedProjectV3.value.versions) {
|
||||
const versions = await get_version_many(linkedProjectV3.value.versions, 'must_revalidate')
|
||||
modrinthVersions.value = versions.sort(
|
||||
(a: Labrinth.Versions.v2.Version, b: Labrinth.Versions.v2.Version) =>
|
||||
dayjs(b.date_published).valueOf() - dayjs(a.date_published).valueOf(),
|
||||
)
|
||||
}
|
||||
} catch (error) {
|
||||
handleError(error as Error)
|
||||
}
|
||||
@@ -605,18 +594,23 @@ const handleOptionsClick = async (args: { option: string; item: unknown }) => {
|
||||
|
||||
const unlistenProfiles = await profile_listener(
|
||||
async (event: { profile_path_id: string; event: string }) => {
|
||||
if (event.profile_path_id === route.params.id) {
|
||||
if (event.event === 'removed') {
|
||||
await router.push({
|
||||
path: '/',
|
||||
})
|
||||
return
|
||||
if (event.profile_path_id !== route.params.id) return
|
||||
if (event.event === 'removed' || route.path === '/') {
|
||||
if (route.path !== '/') {
|
||||
await router.push({ path: '/' })
|
||||
}
|
||||
instance.value = await get(route.params.id as string).catch(handleError)
|
||||
if (!instance.value?.linked_data?.project_id) {
|
||||
linkedProjectV3.value = undefined
|
||||
isServerInstance.value = false
|
||||
return
|
||||
}
|
||||
instance.value = await get(route.params.id as string).catch((err) => {
|
||||
if (String(err).includes('not managed')) {
|
||||
router.push({ path: '/' })
|
||||
return undefined
|
||||
}
|
||||
return handleError(err)
|
||||
})
|
||||
if (!instance.value?.linked_data?.project_id) {
|
||||
linkedProjectV3.value = undefined
|
||||
isServerInstance.value = false
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
@@ -150,10 +150,6 @@ const props = defineProps({
|
||||
return false
|
||||
},
|
||||
},
|
||||
versions: {
|
||||
type: Array,
|
||||
required: true,
|
||||
},
|
||||
installed: {
|
||||
type: Boolean,
|
||||
default() {
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
: (updatingProject?.version?.id ?? '')
|
||||
"
|
||||
:is-app="true"
|
||||
:is-modpack="updatingModpack"
|
||||
:project-type="updatingModpack ? 'modpack' : updatingProject?.project_type"
|
||||
:project-icon-url="
|
||||
updatingModpack ? linkedModpackProject?.icon_url : updatingProject?.project?.icon_url
|
||||
"
|
||||
@@ -73,6 +73,7 @@ import {
|
||||
type OverflowMenuOption,
|
||||
provideAppBackup,
|
||||
provideContentManager,
|
||||
useDebugLogger,
|
||||
useVIntl,
|
||||
} from '@modrinth/ui'
|
||||
import { ContentCardLayout as ContentPageLayout } from '@modrinth/ui'
|
||||
@@ -165,10 +166,10 @@ const { formatMessage } = useVIntl()
|
||||
const { handleError, addNotification } = injectNotificationManager()
|
||||
const { installingItems } = injectContentInstall()
|
||||
const router = useRouter()
|
||||
const debug = useDebugLogger('Mods:ContentUpdate')
|
||||
|
||||
const props = defineProps<{
|
||||
instance: GameInstance
|
||||
versions: Labrinth.Versions.v2.Version[]
|
||||
isServerInstance?: boolean
|
||||
openSettings?: () => void
|
||||
}>()
|
||||
@@ -349,6 +350,18 @@ async function handleUpdate(id: string) {
|
||||
const item = projects.value.find((p) => p.file_name === id)
|
||||
if (!item?.has_update || !item.project?.id || !item.version?.id) return
|
||||
|
||||
debug('handleUpdate triggered', {
|
||||
fileName: item.file_name,
|
||||
projectType: item.project_type,
|
||||
projectId: item.project.id,
|
||||
projectTitle: item.project.title,
|
||||
currentVersionId: item.version.id,
|
||||
currentVersionNumber: item.version.version_number,
|
||||
updateVersionId: item.update_version_id,
|
||||
instanceGameVersion: props.instance.game_version,
|
||||
instanceLoader: props.instance.loader,
|
||||
})
|
||||
|
||||
updatingModpack.value = false
|
||||
updatingProject.value = item
|
||||
updatingProjectVersions.value = []
|
||||
@@ -365,7 +378,24 @@ async function handleUpdate(id: string) {
|
||||
|
||||
loadingVersions.value = false
|
||||
|
||||
if (!versions) return
|
||||
if (!versions) {
|
||||
debug('handleUpdate: no versions returned', { projectId: item.project.id })
|
||||
return
|
||||
}
|
||||
|
||||
debug('handleUpdate: fetched versions', {
|
||||
projectId: item.project.id,
|
||||
projectType: item.project_type,
|
||||
totalVersions: versions.length,
|
||||
versionSample: versions.slice(0, 5).map((v) => ({
|
||||
id: v.id,
|
||||
number: v.version_number,
|
||||
loaders: v.loaders,
|
||||
gameVersions: v.game_versions,
|
||||
})),
|
||||
currentVersionInList: versions.some((v) => v.id === item.version?.id),
|
||||
updateVersionInList: versions.some((v) => v.id === item.update_version_id),
|
||||
})
|
||||
|
||||
versions.sort(
|
||||
(a, b) => new Date(b.date_published).getTime() - new Date(a.date_published).getTime(),
|
||||
@@ -493,9 +523,17 @@ function handleModpackUpdateCancel() {
|
||||
pendingModpackUpdateVersion.value = null
|
||||
}
|
||||
|
||||
async function handleModalUpdate(selectedVersion: Labrinth.Versions.v2.Version) {
|
||||
async function handleModalUpdate(
|
||||
selectedVersion: Labrinth.Versions.v2.Version,
|
||||
event?: MouseEvent,
|
||||
) {
|
||||
if (updatingModpack.value) {
|
||||
handleModpackUpdateRequest(selectedVersion)
|
||||
if (event?.shiftKey) {
|
||||
pendingModpackUpdateVersion.value = selectedVersion
|
||||
await handleModpackUpdateConfirm()
|
||||
} else {
|
||||
handleModpackUpdateRequest(selectedVersion)
|
||||
}
|
||||
} else if (updatingProject.value) {
|
||||
const mod = updatingProject.value
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<template>{{ instance.name }} overview</template>
|
||||
<script setup lang="ts">
|
||||
import type { Version } from '@modrinth/utils'
|
||||
|
||||
import type ContextMenu from '@/components/ui/ContextMenu.vue'
|
||||
import type { GameInstance } from '@/helpers/types'
|
||||
|
||||
@@ -10,7 +8,6 @@ defineProps<{
|
||||
options: InstanceType<typeof ContextMenu>
|
||||
offline: boolean
|
||||
playing: boolean
|
||||
versions: Version[]
|
||||
installed: boolean
|
||||
}>()
|
||||
</script>
|
||||
|
||||
@@ -134,7 +134,6 @@ import {
|
||||
RadialHeader,
|
||||
StyledInput,
|
||||
} from '@modrinth/ui'
|
||||
import type { Version } from '@modrinth/utils'
|
||||
import { platform } from '@tauri-apps/plugin-os'
|
||||
import { computed, onUnmounted, ref, watch } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
@@ -202,7 +201,6 @@ const props = defineProps<{
|
||||
options: InstanceType<typeof ContextMenu> | null
|
||||
offline: boolean
|
||||
playing: boolean
|
||||
versions: Version[]
|
||||
installed: boolean
|
||||
}>()
|
||||
|
||||
|
||||
@@ -13,9 +13,14 @@ export function setupCreationModal(notificationManager: AbstractWebNotificationM
|
||||
const router = useRouter()
|
||||
|
||||
const installationModal = useTemplateRef('installationModal')
|
||||
provide('showCreationModal', async () => {
|
||||
|
||||
async function fetchExistingInstanceNames(): Promise<string[]> {
|
||||
const instances = await list().catch(handleError)
|
||||
installationModal.value?.show(instances?.length ?? 0)
|
||||
return instances?.map((i) => i.name) ?? []
|
||||
}
|
||||
|
||||
provide('showCreationModal', () => {
|
||||
installationModal.value?.show()
|
||||
})
|
||||
|
||||
async function handleCreate(config: CreationFlowContextValue) {
|
||||
@@ -57,9 +62,10 @@ export function setupCreationModal(notificationManager: AbstractWebNotificationM
|
||||
? null
|
||||
: (config.selectedLoaderVersion.value ?? config.loaderVersionType.value)
|
||||
const iconPath = config.instanceIconPath.value ?? null
|
||||
const name = config.instanceName.value.trim() || config.autoInstanceName.value
|
||||
|
||||
await create(
|
||||
config.instanceName.value,
|
||||
name,
|
||||
config.selectedGameVersion.value,
|
||||
loader,
|
||||
loaderVersion,
|
||||
@@ -68,7 +74,7 @@ export function setupCreationModal(notificationManager: AbstractWebNotificationM
|
||||
).catch(handleError)
|
||||
|
||||
trackEvent('InstanceCreate', {
|
||||
profile_name: config.instanceName.value,
|
||||
profile_name: name,
|
||||
game_version: config.selectedGameVersion.value,
|
||||
loader,
|
||||
loader_version: loaderVersion,
|
||||
@@ -102,6 +108,7 @@ export function setupCreationModal(notificationManager: AbstractWebNotificationM
|
||||
|
||||
return {
|
||||
installationModal,
|
||||
fetchExistingInstanceNames,
|
||||
handleCreate,
|
||||
handleBrowseModpacks,
|
||||
searchModpacks,
|
||||
|
||||
Reference in New Issue
Block a user