doctypes,Doctypes,DocTypes,DOCTYPES等关键词替换

This commit is contained in:
jingrow 2025-08-14 23:32:33 +08:00
parent 9046639db7
commit b72a4b2031
26 changed files with 77 additions and 77 deletions

View File

@ -431,7 +431,7 @@ export default {
this.$confirm({ this.$confirm({
title: 'Remove App', title: 'Remove App',
message: `Are you sure you want to uninstall app ${app.title} from <b>site</b>?<br><br> message: `Are you sure you want to uninstall app ${app.title} from <b>site</b>?<br><br>
<b>All doctypes and modules pertaining to this app will be removed.</b>`, <b>All pagetypes and modules pertaining to this app will be removed.</b>`,
actionLabel: 'Remove App', actionLabel: 'Remove App',
actionColor: 'red', actionColor: 'red',
action: closeDialog => { action: closeDialog => {

View File

@ -5,7 +5,7 @@ import { isMobile } from '../../utils/device';
import { duration } from '../../utils/format'; import { duration } from '../../utils/format';
import { ColumnField, Tab } from './types'; import { ColumnField, Tab } from './types';
type JobDocTypes = 'Site' | 'Bench' | 'Server' | 'Release Group'; type JobPageTypes = 'Site' | 'Bench' | 'Server' | 'Release Group';
// 英文 job_type 到中文的映射 // 英文 job_type 到中文的映射
const jobTypeI18nMap: Record<string, string> = { const jobTypeI18nMap: Record<string, string> = {
@ -35,7 +35,7 @@ function statusI18n(status: string) {
return statusI18nMap[status] || status; return statusI18nMap[status] || status;
} }
export function getJobsTab(pagetype: JobDocTypes) { export function getJobsTab(pagetype: JobPageTypes) {
const jobRoute = getJobRoute(pagetype); const jobRoute = getJobRoute(pagetype);
return { return {
@ -95,7 +95,7 @@ export function getJobsTab(pagetype: JobDocTypes) {
} satisfies Tab as Tab; } satisfies Tab as Tab;
} }
function getJobRoute(pagetype: JobDocTypes) { function getJobRoute(pagetype: JobPageTypes) {
if (pagetype === 'Site') return 'Site Job'; if (pagetype === 'Site') return 'Site Job';
else if (pagetype === 'Bench') return 'Bench Job'; else if (pagetype === 'Bench') return 'Bench Job';
else if (pagetype === 'Server') return 'Server Job'; else if (pagetype === 'Server') return 'Server Job';
@ -103,7 +103,7 @@ function getJobRoute(pagetype: JobDocTypes) {
throw unreachable; throw unreachable;
} }
function getJobTabColumns(pagetype: JobDocTypes) { function getJobTabColumns(pagetype: JobPageTypes) {
const columns: ColumnField[] = [ const columns: ColumnField[] = [
{ {
label: '任务类型', label: '任务类型',

View File

@ -100,7 +100,7 @@ test files (for organization reasons). These functions will be doing the bare
minimum to make a valid document of that pagetype. minimum to make a valid document of that pagetype.
Eg: `create_test_bench` in `test_bench.py` can be imported and used whenever Eg: `create_test_bench` in `test_bench.py` can be imported and used whenever
you need a valid bench (which itself has dependencies on many other doctypes) you need a valid bench (which itself has dependencies on many other pagetypes)
You can also add default args to these utility functions as you come across the You can also add default args to these utility functions as you come across the
need. Just append to end so you won't have to rewrite pre-existing tests. need. Just append to end so you won't have to rewrite pre-existing tests.

View File

@ -1205,10 +1205,10 @@ def get_permission_options(name, ptype):
available_actions, available_actions,
) )
doctypes = jingrow.get_all("Jcloud Method Permission", pluck="document_type", distinct=True) pagetypes = jingrow.get_all("Jcloud Method Permission", pluck="document_type", distinct=True)
options = [] options = []
for pagetype in doctypes: for pagetype in pagetypes:
pg = jingrow.qb.PageType(pagetype) pg = jingrow.qb.PageType(pagetype)
perm_pg = jingrow.qb.PageType("Jcloud User Permission") perm_pg = jingrow.qb.PageType("Jcloud User Permission")
subtable = ( subtable = (

View File

@ -105,7 +105,7 @@ def get_list(
if filters is None: if filters is None:
filters = {} filters = {}
# these doctypes doesn't have a team field to filter by but are used in get or run_pg_method # these pagetypes doesn't have a team field to filter by but are used in get or run_pg_method
if pagetype in ["Team", "User SSH Key"]: if pagetype in ["Team", "User SSH Key"]:
return [] return []

View File

@ -22,11 +22,11 @@ if TYPE_CHECKING:
from jcloud.jcloud.pagetype.cluster.cluster import Cluster from jcloud.jcloud.pagetype.cluster.cluster import Cluster
def poly_get_pg(doctypes, name): def poly_get_pg(pagetypes, name):
for pagetype in doctypes: for pagetype in pagetypes:
if jingrow.db.exists(pagetype, name): if jingrow.db.exists(pagetype, name):
return jingrow.get_pg(pagetype, name) return jingrow.get_pg(pagetype, name)
return jingrow.get_pg(doctypes[-1], name) return jingrow.get_pg(pagetypes[-1], name)
MOUNTPOINT_REGEX = "(/|/opt/volumes/mariadb|/opt/volumes/benches)" MOUNTPOINT_REGEX = "(/|/opt/volumes/mariadb|/opt/volumes/benches)"

View File

@ -58,21 +58,21 @@ if TYPE_CHECKING:
NAMESERVERS = ["1.1.1.1", "1.0.0.1", "8.8.8.8", "8.8.4.4"] NAMESERVERS = ["1.1.1.1", "1.0.0.1", "8.8.8.8", "8.8.4.4"]
def protected(doctypes): def protected(pagetypes):
""" """
This decorator is stupid. It works in magical ways. It checks whether the This decorator is stupid. It works in magical ways. It checks whether the
owner of the Pagetype (one of `doctypes`) is the same as the current team. owner of the Pagetype (one of `pagetypes`) is the same as the current team.
The stupid magical part of this decorator is how it gets the name of the The stupid magical part of this decorator is how it gets the name of the
Pagetype (see: `get_protected_pagetype_name`); in order of precedence: Pagetype (see: `get_protected_pagetype_name`); in order of precedence:
1. kwargs value with key `name` 1. kwargs value with key `name`
2. first value in kwargs value with key `filters` i.e. `kwargs['filters'].values()[0]` 2. first value in kwargs value with key `filters` i.e. `kwargs['filters'].values()[0]`
3. first value in the args tuple 3. first value in the args tuple
4. kwargs value with key `snake_case(doctypes[0])` 4. kwargs value with key `snake_case(pagetypes[0])`
""" """
if not isinstance(doctypes, list): if not isinstance(pagetypes, list):
doctypes = [doctypes] pagetypes = [pagetypes]
@wrapt.decorator @wrapt.decorator
def wrapper(wrapped, instance, args, kwargs): def wrapper(wrapped, instance, args, kwargs):
@ -82,12 +82,12 @@ def protected(doctypes):
if user_type == "System User": if user_type == "System User":
return wrapped(*args, **kwargs) return wrapped(*args, **kwargs)
name = get_protected_pagetype_name(args, kwargs, doctypes) name = get_protected_pagetype_name(args, kwargs, pagetypes)
if not name: if not name:
jingrow.throw("找不到名称不允许API访问", jingrow.PermissionError) jingrow.throw("找不到名称不允许API访问", jingrow.PermissionError)
team = get_current_team() team = get_current_team()
for pagetype in doctypes: for pagetype in pagetypes:
owner = jingrow.db.get_value(pagetype, name, "team") owner = jingrow.db.get_value(pagetype, name, "team")
if owner == team or has_role("Jcloud Support Agent"): if owner == team or has_role("Jcloud Support Agent"):
@ -98,7 +98,7 @@ def protected(doctypes):
return wrapper return wrapper
def get_protected_pagetype_name(args: list, kwargs: dict, doctypes: list[str]): def get_protected_pagetype_name(args: list, kwargs: dict, pagetypes: list[str]):
# 1. Name from kwargs["name"] # 1. Name from kwargs["name"]
if name := kwargs.get("name"): if name := kwargs.get("name"):
return name return name
@ -112,11 +112,11 @@ def get_protected_pagetype_name(args: list, kwargs: dict, doctypes: list[str]):
if len(args) >= 1 and args[0]: if len(args) >= 1 and args[0]:
return args[0] return args[0]
if len(doctypes) == 0: if len(pagetypes) == 0:
return None return None
# 4. Name from snakecased first `doctypes` name # 4. Name from snakecased first `pagetypes` name
pagetype = doctypes[0] pagetype = pagetypes[0]
key = pagetype.lower().replace(" ", "_") key = pagetype.lower().replace(" ", "_")
return kwargs.get(key) return kwargs.get(key)

View File

@ -394,10 +394,10 @@ persistent_cache_keys = [
"defaults", "defaults",
"pagetype_form_meta", "pagetype_form_meta",
"pagetype_meta", "pagetype_meta",
"doctypes_with_web_view", "pagetypes_with_web_view",
"document_cache::*", "document_cache::*",
"document_naming_rule_map", "document_naming_rule_map",
"domain_restricted_doctypes", "domain_restricted_pagetypes",
"domain_restricted_pages", "domain_restricted_pages",
"energy_point_rule_map", "energy_point_rule_map",
"jingrow.utils.scheduler.schedule_jobs_based_on_activity*", # dormant checks "jingrow.utils.scheduler.schedule_jobs_based_on_activity*", # dormant checks

View File

@ -202,7 +202,7 @@ def update_with_row_size_too_large_err(details: Details, job: AgentJob):
details[ details[
"message" "message"
] = f"""<p>The server encountered a row size too large error while migrating the site <b>{job.site}</b>.</p> ] = f"""<p>The server encountered a row size too large error while migrating the site <b>{job.site}</b>.</p>
<p>This tends to happen on doctypes with many custom fields</p> <p>This tends to happen on pagetypes with many custom fields</p>
<p>To rectify this issue, please follow the steps mentioned in <i>Help</i>.</p> <p>To rectify this issue, please follow the steps mentioned in <i>Help</i>.</p>
""" """

View File

@ -228,7 +228,7 @@ class AlertmanagerWebhookLog(Document):
return jingrow.render_template(TELEGRAM_NOTIFICATION_TEMPLATE, context) return jingrow.render_template(TELEGRAM_NOTIFICATION_TEMPLATE, context)
def guess_pagetype(self, name): def guess_pagetype(self, name):
doctypes = [ pagetypes = [
"Site", "Site",
"Bench", "Bench",
"Server", "Server",
@ -241,7 +241,7 @@ class AlertmanagerWebhookLog(Document):
"Site Domain", "Site Domain",
"Trace Server", "Trace Server",
] ]
for pagetype in doctypes: for pagetype in pagetypes:
if jingrow.db.exists(pagetype, name): if jingrow.db.exists(pagetype, name):
return pagetype return pagetype
return None return None

View File

@ -235,7 +235,7 @@ class Cluster(Document):
@property @property
def images_available(self) -> float: def images_available(self) -> float:
return len(self.get_same_region_vmis()) / len(self.server_doctypes) return len(self.get_same_region_vmis()) / len(self.server_pagetypes)
def validate_cidr_block(self): def validate_cidr_block(self):
if not self.cidr_block: if not self.cidr_block:
@ -672,18 +672,18 @@ class Cluster(Document):
return VirtualMachineImage.get_available_for_series(series, self.region, platform=platform) return VirtualMachineImage.get_available_for_series(series, self.region, platform=platform)
@property @property
def server_doctypes(self): def server_pagetypes(self):
server_doctypes = {**self.base_servers} server_pagetypes = {**self.base_servers}
if not self.public: if not self.public:
server_doctypes = {**server_doctypes, **self.private_servers} server_pagetypes = {**server_pagetypes, **self.private_servers}
return server_doctypes return server_pagetypes
def get_same_region_vmis(self, get_series=False): def get_same_region_vmis(self, get_series=False):
return jingrow.get_all( return jingrow.get_all(
"Virtual Machine Image", "Virtual Machine Image",
filters={ filters={
"region": self.region, "region": self.region,
"series": ("in", list(self.server_doctypes.values())), "series": ("in", list(self.server_pagetypes.values())),
"status": "Available", "status": "Available",
}, },
pluck="name" if not get_series else "series", pluck="name" if not get_series else "series",
@ -691,7 +691,7 @@ class Cluster(Document):
def get_other_region_vmis(self, get_series=False): def get_other_region_vmis(self, get_series=False):
vmis = [] vmis = []
for series in list(self.server_doctypes.values()): for series in list(self.server_pagetypes.values()):
vmis.extend( vmis.extend(
jingrow.get_all( jingrow.get_all(
"Virtual Machine Image", "Virtual Machine Image",

View File

@ -24,11 +24,11 @@ class JcloudMethodPermission(Document):
def available_actions(): def available_actions():
result = {} result = {}
doctypes = jingrow.get_all( pagetypes = jingrow.get_all(
"Jcloud Method Permission", pluck="document_type", distinct=True "Jcloud Method Permission", pluck="document_type", distinct=True
) )
for pagetype in doctypes: for pagetype in pagetypes:
result[pagetype] = { result[pagetype] = {
perm["checkbox_label"]: perm["method"] perm["checkbox_label"]: perm["method"]
for perm in jingrow.get_all( for perm in jingrow.get_all(

View File

@ -7,7 +7,7 @@ from jingrow.model.document import Document
from jcloud.api.client import dashboard_whitelist from jcloud.api.client import dashboard_whitelist
DEFAULT_PERMISSIONS = { DEFAULT_PERMISSIONS = {
"*": {"*": {"*": True}} # all doctypes # all documents # all methods "*": {"*": {"*": True}} # all pagetypes # all documents # all methods
} }
@ -59,7 +59,7 @@ class JcloudPermissionGroup(Document):
return return
for pagetype, pagetype_perms in permissions.items(): for pagetype, pagetype_perms in permissions.items():
if pagetype not in get_all_restrictable_doctypes() and pagetype != "*": if pagetype not in get_all_restrictable_pagetypes() and pagetype != "*":
jingrow.throw(f"{pagetype} is not a valid pagetype.") jingrow.throw(f"{pagetype} is not a valid pagetype.")
if not isinstance(pagetype_perms, dict): if not isinstance(pagetype_perms, dict):
@ -160,7 +160,7 @@ class JcloudPermissionGroup(Document):
if not (jingrow.local.system_user() or user_belongs_to_group or user_is_team_owner): if not (jingrow.local.system_user() or user_belongs_to_group or user_is_team_owner):
jingrow.throw(f"{user} does not belong to {self.name}") jingrow.throw(f"{user} does not belong to {self.name}")
if pagetype not in get_all_restrictable_doctypes(): if pagetype not in get_all_restrictable_pagetypes():
jingrow.throw(f"{pagetype} is not a valid restrictable pagetype.") jingrow.throw(f"{pagetype} is not a valid restrictable pagetype.")
restrictable_methods = get_all_restrictable_methods(pagetype) restrictable_methods = get_all_restrictable_methods(pagetype)
@ -222,7 +222,7 @@ def has_method_permission(
user = jingrow.session.user user = jingrow.session.user
if pagetype not in get_all_restrictable_doctypes(): if pagetype not in get_all_restrictable_pagetypes():
return True return True
if method not in get_all_restrictable_methods(pagetype): if method not in get_all_restrictable_methods(pagetype):
@ -244,7 +244,7 @@ def has_method_permission(
def get_permitted_methods(pagetype: str, name: str, group_names: list = None) -> list: def get_permitted_methods(pagetype: str, name: str, group_names: list = None) -> list:
user = jingrow.session.user user = jingrow.session.user
if pagetype not in get_all_restrictable_doctypes(): if pagetype not in get_all_restrictable_pagetypes():
jingrow.throw(f"{pagetype} is not a valid restrictable pagetype.") jingrow.throw(f"{pagetype} is not a valid restrictable pagetype.")
permissions_by_group = {} permissions_by_group = {}
@ -320,7 +320,7 @@ def resolve_pg_permissions(pagetype, permissions_by_group: dict) -> dict:
return method_perms return method_perms
def get_all_restrictable_doctypes() -> list: def get_all_restrictable_pagetypes() -> list:
return ["Site", "Release Group"] return ["Site", "Release Group"]

View File

@ -5,8 +5,8 @@ import jingrow
def execute(): def execute():
DOCTYPES = ["Server", "Database Server"] PAGETYPES = ["Server", "Database Server"]
for pagetype in DOCTYPES: for pagetype in PAGETYPES:
server_names = jingrow.get_all( server_names = jingrow.get_all(
pagetype, pagetype,
{"status": ("!=", "Archived"), "virtual_machine": ("is", "set")}, {"status": ("!=", "Archived"), "virtual_machine": ("is", "set")},

View File

@ -293,14 +293,14 @@ def paid_plans():
"price_cny": (">", 0), "price_cny": (">", 0),
"enabled": 1, "enabled": 1,
} }
doctypes = [ pagetypes = [
"Site Plan", "Site Plan",
"Marketplace App Plan", "Marketplace App Plan",
"Server Plan", "Server Plan",
"Server Storage Plan", "Server Storage Plan",
"Cluster Plan", "Cluster Plan",
] ]
for pagetype in doctypes: for pagetype in pagetypes:
paid_plans += jingrow.get_all(pagetype, filter, pluck="name", ignore_ifnull=True) paid_plans += jingrow.get_all(pagetype, filter, pluck="name", ignore_ifnull=True)
return list(set(paid_plans)) return list(set(paid_plans))

View File

@ -141,7 +141,7 @@ class TLSCertificate(Document):
@jingrow.whitelist() @jingrow.whitelist()
def trigger_server_tls_setup_callback(self): def trigger_server_tls_setup_callback(self):
server_doctypes = [ server_pagetypes = [
"Proxy Server", "Proxy Server",
"Server", "Server",
"Database Server", "Database Server",
@ -151,7 +151,7 @@ class TLSCertificate(Document):
"Analytics Server", "Analytics Server",
"Trace Server", "Trace Server",
] ]
for server_pagetype in server_doctypes: for server_pagetype in server_pagetypes:
servers = jingrow.get_all( servers = jingrow.get_all(
server_pagetype, server_pagetype,
{"status": "Active", "name": ("like", f"%.{self.domain}")} {"status": "Active", "name": ("like", f"%.{self.domain}")}
@ -279,7 +279,7 @@ def retrigger_failed_wildcard_tls_callbacks():
""" """
可用于手动重新为失败的通配符证书部署 可用于手动重新为失败的通配符证书部署
""" """
server_doctypes = [ server_pagetypes = [
"Proxy Server", "Proxy Server",
"Server", "Server",
"Database Server", "Database Server",
@ -289,7 +289,7 @@ def retrigger_failed_wildcard_tls_callbacks():
"Analytics Server", "Analytics Server",
"Trace Server", "Trace Server",
] ]
for server_pagetype in server_doctypes: for server_pagetype in server_pagetypes:
servers = jingrow.get_all(server_pagetype, {"status": "Active"}, pluck="name") servers = jingrow.get_all(server_pagetype, {"status": "Active"}, pluck="name")
for srv in servers: for srv in servers:
plays = jingrow.get_all( plays = jingrow.get_all(

View File

@ -38,7 +38,7 @@ from jcloud.overrides import get_permission_query_conditions_for_pagetype
from jcloud.utils import log_error from jcloud.utils import log_error
from jcloud.utils.jobs import has_job_timeout_exceeded from jcloud.utils.jobs import has_job_timeout_exceeded
server_doctypes = [ server_pagetypes = [
"Server", "Server",
"Database Server", "Database Server",
"Proxy Server", "Proxy Server",
@ -392,7 +392,7 @@ class VirtualMachine(Document):
return jingrow.render_template(cloud_init_template, context, is_path=True) return jingrow.render_template(cloud_init_template, context, is_path=True)
def get_server(self): def get_server(self):
for pagetype in server_doctypes: for pagetype in server_pagetypes:
server = jingrow.db.get_value(pagetype, {"virtual_machine": self.name}, "name") server = jingrow.db.get_value(pagetype, {"virtual_machine": self.name}, "name")
if server: if server:
return jingrow.get_pg(pagetype, server) return jingrow.get_pg(pagetype, server)
@ -740,7 +740,7 @@ class VirtualMachine(Document):
"Terminated": "Archived", "Terminated": "Archived",
"Stopped": "Pending", "Stopped": "Pending",
} }
for pagetype in server_doctypes: for pagetype in server_pagetypes:
server = jingrow.get_all(pagetype, {"virtual_machine": self.name}, pluck="name") server = jingrow.get_all(pagetype, {"virtual_machine": self.name}, pluck="name")
if server: if server:
server = server[0] server = server[0]

View File

@ -24,7 +24,7 @@ jcloud.patches.v0_0_1.add_domains_to_site_config
execute:jingrow.reload_pg('jcloud', 'pagetype', 'Remote File') execute:jingrow.reload_pg('jcloud', 'pagetype', 'Remote File')
# jcloud.patches.v0_0_1.add_site_to_remote_file # 2020-11-12 run via run-patch command in active site state # jcloud.patches.v0_0_1.add_site_to_remote_file # 2020-11-12 run via run-patch command in active site state
jcloud.patches.v0_0_1.new_onboarding jcloud.patches.v0_0_1.new_onboarding
jcloud.patches.v0_0_1.remove_obsolete_doctypes jcloud.patches.v0_0_1.remove_obsolete_pagetypes
jcloud.patches.v0_0_1.make_default_site_domain jcloud.patches.v0_0_1.make_default_site_domain
jcloud.patches.v0_0_1.update_site_config_pg jcloud.patches.v0_0_1.update_site_config_pg
jcloud.patches.v0_0_1.create_certificate_authorities jcloud.patches.v0_0_1.create_certificate_authorities
@ -75,7 +75,7 @@ jcloud.patches.v0_0_1.add_domains_in_site_config_preview
jcloud.patches.v0_0_1.use_private_ip_for_upstreams jcloud.patches.v0_0_1.use_private_ip_for_upstreams
jcloud.jcloud.pagetype.site.patches.set_plan_in_site jcloud.jcloud.pagetype.site.patches.set_plan_in_site
jcloud.jcloud.pagetype.app_release.patches.set_status_to_draft jcloud.jcloud.pagetype.app_release.patches.set_status_to_draft
jcloud.patches.v0_0_4.remove_legacy_billing_doctypes jcloud.patches.v0_0_4.remove_legacy_billing_pagetypes
# jcloud.jcloud.pagetype.invoice.patches.set_free_credits # 2021-08-11 run via run-patch command # jcloud.jcloud.pagetype.invoice.patches.set_free_credits # 2021-08-11 run via run-patch command
jcloud.jcloud.pagetype.team.patches.set_payment_mode jcloud.jcloud.pagetype.team.patches.set_payment_mode
jcloud.patches.v0_0_1.add_team_name_as_default_notify_email jcloud.patches.v0_0_1.add_team_name_as_default_notify_email
@ -109,7 +109,7 @@ jcloud.jcloud.pagetype.virtual_disk_snapshot.patches.rename_aws_fields
jcloud.jcloud.pagetype.virtual_machine_volume.patches.rename_aws_fields jcloud.jcloud.pagetype.virtual_machine_volume.patches.rename_aws_fields
jcloud.patches.v0_7_0.convert_marketplace_description_to_html jcloud.patches.v0_7_0.convert_marketplace_description_to_html
jcloud.jcloud.pagetype.team.patches.remove_invalid_email_addresses jcloud.jcloud.pagetype.team.patches.remove_invalid_email_addresses
jcloud.saas.pagetype.product_trial.patches.rename_saas_product_doctypes_to_product_trial jcloud.saas.pagetype.product_trial.patches.rename_saas_product_pagetypes_to_product_trial
[post_model_sync] [post_model_sync]
jcloud.patches.v0_7_0.rename_plan_to_site_plan jcloud.patches.v0_7_0.rename_plan_to_site_plan
@ -119,7 +119,7 @@ jcloud.jcloud.pagetype.agent_job.patches.update_status_for_undelivered_jobs #202
jcloud.jcloud.pagetype.jcloud_role.patches.migrate_permissions jcloud.jcloud.pagetype.jcloud_role.patches.migrate_permissions
jcloud.jcloud.pagetype.jcloud_role.patches.change_fields_from_enable_to_allow jcloud.jcloud.pagetype.jcloud_role.patches.change_fields_from_enable_to_allow
jcloud.jcloud.pagetype.stripe_webhook_log.patches.add_payment_method_for_failed_events jcloud.jcloud.pagetype.stripe_webhook_log.patches.add_payment_method_for_failed_events
jcloud.patches.v0_7_0.add_team_field_for_site_related_doctypes jcloud.patches.v0_7_0.add_team_field_for_site_related_pagetypes
jcloud.patches.v0_7_0.add_team_field_for_site_backups_archived jcloud.patches.v0_7_0.add_team_field_for_site_backups_archived
jcloud.jcloud.pagetype.server_storage_plan.patches.add_subscription_for_servers_with_additional_disk jcloud.jcloud.pagetype.server_storage_plan.patches.add_subscription_for_servers_with_additional_disk
jcloud.jcloud.pagetype.jcloud_notification.patches.link_reference_pagetype_to_notifications jcloud.jcloud.pagetype.jcloud_notification.patches.link_reference_pagetype_to_notifications

View File

@ -9,7 +9,7 @@ def execute():
jingrow.reload_pg("jcloud", "pagetype", "cluster") jingrow.reload_pg("jcloud", "pagetype", "cluster")
cluster = jingrow.get_pg({"pagetype": "Cluster", "name": "Default", "default": True}) cluster = jingrow.get_pg({"pagetype": "Cluster", "name": "Default", "default": True})
cluster.insert() cluster.insert()
doctypes = ["Server", "Proxy Server", "Database Server", "Bench", "Site"] pagetypes = ["Server", "Proxy Server", "Database Server", "Bench", "Site"]
for pagetype in doctypes: for pagetype in pagetypes:
jingrow.reload_pg("jcloud", "pagetype", jingrow.scrub(pagetype)) jingrow.reload_pg("jcloud", "pagetype", jingrow.scrub(pagetype))
jingrow.db.set_value(pagetype, {"name": ("like", "%")}, "cluster", "Default") jingrow.db.set_value(pagetype, {"name": ("like", "%")}, "cluster", "Default")

View File

@ -7,7 +7,7 @@ import jingrow
def execute(): def execute():
obsolete_doctypes = [ obsolete_pagetypes = [
"Credit Ledger Entry", "Credit Ledger Entry",
"Custom Domain", "Custom Domain",
"Site Analytics", "Site Analytics",
@ -16,6 +16,6 @@ def execute():
"Usage Report", "Usage Report",
"User Account", "User Account",
] ]
for pagetype in obsolete_doctypes: for pagetype in obsolete_pagetypes:
if jingrow.db.exists("PageType", pagetype): if jingrow.db.exists("PageType", pagetype):
jingrow.delete_pg("PageType", pagetype) jingrow.delete_pg("PageType", pagetype)

View File

@ -6,8 +6,8 @@ import jingrow
def execute(): def execute():
doctypes = ["Server", "Proxy Server", "Database Server"] pagetypes = ["Server", "Proxy Server", "Database Server"]
for pagetype in doctypes: for pagetype in pagetypes:
jingrow.reload_pg("jcloud", "pagetype", jingrow.scrub(pagetype)) jingrow.reload_pg("jcloud", "pagetype", jingrow.scrub(pagetype))
servers = jingrow.get_all(pagetype, {"hostname": ("is", "not set")}) servers = jingrow.get_all(pagetype, {"hostname": ("is", "not set")})
domain = jingrow.db.get_single_value("Jcloud Settings", "domain") domain = jingrow.db.get_single_value("Jcloud Settings", "domain")

View File

@ -6,6 +6,6 @@ import jingrow
def execute(): def execute():
# these doctypes are only deleted from PageType table, their tables will exist # these pagetypes are only deleted from PageType table, their tables will exist
doctypes = ["Payment", "Payment Ledger Entry"] pagetypes = ["Payment", "Payment Ledger Entry"]
jingrow.db.sql("DELETE from tabPageType where name in %s", [doctypes]) jingrow.db.sql("DELETE from tabPageType where name in %s", [pagetypes])

View File

@ -1,6 +1,6 @@
### New SaaS Flow (Product Trial) ### New SaaS Flow (Product Trial)
It has 2 doctypes. It has 2 pagetypes.
1. **Product Trial** - Hold the configuration for a specific product. 1. **Product Trial** - Hold the configuration for a specific product.
2. **Product Trial Request** - This holds the records of request for a specific product from a user. 2. **Product Trial Request** - This holds the records of request for a specific product from a user.

View File

@ -7,11 +7,11 @@ from jingrow.model.utils.rename_field import rename_field
def execute(): def execute():
rename_doctypes() rename_pagetypes()
rename_fields() rename_fields()
def rename_doctypes(): def rename_pagetypes():
renames = { renames = {
"SaaS Product": "Product Trial", "SaaS Product": "Product Trial",
"SaaS Product App": "Product Trial App", "SaaS Product App": "Product Trial App",

View File

@ -587,12 +587,12 @@ class ttl_cache:
return wrapper_func return wrapper_func
def poly_get_pagetype(doctypes, name): def poly_get_pagetype(pagetypes, name):
"""Get the pagetype value from the given name of a pg from a list of doctypes""" """Get the pagetype value from the given name of a pg from a list of pagetypes"""
for pagetype in doctypes: for pagetype in pagetypes:
if jingrow.db.exists(pagetype, name): if jingrow.db.exists(pagetype, name):
return pagetype return pagetype
return doctypes[-1] return pagetypes[-1]
def reconnect_on_failure(): def reconnect_on_failure():

View File

@ -4,13 +4,13 @@ title: Build a Bench
# Build a Bench # Build a Bench
This is information about doctypes required to manage benches and apps on FC This is information about pagetypes required to manage benches and apps on FC
from [desk](https://jingrow.com/app). Roughly, the build process goes from [desk](https://jingrow.com/app). Roughly, the build process goes
through these doctypes (that you're concerned with) in order. through these pagetypes (that you're concerned with) in order.
App => App Source => Release Group => Deploy Candidate => Bench App => App Source => Release Group => Deploy Candidate => Bench
To build a bench, we need documents of the following doctypes. To build a bench, we need documents of the following pagetypes.
## App ## App