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

[UI] EVEREST-1626 Remove db.spec.backup.enabled condition #813

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ const backupScheduleFormValuesToDbClusterPayload = (
...dbCluster?.spec,
backup: {
...dbCluster.spec.backup,
enabled: schedulesPayload.length > 0,
schedules: schedulesPayload.length > 0 ? schedulesPayload : undefined,
},
},
Expand Down Expand Up @@ -134,7 +133,6 @@ const deletedScheduleToDbClusterPayload = (
...dbCluster?.spec,
backup: {
...dbCluster.spec.backup,
enabled: filteredSchedulesWithCronCorrection.length > 0,
schedules:
filteredSchedulesWithCronCorrection.length > 0
? filteredSchedulesWithCronCorrection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ export const useDbCluster = () => ({
spec: {
allowUnsafeConfiguration: true,
monitoring: {},
backup: {
enabled: false,
},
engine: {
config:
"[mysqld]\ninnodb_adaptive_hash_index = True\ninnodb_log_files_in_group = 2\ninnodb_parallel_read_threads = 1\ninnodb_buffer_pool_instances = 1\ninnodb_flush_method = O_DIRECT\ninnodb_log_file_size = 152548048\ninnodb_page_cleaners = 1\ninnodb_purge_threads = 4\ninnodb_buffer_pool_chunk_size = 2097152\ninnodb_buffer_pool_size = 731424661\ninnodb_ddl_threads = 2\ninnodb_flush_log_at_trx_commit = 2\ninnodb_io_capacity_max = 1800\ninnodb_monitor_enable = ALL\nreplica_parallel_workers = 4\nreplica_preserve_commit_order = ON\nreplica_compressed_protocol = 1\nreplica_exec_mode = STRICT\nreplica_parallel_type = LOGICAL_CLOCK\nloose_group_replication_member_expel_timeout = 6\nloose_group_replication_autorejoin_tries = 3\nloose_group_replication_message_cache_size = 162538812\nloose_group_replication_communication_max_message_size = 10485760\nloose_group_replication_unreachable_majority_timeout = 1029\nloose_group_replication_poll_spin_loops = 20000\nloose_group_replication_paxos_single_leader = ON\nloose_binlog_transaction_dependency_tracking = WRITESET\nread_rnd_buffer_size = 393216\nsort_buffer_size = 524288\nmax_heap_table_size = 16777216\ntmp_table_size = 16777216\nbinlog_cache_size = 131072\nbinlog_stmt_cache_size = 131072\njoin_buffer_size = 524288\nmax_connections = 72\ntablespace_definition_cache = 512\nthread_cache_size = 9\nthread_stack = 1024\ntable_open_cache_instances = 4\nsync_binlog = 1\nsql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION,TRADITIONAL,STRICT_ALL_TABLES'\nbinlog_expire_logs_seconds = 604800\nthread_pool_size = 4\ntable_definition_cache = 4096\ntable_open_cache = 4096\nbinlog_format = ROW\n ",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ const formValuesToPayloadMapping = (
},
spec: {
backup: {
enabled: dbPayload.schedules?.length > 0,
...(dbPayload.pitrEnabled && {
pitr: {
enabled: dbPayload.pitrEnabled,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ const formValuesToPayloadOverrides = (
...dbCluster?.spec,
backup: {
...dbCluster?.spec?.backup,
enabled: dbPayload.schedules?.length > 0,
pitr: {
...dbCluster?.spec?.backup?.pitr,
enabled: dbPayload.pitrEnabled,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ export const DbClusterPayloadToFormValues = (
dbCluster?.spec?.engine?.storage?.class || null,

//backups
[DbWizardFormFields.backupsEnabled]: !!backup?.enabled,

[DbWizardFormFields.backupsEnabled]: (backup?.schedules || []).length > 0,
[DbWizardFormFields.pitrEnabled]:
dbCluster?.spec?.engine?.type === DbEngineType.POSTGRESQL
? (backup?.schedules || []).length > 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const convertDbClusterPayloadToTableFormat = (
: DbClusterStatus.unknown,
dbType: cluster.spec.engine.type,
dbVersion: cluster.spec.engine.version || '',
backupsEnabled: !!cluster.spec.backup?.enabled,
backupsEnabled: (cluster.spec.backup?.schedules || []).length > 0,
databaseName: cluster.metadata.name,
cpu: cluster.spec.engine.resources?.cpu || '',
memory: cluster.spec.engine.resources?.memory || '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,13 @@ const ScheduledBackupsList = () => {
<>
<IconButton
color="primary"
disabled={!dbCluster.spec.backup?.enabled}
onClick={() => handleEdit(item.name)}
data-testid="edit-schedule-button"
>
<EditOutlinedIcon />
</IconButton>
<IconButton
color="primary"
disabled={!dbCluster.spec.backup?.enabled}
onClick={() => handleDelete(item.name)}
data-testid="delete-schedule-button"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export const BackupsDetails = ({
schedules,
pitrEnabled,
pitrStorageName,
backup,
loading,
showStorage = true,
}: BackupsDetailsOverviewCardProps) => {
Expand Down Expand Up @@ -152,9 +151,7 @@ export const BackupsDetails = ({
title={Messages.titles.schedules}
loading={loading}
>
{Array.isArray(schedules) &&
schedules?.length > 0 &&
backup?.enabled ? (
{Array.isArray(schedules) && schedules?.length > 0 ? (
schedules?.map((item) => (
<OverviewSectionText key={`${item.name}-${item.schedule}`}>
{getTimeSelectionPreviewMessage(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ export type ResourcesDetailsOverviewProps = {

export type BackupsDetailsOverviewCardProps = {
schedules: NonNullable<DbCluster['spec']['backup']>['schedules'];
backup: DbCluster['spec']['backup'];
pitrEnabled: NonNullable<
NonNullable<DbCluster['spec']['backup']>['pitr']
>['enabled'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ export const ClusterOverview = () => {
/>
{canReadBackups && (
<BackupsDetails
backup={dbCluster?.spec.backup!}
dbClusterName={dbCluster?.metadata.name}
namespace={dbCluster?.metadata.namespace}
schedules={dbCluster?.spec.backup?.schedules}
Expand Down
1 change: 0 additions & 1 deletion ui/apps/everest/src/shared-types/dbCluster.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export interface PITR {
}

export interface Backup {
enabled: boolean;
pitr?: PITR;
schedules?: Array<Schedule>;
}
Expand Down
Loading