Skip to content
Prev Previous commit
Next Next commit
feat: sub
  • Loading branch information
HuberTRoy committed Nov 3, 2025
commit 7c901407747fdf2632bfd6c981a07c6f9acf3561
47 changes: 5 additions & 42 deletions src/pages/consumer/MyFlexPlans/MyHostedPlan/MyHostedPlan.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ const MyHostedPlan: FC = () => {
const [open, setOpen] = useState(false);
const [loading, setLoading] = useState(false);
const [fetchConnectLoading, setFetchConnectLoading] = useState(false);
const [expandLoading, setExpandLoading] = useState(false);
const [subscriptions, setSubscriptions] = useState<IGetUserSubscription[]>([]);
const [hostingPlansMap, setHostingPlansMap] = useState<
Map<number, (IGetHostingPlans & { projectName: string | number })[]>
Expand Down Expand Up @@ -146,6 +147,7 @@ const MyHostedPlan: FC = () => {

const fetchHostingPlans = async (projectId: number) => {
try {
setExpandLoading(true);
const res = await getUserHostingPlansByProject(projectId);
if (!isConsumerHostError(res.data)) {
const allMetadata = await Promise.allSettled(
Expand All @@ -170,6 +172,8 @@ const MyHostedPlan: FC = () => {
}
} catch (e) {
parseError(e, { alert: true });
} finally {
setExpandLoading(false);
}
};

Expand Down Expand Up @@ -302,47 +306,6 @@ const MyHostedPlan: FC = () => {
);
},
},
// {
// label: (
// <Typography.Link type="info" style={{ padding: '6px 10px' }}>
// {planRecord.price === '0' ? 'Restart' : 'Update'}
// </Typography.Link>
// ),
// key: 2,
// onClick: () => {
// setCurrentEditInfo(planRecord);
// ref.current?.showModal();
// },
// },
// {
// label: (
// <Typography.Link
// type={planRecord.price === '0' ? 'default' : 'danger'}
// style={{
// padding: '6px 10px',
// }}
// >
// Stop
// </Typography.Link>
// ),
// key: 3,
// onClick: async () => {
// if (planRecord.price === '0') return;
// try {
// setLoading(true);
// await updateHostingPlanApi({
// id: planRecord.id,
// deploymentId: planRecord.deployment.deployment,
// price: '0',
// maximum: 2,
// expiration: 0,
// });
// await fetchHostingPlans(record.project_id);
// } finally {
// setLoading(false);
// }
// },
// },
],
}}
>
Expand All @@ -368,7 +331,7 @@ const MyHostedPlan: FC = () => {
<Table
rowKey={(record) => record.project_id}
style={{ marginTop: 40 }}
loading={loading || consumerHostLoading}
loading={loading || consumerHostLoading || expandLoading}
dataSource={subscriptions}
expandable={{
expandedRowRender,
Expand Down