update DocTypes-PageTypes

This commit is contained in:
jingrow 2025-12-23 21:41:13 +08:00
parent ce84804aeb
commit 48c48e587e
10 changed files with 16 additions and 16 deletions

View File

@ -5,9 +5,9 @@ import { isMobile } from '../../utils/device';
import { duration } from '../../utils/format';
import { ColumnField, Tab } from './types';
type JobDocTypes = 'Site' | 'Bench' | 'Server' | 'Release Group';
type JobPageTypes = 'Site' | 'Bench' | 'Server' | 'Release Group';
export function getJobsTab(pagetype: JobDocTypes) {
export function getJobsTab(pagetype: JobPageTypes) {
const jobRoute = getJobRoute(pagetype);
return {
@ -73,7 +73,7 @@ export function getJobsTab(pagetype: JobDocTypes) {
} satisfies Tab as Tab;
}
function getJobRoute(pagetype: JobDocTypes) {
function getJobRoute(pagetype: JobPageTypes) {
if (pagetype === 'Site') return 'Site Job';
else if (pagetype === 'Bench') return 'Bench Job';
else if (pagetype === 'Server') return 'Server Job';
@ -81,7 +81,7 @@ function getJobRoute(pagetype: JobDocTypes) {
throw unreachable;
}
function getJobTabColumns(pagetype: JobDocTypes) {
function getJobTabColumns(pagetype: JobPageTypes) {
const columns: ColumnField[] = [
{
label: 'Job Type',

View File

@ -6,7 +6,7 @@ published: 1
This page describes how Subscription Management works in Jingrow Cloud.
## DocTypes
## PageTypes
These are the key doctypes that are related to subscription:

View File

@ -2,7 +2,7 @@ import functools
import jingrow
SETTINGS_DOCTYPE = "Jcloude Settings"
SETTINGS_PAGETYPE = "Jcloude Settings"
def enabled(key: str, default_value=None, raise_error: bool = False):
@ -20,7 +20,7 @@ def enabled(key: str, default_value=None, raise_error: bool = False):
def wrapped(func):
@functools.wraps(func)
def inner(*args, **kwargs):
if jingrow.db.get_single_value(SETTINGS_DOCTYPE, key, cache=True):
if jingrow.db.get_single_value(SETTINGS_PAGETYPE, key, cache=True):
return func(*args, **kwargs)
if raise_error:
jingrow.throw("This feature is disabled", jingrow.ValidationError)

View File

@ -1,4 +1,4 @@
# Marketplace
## DocTypes at a Glance
## PageTypes at a Glance

View File

@ -124,7 +124,7 @@ class Bench(Document):
vcpu: DF.Int
# end: auto-generated types
DOCTYPE = "Bench"
PAGETYPE = "Bench"
dashboard_fields = (
"apps",
"name",
@ -1144,7 +1144,7 @@ class Bench(Document):
def get_workloads(cls, sites: list[str]) -> Generator[tuple[str, float, str], None, None]:
benches = jingrow.get_all("Site", filters={"name": ["in", sites]}, pluck="bench", order_by="bench")
for bench_name in benches:
bench = cls(cls.DOCTYPE, bench_name)
bench = cls(cls.PAGETYPE, bench_name)
yield bench.name, bench.workload, bench.server

View File

@ -40,7 +40,7 @@ class PressWebhook(Document):
team: DF.Link
# end: auto-generated types
DOCTYPE = "Jcloude Webhook"
PAGETYPE = "Jcloude Webhook"
dashboard_fields = ("enabled", "endpoint", "events")
@role_guard.action()

View File

@ -19,5 +19,5 @@ class PressWebhookEvent(Document):
title: DF.Data
# end: auto-generated types
DOCTYPE = "Jcloude Webhook Event"
PAGETYPE = "Jcloude Webhook Event"
dashboard_fields = ("name", "description")

View File

@ -228,7 +228,7 @@ class Site(Document, TagHelpers):
update_trigger_time: DF.Time | None
# end: auto-generated types
DOCTYPE = "Site"
PAGETYPE = "Site"
dashboard_fields = (
"ip",

View File

@ -22,7 +22,7 @@ class SQLPlaygroundLog(Document):
team: DF.Link | None
# end: auto-generated types
DOCTYPE = "SQL Playground Log"
PAGETYPE = "SQL Playground Log"
dashboard_fields = (
"site",
"query",

View File

@ -51,7 +51,7 @@ class VirtualMachineImage(Document):
volumes: DF.Table[VirtualMachineImageVolume]
# end: auto-generated types
DOCTYPE = "Virtual Machine Image"
PAGETYPE = "Virtual Machine Image"
def before_insert(self):
self.set_credentials()
@ -271,7 +271,7 @@ class VirtualMachineImage(Document):
def get_available_for_series(
cls, series: str, region: str | None = None, platform: str | None = None
) -> str | None:
images = jingrow.qb.PageType(cls.DOCTYPE)
images = jingrow.qb.PageType(cls.PAGETYPE)
get_available_images = (
jingrow.qb.from_(images)
.select("name")