Skip to content

Commit

Permalink
chore(web&server): make the number of database replicas can be changed (
Browse files Browse the repository at this point in the history
#2000)

* fix(web): adjust transparency of the overlay for application startup logs

* style(web): adjust transparency of the overlay for application startup logs

* chore(server&web) the number of database copies can be changed

* chore(server&web) the number of database copies can be changed

Co-authored-by: HUAHUAI23 <lim@outlook.com>
  • Loading branch information
HUAHUAI23 and HUAHUAI23 committed Jun 13, 2024
1 parent 1fcc1f0 commit a72ec2d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
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

0 comments on commit a72ec2d

Please sign in to comment.