Skip to content

Commit

Permalink
Fix deployment scenario field name and image
Browse files Browse the repository at this point in the history
  • Loading branch information
Dany9966 committed Dec 5, 2024
1 parent ade38f3 commit b9a4f0c
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 34 deletions.
2 changes: 1 addition & 1 deletion src/@types/MainItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export type UserScriptData = {
export type DeploymentItem = BaseItem & {
type: "deployment";
transfer_id: string;
transfer_scenario: string;
transfer_scenario_type: string;
};

export type DeploymentItemOptions = DeploymentItem & {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import DateUtils from "@src/utils/DateUtils";

import arrowImage from "./images/arrow.svg";
import scheduleImage from "./images/schedule.svg";
import replicaItemImage from "./images/replica.svg";
import liveMigrationItemImage from "./images/live-migration.svg";

const CheckboxStyled = styled(Checkbox)`
opacity: ${props => (props.checked ? 1 : 0)};
Expand Down Expand Up @@ -109,7 +111,6 @@ type Props = {
item: ActionItem;
onClick: () => void;
selected: boolean;
getListItemImage: (item: ActionItem) => string;
showScheduleIcon?: boolean;
endpointType: (endpointId: string) => string;
getUserName: (userId: string) => string | undefined;
Expand All @@ -129,13 +130,22 @@ class TransferListItem extends React.Component<Props> {
scenario = this.props.item.scenario;
break;
case "deployment":
scenario = this.props.item.transfer_scenario;
scenario = this.props.item.transfer_scenario_type;
break;
default:
}
return scenario;
}

getListItemImage(): string {
let scenario = this.getTransferScenarioType();
let image = replicaItemImage;
if (scenario === "live_migration") {
image = liveMigrationItemImage;
}
return image;
}

renderCreationDate() {
return (
<Column
Expand Down Expand Up @@ -210,7 +220,7 @@ class TransferListItem extends React.Component<Props> {
onChange={this.props.onSelectedChange}
/>
<Content onClick={this.props.onClick}>
<Image image={this.props.getListItemImage(this.props.item)} />
<Image image={this.getListItemImage()} />
<Title>
<TitleLabel>{getTransferItemTitle(this.props.item)}</TitleLabel>
<StatusWrapper>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class DeploymentDetailsPage extends React.Component<Props, State> {

getDeploymentScenarioItemType(details: DeploymentItemDetails | null): string {
let item_type = "replica";
let scenario = details?.transfer_scenario;
let scenario = details?.transfer_scenario_type;
if (scenario && scenario === "live_migration") {
item_type = "migration";
}
Expand All @@ -113,7 +113,7 @@ class DeploymentDetailsPage extends React.Component<Props, State> {

getTransferTypePillShouldRed(details: DeploymentItemDetails | null): boolean {
let should_red = true;
let scenario = details?.transfer_scenario;
let scenario = details?.transfer_scenario_type;
if (scenario && scenario === "live_migration") {
should_red = false;
}
Expand All @@ -122,7 +122,7 @@ class DeploymentDetailsPage extends React.Component<Props, State> {

getDeploymentScenarioTypeImage(details: DeploymentItemDetails | null): string {
let image = replicaDeploymentImage;
let scenario = details?.transfer_scenario;
let scenario = details?.transfer_scenario_type;
if (scenario && scenario === "live_migration") {
image = liveMigrationDeploymentImage;
}
Expand Down
15 changes: 1 addition & 14 deletions src/components/smart/DeploymentsPage/DeploymentsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ import { DeploymentItem } from "@src/@types/MainItem";
import userStore from "@src/stores/UserStore";
import TransferListItem from "@src/components/modules/TransferModule/TransferListItem";
import deploymentLargeImage from "./images/deployment-large.svg";
import replicaDeploymentItemImage from "./images/replica-deployment.svg";
import liveMigrationDeploymentItemImage from "./images/live-migration-deployment.svg"

const Wrapper = styled.div<any>``;

Expand Down Expand Up @@ -100,17 +98,9 @@ class DeploymentsPage extends React.Component<{ history: any }, State> {

getDeploymentType(deploymentId: string): string {
const deployment = deploymentStore.deployments.find(m => m.id === deploymentId);
return deployment ? deployment.transfer_scenario : "";
return deployment ? deployment.transfer_scenario_type : "";
}

getDeploymentItemImage(item: DeploymentItem): string {
let image = replicaDeploymentItemImage;
if (item.transfer_scenario === "live_migration") {
image = liveMigrationDeploymentItemImage;
}
return image;
}

handleProjectChange() {
endpointStore.getEndpoints({ showLoading: true });
deploymentStore.getDeployments({ showLoading: true });
Expand Down Expand Up @@ -300,9 +290,6 @@ class DeploymentsPage extends React.Component<{ history: any }, State> {
renderItemComponent={options => (
<TransferListItem
{...options}
getListItemImage={item => {
return this.getDeploymentItemImage(item);
}}
endpointType={id => {
const endpoint = this.getEndpoint(id);
if (endpoint) {
Expand Down
13 changes: 0 additions & 13 deletions src/components/smart/TransfersPage/TransfersPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ import { TransferItem } from "@src/@types/MainItem";
import userStore from "@src/stores/UserStore";
import TransferListItem from "@src/components/modules/TransferModule/TransferListItem";
import replicaLargeImage from "./images/replica-large.svg";
import replicaItemImage from "./images/replica.svg";
import liveMigrationItemImage from "./images/live-migration.svg";

const Wrapper = styled.div<any>``;

Expand Down Expand Up @@ -119,14 +117,6 @@ class TransfersPage extends React.Component<{ history: any }, State> {
return transfer?.last_execution_status || "";
}

getTransferItemImage(item: TransferItem): string {
let image = replicaItemImage;
if (item.scenario === "live_migration") {
image = liveMigrationItemImage;
}
return image;
}

handleProjectChange() {
transferStore.getTransfers();
endpointStore.getEndpoints({ showLoading: true });
Expand Down Expand Up @@ -450,9 +440,6 @@ class TransfersPage extends React.Component<{ history: any }, State> {
renderItemComponent={options => (
<TransferListItem
{...options}
getListItemImage={item => {
return this.getTransferItemImage(item);
}}
showScheduleIcon={this.isTransferScheduled(options.item.id)}
endpointType={id => {
const endpoint = this.getEndpoint(id);
Expand Down

0 comments on commit b9a4f0c

Please sign in to comment.