Skip to content

Commit

Permalink
Rename dependency attribute is_resolved to is_pinned
Browse files Browse the repository at this point in the history
Renaming the dependency attribute is_resolved to is_pinned. Output changes when we use is_resolved.

Reference: #634
  • Loading branch information
alok1304 committed Dec 30, 2024
1 parent 0a8ee86 commit ff2a84b
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 23 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
--------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const DependenciesTableCols: DepsColDef[] = [
},
{
headerName: "Resolved",
field: "is_resolved",
field: "is_pinned",
cellRenderer: TickRenderer,
maxWidth: 92,
},
Expand Down
4 changes: 2 additions & 2 deletions src/components/PackagesEntityDetails/DependencyEntity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const DependencyEntity = (props: DependencyEntityProps) => {
Optional
</Badge>
)}
{dependency.is_resolved && (
{dependency.is_pinned && (
<Badge pill bg="success">
<FontAwesomeIcon icon={faCheck} /> Resolved
</Badge>
Expand Down Expand Up @@ -86,7 +86,7 @@ const DependencyEntity = (props: DependencyEntityProps) => {
))}
</div>
<br />
{dependency.is_resolved && dependency.resolved_package && (
{dependency.is_pinned && dependency.resolved_package && (
<div>
Resolved package:
<ReactJson
Expand Down
6 changes: 3 additions & 3 deletions src/pages/DependencyInfoDash/DependencyInfoDash.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const DependencyInfoDash = () => {

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);
Expand Down Expand Up @@ -125,7 +125,7 @@ const DependencyInfoDash = () => {
"id",
"for_package_uid",
"is_runtime",
"is_resolved",
"is_pinned",
"is_optional",
"datasource_id",
"scope",
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/pages/Packages/Packages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -572,7 +572,7 @@ const Packages = () => {
Optional
</Badge>
)}
{dependency.is_resolved && (
{dependency.is_pinned && (
<Badge
pill
bg="success"
Expand Down
4 changes: 2 additions & 2 deletions src/pages/Packages/filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ export interface DatasourceFilter {
export interface DepFilterTag {
value: string;
label: string;
flag: "is_runtime" | "is_resolved" | "is_optional";
flag: "is_runtime" | "is_pinned" | "is_optional";
}

export const DepFilterTags: Record<
"RUNTIME" | "RESOLVED" | "OPTIONAL",
DepFilterTag
> = {
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 = [
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Packages/packageDefinitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/services/importedJsonTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}[];
Expand Down
4 changes: 2 additions & 2 deletions src/services/models/dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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: {
Expand Down
18 changes: 9 additions & 9 deletions tests/test-scans/packages_dependencies/expectedPackagesDeps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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/[email protected]?uuid=faa3b45c-2e04-4891-b854-52ed459a6b0a",
Expand All @@ -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/[email protected]?uuid=b2cf6831-b0eb-4a30-98c3-3dac9202d639",
Expand All @@ -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/[email protected]?uuid=1c719652-292f-419c-a7a4-164c39296661",
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit ff2a84b

Please sign in to comment.