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

Adding 'Previous Role' to the reconfiguration text #874

Merged
merged 9 commits into from
Jan 16, 2025
7 changes: 7 additions & 0 deletions src/SfxWeb/cypress/e2e/deployedReplica.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ context('deployed replica', () => {
checkCommand(1);

})

it('reconfiguration text', () => {
cy.intercept(apiUrl(`/Partitions/${partition}?*`), { fixture: 'deployed-replica/partition-reconfiguration.json' }).as('partition-reconfig');
cy.intercept(apiUrl(`/Nodes/${nodeName}/$/GetApplications/${appName}/$/GetReplicas?*`), { fixture: 'deployed-replica/view-replica-reconfiguration.json' }).as('replica-reconfig');

cy.get('[data-cy="tree-panel"]').contains('Reconfiguring: ActiveSecondary ➜ Primary');
})
})
})

Expand Down
8 changes: 8 additions & 0 deletions src/SfxWeb/cypress/e2e/replica.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ context('replica', () => {
});

})

it('view reconfiguration text', () => {
addRoute("partitionInfo", "replica-page/stateful-partition-reconfiguration-info.json", apiUrl(`${baseUrl}?*`))
addRoute("replicaInfo", "replica-page/stateful-replica-reconfiguration.json", apiUrl(`${baseUrl}/$/GetReplicas/${replicaId}?*`))
cy.wait(waitRequest)

cy.get('[data-cy="tree-panel"]').contains('Reconfiguring: ActiveSecondary ➜ Primary');
})
})

describe("stateless", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"ServiceKind": "Stateful",
"PartitionInformation": {
"ServicePartitionKind": "Int64Range",
"Id": "41fb6918-986b-4b6d-bff6-0495b114c720",
"LowKey": "2",
"HighKey": "1844674407370955163"
},
"TargetReplicaSetSize": 3,
"MinReplicaSetSize": 2,
"HealthState": "Ok",
"PartitionStatus": "Reconfiguring",
"LastQuorumLossDurationInSeconds": "0",
"CurrentConfigurationEpoch": {
"ConfigurationVersion": "94489280512",
"DataLossVersion": "132399270145364138"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[
{
"ServiceKind": "Stateful",
"ServiceName": "fabric:/VisualObjectsApplicationType/VisualObjects.ActorService",
"ServiceTypeName": "VisualObjects.ActorServiceType",
"ServiceManifestVersion": "",
"ServiceManifestName": "VisualObjects.ActorServicePkg",
"CodePackageName": "Code",
"PartitionId": "41fb6918-986b-4b6d-bff6-0495b114c720",
"ReplicaId": "132431356665040624",
"ReplicaRole": "Primary",
"ReplicaStatus": "Ready",
"Address": "{\"Endpoints\":{\"\":\"10.0.0.6:20000+41fb6918-986b-4b6d-bff6-0495b114c720-132431356665040624\"}}",
"ServicePackageActivationId": "",
"HostProcessId": "4120",
"ReconfigurationInformation": {
"PreviousConfigurationRole": "ActiveSecondary",
"ReconfigurationPhase": "None",
"ReconfigurationType": "None",
"ReconfigurationStartTimeUtc": "0001-01-01T00:00:00.000Z"
}
}
]
3 changes: 3 additions & 0 deletions src/SfxWeb/cypress/fixtures/partition-page/replicas.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"ServiceKind": "Stateful",
"ReplicaId": "132422367823912071",
"ReplicaRole": "ActiveSecondary",
"PreviousReplicaRole": "None",
"ReplicaStatus": "Ready",
"HealthState": "Ok",
"Address": "",
Expand All @@ -15,6 +16,7 @@
"ServiceKind": "Stateful",
"ReplicaId": "132429154475414363",
"ReplicaRole": "Primary",
"PreviousReplicaRole": "None",
"ReplicaStatus": "Ready",
"HealthState": "Warning",
"Address": "{\"Endpoints\":{\"\":\"10.0.0.5:20001+28bfaf73-37b0-467d-9d47-d011b0aedbc0-132429154475414363\"}}",
Expand All @@ -25,6 +27,7 @@
"ServiceKind": "Stateful",
"ReplicaId": "132431356665040624",
"ReplicaRole": "ActiveSecondary",
"PreviousReplicaRole": "None",
"ReplicaStatus": "Ready",
"HealthState": "Error",
"Address": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"ServiceKind": "Stateful",
"ReplicaId": "132429154475414363",
"ReplicaRole": "IdleSecondary",
"PreviousReplicaRole": "None",
"ReplicaStatus": "Ready",
"HealthState": "Ok",
"Address": "{\"Endpoints\":{\"\":\"10.0.0.5:20001+28bfaf73-37b0-467d-9d47-d011b0aedbc0-132429154475414363\"}}",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"ServiceKind": "Stateful",
"PartitionInformation": {
"ServicePartitionKind": "Int64Range",
"Id": "28bfaf73-37b0-467d-9d47-d011b0aedbc0",
"LowKey": "-9223372036854775808",
"HighKey": "-7378697629483820647"
},
"TargetReplicaSetSize": 3,
"MinReplicaSetSize": 2,
"HealthState": "Ok",
"PartitionStatus": "Reconfiguring",
"LastQuorumLossDurationInSeconds": "0",
"CurrentConfigurationEpoch": {
"ConfigurationVersion": "85899345920",
"DataLossVersion": "132399270145364138"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"ServiceKind": "Stateful",
"ReplicaId": "132429154475414363",
"ReplicaRole": "Primary",
"PreviousReplicaRole": "None",
"ReplicaStatus": "Ready",
"HealthState": "Ok",
"Address": "{\"Endpoints\":{\"\":\"10.0.0.5:20001+28bfaf73-37b0-467d-9d47-d011b0aedbc0-132429154475414363\"}}",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"ServiceKind": "Stateful",
"ReplicaId": "132429154475414363",
"ReplicaRole": "Primary",
"PreviousReplicaRole": "ActiveSecondary",
"ReplicaStatus": "Ready",
"HealthState": "Ok",
"Address": "{\"Endpoints\":{\"\":\"10.0.0.5:20001+28bfaf73-37b0-467d-9d47-d011b0aedbc0-132429154475414363\"}}",
"NodeName": "_nt_1",
"LastInBuildDurationInSeconds": "8"
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"ServiceKind": "Stateful",
"ReplicaId": "132422367823912071",
"ReplicaRole": "ActiveSecondary",
"PreviousReplicaRole": "None",
"ReplicaStatus": "Ready",
"HealthState": "Ok",
"Address": "",
Expand All @@ -15,6 +16,7 @@
"ServiceKind": "Stateful",
"ReplicaId": "132429154475414363",
"ReplicaRole": "Primary",
"PreviousReplicaRole": "None",
"ReplicaStatus": "Ready",
"HealthState": "Ok",
"Address": "{\"Endpoints\":{\"\":\"10.0.0.5:20001+28bfaf73-37b0-467d-9d47-d011b0aedbc0-132429154475414363\"}}",
Expand All @@ -25,6 +27,7 @@
"ServiceKind": "Stateful",
"ReplicaId": "132431356665040624",
"ReplicaRole": "ActiveSecondary",
"PreviousReplicaRole": "None",
"ReplicaStatus": "Ready",
"HealthState": "Ok",
"Address": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"ServiceKind": "Stateful",
"ReplicaId": "132429154475414363",
"ReplicaRole": "Primary",
"PreviousReplicaRole": "None",
"ReplicaStatus": "Ready",
"HealthState": "Ok",
"Address": "{\"Endpoints\":{\"\":\"10.0.0.5:20001+<img src='1' onerror='window.alert(document.domain)'>-132429154475414363\"}}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"ServiceKind": "Stateful",
"ReplicaId": "132422367823912071",
"ReplicaRole": "ActiveSecondary",
"PreviousReplicaRole": "None",
"ReplicaStatus": "Ready",
"HealthState": "Ok",
"Address": "",
Expand All @@ -15,6 +16,7 @@
"ServiceKind": "Stateful",
"ReplicaId": "132429154475414363",
"ReplicaRole": "Primary",
"PreviousReplicaRole": "None",
"ReplicaStatus": "Ready",
"HealthState": "Ok",
"Address": "{\"Endpoints\":{\"\":\"10.0.0.5:20001+28bfaf73-37b0-467d-9d47-d011b0aedbc0-132429154475414363\"}}",
Expand All @@ -25,6 +27,7 @@
"ServiceKind": "Stateful",
"ReplicaId": "132431356665040624",
"ReplicaRole": "ActiveSecondary",
"PreviousReplicaRole": "None",
"ReplicaStatus": "Ready",
"HealthState": "Ok",
"Address": "",
Expand Down
4 changes: 4 additions & 0 deletions src/SfxWeb/src/app/Common/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,10 @@ export class RepairTaskMessages {
}
}

export class UnicodeConstants {
public static RightArrow = '\u279c';
}

export interface IPregeneratedColor {
color: string,
hex: string
Expand Down
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
27 changes: 23 additions & 4 deletions src/SfxWeb/src/app/Models/DataModels/Replica.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { DeployedReplicaDetail } from './DeployedReplica';
import { DataService } from 'src/app/services/data.service';
import { Partition } from './Partition';
import { HealthStateFilterFlags } from '../HealthChunkRawDataTypes';
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 } from 'src/app/Common/ResponseMessageHandlers';
import { HealthBase } from './HealthEvent';
Expand All @@ -27,7 +27,7 @@ export class ReplicaOnPartition extends DataModelBase<IRawReplicaOnPartition> {
displayValue: (value) => this.lastInBuildDuration
},
ReplicaRole: {
displayValue: (value) => this.role
displayValue: (value) => this.role
}
}
};
Expand Down Expand Up @@ -73,13 +73,32 @@ export class ReplicaOnPartition extends DataModelBase<IRawReplicaOnPartition> {
}

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

if (PartitionStatus !== 'Reconfiguring') {
return ReplicaRole;
}

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

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

public get currentRole(): string {
return this.raw.ReplicaRole;
}

public get previousRole(): string {
if (this.parent.raw.PartitionStatus === 'Reconfiguring' && this.raw.PreviousReplicaRole) {
return this.raw.PreviousReplicaRole;
}

return 'None';
}

public get viewPath(): string {
return RoutesService.getReplicaViewPath(this.parent.parent.parent.raw.TypeName, this.parent.parent.parent.id, this.parent.parent.id, this.parent.id, this.id);
}
Expand Down
11 changes: 9 additions & 2 deletions src/SfxWeb/src/app/Models/RawDataTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -582,13 +582,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 @@ -598,8 +606,6 @@ export interface IRawDeployedReplica {
ServicePackageActivationId: string;
}



export interface IRawDeployedReplicaDetail {
PartitionId: string;
InstanceId: string;
Expand Down Expand Up @@ -697,6 +703,7 @@ export interface IRawReplicaOnPartition {
HealthState: string;
ReplicaId: string;
ReplicaRole: string;
PreviousReplicaRole: string;
InstanceId: string;
LastInBuildDurationInSeconds: string;
NodeName: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
.replica-tile {
grid-column: span 2;
grid-row: span 2;

}

.expanded-tall {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class ReplicaTileComponent implements OnChanges {
descriptionName: 'Node',
copyTextValue: this.replica.raw.NodeName,
displayText: this.replica.raw.NodeName,
},
}
];

this.status = {
Expand Down
Loading