Skip to content

Commit

Permalink
Add link to show applicable extension for each storage provider
Browse files Browse the repository at this point in the history
  • Loading branch information
mattseddon committed May 30, 2023
1 parent 6bb685c commit c3f0393
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 12 deletions.
1 change: 1 addition & 0 deletions extension/src/webview/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export const createWebview = async (
title,
viewColumn || ViewColumn.Active,
{
enableCommandUris: true,
enableScripts: true,
localResourceRoots: [Uri.file(distPath), ...getWorkspaceRootUris()],
retainContextWhenHidden: true
Expand Down
1 change: 1 addition & 0 deletions webview/icons/codicons.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const codicons = [
'copy',
'ellipsis',
'error',
'extensions',
'filter',
'git-commit',
'git-merge',
Expand Down
12 changes: 6 additions & 6 deletions webview/src/setup/components/remotes/AmazonS3.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import styles from './styles.module.scss'
import { InfoText } from './InfoText'
import { CloudVersioning } from './CloudVersioning'
import { CustomAuth } from './CustomAuth'
import { ShowExtension } from './ShowExtension'

export const AmazonS3 = () => (
<div className={styles.storageDetails}>
Expand All @@ -14,12 +15,11 @@ export const AmazonS3 = () => (
.{'\n'}This reads the default AWS credentials file (if available) or env
vars.
</p>
<p>
<InfoText>
The AWS user needs the following permissions:{'\n'} s3:ListBucket,
s3:GetObject, s3:PutObject, s3:DeleteObject.
</InfoText>
</p>
<ShowExtension id="AmazonWebServices.aws-toolkit-vscode" name="AWS" />
<InfoText>
The AWS user needs the following permissions:{'\n'} s3:ListBucket,
s3:GetObject, s3:PutObject, s3:DeleteObject.
</InfoText>
<CloudVersioning>
<a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/Versioning.html">
S3 versioning
Expand Down
5 changes: 5 additions & 0 deletions webview/src/setup/components/remotes/AzureBlobStorage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react'
import styles from './styles.module.scss'
import { CloudVersioning } from './CloudVersioning'
import { ShowExtension } from './ShowExtension'

export const AzureBlobStorage = () => (
<div className={styles.storageDetails}>
Expand All @@ -11,6 +12,10 @@ export const AzureBlobStorage = () => (
</a>{' '}
for details on how to authenticate.
</p>
<ShowExtension
id="ms-azuretools.vscode-azurestorage"
name="Azure Storage"
/>
<CloudVersioning>
<a href="https://learn.microsoft.com/en-us/azure/storage/blobs/versioning-overview">
Blob versioning
Expand Down
2 changes: 2 additions & 0 deletions webview/src/setup/components/remotes/GoogleCloudStorage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react'
import styles from './styles.module.scss'
import { CloudVersioning } from './CloudVersioning'
import { CustomAuth } from './CustomAuth'
import { ShowExtension } from './ShowExtension'
import { Icon } from '../../../shared/components/Icon'
import { Warning } from '../../../shared/components/icons'

Expand All @@ -14,6 +15,7 @@ export const GoogleCloudStorage: React.FC = () => (
</a>
.{'\n'}This reads the default GCP key file.
</p>
<ShowExtension id="GoogleCloudTools.cloudcode" name="Google Cloud Code" />
<p>
<Icon icon={Warning} width={16} height={16} className={styles.warnIcon} />{' '}
Make sure to run{' '}
Expand Down
10 changes: 4 additions & 6 deletions webview/src/setup/components/remotes/OtherStorageTypes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,9 @@ export const OtherStorageTypes: React.FC = () => (
</a>
</li>
</ul>
<p>
<InfoText>
<CloudVersioningLink /> is not currently supported by any of these
remotes.
</InfoText>
</p>
<InfoText>
<CloudVersioningLink /> is not currently supported by any of these
remotes.
</InfoText>
</div>
)
31 changes: 31 additions & 0 deletions webview/src/setup/components/remotes/ShowExtension.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from 'react'
import styles from './styles.module.scss'
import { Icon } from '../../../shared/components/Icon'
import { Extensions } from '../../../shared/components/icons'

export const ShowExtension: React.FC<{ id: string; name: string }> = ({
id,
name
}) => {
const idQuery = `"@id:${id}"`

return (
<p>
<Icon
icon={Extensions}
width={16}
height={16}
className={styles.infoIcon}
/>{' '}
View the{' '}
<a
href={`command:workbench.extensions.search?${encodeURIComponent(
idQuery
)}`}
>
{name}
</a>{' '}
extension.
</p>
)
}
19 changes: 19 additions & 0 deletions webview/src/shared/components/icons/Extensions.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import * as React from 'react'
import type { SVGProps } from 'react'
const Extensions = (props: SVGProps<SVGSVGElement>) => (
<svg
width={24}
height={24}
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
fill="currentColor"
{...props}
>
<path
fillRule="evenodd"
clipRule="evenodd"
d="M13.5 1.5L15 0h7.5L24 1.5V9l-1.5 1.5H15L13.5 9V1.5zm1.5 0V9h7.5V1.5H15zM0 15V6l1.5-1.5H9L10.5 6v7.5H18l1.5 1.5v7.5L18 24H1.5L0 22.5V15zm9-1.5V6H1.5v7.5H9zM9 15H1.5v7.5H9V15zm1.5 7.5H18V15h-7.5v7.5z"
/>
</svg>
)
export default Extensions
1 change: 1 addition & 0 deletions webview/src/shared/components/icons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export { default as Close } from './Close'
export { default as Copy } from './Copy'
export { default as Ellipsis } from './Ellipsis'
export { default as Error } from './Error'
export { default as Extensions } from './Extensions'
export { default as Filter } from './Filter'
export { default as GitCommit } from './GitCommit'
export { default as GitMerge } from './GitMerge'
Expand Down

0 comments on commit c3f0393

Please sign in to comment.