chore: rename worlds -> instances

This commit is contained in:
Calum H. (IMB11)
2026-06-26 17:09:22 +01:00
parent f799e6f67e
commit f097409b92
33 changed files with 227 additions and 172 deletions
+6 -6
View File
@@ -496,7 +496,7 @@ const sidebarOverlayScrollbarsOptions = Object.freeze({
})
router.beforeEach(async (to) => {
const redirect = await resolveLegacyServerWorldTabRedirect(to)
const redirect = await resolveLegacyServerInstanceTabRedirect(to)
if (redirect) return redirect
})
@@ -531,7 +531,7 @@ function onSuspensePending() {
suspenseToken = loading.begin()
}
async function resolveLegacyServerWorldTabRedirect(to) {
async function resolveLegacyServerInstanceTabRedirect(to) {
if (!['ServerManageContent', 'ServerManageFiles', 'ServerManageBackups'].includes(to.name)) {
return null
}
@@ -541,14 +541,14 @@ async function resolveLegacyServerWorldTabRedirect(to) {
const tabPath =
to.name === 'ServerManageFiles' ? '/files' : to.name === 'ServerManageBackups' ? '/backups' : ''
const worldsPath = `/hosting/manage/${encodeURIComponent(serverId)}/worlds`
const instancesPath = `/hosting/manage/${encodeURIComponent(serverId)}/instances`
try {
const serverFull = await tauriApiClient.archon.servers_v1.get(serverId)
const world = serverFull.worlds.find((item) => item.is_active) ?? serverFull.worlds[0]
if (world) {
return {
path: `${worldsPath}/${encodeURIComponent(world.id)}${tabPath}`,
path: `${instancesPath}/${encodeURIComponent(world.id)}${tabPath}`,
query: to.query,
hash: to.hash,
replace: true,
@@ -556,7 +556,7 @@ async function resolveLegacyServerWorldTabRedirect(to) {
}
} catch {
return {
path: worldsPath,
path: instancesPath,
query: to.query,
hash: to.hash,
replace: true,
@@ -564,7 +564,7 @@ async function resolveLegacyServerWorldTabRedirect(to) {
}
return {
path: worldsPath,
path: instancesPath,
query: to.query,
hash: to.hash,
replace: true,
@@ -93,7 +93,7 @@ watch(
breadcrumbs.setName('Server', server.name)
breadcrumbs.setContext({
name: server.name,
link: `/hosting/manage/${serverId.value}/worlds`,
link: `/hosting/manage/${serverId.value}/instances`,
})
}
},
@@ -1,5 +1,5 @@
<template>
<ServersManageWorldRootLayout>
<ServersManageInstanceRootLayout>
<RouterView v-slot="{ Component }">
<template v-if="Component">
<Suspense>
@@ -7,10 +7,10 @@
</Suspense>
</template>
</RouterView>
</ServersManageWorldRootLayout>
</ServersManageInstanceRootLayout>
</template>
<script setup lang="ts">
import { ServersManageWorldRootLayout } from '@modrinth/ui'
import { ServersManageInstanceRootLayout } from '@modrinth/ui'
import { RouterView } from 'vue-router'
</script>
@@ -0,0 +1,7 @@
<script setup lang="ts">
import { ServersManageInstancesPage } from '@modrinth/ui'
</script>
<template>
<ServersManageInstancesPage />
</template>
@@ -1,7 +0,0 @@
<script setup lang="ts">
import { ServersManageWorldsPage } from '@modrinth/ui'
</script>
<template>
<ServersManageWorldsPage />
</template>
@@ -3,8 +3,8 @@ import Backups from './Backups.vue'
import Content from './Content.vue'
import Files from './Files.vue'
import Index from './Index.vue'
import Instance from './Instance.vue'
import Instances from './Instances.vue'
import Overview from './Overview.vue'
import World from './World.vue'
import Worlds from './Worlds.vue'
export { Access, Backups, Content, Files, Index, Overview, World, Worlds }
export { Access, Backups, Content, Files, Index, Instance, Instances, Overview }
@@ -252,7 +252,7 @@ export function createServerInstallContent(opts: {
if (serverFlowFrom.value === 'reset-server') {
return `/hosting/manage/${sid}?openSettings=installation`
}
return getServerWorldContentPath(sid, effectiveServerWorldId.value)
return getServerInstanceContentPath(sid, effectiveServerWorldId.value)
})
const serverBackLabel = computed(() => {
if (serverFlowFrom.value === 'onboarding') return 'Back to setup'
@@ -424,7 +424,7 @@ export function createServerInstallContent(opts: {
if (isInstallingQueuedServerInstalls.value) return false
if (!serverId || !worldId) {
handleError(new Error('No server world is available for install.'))
handleError(new Error('No server instance is available for install.'))
return false
}
@@ -556,7 +556,7 @@ export function createServerInstallContent(opts: {
if (serverFlowFrom.value === 'onboarding') {
await client.archon.servers_v1.endIntro(sid)
await router.push(getServerWorldContentPath(sid, wid))
await router.push(getServerInstanceContentPath(sid, wid))
return
}
@@ -571,8 +571,8 @@ export function createServerInstallContent(opts: {
serverContentProjectIds.value = new Set([...serverContentProjectIds.value, id])
}
function getServerWorldContentPath(serverId: string, worldId: string | null) {
const base = `/hosting/manage/${encodeURIComponent(serverId)}/worlds`
function getServerInstanceContentPath(serverId: string, worldId: string | null) {
const base = `/hosting/manage/${encodeURIComponent(serverId)}/instances`
return worldId ? `${base}/${encodeURIComponent(worldId)}` : base
}
+9 -9
View File
@@ -58,24 +58,24 @@ export default new createRouter({
},
},
{
path: 'worlds',
name: 'ServerManageWorlds',
component: Hosting.Worlds,
path: 'instances',
name: 'ServerManageInstances',
component: Hosting.Instances,
meta: {
breadcrumb: [{ name: '?Server' }],
},
},
{
path: 'worlds/:world_id',
name: 'ServerManageWorld',
component: Hosting.World,
path: 'instances/:instance_id',
name: 'ServerManageInstance',
component: Hosting.Instance,
meta: {
breadcrumb: [{ name: '?Server' }],
},
children: [
{
path: '',
name: 'ServerManageWorldContent',
name: 'ServerManageInstanceContent',
component: Hosting.Content,
meta: {
breadcrumb: [{ name: '?Server' }],
@@ -83,7 +83,7 @@ export default new createRouter({
},
{
path: 'files',
name: 'ServerManageWorldFiles',
name: 'ServerManageInstanceFiles',
component: Hosting.Files,
meta: {
breadcrumb: [{ name: '?Server' }],
@@ -91,7 +91,7 @@ export default new createRouter({
},
{
path: 'backups',
name: 'ServerManageWorldBackups',
name: 'ServerManageInstanceBackups',
component: Hosting.Backups,
meta: {
breadcrumb: [{ name: '?Server' }],