Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(web&server): make the number of database replicas can be changed #2000

Merged
merged 5 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions server/src/application/application.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,10 +371,12 @@ export class ApplicationController {
if (
dto.dedicatedDatabase?.replicas &&
origin.resource.dedicatedDatabase?.replicas &&
dto.dedicatedDatabase?.replicas !==
dto.dedicatedDatabase?.replicas <
origin.resource.dedicatedDatabase?.replicas
) {
return ResponseUtil.error('cannot change database replicas')
return ResponseUtil.error(
'To reduce the number of database replicas, please contact customer support.',
)
}

// check if a user exceeds the resource limit in a region
Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/app/mods/StatusBar/LogsModal/initLog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export default function InitLog() {
<div
id="log-viewer-cover-container"
className={clsx(
"absolute inset-0 z-[999] h-full w-full px-2 pt-0 font-mono text-base font-bold opacity-70",
"absolute inset-0 z-[999] h-full w-full px-2 pt-0 font-mono text-base font-bold opacity-60",
darkMode ? "bg-lafDark-100" : "bg-lafWhite-600",
{ "log-viewer-cover-container-hide-scrollbar": !paused },
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import useGlobalStore from "@/pages/globalStore";
export default function DatabaseBundleControl(props: {
bundle: TypeBundle;
originCapacity?: number;
originReplicas?: number;
resourceOptions: any;
type: "create" | "change";
defaultDatabaseCapacity?: number;
Expand All @@ -36,6 +37,7 @@ export default function DatabaseBundleControl(props: {
defaultDatabaseCapacity,
defaultDedicatedDatabaseBundle,
originCapacity,
originReplicas,
} = props;
const { t } = useTranslation();
const darkMode = useColorMode().colorMode === COLOR_MODE.dark;
Expand Down Expand Up @@ -202,7 +204,8 @@ export default function DatabaseBundleControl(props: {
})}
{buildSlider({
type: "replicas",
disable: disabledChangeType,
min: originReplicas,
// disable: disabledChangeType,
value: _.get(bundle, "dedicatedDatabase.replicas") as unknown as number,
specs: find(resourceOptions, { type: "dedicatedDatabaseReplicas" })?.specs || [],
onChange: (value) => {
Expand Down
1 change: 1 addition & 0 deletions web/src/pages/home/mods/CreateAppModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ const CreateAppModal = (props: {
<DatabaseBundleControl
bundle={bundle}
originCapacity={application?.bundle.resource.dedicatedDatabase?.capacity}
originReplicas={application?.bundle.resource.dedicatedDatabase?.replicas}
onBundleItemChange={(k: string, v?: number) => {
setBundle((prev) => {
const v1 = _.cloneDeep(_.set(prev, k, v));
Expand Down
Loading