update DocTypes-PageTypes
This commit is contained in:
parent
ce84804aeb
commit
48c48e587e
@ -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',
|
||||
|
||||
@ -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:
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
# Marketplace
|
||||
|
||||
## DocTypes at a Glance
|
||||
## PageTypes at a Glance
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
|
||||
@ -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()
|
||||
|
||||
@ -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")
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user