Skip to content
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

Add link to show applicable extension for each storage provider #4004

Merged
merged 1 commit into from
May 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
3 changes: 2 additions & 1 deletion 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 @@ -13,7 +14,7 @@ export const AmazonS3 = () => (
</a>
. This reads the default AWS credentials file (if available) or env vars.
</p>

<ShowExtension id="AmazonWebServices.aws-toolkit-vscode" name="AWS" />
<InfoText>
The AWS user needs the following permissions: s3:ListBucket, s3:GetObject,
s3:PutObject, s3:DeleteObject.
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it's just me as a pretty literal person, but a sentence telling me about the separate extension felt confusing. Do I need this extension to setup DVC remotes? Looking at the comment you linked in #3867, I'm assuming the purpose is to let the user know that installing the corresponding remote extension would make remote setup easier 🤔

Maybe we could make that reasoning more clear? For example, Make setup easier with the Azure Storage extension.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could make that reasoning more clear? For example, Make setup easier with the Azure Storage extension.

Without doing some due diligence I wouldn't make that claim. I am going to see if those extensions expose useful APIs but for now I just wanted to make people aware that they exist.

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>
. 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this admonition added, there are now 2-3 admonitions stacked up on top of each other in each panel:

image

This feels hard to read for me but I'm not really seeing an alternative solution besides rewording these into paragraphs instead of admonitions which might not actually make these more readable 🤔

icon={Extensions}
width={16}
height={16}
className={styles.infoIcon}
/>{' '}
View the{' '}
<a
href={`command:workbench.extensions.search?${encodeURIComponent(
idQuery
)}`}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[F] This took a long time to workout. I actually had to visit the VS Code codebase to copy the expected format.

Finally found the format at
https://github.com/microsoft/vscode/blob/main/src/vs/workbench/contrib/welcomeGettingStarted/common/media/extensions-web.svg#L44

>
{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