Skip to content

Commit

Permalink
fix(web): fix ddb not compactable with old app (#1768)
Browse files Browse the repository at this point in the history
  • Loading branch information
0fatal committed Jan 3, 2024
1 parent 6a02910 commit 208a683
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion web/src/pages/app/mods/StatusBar/MonitorBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function MonitorBar() {
const { currentApp } = useGlobalStore();
const { t } = useTranslation();
const { limitCPU, limitMemory, storageCapacity, dedicatedDatabase } = currentApp.bundle.resource;
const dedicatedDatabaseLimitCPU = dedicatedDatabase.limitCPU;
const dedicatedDatabaseLimitCPU = dedicatedDatabase?.limitCPU;
let { databaseCapacity } = currentApp.bundle.resource;
databaseCapacity = dedicatedDatabaseLimitCPU ? dedicatedDatabase.capacity : databaseCapacity;

Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/app/setting/SysSetting/AppMonitor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function AppMonitor() {
const { currentApp } = useGlobalStore();
const { limitCPU, limitMemory, databaseCapacity, storageCapacity, dedicatedDatabase } =
currentApp.bundle.resource;
const dedicatedDatabaseCPU = dedicatedDatabase.limitCPU;
const dedicatedDatabaseCPU = dedicatedDatabase?.limitCPU;

const [dataNumber, setDataNumber] = useState(0);
const queryClient = useQueryClient();
Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/app/setting/SysSetting/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default function SysSetting(props: {
currentTab?: string;
}) {
const { currentApp } = useGlobalStore();
const dedicatedDatabaseLimitCPU = currentApp.bundle.resource.dedicatedDatabase.limitCPU;
const dedicatedDatabaseLimitCPU = currentApp.bundle.resource.dedicatedDatabase?.limitCPU;

const monitorItems = useMemo(() => {
const items = [
Expand Down
10 changes: 5 additions & 5 deletions web/src/pages/home/mods/CreateAppModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,16 @@ const CreateAppModal = (props: {
dedicatedDatabase: !application?.bundle.resource.databaseCapacity
? {
cpu:
application?.bundle.resource.dedicatedDatabase.limitCPU ||
application?.bundle.resource.dedicatedDatabase?.limitCPU ||
sortedBundles[0].spec.dedicatedDatabaseCPU.value,
memory:
application?.bundle.resource.dedicatedDatabase.limitMemory ||
application?.bundle.resource.dedicatedDatabase?.limitMemory ||
sortedBundles[0].spec.dedicatedDatabaseMemory.value,
capacity:
application?.bundle.resource.dedicatedDatabase.capacity ||
application?.bundle.resource.dedicatedDatabase?.capacity ||
sortedBundles[0].spec.dedicatedDatabaseCapacity.value,
replicas:
application?.bundle.resource.dedicatedDatabase.replicas ||
application?.bundle.resource.dedicatedDatabase?.replicas ||
sortedBundles[0].spec.dedicatedDatabaseReplicas.value,
}
: undefined,
Expand Down Expand Up @@ -333,7 +333,7 @@ const CreateAppModal = (props: {
/>
<DatabaseBundleControl
bundle={bundle}
originCapacity={application?.bundle.resource.dedicatedDatabase.capacity}
originCapacity={application?.bundle.resource.dedicatedDatabase?.capacity}
onBundleItemChange={(k: string, v?: number) => {
setBundle((prev) => {
const v1 = _.cloneDeep(_.set(prev, k, v));
Expand Down

0 comments on commit 208a683

Please sign in to comment.