From ff2a84befd1c5734d4a27cb564b62e725443c758 Mon Sep 17 00:00:00 2001 From: Alok Kumar Date: Mon, 30 Dec 2024 23:42:02 +0530 Subject: [PATCH] Rename dependency attribute is_resolved to is_pinned Renaming the dependency attribute is_resolved to is_pinned. Output changes when we use is_resolved. Reference: https://github.com/aboutcode-org/scancode-workbench/issues/634 --- CHANGELOG.rst | 1 + .../DependenciesTableCols.ts.ts | 2 +- .../PackagesEntityDetails/DependencyEntity.tsx | 4 ++-- .../DependencyInfoDash/DependencyInfoDash.tsx | 6 +++--- src/pages/Packages/Packages.tsx | 4 ++-- src/pages/Packages/filters.ts | 4 ++-- src/pages/Packages/packageDefinitions.ts | 2 +- src/services/importedJsonTypes.ts | 2 +- src/services/models/dependencies.ts | 4 ++-- .../expectedPackagesDeps.ts | 18 +++++++++--------- 10 files changed, 24 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 4b188154..5bc48dca 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -12,6 +12,7 @@ Docs ~~~~~~~~~ - Update macOS installation steps by @OmkarPh in #631 +- Renamed the dependency attribute ``is_resolved`` to ``is_pinned``. See #634 [v4.0.3] - 2024-08-07 -------------------------- diff --git a/src/components/PackagesEntityDetails/DependenciesTableCols.ts.ts b/src/components/PackagesEntityDetails/DependenciesTableCols.ts.ts index 00dc8e25..523e4015 100644 --- a/src/components/PackagesEntityDetails/DependenciesTableCols.ts.ts +++ b/src/components/PackagesEntityDetails/DependenciesTableCols.ts.ts @@ -33,7 +33,7 @@ export const DependenciesTableCols: DepsColDef[] = [ }, { headerName: "Resolved", - field: "is_resolved", + field: "is_pinned", cellRenderer: TickRenderer, maxWidth: 92, }, diff --git a/src/components/PackagesEntityDetails/DependencyEntity.tsx b/src/components/PackagesEntityDetails/DependencyEntity.tsx index bf055e98..e0545d47 100644 --- a/src/components/PackagesEntityDetails/DependencyEntity.tsx +++ b/src/components/PackagesEntityDetails/DependencyEntity.tsx @@ -37,7 +37,7 @@ const DependencyEntity = (props: DependencyEntityProps) => { Optional )} - {dependency.is_resolved && ( + {dependency.is_pinned && ( Resolved @@ -86,7 +86,7 @@ const DependencyEntity = (props: DependencyEntityProps) => { ))}
- {dependency.is_resolved && dependency.resolved_package && ( + {dependency.is_pinned && dependency.resolved_package && (
Resolved package: { packageTypeSummary.packageTypeDetails.total += deps.length; packageTypeSummary.resolved += deps.reduce((counter, curr) => { - return counter + (curr.is_resolved ? 1 : 0); + return counter + (curr.is_pinned ? 1 : 0); }, 0); packageTypeSummary.runtime += deps.reduce((counter, curr) => { return counter + (curr.is_runtime ? 1 : 0); @@ -125,7 +125,7 @@ const DependencyInfoDash = () => { "id", "for_package_uid", "is_runtime", - "is_resolved", + "is_pinned", "is_optional", "datasource_id", "scope", @@ -145,7 +145,7 @@ const DependencyInfoDash = () => { // Prepare chart for resolved dependencies const resolvedDependencies = dependencies.map((dependency) => - dependency.getDataValue("is_resolved") ? "Resolved" : "Unresolved" + dependency.getDataValue("is_pinned") ? "Resolved" : "Unresolved" ); const { chartData: resolvedDependenciesChartData } = formatPieChartData(resolvedDependencies); diff --git a/src/pages/Packages/Packages.tsx b/src/pages/Packages/Packages.tsx index cb46b979..a4ff2918 100644 --- a/src/pages/Packages/Packages.tsx +++ b/src/pages/Packages/Packages.tsx @@ -202,7 +202,7 @@ const Packages = () => { scope: dependencyInfo.scope as DEPENDENCY_SCOPES, is_runtime: dependencyInfo.is_runtime, is_optional: dependencyInfo.is_optional, - is_resolved: dependencyInfo.is_resolved, + is_pinned: dependencyInfo.is_pinned, resolved_package: dependencyInfo.resolved_package || {}, dependency_uid: dependencyInfo.dependency_uid, for_package_uid: dependencyInfo.for_package_uid, @@ -572,7 +572,7 @@ const Packages = () => { Optional )} - {dependency.is_resolved && ( + {dependency.is_pinned && ( = { RUNTIME: { value: "runtime", label: "Runtime", flag: "is_runtime" }, - RESOLVED: { value: "resolved", label: "Resolved", flag: "is_resolved" }, + RESOLVED: { value: "resolved", label: "Resolved", flag: "is_pinned" }, OPTIONAL: { value: "optional", label: "Optional", flag: "is_optional" }, }; export const DepFilterTagsList = [ diff --git a/src/pages/Packages/packageDefinitions.ts b/src/pages/Packages/packageDefinitions.ts index 75d5547a..618e099c 100644 --- a/src/pages/Packages/packageDefinitions.ts +++ b/src/pages/Packages/packageDefinitions.ts @@ -6,7 +6,7 @@ export interface DependencyDetails { scope: DEPENDENCY_SCOPES; is_runtime: boolean; is_optional: boolean; - is_resolved: boolean; + is_pinned: boolean; resolved_package: unknown; dependency_uid: string; for_package_uid: string | null; diff --git a/src/services/importedJsonTypes.ts b/src/services/importedJsonTypes.ts index 938b0db6..0f3a24e7 100644 --- a/src/services/importedJsonTypes.ts +++ b/src/services/importedJsonTypes.ts @@ -181,7 +181,7 @@ export interface Resource { scope: string | null; is_runtime: boolean; is_optional: boolean; - is_resolved: boolean; + is_pinned: boolean; resolved_package: unknown; extra_data: unknown; }[]; diff --git a/src/services/models/dependencies.ts b/src/services/models/dependencies.ts index 5e6e3ec6..971ad452 100644 --- a/src/services/models/dependencies.ts +++ b/src/services/models/dependencies.ts @@ -24,7 +24,7 @@ export interface DependenciesAttributes { scope: string; is_runtime: boolean; is_optional: boolean; - is_resolved: boolean; + is_pinned: boolean; resolved_package: unknown; dependency_uid: string; for_package_uid: string; @@ -60,7 +60,7 @@ export default function dependenciesModel(sequelize: Sequelize) { scope: DataTypes.STRING, is_runtime: DataTypes.BOOLEAN, is_optional: DataTypes.BOOLEAN, - is_resolved: DataTypes.BOOLEAN, + is_pinned: DataTypes.BOOLEAN, resolved_package: jsonDataType("resolved_package", {}), dependency_uid: DataTypes.STRING, for_package_uid: { diff --git a/tests/test-scans/packages_dependencies/expectedPackagesDeps.ts b/tests/test-scans/packages_dependencies/expectedPackagesDeps.ts index 9370e748..cc20357b 100644 --- a/tests/test-scans/packages_dependencies/expectedPackagesDeps.ts +++ b/tests/test-scans/packages_dependencies/expectedPackagesDeps.ts @@ -150,7 +150,7 @@ export const PackageDepsSamples: { scope: DEPENDENCY_SCOPES.DEVELOPMENT, is_runtime: false, is_optional: true, - is_resolved: true, + is_pinned: true, resolved_package: {}, extra_data: { is_editable: false, @@ -171,7 +171,7 @@ export const PackageDepsSamples: { scope: DEPENDENCY_SCOPES.DEVELOPMENT, is_runtime: false, is_optional: true, - is_resolved: true, + is_pinned: true, resolved_package: {}, extra_data: { is_editable: false, @@ -192,7 +192,7 @@ export const PackageDepsSamples: { scope: DEPENDENCY_SCOPES.DEVELOPMENT, is_runtime: false, is_optional: true, - is_resolved: true, + is_pinned: true, resolved_package: {}, extra_data: { is_editable: false, @@ -332,7 +332,7 @@ export const PackageDepsSamples: { scope: DEPENDENCY_SCOPES.DEVELOPMENT, is_runtime: false, is_optional: true, - is_resolved: true, + is_pinned: true, resolved_package: {}, dependency_uid: "pkg:pypi/aboutcode-toolkit@6.0.0?uuid=faa3b45c-2e04-4891-b854-52ed459a6b0a", @@ -347,7 +347,7 @@ export const PackageDepsSamples: { scope: DEPENDENCY_SCOPES.DEVELOPMENT, is_runtime: false, is_optional: true, - is_resolved: true, + is_pinned: true, resolved_package: {}, dependency_uid: "pkg:pypi/py@1.10.0?uuid=b2cf6831-b0eb-4a30-98c3-3dac9202d639", @@ -362,7 +362,7 @@ export const PackageDepsSamples: { scope: DEPENDENCY_SCOPES.DEVELOPMENT, is_runtime: false, is_optional: true, - is_resolved: true, + is_pinned: true, resolved_package: {}, dependency_uid: "pkg:pypi/pytest@6.2.4?uuid=1c719652-292f-419c-a7a4-164c39296661", @@ -442,7 +442,7 @@ export const PackageDepsSamples: { scope: DEPENDENCY_SCOPES.DEVELOPMENT, is_runtime: false, is_optional: true, - is_resolved: true, + is_pinned: true, resolved_package: {}, extra_data: { is_editable: false, @@ -463,7 +463,7 @@ export const PackageDepsSamples: { scope: DEPENDENCY_SCOPES.DEVELOPMENT, is_runtime: false, is_optional: true, - is_resolved: true, + is_pinned: true, resolved_package: {}, extra_data: { is_editable: false, @@ -484,7 +484,7 @@ export const PackageDepsSamples: { scope: DEPENDENCY_SCOPES.DEVELOPMENT, is_runtime: false, is_optional: true, - is_resolved: true, + is_pinned: true, resolved_package: {}, extra_data: { is_editable: false,