Skip to content

Commit

Permalink
Merge pull request #3867 from dlabrecq/network-costs
Browse files Browse the repository at this point in the history
Rename cost model properties
  • Loading branch information
dlabrecq authored May 31, 2024
2 parents 408fcbd + a0599fd commit 0974bb1
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions src/api/costModels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ export interface CostModel {
description: string;
distribution_info?: {
distribution_type?: string;
network_cost?: boolean;
network_unattributed?: boolean;
platform_cost?: boolean;
storage_cost?: boolean;
storage_unattributed?: boolean;
worker_cost?: boolean;
};
markup: { value: string; unit: string };
Expand All @@ -34,9 +34,9 @@ export interface CostModelRequest {
description: string;
distribution_info?: {
distribution_type?: string;
network_cost?: boolean;
network_unattributed?: boolean;
platform_cost?: boolean;
storage_cost?: boolean;
storage_unattributed?: boolean;
worker_cost?: boolean;
};
markup: { value: string; unit: string };
Expand Down
4 changes: 2 additions & 2 deletions src/routes/settings/costModels/components/rateForm/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ export const mergeToRequest = (
description: costModel.description,
distribution_info: {
distribution_type: costModel.distribution_info ? costModel.distribution_info.distribution_type : undefined,
network_cost: costModel.distribution_info ? costModel.distribution_info.network_cost : undefined,
network_unattributed: costModel.distribution_info ? costModel.distribution_info.network_unattributed : undefined,
platform_cost: costModel.distribution_info ? costModel.distribution_info.platform_cost : undefined,
storage_cost: costModel.distribution_info ? costModel.distribution_info.storage_cost : undefined,
storage_unattributed: costModel.distribution_info ? costModel.distribution_info.storage_unattributed : undefined,
worker_cost: costModel.distribution_info ? costModel.distribution_info.worker_cost : undefined,
},
source_uuids: costModel.sources.map(src => src.uuid),
Expand Down
4 changes: 2 additions & 2 deletions src/routes/settings/costModels/costModel/distribution.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ const DistributionCardBase: React.FC<Props> = ({
{isOcpCloudNetworkingToggleEnabled && (
<div>
{intl.formatMessage(messages.distributeCosts, {
value: current.distribution_info.network_cost || false,
value: current.distribution_info.network_unattributed || false,
type: 'network',
})}
</div>
)}
{isOcpProjectStorageToggleEnabled && (
<div>
{intl.formatMessage(messages.distributeCosts, {
value: current.distribution_info.storage_cost || false,
value: current.distribution_info.storage_unattributed || false,
type: 'storage',
})}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ class UpdateDistributionDialogBase extends React.Component<
super(props);
this.state = {
distribution: this.props.current.distribution_info.distribution_type,
distributeNetwork: this.props.current.distribution_info.network_cost === true,
distributeNetwork: this.props.current.distribution_info.network_unattributed === true,
distributePlatformUnallocated: this.props.current.distribution_info.platform_cost === true,
distributeStorage: this.props.current.distribution_info.storage_cost === true,
distributeStorage: this.props.current.distribution_info.storage_unattributed === true,
distributeWorkerUnallocated: this.props.current.distribution_info.worker_cost === true,
};
}
Expand Down Expand Up @@ -127,9 +127,9 @@ class UpdateDistributionDialogBase extends React.Component<
source_type: 'OCP',
distribution_info: {
distribution_type: this.state.distribution,
network_cost: this.state.distributeNetwork,
network_unattributed: this.state.distributeNetwork,
platform_cost: this.state.distributePlatformUnallocated,
storage_cost: this.state.distributeStorage,
storage_unattributed: this.state.distributeStorage,
worker_cost: this.state.distributeWorkerUnallocated,
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ const InternalWizardBase: React.FC<InternalWizardBaseProps> = ({
description,
distribution_info: {
distribution_type: distribution,
network_cost: distributeNetwork,
network_unattributed: distributeNetwork,
platform_cost: distributePlatformUnallocated,
storage_cost: distributeStorage,
storage_unattributed: distributeStorage,
worker_cost: distributeWorkerUnallocated,
},
rates: tiers,
Expand Down

0 comments on commit 0974bb1

Please sign in to comment.