Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/dashboard/src/data/organizations/default-org-timeout-query.ts
2501 views
1
/**
2
* Copyright (c) 2025 Gitpod GmbH. All rights reserved.
3
* Licensed under the GNU Affero General Public License (AGPL).
4
* See License.AGPL.txt in the project root for license information.
5
*/
6
7
import { WORKSPACE_TIMEOUT_DEFAULT_LONG, WORKSPACE_TIMEOUT_DEFAULT_SHORT } from "@gitpod/gitpod-protocol";
8
import { useOrgBillingMode } from "../billing-mode/org-billing-mode-query";
9
10
/**
11
* Returns the default workspace timeout for an organization based on their billing mode (does not take into account the organization's own settings)
12
*/
13
export const useDefaultOrgTimeoutQuery = () => {
14
const { data: billingMode } = useOrgBillingMode();
15
16
const isPaidOrDedicated =
17
billingMode?.mode === "none" || (billingMode?.mode === "usage-based" && billingMode?.paid);
18
19
return isPaidOrDedicated ? WORKSPACE_TIMEOUT_DEFAULT_LONG : WORKSPACE_TIMEOUT_DEFAULT_SHORT;
20
};
21
22