Skip to content

Commit

Permalink
Merge pull request #1 from mssusnjar/master
Browse files Browse the repository at this point in the history
Adding 'Previous Role' to the reconfiguration text (Deployed replica case)
  • Loading branch information
vpavlovicMSFT authored Nov 26, 2024
2 parents 922b6c4 + c65a6f9 commit 2c83b09
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
17 changes: 12 additions & 5 deletions src/SfxWeb/src/app/Models/DataModels/DeployedReplica.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { IRawDeployedReplica, IRawPartition, IRawDeployedReplicaDetail, IRawLoad
import { DataService } from 'src/app/services/data.service';
import { DeployedServicePackage } from './DeployedServicePackage';
import { IdUtils } from 'src/app/Utils/IdUtils';
import { ServiceKindRegexes, SortPriorities } from 'src/app/Common/Constants';
import { ServiceKindRegexes, SortPriorities, UnicodeConstants } from 'src/app/Common/Constants';
import { TimeUtils } from 'src/app/Utils/TimeUtils';
import { IResponseMessageHandler, ResponseMessageHandlers } from 'src/app/Common/ResponseMessageHandlers';
import { HtmlUtils } from 'src/app/Utils/HtmlUtils';
Expand Down Expand Up @@ -73,11 +73,18 @@ export class DeployedReplica extends DataModelBase<IRawDeployedReplica> {
}

public get role(): string {
if (this.partition && this.partition.PartitionStatus === 'Reconfiguring') {
return `Reconfiguring - Target Role: ${this.raw.ReplicaRole}`;
}
const { ReconfigurationInformation, ReplicaRole } = this.raw;

return this.raw.ReplicaRole;
if (!this.partition || this.partition.PartitionStatus !== 'Reconfiguring') {
return ReplicaRole;
}

const PreviousReplicaRole = ReconfigurationInformation.PreviousConfigurationRole;
if (!PreviousReplicaRole || PreviousReplicaRole === 'None') {
return `Reconfiguring - Target Role: ${ReplicaRole}`;
}

return `Reconfiguring: ${PreviousReplicaRole} ${UnicodeConstants.RightArrow} ${ReplicaRole}`;
}

public get viewPath(): string {
Expand Down
3 changes: 1 addition & 2 deletions src/SfxWeb/src/app/Models/DataModels/Replica.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ export class ReplicaOnPartition extends DataModelBase<IRawReplicaOnPartition> {
return `Reconfiguring - Target Role: ${ReplicaRole}`;
}

const roleTransition = PreviousReplicaRole === ReplicaRole ? ReplicaRole : `${PreviousReplicaRole} ${UnicodeConstants.RightArrow} ${ReplicaRole}`;
return `Reconfiguring: ${roleTransition}`;
return `Reconfiguring: ${PreviousReplicaRole} ${UnicodeConstants.RightArrow} ${ReplicaRole}`;
}

public get currentRole(): string {
Expand Down
10 changes: 8 additions & 2 deletions src/SfxWeb/src/app/Models/RawDataTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -579,13 +579,21 @@ export interface IRawReplicaHealth extends IRawHealth {
InstanceId: string;
}

export interface IReconfigurationInformation {
PreviousConfigurationRole: string;
ReconfigurationPhase: string;
ReconfigurationType: string;
ReconfigurationStartTimeUtc: string;
}

export interface IRawDeployedReplica {
Address: string;
CodePackageName: string;
InstanceId: string;
LastInBuildDurationInSeconds: string;
ReplicaId: string;
PartitionId: string;
ReconfigurationInformation: IReconfigurationInformation;
ReplicaRole: string;
ReplicaStatus: string;
ServiceKind: string;
Expand All @@ -595,8 +603,6 @@ export interface IRawDeployedReplica {
ServicePackageActivationId: string;
}



export interface IRawDeployedReplicaDetail {
PartitionId: string;
InstanceId: string;
Expand Down

0 comments on commit 2c83b09

Please sign in to comment.