Revert "feat(graph): show next steps for successful migrations" (#30933)

This reverts commit 307c45542a10b6e273d090a768175739690f2663.

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
This commit is contained in:
Jack Hsu 2025-04-29 17:09:19 -04:00 committed by GitHub
parent 624f0359e3
commit 6451f66492
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 60 deletions

View File

@ -12,13 +12,7 @@ import {
PlayIcon, PlayIcon,
} from '@heroicons/react/24/outline'; } from '@heroicons/react/24/outline';
import { Pill } from '@nx/graph-internal/ui-project-details'; import { Pill } from '@nx/graph-internal/ui-project-details';
import { import { useState, forwardRef, useImperativeHandle, useEffect } from 'react';
useState,
forwardRef,
useImperativeHandle,
useEffect,
type ReactNode,
} from 'react';
import { AnimatePresence, motion } from 'framer-motion'; import { AnimatePresence, motion } from 'framer-motion';
export interface MigrationCardHandle { export interface MigrationCardHandle {
@ -27,30 +21,6 @@ export interface MigrationCardHandle {
toggle: () => void; toggle: () => void;
} }
function convertUrlsToLinks(text: string): ReactNode[] {
const urlRegex = /(https?:\/\/[^\s]+)/g;
const parts = text.split(urlRegex);
const urls = text.match(urlRegex) || [];
const result: ReactNode[] = [];
for (let i = 0; i < parts.length; i++) {
if (urls[i - 1]) {
result.push(
<a
key={i}
href={urls[i - 1]}
target="_blank"
className="text-blue-500 hover:underline"
>
{urls[i - 1]}
</a>
);
} else if (parts[i]) {
result.push(parts[i]);
}
}
return result;
}
export const MigrationCard = forwardRef< export const MigrationCard = forwardRef<
MigrationCardHandle, MigrationCardHandle,
{ {
@ -230,23 +200,6 @@ export const MigrationCard = forwardRef<
)} )}
</div> </div>
</div> </div>
{succeeded && migrationResult?.nextSteps?.length ? (
<div className="pt-2">
<div className="my-2 border-t border-slate-200 dark:border-slate-700/60" />
<span className="pb-2 text-sm font-bold">
More Information & Next Steps
</span>
<ul className="list-inside list-disc pl-2">
{migrationResult?.nextSteps.map((step, idx) => (
<li key={idx} className="text-sm">
{convertUrlsToLinks(step)}
</li>
))}
</ul>
<p></p>
</div>
) : null}
<div className="mt-4 flex justify-end gap-2"> <div className="mt-4 flex justify-end gap-2">
<button <button
onClick={() => onViewImplementation()} onClick={() => onViewImplementation()}
@ -313,7 +266,7 @@ export const MigrationCard = forwardRef<
onFileClick(file); onFileClick(file);
}} }}
> >
<code>{file.path}</code> {file.path}
</li> </li>
); );
})} })}

View File

@ -242,7 +242,7 @@ export const PendingApproval: Story = {
{ {
id: 'migration-1', id: 'migration-1',
name: 'migration-1', name: 'migration-1',
description: 'This is a test migration', description: 'Migrate 1',
version: '1.0.0', version: '1.0.0',
package: 'nx', package: 'nx',
implementation: './src/migrations/migration-1.ts', implementation: './src/migrations/migration-1.ts',
@ -250,7 +250,7 @@ export const PendingApproval: Story = {
{ {
id: 'migration-2', id: 'migration-2',
name: 'migration-2', name: 'migration-2',
description: 'This is a test migration', description: 'Migrate 2',
version: '1.0.1', version: '1.0.1',
package: '@nx/react', package: '@nx/react',
implementation: './src/migrations/migration-2.ts', implementation: './src/migrations/migration-2.ts',
@ -271,14 +271,12 @@ export const PendingApproval: Story = {
type: 'successful', type: 'successful',
changedFiles: [], changedFiles: [],
ref: '123', ref: '123',
nextSteps: [],
}, },
'migration-2': { 'migration-2': {
name: 'migration-2', name: 'migration-2',
type: 'successful', type: 'successful',
changedFiles: [{ path: 'foo.txt', type: 'CREATE' }], changedFiles: [{ path: 'foo.txt', type: 'CREATE' }],
ref: '124', ref: '124',
nextSteps: ['Check something: https://nx.dev/docs', 'Check another thing: https://nx.dev/docs'],
}, },
}, },
targetVersion: '20.3.2', targetVersion: '20.3.2',

View File

@ -27,7 +27,6 @@ export type SuccessfulMigration = {
name: string; name: string;
changedFiles: Omit<FileChange, 'content'>[]; changedFiles: Omit<FileChange, 'content'>[];
ref: string; ref: string;
nextSteps?: string[];
}; };
export type FailedMigration = { export type FailedMigration = {
@ -136,7 +135,7 @@ export async function runSingleMigration(
// 2. Bundled into Console, so the version is fixed to what we build Console with. // 2. Bundled into Console, so the version is fixed to what we build Console with.
const updatedMigrateModule = await import('./migrate.js'); const updatedMigrateModule = await import('./migrate.js');
const { changes: fileChanges, nextSteps } = const { changes: fileChanges } =
await updatedMigrateModule.runNxOrAngularMigration( await updatedMigrateModule.runNxOrAngularMigration(
workspacePath, workspacePath,
migration, migration,
@ -160,8 +159,7 @@ export async function runSingleMigration(
path: change.path, path: change.path,
type: change.type, type: change.type,
})), })),
gitRefAfter, gitRefAfter
nextSteps
) )
); );
@ -236,8 +234,7 @@ export function modifyMigrationsJsonMetadata(
export function addSuccessfulMigration( export function addSuccessfulMigration(
id: string, id: string,
fileChanges: Omit<FileChange, 'content'>[], fileChanges: Omit<FileChange, 'content'>[],
ref: string, ref: string
nextSteps: string[]
) { ) {
return ( return (
migrationsJsonMetadata: MigrationsJsonMetadata migrationsJsonMetadata: MigrationsJsonMetadata
@ -253,7 +250,6 @@ export function addSuccessfulMigration(
name: id, name: id,
changedFiles: fileChanges, changedFiles: fileChanges,
ref, ref,
nextSteps,
}, },
}; };
return copied; return copied;