Skip to content

Commit 7a595d3

Browse files
committed
feat(frontend): new install error flow, billing fix pt 1
1 parent c5b29d5 commit 7a595d3

File tree

3 files changed

+20
-24
lines changed

3 files changed

+20
-24
lines changed

apps/frontend/src/components/ui/servers/PanelServerActionButton.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<template>
22
<div class="flex flex-row items-center gap-2 rounded-lg">
33
<ButtonStyled v-if="showStopButton" type="standard" color="red">
4-
<button :disabled="!canTakeAction || isStartingDelay" @click="killServer">
4+
<button :disabled="!canTakeAction || isStartingDelay || disabled" @click="killServer">
55
<div class="flex gap-1">
66
<SlashIcon class="h-5 w-5" />
77
<span>{{ killButtonText }}</span>
88
</div>
99
</button>
1010
</ButtonStyled>
1111
<ButtonStyled v-if="showStopButton" type="standard" color="red">
12-
<button :disabled="!canTakeAction || isStartingDelay" @click="stopServer">
12+
<button :disabled="!canTakeAction || isStartingDelay || disabled" @click="stopServer">
1313
<div class="flex gap-1">
1414
<StopCircleIcon class="h-5 w-5" />
1515
<span>{{ stopButtonText }}</span>
@@ -18,7 +18,7 @@
1818
</ButtonStyled>
1919

2020
<ButtonStyled type="standard" color="brand">
21-
<button :disabled="!canTakeAction || isStartingDelay" @click="handleAction">
21+
<button :disabled="!canTakeAction || isStartingDelay || disabled" @click="handleAction">
2222
<div v-if="isStartingOrRestarting" class="grid place-content-center">
2323
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
2424
<path
@@ -49,6 +49,7 @@ import { ButtonStyled } from "@modrinth/ui";
4949
const props = defineProps<{
5050
isOnline: boolean;
5151
isActioning: boolean;
52+
disabled: any;
5253
}>();
5354
5455
const emit = defineEmits<{

apps/frontend/src/pages/servers/manage/[id].vue

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
11
<template>
22
<div class="contents">
3-
<UiServersPyroError
4-
v-if="error"
5-
:title="errorTitle"
6-
:message="errorMessage"
7-
:server-id="serverData?.server_id"
8-
/>
93
<div
104
v-if="serverData && serverData.status !== 'installing'"
115
data-pyro-server-manager-root
126
class="mx-auto box-border flex min-h-screen w-full max-w-[1280px] flex-col gap-6 px-3 transition-all duration-300"
13-
:class="error ? 'pointer-events-none select-none blur-md' : ''"
147
>
158
<div class="flex w-full min-w-0 flex-row items-center gap-6 pt-4">
169
<UiServersServerIcon :image="serverData.image" />
@@ -34,6 +27,7 @@
3427
class="flex-shrink-0"
3528
:is-online="isServerRunning"
3629
:is-actioning="isActioning"
30+
:disabled="error"
3731
@action="sendPowerAction"
3832
/>
3933
</div>
@@ -63,6 +57,16 @@
6357
</div>
6458

6559
<div data-pyro-mount class="h-full w-full flex-1">
60+
<div
61+
v-if="error"
62+
class="mb-4 flex h-full w-full items-center gap-2 rounded-xl border-2 border-solid border-red bg-bg-red p-4 font-semibold text-contrast"
63+
>
64+
<IssuesIcon class="h-8 w-8 text-red" />
65+
<div class="flex flex-col gap-2">
66+
{{ errorTitle }}
67+
{{ errorMessage }}
68+
</div>
69+
</div>
6670
<NuxtPage
6771
:route="route"
6872
:is-connected="isConnected"
@@ -92,7 +96,7 @@
9296

9397
<script setup lang="ts">
9498
import { ref, computed, onMounted, onUnmounted, watch } from "vue";
95-
import { LeftArrowIcon } from "@modrinth/assets";
99+
import { IssuesIcon, LeftArrowIcon } from "@modrinth/assets";
96100
import type { ServerState, Stats, WSEvent, WSInstallationResultEvent } from "~/types/servers";
97101
98102
const socket = ref<WebSocket | null>(null);

apps/frontend/src/pages/settings/billing/index.vue

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,7 @@ import {
519519
} from "@modrinth/assets";
520520
import { calculateSavings, formatPrice, createStripeElements, getCurrency } from "@modrinth/utils";
521521
import { ref } from "vue";
522+
import { asyncComputed } from "@vueuse/core";
522523
import { products } from "~/generated/state.json";
523524
524525
definePageMeta({
@@ -743,7 +744,6 @@ const [
743744
{ data: charges, refresh: refreshCharges },
744745
{ data: customer, refresh: refreshCustomer },
745746
{ data: subscriptions, refresh: refreshSubscriptions },
746-
{ data: servers, refresh: refreshServers },
747747
] = await Promise.all([
748748
useAsyncData("billing/payment_methods", () =>
749749
useBaseFetch("billing/payment_methods", { internal: true }),
@@ -753,15 +753,6 @@ const [
753753
useAsyncData("billing/subscriptions", () =>
754754
useBaseFetch("billing/subscriptions", { internal: true }),
755755
),
756-
useAsyncData("ServerList", async () => {
757-
try {
758-
const response = await usePyroFetch("servers");
759-
await updateIcons(response.servers);
760-
return response;
761-
} catch {
762-
throw new PyroFetchError("Unable to load servers");
763-
}
764-
}),
765756
]);
766757
767758
onMounted(() => {
@@ -780,11 +771,11 @@ async function refresh() {
780771
]);
781772
}
782773
783-
const pyroSubscriptions = computed(() => {
774+
const pyroSubscriptions = asyncComputed(() => {
784775
return subscriptions.value
785776
.filter((x) => x.status === "provisioned" && x.metadata && x.metadata.type === "pyro")
786-
.map((x) => {
787-
const server = servers.value.servers.find((y) => y.server_id === x.metadata.id);
777+
.map(async (x) => {
778+
const server = await usePyroServer(x.metadata.id, ["general"]);
788779
return {
789780
...x,
790781
server,

0 commit comments

Comments
 (0)