From ef59366993be0085ac45796791c6567664849d64 Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Mon, 16 Dec 2024 07:38:45 -0500 Subject: [PATCH] * Removed totalByModule because the results were very verbose and not being used. (#39) * Removed duplicate GitSha for report metadata and cleaned up the model class. --- .../internal/report/js/InvertJsReportUtils.kt | 1 - .../tasks/ProjectMetadataCollector.kt | 5 ++-- .../js/CollectedStatTotalsJsReportModel.kt | 1 - .../invert/models/js/MetadataJsReportModel.kt | 25 +++++++++---------- .../invert/common/utils/FormattingUtils.kt | 2 +- .../navigation/NavigationComposables.kt | 2 +- 6 files changed, 16 insertions(+), 20 deletions(-) diff --git a/invert-gradle-plugin/src/main/kotlin/com/squareup/invert/internal/report/js/InvertJsReportUtils.kt b/invert-gradle-plugin/src/main/kotlin/com/squareup/invert/internal/report/js/InvertJsReportUtils.kt index 4e0850d..69fcbac 100644 --- a/invert-gradle-plugin/src/main/kotlin/com/squareup/invert/internal/report/js/InvertJsReportUtils.kt +++ b/invert-gradle-plugin/src/main/kotlin/com/squareup/invert/internal/report/js/InvertJsReportUtils.kt @@ -115,7 +115,6 @@ object InvertJsReportUtils { statMetadata.key to StatTotalAndMetadata( metadata = statMetadata, total = totalCount, - totalByModule = totalByModule, totalByOwner = ownerToTotalCount ) }.toMap() diff --git a/invert-gradle-plugin/src/main/kotlin/com/squareup/invert/internal/tasks/ProjectMetadataCollector.kt b/invert-gradle-plugin/src/main/kotlin/com/squareup/invert/internal/tasks/ProjectMetadataCollector.kt index 4a234ee..7254d97 100644 --- a/invert-gradle-plugin/src/main/kotlin/com/squareup/invert/internal/tasks/ProjectMetadataCollector.kt +++ b/invert-gradle-plugin/src/main/kotlin/com/squareup/invert/internal/tasks/ProjectMetadataCollector.kt @@ -52,14 +52,13 @@ object ProjectMetadataCollector { return MetadataJsReportModel( currentTime = time.epochSecond, - currentTimeStr = formatter.format(time), - currentTimezoneId = timeZoneId, + currentTimeFormatted = formatter.format(time), + timezoneId = timeZoneId, latestCommitTime = latestCommitTimestamp, latestCommitTimeFormatted = formatter.format(Instant.ofEpochSecond(latestCommitTimestamp)), latestCommitGitSha = currentBranchHash, branchName = currentBranch, tagName = currentTag, - latestCommitSha = currentBranchHash, remoteRepoGit = remoteGitRepoUrl, remoteRepoUrl = remoteRepoUrl, artifactRepositories = repoUrls, diff --git a/invert-models/src/commonMain/kotlin/com/squareup/invert/models/js/CollectedStatTotalsJsReportModel.kt b/invert-models/src/commonMain/kotlin/com/squareup/invert/models/js/CollectedStatTotalsJsReportModel.kt index e6bc3a9..fc829f8 100644 --- a/invert-models/src/commonMain/kotlin/com/squareup/invert/models/js/CollectedStatTotalsJsReportModel.kt +++ b/invert-models/src/commonMain/kotlin/com/squareup/invert/models/js/CollectedStatTotalsJsReportModel.kt @@ -15,7 +15,6 @@ data class CollectedStatTotalsJsReportModel( data class StatTotalAndMetadata( val metadata: StatMetadata, val total: Int, - val totalByModule: Map, val totalByOwner: Map, ) diff --git a/invert-models/src/commonMain/kotlin/com/squareup/invert/models/js/MetadataJsReportModel.kt b/invert-models/src/commonMain/kotlin/com/squareup/invert/models/js/MetadataJsReportModel.kt index bae3f17..1965d34 100644 --- a/invert-models/src/commonMain/kotlin/com/squareup/invert/models/js/MetadataJsReportModel.kt +++ b/invert-models/src/commonMain/kotlin/com/squareup/invert/models/js/MetadataJsReportModel.kt @@ -10,17 +10,16 @@ import kotlinx.serialization.Serializable */ @Serializable data class MetadataJsReportModel( - val currentTime: Long, - val currentTimeStr: String, - val currentTimezoneId: String, - val latestCommitSha: GitSha, - val latestCommitTime: Long, - val latestCommitTimeFormatted: String, - val latestCommitGitSha: GitSha?, - val branchName: GitBranch?, - val tagName: GitTag?, - val remoteRepoGit: String, - val remoteRepoUrl: String, - val artifactRepositories: List, - val buildSystem: BuildSystem, + val artifactRepositories: List, + val branchName: GitBranch?, + val buildSystem: BuildSystem, + val currentTime: Long, + val currentTimeFormatted: String, + val latestCommitGitSha: GitSha, + val latestCommitTime: Long, + val latestCommitTimeFormatted: String, + val tagName: GitTag?, + val timezoneId: String, + val remoteRepoGit: String, + val remoteRepoUrl: String, ) diff --git a/invert-report/src/jsMain/kotlin/com/squareup/invert/common/utils/FormattingUtils.kt b/invert-report/src/jsMain/kotlin/com/squareup/invert/common/utils/FormattingUtils.kt index a162935..82c2c19 100644 --- a/invert-report/src/jsMain/kotlin/com/squareup/invert/common/utils/FormattingUtils.kt +++ b/invert-report/src/jsMain/kotlin/com/squareup/invert/common/utils/FormattingUtils.kt @@ -30,7 +30,7 @@ object FormattingUtils { } ${dateTime.dayOfMonth}, ${dateTime.year} at " + "${dateTime.hour.toString().padStart(2, '0')}:${ dateTime.minute.toString().padStart(2, '0') - }:${dateTime.second.toString().padStart(2, '0')} ($currentTimezoneId)" + }:${dateTime.second.toString().padStart(2, '0')} ($timezoneId)" return formattedDate } diff --git a/invert-report/src/jsMain/kotlin/navigation/NavigationComposables.kt b/invert-report/src/jsMain/kotlin/navigation/NavigationComposables.kt index 21ea714..96e8d77 100644 --- a/invert-report/src/jsMain/kotlin/navigation/NavigationComposables.kt +++ b/invert-report/src/jsMain/kotlin/navigation/NavigationComposables.kt @@ -141,7 +141,7 @@ fun LeftNavigationComposable( } } Br() - metadata.latestCommitSha.let { currentBranchHash -> + metadata.latestCommitGitSha.let { currentBranchHash -> Text("Commit ") A(href = metadata.remoteRepoUrl + "/tree/${currentBranchHash}", attrs = { target(Blank) }) { Text(currentBranchHash.substring(0, 7))