New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFE] Dynamic Reports - Incident: Add line numbers to the codeSnip
string (right-aligned)
#124
Comments
Note that @shawn-hurley mentioned earlier that the codeSnip should start 10 lines above, but IMO the UI should not hard-code the number of context lines here so that we can decide to have the analyzer provide more/less context in the future without a UI change (also, if the offending line is within the first 10 lines of the file we need to reason about that in the UI) |
Seems like a more holistic and clearer solution would be for the analyzer to prefix each line with the line number. That would provide value when using the analyzer outside of tackle (CLI) and when using the analysis data outside of the UI (like hub api). Also, removing the need for arithmetic to identify the offending line number would be less brittle. |
For posterity, from discussion on slack with @jortel: If we prefix each line with the line number in the To be clear, we need this:
and NOT this:
(see the difference in the first 9 lines) |
codeSnip
codeSnip
string (right-aligned)
(I just realized I could still strip left-aligned numbers out by using the length of the last line number for all lines, but I still have a preference for right-aligned numbers as that's what editors tend to use and it looks nicer) |
I am no opposed to this, and it does make sense we will do the same logic, but if the context number is configurable, it makes sense for that logic to live there. Note to anyone implementing this on the analyzer-lsp I am pretty sure most of our stuff is 0 indexed not 1. |
@pranavgaikwad I think we can move this to the analyzer then (as it seems all the work is on our side now), and I believe that we should align to Demo E. What are your thoughts? |
@shawn-hurley do you mean the |
What our providers return is 0 indexed, I assume that you would want that to be 1 indexed. just means we have to add by one |
Yeah I assume API users would want the same, to match what they see in their code editor |
Created issue to track, adding it on Demo E |
…ode snippet viewer, adjust for hub change from IssueReport to AppReport (#966) Initial implementation of the `FileIncidentsDetailModal`, which shows incident details within a file. Some details are incomplete pending hub implementation and design review, and will be finished outside the scope of this PR. ![Screenshot 2023-06-07 at 3 01 24 PM](https://github.com/konveyor/tackle2-ui/assets/811963/7d0025bc-73d6-434c-b133-fbec3dc212f1) ![Screenshot 2023-06-07 at 3 01 30 PM](https://github.com/konveyor/tackle2-ui/assets/811963/c496a11c-bc3c-42f6-ad55-f695b9ce850c) Full flow to reach this modal: * On the Issues page, click the number of affected applications for an issue (RuleReport) * On the Affected Applications page, click an application (AppReport) to open the drawer * In the drawer's Affected Files tab, click a file (FileReport) ![qi904nHhzs](https://github.com/konveyor/tackle2-ui/assets/811963/0b2276e0-3244-42fd-adcf-2036d6a38792) This PR: * Replaces the `AnalysisIssueReport` with `AnalysisAppReport` to match new hub changes (see konveyor/tackle2-hub#368). * The AppReport object's top level properties are Application properties, and issue properties are now nested under `issue`. This aligns better with the "Affected applications" page we are using these objects for and better supports the sorting/filtering on that page. * Changes the hub path `/analyses/report/issues` to `/analyses/report/applications` to match. * Changes the Affected Applications page / table / drawer code to use the new type and naming * Adds `incidents` and `effort` columns to the Affected Applications table * Re-enables sorting on this table now that it is working in the hub * Removes the logic to manually cross-reference an IssueReport with an Application, because now the AppReport contains the application properties we need. * Adds the `AnalysisIncident` type (corresponds to the hub type `Incident`). * This is the actual incident from the analyzer including line number, code snippet and markdown message. * Adds a hub request function `getIncidents` and query `useFetchIncidents` for fetching these. * Adds the new `FileIncidentsDetailModal` component which is opened by clicking a file in the `IssueAffectedFilesTable`. * At the top level, this modal only fetches the first 5 incidents for the file (useFetchIncidents is used without any table hooks, so the `hubRequestParams` are passed in by hand to filter by file and limit to 5 results instead of using `getHubRequestParams`). * Tabs are dynamically rendered for each of the first 5 incidents. In each of these tabs, a grid is rendered with details including the `IncidentCodeSnipViewer` (see below). * Installs the `react-markdown` package for rendering the incident message. Adds a custom object in `client/src/app/components/markdown-pf-components.tsx` for configuring react-markdown to use PF-specific components for common HTML tags. * A 6th tab for "All incidents" is rendered if there are more than 5 total incidents. In this tab, the `FileAllIncidentsTable` is rendered (see below). * Adds the `IncidentCodeSnipViewer` component, which renders the `incident.codeSnip` in PatternFly's CodeEditor component in read-only mode with a marker (red squiggly underline and icon) on the affected line. * Installs required packages `@patternfly/react-code-editor`, `monaco-editor`, `react-monaco-editor`, and `monaco-editor-webpack-plugin`. See https://github.com/patternfly/patternfly-react/blob/main/packages/react-code-editor/README.md#usage * Configures `monaco-editor-webpack-plugin`-related loaders in webpack config. See https://github.com/microsoft/monaco-editor/tree/main/webpack-plugin#using * Includes logic to reason about relative and absolute line numbers. The CodeEditor methods deal with relative line numbers (1 is the first line in the codeSnip string, even if the codeSnip starts on line 15 of the source file), and the hub and display logic deal with absolute line numbers (the line numbers from the source file). * Note that for now, the analyzer/hub does not indicate what line the codeSnip starts on. This PR hard-codes `codeSnipStartLine = 1`, and we will need to later add logic to strip line numbers out of the codeSnip string and determine this number from them (see konveyor/enhancements#124) * Includes a commented-out `language` prop, which can be set to enable syntax highlighting. * Note that for now, the analyzer/hub does not indicate what language the codeSnip is written in (see konveyor/enhancements#125). We will need to identify this and use it for the `language` prop, and then we may want to limit the UI to a static list of supported languages and configure the monaco webpack plugin to only include resources for those languages in the build. See https://github.com/microsoft/monaco-editor/tree/main/webpack-plugin#options * Includes some miscellaneous code cleanup in files surrounding the Issues and Affected Apps pages. * Adds a `noMargin` prop to `SimplePagination` for rendering it inline somewhere (it is aligned with column headers in the "all incidents" table as per the mockup) * Adds a `forceNumRenderedColumns` argument to `useTableControlProps` to override the automatically calculated `numRenderedColumns` when using custom `colSpan`s in the table (for adding this extra pagination column header that overlaps the last data column) * Includes some TODO comments to be addressed in future PRs.
…ode snippet viewer, adjust for hub change from IssueReport to AppReport (konveyor#966) Initial implementation of the `FileIncidentsDetailModal`, which shows incident details within a file. Some details are incomplete pending hub implementation and design review, and will be finished outside the scope of this PR. ![Screenshot 2023-06-07 at 3 01 24 PM](https://github.com/konveyor/tackle2-ui/assets/811963/7d0025bc-73d6-434c-b133-fbec3dc212f1) ![Screenshot 2023-06-07 at 3 01 30 PM](https://github.com/konveyor/tackle2-ui/assets/811963/c496a11c-bc3c-42f6-ad55-f695b9ce850c) Full flow to reach this modal: * On the Issues page, click the number of affected applications for an issue (RuleReport) * On the Affected Applications page, click an application (AppReport) to open the drawer * In the drawer's Affected Files tab, click a file (FileReport) ![qi904nHhzs](https://github.com/konveyor/tackle2-ui/assets/811963/0b2276e0-3244-42fd-adcf-2036d6a38792) This PR: * Replaces the `AnalysisIssueReport` with `AnalysisAppReport` to match new hub changes (see konveyor/tackle2-hub#368). * The AppReport object's top level properties are Application properties, and issue properties are now nested under `issue`. This aligns better with the "Affected applications" page we are using these objects for and better supports the sorting/filtering on that page. * Changes the hub path `/analyses/report/issues` to `/analyses/report/applications` to match. * Changes the Affected Applications page / table / drawer code to use the new type and naming * Adds `incidents` and `effort` columns to the Affected Applications table * Re-enables sorting on this table now that it is working in the hub * Removes the logic to manually cross-reference an IssueReport with an Application, because now the AppReport contains the application properties we need. * Adds the `AnalysisIncident` type (corresponds to the hub type `Incident`). * This is the actual incident from the analyzer including line number, code snippet and markdown message. * Adds a hub request function `getIncidents` and query `useFetchIncidents` for fetching these. * Adds the new `FileIncidentsDetailModal` component which is opened by clicking a file in the `IssueAffectedFilesTable`. * At the top level, this modal only fetches the first 5 incidents for the file (useFetchIncidents is used without any table hooks, so the `hubRequestParams` are passed in by hand to filter by file and limit to 5 results instead of using `getHubRequestParams`). * Tabs are dynamically rendered for each of the first 5 incidents. In each of these tabs, a grid is rendered with details including the `IncidentCodeSnipViewer` (see below). * Installs the `react-markdown` package for rendering the incident message. Adds a custom object in `client/src/app/components/markdown-pf-components.tsx` for configuring react-markdown to use PF-specific components for common HTML tags. * A 6th tab for "All incidents" is rendered if there are more than 5 total incidents. In this tab, the `FileAllIncidentsTable` is rendered (see below). * Adds the `IncidentCodeSnipViewer` component, which renders the `incident.codeSnip` in PatternFly's CodeEditor component in read-only mode with a marker (red squiggly underline and icon) on the affected line. * Installs required packages `@patternfly/react-code-editor`, `monaco-editor`, `react-monaco-editor`, and `monaco-editor-webpack-plugin`. See https://github.com/patternfly/patternfly-react/blob/main/packages/react-code-editor/README.md#usage * Configures `monaco-editor-webpack-plugin`-related loaders in webpack config. See https://github.com/microsoft/monaco-editor/tree/main/webpack-plugin#using * Includes logic to reason about relative and absolute line numbers. The CodeEditor methods deal with relative line numbers (1 is the first line in the codeSnip string, even if the codeSnip starts on line 15 of the source file), and the hub and display logic deal with absolute line numbers (the line numbers from the source file). * Note that for now, the analyzer/hub does not indicate what line the codeSnip starts on. This PR hard-codes `codeSnipStartLine = 1`, and we will need to later add logic to strip line numbers out of the codeSnip string and determine this number from them (see konveyor/enhancements#124) * Includes a commented-out `language` prop, which can be set to enable syntax highlighting. * Note that for now, the analyzer/hub does not indicate what language the codeSnip is written in (see konveyor/enhancements#125). We will need to identify this and use it for the `language` prop, and then we may want to limit the UI to a static list of supported languages and configure the monaco webpack plugin to only include resources for those languages in the build. See https://github.com/microsoft/monaco-editor/tree/main/webpack-plugin#options * Includes some miscellaneous code cleanup in files surrounding the Issues and Affected Apps pages. * Adds a `noMargin` prop to `SimplePagination` for rendering it inline somewhere (it is aligned with column headers in the "all incidents" table as per the mockup) * Adds a `forceNumRenderedColumns` argument to `useTableControlProps` to override the automatically calculated `numRenderedColumns` when using custom `colSpan`s in the table (for adding this extra pagination column header that overlaps the last data column) * Includes some TODO comments to be addressed in future PRs.
…ode snippet viewer, adjust for hub change from IssueReport to AppReport (konveyor#966) Initial implementation of the `FileIncidentsDetailModal`, which shows incident details within a file. Some details are incomplete pending hub implementation and design review, and will be finished outside the scope of this PR. ![Screenshot 2023-06-07 at 3 01 24 PM](https://github.com/konveyor/tackle2-ui/assets/811963/7d0025bc-73d6-434c-b133-fbec3dc212f1) ![Screenshot 2023-06-07 at 3 01 30 PM](https://github.com/konveyor/tackle2-ui/assets/811963/c496a11c-bc3c-42f6-ad55-f695b9ce850c) Full flow to reach this modal: * On the Issues page, click the number of affected applications for an issue (RuleReport) * On the Affected Applications page, click an application (AppReport) to open the drawer * In the drawer's Affected Files tab, click a file (FileReport) ![qi904nHhzs](https://github.com/konveyor/tackle2-ui/assets/811963/0b2276e0-3244-42fd-adcf-2036d6a38792) This PR: * Replaces the `AnalysisIssueReport` with `AnalysisAppReport` to match new hub changes (see konveyor/tackle2-hub#368). * The AppReport object's top level properties are Application properties, and issue properties are now nested under `issue`. This aligns better with the "Affected applications" page we are using these objects for and better supports the sorting/filtering on that page. * Changes the hub path `/analyses/report/issues` to `/analyses/report/applications` to match. * Changes the Affected Applications page / table / drawer code to use the new type and naming * Adds `incidents` and `effort` columns to the Affected Applications table * Re-enables sorting on this table now that it is working in the hub * Removes the logic to manually cross-reference an IssueReport with an Application, because now the AppReport contains the application properties we need. * Adds the `AnalysisIncident` type (corresponds to the hub type `Incident`). * This is the actual incident from the analyzer including line number, code snippet and markdown message. * Adds a hub request function `getIncidents` and query `useFetchIncidents` for fetching these. * Adds the new `FileIncidentsDetailModal` component which is opened by clicking a file in the `IssueAffectedFilesTable`. * At the top level, this modal only fetches the first 5 incidents for the file (useFetchIncidents is used without any table hooks, so the `hubRequestParams` are passed in by hand to filter by file and limit to 5 results instead of using `getHubRequestParams`). * Tabs are dynamically rendered for each of the first 5 incidents. In each of these tabs, a grid is rendered with details including the `IncidentCodeSnipViewer` (see below). * Installs the `react-markdown` package for rendering the incident message. Adds a custom object in `client/src/app/components/markdown-pf-components.tsx` for configuring react-markdown to use PF-specific components for common HTML tags. * A 6th tab for "All incidents" is rendered if there are more than 5 total incidents. In this tab, the `FileAllIncidentsTable` is rendered (see below). * Adds the `IncidentCodeSnipViewer` component, which renders the `incident.codeSnip` in PatternFly's CodeEditor component in read-only mode with a marker (red squiggly underline and icon) on the affected line. * Installs required packages `@patternfly/react-code-editor`, `monaco-editor`, `react-monaco-editor`, and `monaco-editor-webpack-plugin`. See https://github.com/patternfly/patternfly-react/blob/main/packages/react-code-editor/README.md#usage * Configures `monaco-editor-webpack-plugin`-related loaders in webpack config. See https://github.com/microsoft/monaco-editor/tree/main/webpack-plugin#using * Includes logic to reason about relative and absolute line numbers. The CodeEditor methods deal with relative line numbers (1 is the first line in the codeSnip string, even if the codeSnip starts on line 15 of the source file), and the hub and display logic deal with absolute line numbers (the line numbers from the source file). * Note that for now, the analyzer/hub does not indicate what line the codeSnip starts on. This PR hard-codes `codeSnipStartLine = 1`, and we will need to later add logic to strip line numbers out of the codeSnip string and determine this number from them (see konveyor/enhancements#124) * Includes a commented-out `language` prop, which can be set to enable syntax highlighting. * Note that for now, the analyzer/hub does not indicate what language the codeSnip is written in (see konveyor/enhancements#125). We will need to identify this and use it for the `language` prop, and then we may want to limit the UI to a static list of supported languages and configure the monaco webpack plugin to only include resources for those languages in the build. See https://github.com/microsoft/monaco-editor/tree/main/webpack-plugin#options * Includes some miscellaneous code cleanup in files surrounding the Issues and Affected Apps pages. * Adds a `noMargin` prop to `SimplePagination` for rendering it inline somewhere (it is aligned with column headers in the "all incidents" table as per the mockup) * Adds a `forceNumRenderedColumns` argument to `useTableControlProps` to override the automatically calculated `numRenderedColumns` when using custom `colSpan`s in the table (for adding this extra pagination column header that overlaps the last data column) * Includes some TODO comments to be addressed in future PRs. Signed-off-by: Mike Turley <mike.turley@alum.cs.umass.edu>
…ode snippet viewer, adjust for hub change from IssueReport to AppReport (konveyor#966) Initial implementation of the `FileIncidentsDetailModal`, which shows incident details within a file. Some details are incomplete pending hub implementation and design review, and will be finished outside the scope of this PR. ![Screenshot 2023-06-07 at 3 01 24 PM](https://github.com/konveyor/tackle2-ui/assets/811963/7d0025bc-73d6-434c-b133-fbec3dc212f1) ![Screenshot 2023-06-07 at 3 01 30 PM](https://github.com/konveyor/tackle2-ui/assets/811963/c496a11c-bc3c-42f6-ad55-f695b9ce850c) Full flow to reach this modal: * On the Issues page, click the number of affected applications for an issue (RuleReport) * On the Affected Applications page, click an application (AppReport) to open the drawer * In the drawer's Affected Files tab, click a file (FileReport) ![qi904nHhzs](https://github.com/konveyor/tackle2-ui/assets/811963/0b2276e0-3244-42fd-adcf-2036d6a38792) This PR: * Replaces the `AnalysisIssueReport` with `AnalysisAppReport` to match new hub changes (see konveyor/tackle2-hub#368). * The AppReport object's top level properties are Application properties, and issue properties are now nested under `issue`. This aligns better with the "Affected applications" page we are using these objects for and better supports the sorting/filtering on that page. * Changes the hub path `/analyses/report/issues` to `/analyses/report/applications` to match. * Changes the Affected Applications page / table / drawer code to use the new type and naming * Adds `incidents` and `effort` columns to the Affected Applications table * Re-enables sorting on this table now that it is working in the hub * Removes the logic to manually cross-reference an IssueReport with an Application, because now the AppReport contains the application properties we need. * Adds the `AnalysisIncident` type (corresponds to the hub type `Incident`). * This is the actual incident from the analyzer including line number, code snippet and markdown message. * Adds a hub request function `getIncidents` and query `useFetchIncidents` for fetching these. * Adds the new `FileIncidentsDetailModal` component which is opened by clicking a file in the `IssueAffectedFilesTable`. * At the top level, this modal only fetches the first 5 incidents for the file (useFetchIncidents is used without any table hooks, so the `hubRequestParams` are passed in by hand to filter by file and limit to 5 results instead of using `getHubRequestParams`). * Tabs are dynamically rendered for each of the first 5 incidents. In each of these tabs, a grid is rendered with details including the `IncidentCodeSnipViewer` (see below). * Installs the `react-markdown` package for rendering the incident message. Adds a custom object in `client/src/app/components/markdown-pf-components.tsx` for configuring react-markdown to use PF-specific components for common HTML tags. * A 6th tab for "All incidents" is rendered if there are more than 5 total incidents. In this tab, the `FileAllIncidentsTable` is rendered (see below). * Adds the `IncidentCodeSnipViewer` component, which renders the `incident.codeSnip` in PatternFly's CodeEditor component in read-only mode with a marker (red squiggly underline and icon) on the affected line. * Installs required packages `@patternfly/react-code-editor`, `monaco-editor`, `react-monaco-editor`, and `monaco-editor-webpack-plugin`. See https://github.com/patternfly/patternfly-react/blob/main/packages/react-code-editor/README.md#usage * Configures `monaco-editor-webpack-plugin`-related loaders in webpack config. See https://github.com/microsoft/monaco-editor/tree/main/webpack-plugin#using * Includes logic to reason about relative and absolute line numbers. The CodeEditor methods deal with relative line numbers (1 is the first line in the codeSnip string, even if the codeSnip starts on line 15 of the source file), and the hub and display logic deal with absolute line numbers (the line numbers from the source file). * Note that for now, the analyzer/hub does not indicate what line the codeSnip starts on. This PR hard-codes `codeSnipStartLine = 1`, and we will need to later add logic to strip line numbers out of the codeSnip string and determine this number from them (see konveyor/enhancements#124) * Includes a commented-out `language` prop, which can be set to enable syntax highlighting. * Note that for now, the analyzer/hub does not indicate what language the codeSnip is written in (see konveyor/enhancements#125). We will need to identify this and use it for the `language` prop, and then we may want to limit the UI to a static list of supported languages and configure the monaco webpack plugin to only include resources for those languages in the build. See https://github.com/microsoft/monaco-editor/tree/main/webpack-plugin#options * Includes some miscellaneous code cleanup in files surrounding the Issues and Affected Apps pages. * Adds a `noMargin` prop to `SimplePagination` for rendering it inline somewhere (it is aligned with column headers in the "all incidents" table as per the mockup) * Adds a `forceNumRenderedColumns` argument to `useTableControlProps` to override the automatically calculated `numRenderedColumns` when using custom `colSpan`s in the table (for adding this extra pagination column header that overlaps the last data column) * Includes some TODO comments to be addressed in future PRs. Signed-off-by: ibolton336 <ibolton@redhat.com>
…ode snippet viewer, adjust for hub change from IssueReport to AppReport (konveyor#966) Initial implementation of the `FileIncidentsDetailModal`, which shows incident details within a file. Some details are incomplete pending hub implementation and design review, and will be finished outside the scope of this PR. ![Screenshot 2023-06-07 at 3 01 24 PM](https://github.com/konveyor/tackle2-ui/assets/811963/7d0025bc-73d6-434c-b133-fbec3dc212f1) ![Screenshot 2023-06-07 at 3 01 30 PM](https://github.com/konveyor/tackle2-ui/assets/811963/c496a11c-bc3c-42f6-ad55-f695b9ce850c) Full flow to reach this modal: * On the Issues page, click the number of affected applications for an issue (RuleReport) * On the Affected Applications page, click an application (AppReport) to open the drawer * In the drawer's Affected Files tab, click a file (FileReport) ![qi904nHhzs](https://github.com/konveyor/tackle2-ui/assets/811963/0b2276e0-3244-42fd-adcf-2036d6a38792) This PR: * Replaces the `AnalysisIssueReport` with `AnalysisAppReport` to match new hub changes (see konveyor/tackle2-hub#368). * The AppReport object's top level properties are Application properties, and issue properties are now nested under `issue`. This aligns better with the "Affected applications" page we are using these objects for and better supports the sorting/filtering on that page. * Changes the hub path `/analyses/report/issues` to `/analyses/report/applications` to match. * Changes the Affected Applications page / table / drawer code to use the new type and naming * Adds `incidents` and `effort` columns to the Affected Applications table * Re-enables sorting on this table now that it is working in the hub * Removes the logic to manually cross-reference an IssueReport with an Application, because now the AppReport contains the application properties we need. * Adds the `AnalysisIncident` type (corresponds to the hub type `Incident`). * This is the actual incident from the analyzer including line number, code snippet and markdown message. * Adds a hub request function `getIncidents` and query `useFetchIncidents` for fetching these. * Adds the new `FileIncidentsDetailModal` component which is opened by clicking a file in the `IssueAffectedFilesTable`. * At the top level, this modal only fetches the first 5 incidents for the file (useFetchIncidents is used without any table hooks, so the `hubRequestParams` are passed in by hand to filter by file and limit to 5 results instead of using `getHubRequestParams`). * Tabs are dynamically rendered for each of the first 5 incidents. In each of these tabs, a grid is rendered with details including the `IncidentCodeSnipViewer` (see below). * Installs the `react-markdown` package for rendering the incident message. Adds a custom object in `client/src/app/components/markdown-pf-components.tsx` for configuring react-markdown to use PF-specific components for common HTML tags. * A 6th tab for "All incidents" is rendered if there are more than 5 total incidents. In this tab, the `FileAllIncidentsTable` is rendered (see below). * Adds the `IncidentCodeSnipViewer` component, which renders the `incident.codeSnip` in PatternFly's CodeEditor component in read-only mode with a marker (red squiggly underline and icon) on the affected line. * Installs required packages `@patternfly/react-code-editor`, `monaco-editor`, `react-monaco-editor`, and `monaco-editor-webpack-plugin`. See https://github.com/patternfly/patternfly-react/blob/main/packages/react-code-editor/README.md#usage * Configures `monaco-editor-webpack-plugin`-related loaders in webpack config. See https://github.com/microsoft/monaco-editor/tree/main/webpack-plugin#using * Includes logic to reason about relative and absolute line numbers. The CodeEditor methods deal with relative line numbers (1 is the first line in the codeSnip string, even if the codeSnip starts on line 15 of the source file), and the hub and display logic deal with absolute line numbers (the line numbers from the source file). * Note that for now, the analyzer/hub does not indicate what line the codeSnip starts on. This PR hard-codes `codeSnipStartLine = 1`, and we will need to later add logic to strip line numbers out of the codeSnip string and determine this number from them (see konveyor/enhancements#124) * Includes a commented-out `language` prop, which can be set to enable syntax highlighting. * Note that for now, the analyzer/hub does not indicate what language the codeSnip is written in (see konveyor/enhancements#125). We will need to identify this and use it for the `language` prop, and then we may want to limit the UI to a static list of supported languages and configure the monaco webpack plugin to only include resources for those languages in the build. See https://github.com/microsoft/monaco-editor/tree/main/webpack-plugin#options * Includes some miscellaneous code cleanup in files surrounding the Issues and Affected Apps pages. * Adds a `noMargin` prop to `SimplePagination` for rendering it inline somewhere (it is aligned with column headers in the "all incidents" table as per the mockup) * Adds a `forceNumRenderedColumns` argument to `useTableControlProps` to override the automatically calculated `numRenderedColumns` when using custom `colSpan`s in the table (for adding this extra pagination column header that overlaps the last data column) * Includes some TODO comments to be addressed in future PRs. Signed-off-by: ibolton336 <ibolton@redhat.com>
Note for implementation (cc @pranavgaikwad): @jortel and I agreed that the code snip lines should have exactly 2 additional spaces between the line number and the code (not including any leading whitespace from the source code itself). See konveyor/tackle2-hub#414 for an example. |
…er (#1054) `incident.codeSnip` now includes line numbers embedded in the string with the following properties: * There may or may not be leading whitespace before the line number * The line numbers are always right-aligned (end on the same character index in the line) * The line number is followed by 2 spaces, then by the code for that line (which possibly includes more leading whitespace) * If there is no code on that line, the line number may be followed by only 1 space or no whitespace See: * konveyor/enhancements#124 * konveyor/analyzer-lsp#200 * konveyor/tackle2-hub#403 * konveyor/tackle2-hub#414 This PR adds a regex for matching each line of the codeSnip to pull out the line number and code, tolerating leading whitespace before the number and preserving original whitespace from the code. It uses the number found on the first line as `codeSnipStartLine` for the purposes of custom rendering of line numbers in the CodeEditor, and strips the numbers and 2-space padding out before rendering the code. Before testing, pull the latest main branch of the tackle2-hub repo and re-run your `./hack/add/analysis.sh` for each app. ![Screenshot 2023-06-20 at 2 29 24 PM](https://github.com/konveyor/tackle2-ui/assets/811963/6077b827-98b0-4705-aa93-a36e1a3e2c71) Signed-off-by: Mike Turley <mike.turley@alum.cs.umass.edu> Co-authored-by: Ian Bolton <ibolton@redhat.com>
@mturley can we consider this done already? I see that the related PR has been merged. |
Ah yes, this is done. Thanks @rromannissen |
When rendering the
codeSnip
string of an Incident in the UI, we display line numbers from the source file in a gutter to the side of the code snippet. In order to align these numbers correctly and correctly mark the actual offending line, we need to know how much context is provided in the code snippet around the actual line numbered by the Incident'sline
property. I propose acodeSnipStartLine
or similarly-named property, which would be the line number where the codeSnip begins.The text was updated successfully, but these errors were encountered: