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