mirror of
https://github.com/aljazceru/lnd-manageJ.git
synced 2026-01-20 14:34:24 +01:00
Channel details: add rating
This commit is contained in:
committed by
Carsten Otto
parent
5c6bd92261
commit
e40a49de2f
@@ -119,6 +119,7 @@ public class DemoDataService extends UiDataService {
|
||||
"No flow in the past 35 days.");
|
||||
|
||||
public static final ChannelId CLOSED_CHANNEL = ChannelId.fromCompactForm("712345x124x1");
|
||||
public static final RatingDto RATING = RatingDto.fromModel(new Rating(700L));
|
||||
|
||||
public DemoDataService() {
|
||||
super();
|
||||
@@ -248,8 +249,8 @@ public class DemoDataService extends UiDataService {
|
||||
deriveFeeReport(channel.channelId()),
|
||||
deriveFlowReport(channel.channelId()),
|
||||
deriveRebalanceReport(channel.channelId()),
|
||||
warnings
|
||||
);
|
||||
warnings,
|
||||
RatingDto.fromModel(new Rating(channel.rating())));
|
||||
}
|
||||
|
||||
private ChannelDetailsDto createClosedChannelDetails(Set<String> warnings) {
|
||||
@@ -267,8 +268,8 @@ public class DemoDataService extends UiDataService {
|
||||
deriveFeeReport(CLOSED_CHANNEL),
|
||||
deriveFlowReport(CLOSED_CHANNEL),
|
||||
deriveRebalanceReport(CLOSED_CHANNEL),
|
||||
warnings
|
||||
);
|
||||
warnings,
|
||||
RATING);
|
||||
}
|
||||
|
||||
private static NodeDetailsDto createNodeDetails(NodeDto node, List<OpenChannelDto> channels, Set<String> warnings) {
|
||||
|
||||
@@ -116,7 +116,8 @@ public class UiDataServiceImpl extends UiDataService {
|
||||
details.feeReport(),
|
||||
details.flowReport(),
|
||||
details.rebalanceReport(),
|
||||
details.warnings()
|
||||
details.warnings(),
|
||||
details.rating()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import de.cotto.lndmanagej.controller.dto.FeeReportDto;
|
||||
import de.cotto.lndmanagej.controller.dto.FlowReportDto;
|
||||
import de.cotto.lndmanagej.controller.dto.OnChainCostsDto;
|
||||
import de.cotto.lndmanagej.controller.dto.PoliciesDto;
|
||||
import de.cotto.lndmanagej.controller.dto.RatingDto;
|
||||
import de.cotto.lndmanagej.controller.dto.RebalanceReportDto;
|
||||
import de.cotto.lndmanagej.model.ChannelId;
|
||||
import de.cotto.lndmanagej.model.OpenInitiator;
|
||||
@@ -26,7 +27,8 @@ public record ChannelDetailsDto(
|
||||
FeeReportDto feeReport,
|
||||
FlowReportDto flowReport,
|
||||
RebalanceReportDto rebalanceReport,
|
||||
Set<String> warnings
|
||||
Set<String> warnings,
|
||||
RatingDto rating
|
||||
) {
|
||||
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
</p>
|
||||
<p th:text="'Channel age: ' + ${channel.channelAge}+ ' days'"></p>
|
||||
<p th:text="'Capacity: ' + ${@formatter.formatNumber(channel.capacitySat)}+ ' sats'"></p>
|
||||
<p style="margin-bottom: 0" th:text="'Channel Rating: ' + ${@formatter.formatNumber(channel.rating.rating)}"></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -14,6 +14,7 @@ import de.cotto.lndmanagej.controller.dto.NodesAndChannelsWithWarningsDto;
|
||||
import de.cotto.lndmanagej.controller.dto.OnChainCostsDto;
|
||||
import de.cotto.lndmanagej.controller.dto.PoliciesDto;
|
||||
import de.cotto.lndmanagej.controller.dto.PolicyDto;
|
||||
import de.cotto.lndmanagej.controller.dto.RatingDto;
|
||||
import de.cotto.lndmanagej.controller.dto.RebalanceReportDto;
|
||||
import de.cotto.lndmanagej.model.BalanceInformation;
|
||||
import de.cotto.lndmanagej.model.Coins;
|
||||
@@ -297,8 +298,8 @@ class UiDataServiceImplTest {
|
||||
FeeReportDto.createFromModel(FEE_REPORT),
|
||||
FlowReportDto.createFromModel(FLOW_REPORT),
|
||||
RebalanceReportDto.createFromModel(REBALANCE_REPORT),
|
||||
Set.of(CHANNEL_NUM_UPDATES_WARNING.description())
|
||||
));
|
||||
Set.of(CHANNEL_NUM_UPDATES_WARNING.description()),
|
||||
RatingDto.fromModel(RATING)));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -4,6 +4,7 @@ import de.cotto.lndmanagej.controller.dto.FeeReportDto;
|
||||
import de.cotto.lndmanagej.controller.dto.FlowReportDto;
|
||||
import de.cotto.lndmanagej.controller.dto.OnChainCostsDto;
|
||||
import de.cotto.lndmanagej.controller.dto.PoliciesDto;
|
||||
import de.cotto.lndmanagej.controller.dto.RatingDto;
|
||||
import de.cotto.lndmanagej.controller.dto.RebalanceReportDto;
|
||||
import de.cotto.lndmanagej.model.OpenInitiator;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -15,6 +16,7 @@ import static de.cotto.lndmanagej.model.FlowReportFixtures.FLOW_REPORT;
|
||||
import static de.cotto.lndmanagej.model.OnChainCostsFixtures.ON_CHAIN_COSTS;
|
||||
import static de.cotto.lndmanagej.model.PolicyFixtures.POLICIES_FOR_LOCAL_CHANNEL;
|
||||
import static de.cotto.lndmanagej.model.PubkeyFixtures.PUBKEY;
|
||||
import static de.cotto.lndmanagej.model.RatingFixtures.RATING;
|
||||
import static de.cotto.lndmanagej.model.RebalanceReportFixtures.REBALANCE_REPORT;
|
||||
import static de.cotto.lndmanagej.model.warnings.ChannelWarningsFixtures.CHANNEL_WARNINGS;
|
||||
import static de.cotto.lndmanagej.ui.dto.ChannelDetailsDtoFixture.CHANNEL_DETAILS_DTO;
|
||||
@@ -83,5 +85,10 @@ class ChannelDetailsDtoTest {
|
||||
void warnings() {
|
||||
assertThat(CHANNEL_DETAILS_DTO.warnings()).isEqualTo(CHANNEL_WARNINGS.descriptions());
|
||||
}
|
||||
|
||||
@Test
|
||||
void rating() {
|
||||
assertThat(CHANNEL_DETAILS_DTO.rating()).isEqualTo(RatingDto.fromModel(RATING));
|
||||
}
|
||||
// CPD-ON
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import de.cotto.lndmanagej.controller.dto.FeeReportDto;
|
||||
import de.cotto.lndmanagej.controller.dto.FlowReportDto;
|
||||
import de.cotto.lndmanagej.controller.dto.OnChainCostsDto;
|
||||
import de.cotto.lndmanagej.controller.dto.PoliciesDto;
|
||||
import de.cotto.lndmanagej.controller.dto.RatingDto;
|
||||
import de.cotto.lndmanagej.controller.dto.RebalanceReportDto;
|
||||
|
||||
import static de.cotto.lndmanagej.controller.dto.ChannelStatusDtoFixture.CHANNEL_STATUS_PUBLIC_OPEN;
|
||||
@@ -14,6 +15,7 @@ import static de.cotto.lndmanagej.model.OnChainCostsFixtures.ON_CHAIN_COSTS;
|
||||
import static de.cotto.lndmanagej.model.OpenInitiator.LOCAL;
|
||||
import static de.cotto.lndmanagej.model.PolicyFixtures.POLICIES_FOR_LOCAL_CHANNEL;
|
||||
import static de.cotto.lndmanagej.model.PubkeyFixtures.PUBKEY;
|
||||
import static de.cotto.lndmanagej.model.RatingFixtures.RATING;
|
||||
import static de.cotto.lndmanagej.model.RebalanceReportFixtures.REBALANCE_REPORT;
|
||||
import static de.cotto.lndmanagej.model.warnings.ChannelWarningsFixtures.CHANNEL_WARNINGS;
|
||||
import static de.cotto.lndmanagej.ui.dto.BalanceInformationModelFixture.BALANCE_INFORMATION_MODEL;
|
||||
@@ -35,6 +37,6 @@ public class ChannelDetailsDtoFixture {
|
||||
FeeReportDto.createFromModel(FEE_REPORT),
|
||||
FlowReportDto.createFromModel(FLOW_REPORT),
|
||||
RebalanceReportDto.createFromModel(REBALANCE_REPORT),
|
||||
CHANNEL_WARNINGS.descriptions()
|
||||
);
|
||||
CHANNEL_WARNINGS.descriptions(),
|
||||
RatingDto.fromModel(RATING));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user