diff --git a/apps/app-frontend/src/App.vue b/apps/app-frontend/src/App.vue index dc727147c8..83aa968c3b 100644 --- a/apps/app-frontend/src/App.vue +++ b/apps/app-frontend/src/App.vue @@ -94,9 +94,9 @@ import { debugAnalytics, initAnalytics, trackEvent } from '@/helpers/analytics' import { check_reachable } from '@/helpers/auth.js' import { get_user, get_version } from '@/helpers/cache.js' import { command_listener, notification_listener, warning_listener } from '@/helpers/events.js' +import { list } from '@/helpers/instance' import { cancelLogin, get as getCreds, login, logout } from '@/helpers/mr_auth.ts' -import { create_profile_and_install_from_file } from '@/helpers/pack' -import { list } from '@/helpers/profile.js' +import { create_instance_and_install_from_file } from '@/helpers/pack' import { mergeUrlQuery, parseModrinthLink } from '@/helpers/project-links.ts' import { get as getSettings, set as setSettings } from '@/helpers/settings.ts' import { get_opening_command, initialize_state } from '@/helpers/state' @@ -852,8 +852,8 @@ async function handleCommand(e) { if (e.event === 'RunMRPack') { // RunMRPack should directly install a local mrpack given a path if (e.path.endsWith('.mrpack')) { - await create_profile_and_install_from_file(e.path, (createProfile, fileName) => - unknownPackWarningModal.value?.show(createProfile, fileName), + await create_instance_and_install_from_file(e.path, (createInstance, fileName) => + unknownPackWarningModal.value?.show(createInstance, fileName), ).catch(handleError) trackEvent('InstanceCreate', { source: 'CreationModalFileDrop', diff --git a/apps/app-frontend/src/components/GridDisplay.vue b/apps/app-frontend/src/components/GridDisplay.vue index 3d6dc42a13..b407ee483c 100644 --- a/apps/app-frontend/src/components/GridDisplay.vue +++ b/apps/app-frontend/src/components/GridDisplay.vue @@ -24,7 +24,7 @@ import { computed, ref } from 'vue' import ContextMenu from '@/components/ui/ContextMenu.vue' import Instance from '@/components/ui/Instance.vue' import ConfirmDeleteInstanceModal from '@/components/ui/modal/ConfirmDeleteInstanceModal.vue' -import { duplicate, remove } from '@/helpers/profile.js' +import { duplicate, remove } from '@/helpers/instance' const { handleError } = injectNotificationManager() @@ -48,21 +48,21 @@ const instanceComponents = ref(null) const currentDeleteInstance = ref(null) const confirmModal = ref(null) -async function deleteProfile() { +async function deleteInstance() { if (currentDeleteInstance.value) { instanceComponents.value = instanceComponents.value.filter( - (x) => x.instance.path !== currentDeleteInstance.value, + (x) => x.instance.id !== currentDeleteInstance.value, ) await remove(currentDeleteInstance.value).catch(handleError) } } -async function duplicateProfile(p) { +async function duplicateInstance(p) { await duplicate(p).catch(handleError) } -const handleRightClick = (event, profilePathId) => { - const item = instanceComponents.value.find((x) => x.instance.path === profilePathId) +const handleRightClick = (event, instanceId) => { + const item = instanceComponents.value.find((x) => x.instance.id === instanceId) const baseOptions = [ { name: 'add_content' }, { type: 'divider' }, @@ -114,16 +114,16 @@ const handleOptionsClick = async (args) => { break case 'duplicate': if (args.item.instance.install_stage == 'installed') - await duplicateProfile(args.item.instance.path) + await duplicateInstance(args.item.instance.id) break case 'open': await args.item.openFolder() break case 'copy': - await navigator.clipboard.writeText(args.item.instance.path) + await navigator.clipboard.writeText(args.item.instance.id) break case 'delete': - currentDeleteInstance.value = args.item.instance.path + currentDeleteInstance.value = args.item.instance.id confirmModal.value.show() break } @@ -321,13 +321,13 @@ const filteredResults = computed(() => { - + diff --git a/apps/app-frontend/src/components/RowDisplay.vue b/apps/app-frontend/src/components/RowDisplay.vue index 8e3a4cc276..0d0c47988d 100644 --- a/apps/app-frontend/src/components/RowDisplay.vue +++ b/apps/app-frontend/src/components/RowDisplay.vue @@ -21,9 +21,9 @@ import Instance from '@/components/ui/Instance.vue' import LegacyProjectCard from '@/components/ui/LegacyProjectCard.vue' import ConfirmDeleteInstanceModal from '@/components/ui/modal/ConfirmDeleteInstanceModal.vue' import { trackEvent } from '@/helpers/analytics' -import { get_by_profile_path } from '@/helpers/process.js' -import { duplicate, kill, remove, run } from '@/helpers/profile.js' -import { showProfileInFolder } from '@/helpers/utils.js' +import { duplicate, kill, remove, run } from '@/helpers/instance' +import { get_by_instance_id } from '@/helpers/process.js' +import { showInstanceInFolder } from '@/helpers/utils.js' import { injectContentInstall } from '@/providers/content-install' import { handleSevereError } from '@/store/error.js' @@ -60,13 +60,13 @@ const deleteConfirmModal = ref(null) const currentDeleteInstance = ref(null) -async function deleteProfile() { +async function deleteInstance() { if (currentDeleteInstance.value) { await remove(currentDeleteInstance.value).catch(handleError) } } -async function duplicateProfile(p) { +async function duplicateInstance(p) { await duplicate(p).catch(handleError) } @@ -85,7 +85,7 @@ const handleInstanceRightClick = async (event, passedInstance) => { }, ] - const runningProcesses = await get_by_profile_path(passedInstance.path).catch(handleError) + const runningProcesses = await get_by_instance_id(passedInstance.id).catch(handleError) const options = runningProcesses.length > 0 @@ -126,16 +126,14 @@ const handleProjectClick = (event, passedInstance) => { const handleOptionsClick = async (args) => { switch (args.option) { case 'play': - await run(args.item.path).catch((err) => - handleSevereError(err, { profilePath: args.item.path }), - ) + await run(args.item.id).catch((err) => handleSevereError(err, { instanceId: args.item.id })) trackEvent('InstanceStart', { loader: args.item.loader, game_version: args.item.game_version, }) break case 'stop': - await kill(args.item.path).catch(handleError) + await kill(args.item.id).catch(handleError) trackEvent('InstanceStop', { loader: args.item.loader, game_version: args.item.game_version, @@ -144,26 +142,26 @@ const handleOptionsClick = async (args) => { case 'add_content': await router.push({ path: `/browse/${args.item.loader === 'vanilla' ? 'datapack' : 'mod'}`, - query: { i: args.item.path }, + query: { i: args.item.id }, }) break case 'edit': await router.push({ - path: `/instance/${encodeURIComponent(args.item.path)}`, + path: `/instance/${encodeURIComponent(args.item.id)}`, }) break case 'duplicate': - if (args.item.install_stage == 'installed') await duplicateProfile(args.item.path) + if (args.item.install_stage == 'installed') await duplicateInstance(args.item.id) break case 'delete': - currentDeleteInstance.value = args.item.path + currentDeleteInstance.value = args.item.id deleteConfirmModal.value.show() break case 'open_folder': - await showProfileInFolder(args.item.path) + await showInstanceInFolder(args.item.id) break case 'copy_path': - await navigator.clipboard.writeText(args.item.path) + await navigator.clipboard.writeText(args.item.id) break case 'install': { await installVersion( @@ -239,7 +237,7 @@ onUnmounted(() => {