Move CodePaths and FileCodeSnippet to common directory
This commit is contained in:
@@ -3,7 +3,7 @@ import React from 'react';
|
||||
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
||||
import { ThemeProvider } from '@primer/react';
|
||||
|
||||
import CodePaths from '../../view/remote-queries/CodePaths';
|
||||
import { CodePaths } from '../../view/common';
|
||||
import type { CodeFlow } from '../../remote-queries/shared/analysis-result';
|
||||
|
||||
export default {
|
||||
@@ -112,8 +112,8 @@ PowerShell.args = {
|
||||
message: {
|
||||
tokens: [
|
||||
{
|
||||
type: 'text',
|
||||
t: 'This zip file may have a dangerous path'
|
||||
t: 'text',
|
||||
text: 'This zip file may have a dangerous path'
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -2,7 +2,7 @@ import React from 'react';
|
||||
|
||||
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
||||
|
||||
import FileCodeSnippet from '../../view/remote-queries/FileCodeSnippet';
|
||||
import { FileCodeSnippet } from '../../view/common';
|
||||
|
||||
export default {
|
||||
title: 'File Code Snippet',
|
||||
@@ -4,9 +4,10 @@ import { VSCodeDropdown, VSCodeLink, VSCodeOption, VSCodeTag } from '@vscode/web
|
||||
import * as React from 'react';
|
||||
import { ChangeEvent, useRef, useState } from 'react';
|
||||
import styled from 'styled-components';
|
||||
import { CodeFlow, AnalysisMessage, ResultSeverity } from '../../remote-queries/shared/analysis-result';
|
||||
import { SectionTitle, VerticalSpace } from '../common';
|
||||
import FileCodeSnippet from './FileCodeSnippet';
|
||||
import { CodeFlow, AnalysisMessage, ResultSeverity } from '../../../remote-queries/shared/analysis-result';
|
||||
import { SectionTitle } from '../SectionTitle';
|
||||
import { VerticalSpace } from '../VerticalSpace';
|
||||
import { FileCodeSnippet } from '../FileCodeSnippet';
|
||||
|
||||
const StyledCloseButton = styled.button`
|
||||
position: absolute;
|
||||
@@ -111,7 +112,7 @@ const Menu = ({
|
||||
</VSCodeDropdown>;
|
||||
};
|
||||
|
||||
const CodePaths = ({
|
||||
export const CodePaths = ({
|
||||
codeFlows,
|
||||
ruleDescription,
|
||||
message,
|
||||
@@ -173,5 +174,3 @@ const CodePaths = ({
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default CodePaths;
|
||||
1
extensions/ql-vscode/src/view/common/CodePaths/index.ts
Normal file
1
extensions/ql-vscode/src/view/common/CodePaths/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './CodePaths';
|
||||
@@ -1,10 +1,10 @@
|
||||
import * as React from 'react';
|
||||
import styled from 'styled-components';
|
||||
import { CodeSnippet, FileLink, HighlightedRegion, AnalysisMessage, ResultSeverity } from '../../remote-queries/shared/analysis-result';
|
||||
import { createRemoteFileRef } from '../../pure/location-link-utils';
|
||||
import { parseHighlightedLine, shouldHighlightLine } from '../../pure/sarif-utils';
|
||||
import { CodeSnippet, FileLink, HighlightedRegion, AnalysisMessage, ResultSeverity } from '../../../remote-queries/shared/analysis-result';
|
||||
import { createRemoteFileRef } from '../../../pure/location-link-utils';
|
||||
import { parseHighlightedLine, shouldHighlightLine } from '../../../pure/sarif-utils';
|
||||
import { VSCodeLink } from '@vscode/webview-ui-toolkit/react';
|
||||
import { VerticalSpace } from '../common';
|
||||
import { VerticalSpace } from '../VerticalSpace';
|
||||
|
||||
const borderColor = 'var(--vscode-editor-snippetFinalTabstopHighlightBorder)';
|
||||
const warningColor = '#966C23';
|
||||
@@ -193,7 +193,7 @@ const Line = ({
|
||||
</div>;
|
||||
};
|
||||
|
||||
const FileCodeSnippet = ({
|
||||
export const FileCodeSnippet = ({
|
||||
fileLink,
|
||||
codeSnippet,
|
||||
highlightedRegion,
|
||||
@@ -257,5 +257,3 @@ const FileCodeSnippet = ({
|
||||
</Container>
|
||||
);
|
||||
};
|
||||
|
||||
export default FileCodeSnippet;
|
||||
@@ -0,0 +1 @@
|
||||
export * from './FileCodeSnippet';
|
||||
@@ -1,4 +1,6 @@
|
||||
export * from './icon';
|
||||
export * from './CodePaths';
|
||||
export * from './FileCodeSnippet';
|
||||
export * from './HorizontalSpace';
|
||||
export * from './SectionTitle';
|
||||
export * from './VerticalSpace';
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import * as React from 'react';
|
||||
import { AnalysisAlert } from '../../remote-queries/shared/analysis-result';
|
||||
import CodePaths from './CodePaths';
|
||||
import FileCodeSnippet from './FileCodeSnippet';
|
||||
import { CodePaths, FileCodeSnippet } from '../common';
|
||||
|
||||
const AnalysisAlertResult = ({ alert }: { alert: AnalysisAlert }) => {
|
||||
const showPathsLink = alert.codeFlows.length > 0;
|
||||
|
||||
Reference in New Issue
Block a user