Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

update mdi-react, modify last sync icon #26617

Merged
merged 4 commits into from
Oct 26, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 2 additions & 2 deletions client/shared/src/components/CodeExcerpt.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import classNames from 'classnames'
import { range, isEqual } from 'lodash'
import ErrorIcon from 'mdi-react/ErrorIcon'
import AlertCircleIcon from 'mdi-react/AlertCircleIcon'
import React from 'react'
import VisibilitySensor from 'react-visibility-sensor'
import { of, combineLatest, Observable, Subject, Subscription } from 'rxjs'
Expand Down Expand Up @@ -139,7 +139,7 @@ export class CodeExcerpt extends React.PureComponent<Props, State> {
)}
{this.state.blobLinesOrError && isErrorLike(this.state.blobLinesOrError) && (
<div className="code-excerpt-alert">
<ErrorIcon className="icon-inline mr-2" />
<AlertCircleIcon className="icon-inline mr-2" />
{this.state.blobLinesOrError.message}
</div>
)}
Expand Down
4 changes: 2 additions & 2 deletions client/shared/src/components/LastSyncedIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import classNames from 'classnames'
import format from 'date-fns/format'
import CloudSyncOutlineIcon from 'mdi-react/CloudSyncOutlineIcon'
import WeatherCloudyClockIcon from 'mdi-react/WeatherCloudyClockIcon'
import React from 'react'

import styles from './LastSyncedIcon.module.scss'
Expand All @@ -14,7 +14,7 @@ export const LastSyncedIcon: React.FunctionComponent<Props> = props => {
const formattedTime = format(Date.parse(props.lastSyncedTime), "yyyy-MM-dd'T'HH:mm:ss")

return (
<CloudSyncOutlineIcon
<WeatherCloudyClockIcon
className={classNames(props.className, styles.lastSyncedIcon, 'icon-inline', 'text-muted')}
data-tooltip={`Last synced: ${formattedTime}`}
/>
Expand Down
2 changes: 1 addition & 1 deletion client/web/src/components/ErrorBoundary.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { HTTPStatusError } from '@sourcegraph/shared/src/backend/fetch'

import { ErrorBoundary } from './ErrorBoundary'

jest.mock('mdi-react/ErrorIcon', () => 'ErrorIcon')
jest.mock('mdi-react/AlertCircleIcon', () => 'AlertCircleIcon')
jest.mock('mdi-react/ReloadIcon', () => 'ReloadIcon')

const ThrowError: React.FunctionComponent = () => {
Expand Down
4 changes: 2 additions & 2 deletions client/web/src/components/ErrorBoundary.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as sentry from '@sentry/browser'
import * as H from 'history'
import ErrorIcon from 'mdi-react/ErrorIcon'
import AlertCircleIcon from 'mdi-react/AlertCircleIcon'
import ReloadIcon from 'mdi-react/ReloadIcon'
import React from 'react'

Expand Down Expand Up @@ -98,7 +98,7 @@ export class ErrorBoundary extends React.PureComponent<Props, State> {

return (
<HeroPage
icon={ErrorIcon}
icon={AlertCircleIcon}
title="Error"
className={this.props.className}
subtitle={
Expand Down
4 changes: 2 additions & 2 deletions client/web/src/components/ExecutionLogEntry.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import classNames from 'classnames'
import AlertCircleIcon from 'mdi-react/AlertCircleIcon'
import CheckCircleIcon from 'mdi-react/CheckCircleIcon'
import ErrorIcon from 'mdi-react/ErrorIcon'
import React from 'react'

import { LoadingSpinner } from '@sourcegraph/react-loading-spinner'
Expand Down Expand Up @@ -40,7 +40,7 @@ export const ExecutionLogEntry: React.FunctionComponent<ExecutionLogEntryProps>
{logEntry.exitCode === 0 ? (
<CheckCircleIcon className="text-success mr-1" />
) : (
<ErrorIcon className="text-danger mr-1" />
<AlertCircleIcon className="text-danger mr-1" />
)}
</>
)}
Expand Down
8 changes: 4 additions & 4 deletions client/web/src/components/Timeline.story.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { storiesOf } from '@storybook/react'
import { parseISO } from 'date-fns'
import AlertCircleIcon from 'mdi-react/AlertCircleIcon'
import CheckIcon from 'mdi-react/CheckIcon'
import ErrorIcon from 'mdi-react/ErrorIcon'
import React from 'react'

import { Timeline } from './Timeline'
Expand All @@ -24,7 +24,7 @@ add('Basic', () => (
date: '2020-06-15T11:15:00+00:00',
},
{
icon: <ErrorIcon />,
icon: <AlertCircleIcon />,
className: 'bg-danger',
text: 'Second event description',
date: '2020-06-15T12:20:00+00:00',
Expand All @@ -36,7 +36,7 @@ add('Basic', () => (
date: '2020-06-15T13:25:00+00:00',
},
{
icon: <ErrorIcon />,
icon: <AlertCircleIcon />,
className: 'bg-danger',
text: 'Fourth event description',
date: '2020-06-15T14:30:00+00:00',
Expand Down Expand Up @@ -66,7 +66,7 @@ add('Details', () => (
date: '2020-06-15T11:15:00+00:00',
},
{
icon: <ErrorIcon />,
icon: <AlertCircleIcon />,
className: 'bg-danger',
text: 'Second event description',
date: '2020-06-15T12:20:00+00:00',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ exports[`ErrorBoundary passes through if non-error 1`] = `
<div
className="icon"
>
<ErrorIcon />
<AlertCircleIcon />
</div>
<div
className="title"
Expand Down Expand Up @@ -49,7 +49,7 @@ exports[`ErrorBoundary renders reload page if chunk error 1`] = `
<div
className="icon"
>
<ErrorIcon />
<AlertCircleIcon />
</div>
<div
className="title"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import classNames from 'classnames'
import * as H from 'history'
import AccountIcon from 'mdi-react/AccountIcon'
import ChevronRightIcon from 'mdi-react/ChevronRightIcon'
import UserIcon from 'mdi-react/UserIcon'
import React from 'react'

import { Link } from '@sourcegraph/shared/src/components/Link'
Expand Down Expand Up @@ -51,7 +51,7 @@ export const ExternalServiceCard: React.FunctionComponent<ExternalServiceCardPro
<small>
{' '}
by
<UserIcon className="icon-inline" />
<AccountIcon className="icon-inline" />
<Link to={namespace.url}>{namespace.namespaceName}</Link>
</small>
)}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as H from 'history'
import AccountIcon from 'mdi-react/AccountIcon'
import DeleteIcon from 'mdi-react/DeleteIcon'
import SettingsIcon from 'mdi-react/SettingsIcon'
import UserIcon from 'mdi-react/UserIcon'
import React, { useCallback, useState } from 'react'

import { Link } from '@sourcegraph/shared/src/components/Link'
Expand Down Expand Up @@ -52,7 +52,7 @@ export const ExternalServiceNode: React.FunctionComponent<ExternalServiceNodePro
<div>
{node.namespace && (
<>
<UserIcon className="icon-inline" />
<AccountIcon className="icon-inline" />
<Link to={node.namespace.url}>{node.namespace.namespaceName}</Link>{' '}
</>
)}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Edit, FormattingOptions, JSONPath } from '@sqs/jsonc-parser'
import { setProperty } from '@sqs/jsonc-parser/lib/edit'
import AmazonIcon from 'mdi-react/AmazonIcon'
import AwsIcon from 'mdi-react/AwsIcon'
import BitbucketIcon from 'mdi-react/BitbucketIcon'
import GithubIcon from 'mdi-react/GithubIcon'
import GitIcon from 'mdi-react/GitIcon'
Expand Down Expand Up @@ -531,7 +531,7 @@ const GITHUB_ENTERPRISE: AddExternalServiceOptions = {
const AWS_CODE_COMMIT: AddExternalServiceOptions = {
kind: ExternalServiceKind.AWSCODECOMMIT,
title: 'AWS CodeCommit repositories',
icon: AmazonIcon,
icon: AwsIcon,
jsonSchema: awsCodeCommitSchemaJSON,
defaultDisplayName: 'AWS CodeCommit',
defaultConfig: `{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import classNames from 'classnames'
import { formatDistance, isBefore, parseISO } from 'date-fns'
import ErrorIcon from 'mdi-react/ErrorIcon'
import AlertCircleIcon from 'mdi-react/AlertCircleIcon'
import InfoCircleOutlineIcon from 'mdi-react/InfoCircleOutlineIcon'
import SyncIcon from 'mdi-react/SyncIcon'
import React, { useState, useEffect, useCallback } from 'react'
Expand Down Expand Up @@ -78,13 +78,13 @@ export const ChangesetLastSynced: React.FunctionComponent<Props> = ({ changeset,
<small className="text-muted">
{changeset.__typename === 'ExternalChangeset' && changeset.syncerError ? (
<span data-tooltip="Expand to see details.">
<ErrorIcon className="icon-inline text-danger" /> Syncing from code host failed.
<AlertCircleIcon className="icon-inline text-danger" /> Syncing from code host failed.
</span>
) : (
<>Last synced {formatDistance(parseISO(changeset.updatedAt), _now ?? new Date())} ago.</>
)}{' '}
{isErrorLike(lastUpdatedAt) && (
<ErrorIcon data-tooltip={lastUpdatedAt.message} className="ml-2 icon-inline small" />
<AlertCircleIcon data-tooltip={lastUpdatedAt.message} className="ml-2 icon-inline small" />
)}
<span data-tooltip={tooltipText}>
<UpdateLoaderIcon
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import classNames from 'classnames'
import AlertCircleIcon from 'mdi-react/AlertCircleIcon'
import ArchiveIcon from 'mdi-react/ArchiveIcon'
import AutorenewIcon from 'mdi-react/AutorenewIcon'
import DeleteIcon from 'mdi-react/DeleteIcon'
import ErrorIcon from 'mdi-react/ErrorIcon'
import SourceBranchIcon from 'mdi-react/SourceBranchIcon'
import SourceMergeIcon from 'mdi-react/SourceMergeIcon'
import SourcePullIcon from 'mdi-react/SourcePullIcon'
Expand Down Expand Up @@ -114,7 +114,7 @@ export const ChangesetStatusError: React.FunctionComponent<ChangesetStatusIconPr
className,
}) => (
<div className={classNames(iconClassNames, className)}>
<ErrorIcon className="text-danger" />
<AlertCircleIcon className="text-danger" />
{label}
</div>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ export const BatchSpecExecutionDetailsPage: React.FunctionComponent<BatchSpecExe
// execution.state === BatchSpecState.COMPLETED
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sourcegraph/batchers Is there a reason this code is commented out instead of deleted?

Copy link
Member

Choose a reason for hiding this comment

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

It disappears in a PR that's already open

// ? { icon: <CheckIcon />, text: 'Finished', date: execution.finishedAt, className: 'bg-success' }
// : execution.state === BatchSpecState.CANCELED
// ? { icon: <ErrorIcon />, text: 'Canceled', date: execution.finishedAt, className: 'bg-secondary' }
// : { icon: <ErrorIcon />, text: 'Failed', date: execution.finishedAt, className: 'bg-danger' },
// ? { icon: <AlertCircleIcon />, text: 'Canceled', date: execution.finishedAt, className: 'bg-secondary' }
// : { icon: <AlertCircleIcon />, text: 'Failed', date: execution.finishedAt, className: 'bg-danger' },
// ],
// [execution, now, expandStage]
// )
Expand Down Expand Up @@ -233,7 +233,7 @@ export const BatchSpecExecutionDetailsPage: React.FunctionComponent<BatchSpecExe
// const success = isArray(value) ? value.every(logEntry => logEntry.exitCode === 0) : value.exitCode === 0

// return {
// icon: !finished ? <ProgressClockIcon /> : success ? <CheckIcon /> : <ErrorIcon />,
// icon: !finished ? <ProgressClockIcon /> : success ? <CheckIcon /> : <AlertCircleIcon />,
// date: isArray(value) ? value[0].startTime : value.startTime,
// className: success || !finished ? 'bg-success' : 'bg-danger',
// expanded: expand || !(success || !finished),
Expand Down Expand Up @@ -367,7 +367,7 @@ export const BatchSpecExecutionDetailsPage: React.FunctionComponent<BatchSpecExe
// <CheckCircleIcon className="icon-inline text-success mr-1" />
// )}
// {completionStatus === JSONLogLineStatus.FAILURE && (
// <ErrorIcon className="icon-inline text-danger mr-1" />
// <AlertCircleIcon className="icon-inline text-danger mr-1" />
// )}
// {prettyOperationNames[tuple[0].operation]}
// </p>
Expand Down Expand Up @@ -414,7 +414,7 @@ export const BatchSpecExecutionDetailsPage: React.FunctionComponent<BatchSpecExe
// if (line.status === JSONLogLineStatus.FAILURE) {
// return (
// <li className="list-group-item p-2" key={key}>
// <ErrorIcon className="icon-inline text-danger mr-1" />
// <AlertCircleIcon className="icon-inline text-danger mr-1" />
// <b>{repo}</b>: Failed :(
// </li>
// )
Expand Down
4 changes: 2 additions & 2 deletions client/web/src/enterprise/batches/settings/BatchSpecNode.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import classNames from 'classnames'
import { parseISO } from 'date-fns'
import { upperFirst } from 'lodash'
import AlertCircleIcon from 'mdi-react/AlertCircleIcon'
import CancelIcon from 'mdi-react/CancelIcon'
import CheckCircleIcon from 'mdi-react/CheckCircleIcon'
import ChevronDownIcon from 'mdi-react/ChevronDownIcon'
import ChevronRightIcon from 'mdi-react/ChevronRightIcon'
import ErrorIcon from 'mdi-react/ErrorIcon'
import TimerSandIcon from 'mdi-react/TimerSandIcon'
import React, { useCallback, useState } from 'react'

Expand Down Expand Up @@ -91,7 +91,7 @@ const StateIcon: React.FunctionComponent<{ state: BatchSpecState }> = ({ state }

case BatchSpecState.FAILED:
default:
return <ErrorIcon className={classNames(styles.nodeStateIcon, 'icon-inline text-danger mb-1')} />
return <AlertCircleIcon className={classNames(styles.nodeStateIcon, 'icon-inline text-danger mb-1')} />
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { isArray } from 'lodash'
import AlertCircleIcon from 'mdi-react/AlertCircleIcon'
import CheckIcon from 'mdi-react/CheckIcon'
import ErrorIcon from 'mdi-react/ErrorIcon'
import ProgressClockIcon from 'mdi-react/ProgressClockIcon'
import TimerSandIcon from 'mdi-react/TimerSandIcon'
import React, { FunctionComponent, useMemo } from 'react'
Expand Down Expand Up @@ -34,7 +34,7 @@ export const CodeIntelIndexTimeline: FunctionComponent<CodeIntelIndexTimelinePro

index.state === LSIFIndexState.COMPLETED
? { icon: <CheckIcon />, text: 'Finished', date: index.finishedAt, className: 'bg-success' }
: { icon: <ErrorIcon />, text: 'Failed', date: index.finishedAt, className: 'bg-danger' },
: { icon: <AlertCircleIcon />, text: 'Failed', date: index.finishedAt, className: 'bg-danger' },
],
[index, now]
)
Expand Down Expand Up @@ -128,7 +128,7 @@ const genericStage = <E extends { startTime: string; exitCode: number | null }>(
const success = isArray(value) ? value.every(logEntry => logEntry.exitCode === 0) : value.exitCode === 0

return {
icon: !finished ? <ProgressClockIcon /> : success ? <CheckIcon /> : <ErrorIcon />,
icon: !finished ? <ProgressClockIcon /> : success ? <CheckIcon /> : <AlertCircleIcon />,
date: isArray(value) ? value[0].startTime : value.startTime,
className: success || !finished ? 'bg-success' : 'bg-danger',
expanded: !(success || !finished),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import AlertCircleIcon from 'mdi-react/AlertCircleIcon'
import CheckIcon from 'mdi-react/CheckIcon'
import ErrorIcon from 'mdi-react/ErrorIcon'
import FileUploadIcon from 'mdi-react/FileUploadIcon'
import ProgressClockIcon from 'mdi-react/ProgressClockIcon'
import React, { FunctionComponent, useMemo } from 'react'
Expand Down Expand Up @@ -94,7 +94,7 @@ const terminalStages = (upload: LsifUploadFields): TimelineStage[] =>
: upload.state === LSIFUploadState.ERRORED
? [
{
icon: <ErrorIcon />,
icon: <AlertCircleIcon />,
text: 'Failed',
date: upload.finishedAt,
className: 'bg-danger',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import classNames from 'classnames'
import AlertCircleIcon from 'mdi-react/AlertCircleIcon'
import CheckCircleIcon from 'mdi-react/CheckCircleIcon'
import ErrorIcon from 'mdi-react/ErrorIcon'
import FileUploadIcon from 'mdi-react/FileUploadIcon'
import TimerSandIcon from 'mdi-react/TimerSandIcon'
import React, { FunctionComponent } from 'react'
Expand All @@ -26,7 +26,7 @@ export const CodeIntelStateIcon: FunctionComponent<CodeIntelStateIconProps> = ({
) : state === LSIFUploadState.COMPLETED || state === LSIFIndexState.COMPLETED ? (
<CheckCircleIcon className={classNames('text-success', className)} />
) : state === LSIFUploadState.ERRORED || state === LSIFIndexState.ERRORED ? (
<ErrorIcon className={classNames('text-danger', className)} />
<AlertCircleIcon className={classNames('text-danger', className)} />
) : (
<></>
)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as H from 'history'
import AlertCircleIcon from 'mdi-react/AlertCircleIcon'
import CheckCircleIcon from 'mdi-react/CheckCircleIcon'
import ErrorIcon from 'mdi-react/ErrorIcon'
import React, { useCallback, useState } from 'react'
import { of, Observable, concat, from } from 'rxjs'
import { fromFetch } from 'rxjs/fetch'
Expand Down Expand Up @@ -125,7 +125,7 @@ export const RegistryExtensionNewReleasePage = withAuthenticatedUser<Props>(

return !extension.registryExtension || !extension.registryExtension.viewerCanAdminister ? (
<HeroPage
icon={ErrorIcon}
icon={AlertCircleIcon}
title="Unauthorized"
subtitle="You are not authorized to adminster this extension."
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
import classNames from 'classnames'
import DoNotDisturbIcon from 'mdi-react/DoNotDisturbIcon'
import WebIcon from 'mdi-react/WebIcon'
import * as React from 'react'

import { LinkOrSpan } from '@sourcegraph/shared/src/components/LinkOrSpan'
import * as GQL from '@sourcegraph/shared/src/graphql/schema'

export const RegistryExtensionSourceBadge: React.FunctionComponent<{
extension: Pick<GQL.IRegistryExtension, 'remoteURL' | 'registryName' | 'isLocal'>
showIcon?: boolean
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This prop has been removed altogether because it is never used.

showText?: boolean
showRegistryName?: boolean
className?: string
}> = ({ extension, showIcon, showText, showRegistryName, className = '' }) => (
}> = ({ extension, showText, showRegistryName, className = '' }) => (
<LinkOrSpan
to={extension.remoteURL}
target="_blank"
Expand All @@ -24,12 +21,6 @@ export const RegistryExtensionSourceBadge: React.FunctionComponent<{
: `Published on external extension registry ${extension.registryName}`
}
>
{showIcon &&
(extension.isLocal ? (
<DoNotDisturbIcon className="icon-inline mr-1" />
) : (
<WebIcon className="icon-inline mr-1" />
))}
{showText && (extension.isLocal ? 'Local' : showRegistryName ? extension.registryName : 'External')}
</LinkOrSpan>
)
Loading