mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 17:11:49 +00:00
App: Fix paper cuts in UI and rename sourcegraph to cody app (#53714)
Closes https://github.com/sourcegraph/sourcegraph/issues/53629 Closes https://github.com/sourcegraph/sourcegraph/issues/53694 Closes https://github.com/sourcegraph/sourcegraph/issues/53699 Closes https://github.com/sourcegraph/sourcegraph/issues/52416 Closes https://github.com/sourcegraph/sourcegraph/issues/53700 Closes https://github.com/sourcegraph/sourcegraph/issues/53708 ## TODO - [x] The App system tray icon should be updated to the Cody Icon. - [x] I still see the Sourcegraph logo in the top lefthand corner. We probably don't need this anymore, since we have the "Cody AI" tab and they direct to the same chat view. - [x] In the settings dropdown in the app UI there's a "Teams" option that doesn't go anywhere. I don't know what this is or where it's supposed to go. - [x] The cloud icon in the app UI still always says "indexing." This is pretty prominent UI and (I believe) refers to Code Search indexing, not embeddings jobs. If it isn't doing anything, we should remove it. - [x] Update the Authorization page to say "Cody App" instead of "Sourcegraph App" when connecting App to dotcom. ## Test plan - Check the points from the todo section
This commit is contained in:
parent
9794790307
commit
0caec0bc91
@ -21,7 +21,7 @@ export const ConnectApp: React.FunctionComponent<ConnectAppProps> = props => {
|
||||
type="button"
|
||||
onClick={() => openLink('sourcegraph://user/settings/tokens/new/callback?requestFrom=CODY')}
|
||||
>
|
||||
Connect Sourcegraph App
|
||||
Connect Cody App
|
||||
</VSCodeButton>
|
||||
</p>
|
||||
)
|
||||
|
||||
@ -16,9 +16,7 @@ export const Settings: React.FunctionComponent<React.PropsWithChildren<SettingsP
|
||||
<div className="inner-container">
|
||||
<div className="non-transcript-container">
|
||||
<div className="settings">
|
||||
{serverEndpoint && (
|
||||
<p>🟢 Connected to {isLocalApp(serverEndpoint) ? 'Sourcegraph App' : serverEndpoint}</p>
|
||||
)}
|
||||
{serverEndpoint && <p>🟢 Connected to {isLocalApp(serverEndpoint) ? 'Cody App' : serverEndpoint}</p>}
|
||||
<VSCodeButton className="logout-button" type="button" onClick={onLogout}>
|
||||
Logout
|
||||
</VSCodeButton>
|
||||
|
||||
1
client/web/BUILD.bazel
generated
1
client/web/BUILD.bazel
generated
@ -722,7 +722,6 @@ ts_project(
|
||||
"src/enterprise/insights/admin-ui/query.ts",
|
||||
"src/enterprise/insights/components/DownloadFileButton.tsx",
|
||||
"src/enterprise/insights/components/code-insights-page/CodeInsightsPage.tsx",
|
||||
"src/enterprise/insights/components/code-insights-page/limit-access-banner/CodeInsightsLimitAccessAppBanner.tsx",
|
||||
"src/enterprise/insights/components/code-insights-page/limit-access-banner/CodeInsightsLimitAccessBanner.tsx",
|
||||
"src/enterprise/insights/components/creation-ui/CodeInsightDashboardsVisibility.tsx",
|
||||
"src/enterprise/insights/components/creation-ui/code-insight-time-step-picker/CodeInsightTimeStepPicker.tsx",
|
||||
|
||||
@ -166,7 +166,7 @@ export const SignInPage: React.FunctionComponent<React.PropsWithChildren<SignInP
|
||||
to="https://about.sourcegraph.com/app"
|
||||
onClick={() => eventLogger.log('ClickedOnAppCTA', { location: 'SignInPage' })}
|
||||
>
|
||||
download Sourcegraph app
|
||||
download Cody app
|
||||
</Link>{' '}
|
||||
or{' '}
|
||||
<Link
|
||||
|
||||
@ -495,7 +495,7 @@ exports[`SignInPage renders sign in page (dotcom) 1`] = `
|
||||
class="anchorLink"
|
||||
href="https://about.sourcegraph.com/app"
|
||||
>
|
||||
download Sourcegraph app
|
||||
download Cody app
|
||||
</a>
|
||||
or
|
||||
<a
|
||||
|
||||
@ -93,7 +93,7 @@ export const AppSetupWizard: FC<TelemetryProps> = ({ telemetryService }) => {
|
||||
|
||||
return (
|
||||
<ThemeContext.Provider value={{ themeSetting: ThemeSetting.Light }}>
|
||||
<PageTitle title="Sourcegraph App setup" />
|
||||
<PageTitle title="Cody App setup" />
|
||||
|
||||
<SetupStepsRoot
|
||||
baseURL="/app-setup/"
|
||||
|
||||
@ -46,7 +46,6 @@ const BatchChangeClosePage = lazyComponent<BatchChangeClosePageProps, 'BatchChan
|
||||
interface Props extends TelemetryProps, SettingsCascadeProps {
|
||||
authenticatedUser: AuthenticatedUser | null
|
||||
isSourcegraphDotCom: boolean
|
||||
isSourcegraphApp: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
@ -55,7 +54,6 @@ interface Props extends TelemetryProps, SettingsCascadeProps {
|
||||
export const GlobalBatchChangesArea: React.FunctionComponent<React.PropsWithChildren<Props>> = ({
|
||||
authenticatedUser,
|
||||
isSourcegraphDotCom,
|
||||
isSourcegraphApp,
|
||||
...props
|
||||
}) => {
|
||||
const canCreate: true | string = useMemo(() => {
|
||||
@ -79,7 +77,6 @@ export const GlobalBatchChangesArea: React.FunctionComponent<React.PropsWithChil
|
||||
canCreate={canCreate}
|
||||
authenticatedUser={authenticatedUser}
|
||||
isSourcegraphDotCom={isSourcegraphDotCom}
|
||||
isSourcegraphApp={isSourcegraphApp}
|
||||
{...props}
|
||||
/>
|
||||
}
|
||||
|
||||
@ -103,7 +103,6 @@ export const ListOfBatchChanges: Story<Args> = args => {
|
||||
canCreate={args.canCreate || "You don't have permission to create batch changes"}
|
||||
settingsCascade={EMPTY_SETTINGS_CASCADE}
|
||||
isSourcegraphDotCom={args.isDotCom}
|
||||
isSourcegraphApp={args.isApp}
|
||||
authenticatedUser={null}
|
||||
/>
|
||||
</MockedTestProvider>
|
||||
@ -122,11 +121,6 @@ ListOfBatchChanges.argTypes = {
|
||||
control: { type: 'boolean' },
|
||||
defaultValue: false,
|
||||
},
|
||||
isApp: {
|
||||
name: 'is Sourcegraph App',
|
||||
control: { type: 'boolean' },
|
||||
defaultValue: false,
|
||||
},
|
||||
}
|
||||
|
||||
ListOfBatchChanges.storyName = 'List of batch changes'
|
||||
@ -145,7 +139,6 @@ export const ListOfBatchChangesSpecificNamespace: Story = () => {
|
||||
namespaceID="test-12345"
|
||||
settingsCascade={EMPTY_SETTINGS_CASCADE}
|
||||
isSourcegraphDotCom={false}
|
||||
isSourcegraphApp={false}
|
||||
authenticatedUser={null}
|
||||
/>
|
||||
</MockedTestProvider>
|
||||
@ -174,7 +167,6 @@ export const ListOfBatchChangesServerSideExecutionEnabled: Story = () => {
|
||||
},
|
||||
}}
|
||||
isSourcegraphDotCom={false}
|
||||
isSourcegraphApp={false}
|
||||
authenticatedUser={null}
|
||||
/>
|
||||
</MockedTestProvider>
|
||||
@ -198,7 +190,6 @@ export const LicensingNotEnforced: Story = () => {
|
||||
canCreate={true}
|
||||
settingsCascade={EMPTY_SETTINGS_CASCADE}
|
||||
isSourcegraphDotCom={false}
|
||||
isSourcegraphApp={false}
|
||||
authenticatedUser={null}
|
||||
/>
|
||||
</MockedTestProvider>
|
||||
@ -222,7 +213,6 @@ export const NoBatchChanges: Story = () => {
|
||||
canCreate={true}
|
||||
settingsCascade={EMPTY_SETTINGS_CASCADE}
|
||||
isSourcegraphDotCom={false}
|
||||
isSourcegraphApp={false}
|
||||
authenticatedUser={null}
|
||||
/>
|
||||
</MockedTestProvider>
|
||||
@ -247,7 +237,6 @@ export const AllBatchChangesTabEmpty: Story = () => {
|
||||
openTab="batchChanges"
|
||||
settingsCascade={EMPTY_SETTINGS_CASCADE}
|
||||
isSourcegraphDotCom={false}
|
||||
isSourcegraphApp={false}
|
||||
authenticatedUser={null}
|
||||
/>
|
||||
</MockedTestProvider>
|
||||
|
||||
@ -8,7 +8,6 @@ import { dataOrThrowErrors, useQuery } from '@sourcegraph/http-client'
|
||||
import { Settings } from '@sourcegraph/shared/src/schema/settings.schema'
|
||||
import { SettingsCascadeProps } from '@sourcegraph/shared/src/settings/settings'
|
||||
import { TelemetryProps } from '@sourcegraph/shared/src/telemetry/telemetryService'
|
||||
import { addSourcegraphAppOutboundUrlParameters } from '@sourcegraph/shared/src/util/url'
|
||||
import { Button, PageHeader, Link, Container, H3, Text, screenReaderAnnounce } from '@sourcegraph/wildcard'
|
||||
|
||||
import { AuthenticatedUser } from '../../../auth'
|
||||
@ -25,7 +24,6 @@ import {
|
||||
ShowMoreButton,
|
||||
SummaryContainer,
|
||||
} from '../../../components/FilteredConnection/ui'
|
||||
import { LimitedAccessBanner } from '../../../components/LimitedAccessBanner'
|
||||
import { Page } from '../../../components/Page'
|
||||
import {
|
||||
ListBatchChange,
|
||||
@ -58,7 +56,6 @@ export interface BatchChangeListPageProps extends TelemetryProps, SettingsCascad
|
||||
headingElement: 'h1' | 'h2'
|
||||
namespaceID?: Scalars['ID']
|
||||
isSourcegraphDotCom: boolean
|
||||
isSourcegraphApp: boolean
|
||||
authenticatedUser: AuthenticatedUser | null
|
||||
/** For testing only. */
|
||||
openTab?: SelectedTab
|
||||
@ -79,7 +76,6 @@ export const BatchChangeListPage: React.FunctionComponent<React.PropsWithChildre
|
||||
settingsCascade,
|
||||
telemetryService,
|
||||
isSourcegraphDotCom,
|
||||
isSourcegraphApp,
|
||||
authenticatedUser,
|
||||
}) => {
|
||||
const location = useLocation()
|
||||
@ -181,34 +177,12 @@ export const BatchChangeListPage: React.FunctionComponent<React.PropsWithChildre
|
||||
<PageHeader.Breadcrumb icon={BatchChangesIcon}>Batch Changes</PageHeader.Breadcrumb>
|
||||
</PageHeader.Heading>
|
||||
</PageHeader>
|
||||
{isSourcegraphApp && (
|
||||
<LimitedAccessBanner storageKey="app.limitedAccessBannerDismissed.batchChanges" className="my-4">
|
||||
Batch Changes is currently available to try for free, up to 10 changesets, while Sourcegraph App is
|
||||
in beta. Pricing and availability for Batch Changes is subject to change in future releases.{' '}
|
||||
<strong>
|
||||
For unlimited access to Batch Changes,{' '}
|
||||
<Link
|
||||
to={addSourcegraphAppOutboundUrlParameters(
|
||||
'https://about.sourcegraph.com/get-started?t=enterprise',
|
||||
'batch-changes'
|
||||
)}
|
||||
>
|
||||
sign up for an Enterprise trial.
|
||||
</Link>
|
||||
</strong>
|
||||
</LimitedAccessBanner>
|
||||
)}
|
||||
<BatchChangesListIntro isLicensed={isBatchChangesLicensed} />
|
||||
{!isSourcegraphDotCom && canUseBatchChanges && (
|
||||
<BatchChangeListTabHeader selectedTab={selectedTab} setSelectedTab={setSelectedTab} />
|
||||
)}
|
||||
{selectedTab === 'gettingStarted' && (
|
||||
<GettingStarted
|
||||
canCreate={canCreate}
|
||||
isSourcegraphApp={isSourcegraphApp}
|
||||
isSourcegraphDotCom={isSourcegraphDotCom}
|
||||
className="mb-4"
|
||||
/>
|
||||
<GettingStarted canCreate={canCreate} isSourcegraphDotCom={isSourcegraphDotCom} className="mb-4" />
|
||||
)}
|
||||
{selectedTab === 'batchChanges' && (
|
||||
<>
|
||||
|
||||
@ -2,7 +2,6 @@ import React from 'react'
|
||||
|
||||
import { mdiOpenInNew } from '@mdi/js'
|
||||
|
||||
import { addSourcegraphAppOutboundUrlParameters } from '@sourcegraph/shared/src/util/url'
|
||||
import { Alert, Container, H2, H3, Link, Text, Icon, useReducedMotion } from '@sourcegraph/wildcard'
|
||||
|
||||
import { BatchChangesIcon } from '../../../batches/icons'
|
||||
@ -12,7 +11,6 @@ import { eventLogger } from '../../../tracking/eventLogger'
|
||||
|
||||
export interface GettingStartedProps {
|
||||
isSourcegraphDotCom: boolean
|
||||
isSourcegraphApp?: boolean
|
||||
// canCreate indicates whether or not the currently-authenticated user has sufficient
|
||||
// permissions to create a batch change in whatever context this getting started
|
||||
// section is being presented. If not, canCreate will be a string reason why the user
|
||||
@ -25,7 +23,6 @@ const productPageUrl = 'https://about.sourcegraph.com/batch-changes'
|
||||
|
||||
export const GettingStarted: React.FunctionComponent<React.PropsWithChildren<GettingStartedProps>> = ({
|
||||
isSourcegraphDotCom,
|
||||
isSourcegraphApp,
|
||||
canCreate,
|
||||
className,
|
||||
}) => {
|
||||
@ -85,15 +82,7 @@ export const GettingStarted: React.FunctionComponent<React.PropsWithChildren<Get
|
||||
</Link>
|
||||
</li>
|
||||
<li>
|
||||
<Link
|
||||
to={
|
||||
isSourcegraphApp
|
||||
? addSourcegraphAppOutboundUrlParameters(productPageUrl)
|
||||
: productPageUrl
|
||||
}
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
>
|
||||
<Link to={productPageUrl} target="_blank" rel="noopener">
|
||||
Product page{' '}
|
||||
<Icon role="img" aria-label="Open in a new tab" svgPath={mdiOpenInNew} />
|
||||
</Link>
|
||||
|
||||
@ -30,7 +30,6 @@ const EditInsightLazyPage = lazyComponent(
|
||||
|
||||
export interface CodeInsightsAppRouter extends TelemetryProps {
|
||||
authenticatedUser: AuthenticatedUser
|
||||
isSourcegraphApp: boolean
|
||||
}
|
||||
|
||||
const rootPagePathsToTab = {
|
||||
@ -40,7 +39,7 @@ const rootPagePathsToTab = {
|
||||
}
|
||||
|
||||
export const CodeInsightsAppRouter = withAuthenticatedUser<CodeInsightsAppRouter>(props => {
|
||||
const { telemetryService, isSourcegraphApp } = props
|
||||
const { telemetryService } = props
|
||||
|
||||
const fetched = useLicense()
|
||||
const api = useApi()
|
||||
@ -51,42 +50,25 @@ export const CodeInsightsAppRouter = withAuthenticatedUser<CodeInsightsAppRouter
|
||||
|
||||
return (
|
||||
<CodeInsightsBackendContext.Provider value={api}>
|
||||
<GaConfirmationModal isSourcegraphApp={props.isSourcegraphApp} />
|
||||
<GaConfirmationModal />
|
||||
|
||||
<Routes>
|
||||
<Route index={true} element={<CodeInsightsSmartRoutingRedirect />} />
|
||||
|
||||
<Route
|
||||
path="create/*"
|
||||
element={<CreationRoutes telemetryService={telemetryService} isSourcegraphApp={isSourcegraphApp} />}
|
||||
/>
|
||||
<Route path="create/*" element={<CreationRoutes telemetryService={telemetryService} />} />
|
||||
|
||||
<Route
|
||||
path="dashboards/:dashboardId/edit"
|
||||
element={<EditDashboardPage isSourcegraphApp={isSourcegraphApp} />}
|
||||
/>
|
||||
<Route path="dashboards/:dashboardId/edit" element={<EditDashboardPage />} />
|
||||
|
||||
<Route
|
||||
path="add-dashboard"
|
||||
element={
|
||||
<InsightsDashboardCreationPage
|
||||
telemetryService={telemetryService}
|
||||
isSourcegraphApp={isSourcegraphApp}
|
||||
/>
|
||||
}
|
||||
element={<InsightsDashboardCreationPage telemetryService={telemetryService} />}
|
||||
/>
|
||||
|
||||
{Object.entries(rootPagePathsToTab).map(([path, activeTab]) => (
|
||||
<Route
|
||||
key="hardcoded-key"
|
||||
path={path}
|
||||
element={
|
||||
<CodeInsightsRootPage
|
||||
activeTab={activeTab}
|
||||
telemetryService={telemetryService}
|
||||
isSourcegraphApp={isSourcegraphApp}
|
||||
/>
|
||||
}
|
||||
element={<CodeInsightsRootPage activeTab={activeTab} telemetryService={telemetryService} />}
|
||||
/>
|
||||
))}
|
||||
|
||||
@ -95,22 +77,14 @@ export const CodeInsightsAppRouter = withAuthenticatedUser<CodeInsightsAppRouter
|
||||
path="edit/:insightId"
|
||||
element={<RedirectRoute getRedirectURL={({ params }) => `/insights/${params.insightId}/edit`} />}
|
||||
/>
|
||||
<Route path=":insightId/edit" element={<EditInsightLazyPage isSourcegraphApp={isSourcegraphApp} />} />
|
||||
<Route path=":insightId/edit" element={<EditInsightLazyPage />} />
|
||||
|
||||
<Route
|
||||
// Deprecated URL, delete this in the 4.10
|
||||
path="insight/:insightId"
|
||||
element={<RedirectRoute getRedirectURL={({ params }) => `/insights/${params.insightId}`} />}
|
||||
/>
|
||||
<Route
|
||||
path=":insightId"
|
||||
element={
|
||||
<CodeInsightIndependentPage
|
||||
telemetryService={telemetryService}
|
||||
isSourcegraphApp={isSourcegraphApp}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
<Route path=":insightId" element={<CodeInsightIndependentPage telemetryService={telemetryService} />} />
|
||||
|
||||
<Route path="*" element={<NotFoundPage pageType="code insights" />} />
|
||||
</Routes>
|
||||
|
||||
@ -15,11 +15,10 @@ const CodeInsightsDotComGetStartedLazy = lazyComponent(
|
||||
export interface CodeInsightsRouterProps extends TelemetryProps {
|
||||
authenticatedUser: AuthenticatedUser | null
|
||||
isSourcegraphDotCom: boolean
|
||||
isSourcegraphApp: boolean
|
||||
}
|
||||
|
||||
export const CodeInsightsRouter: FC<CodeInsightsRouterProps> = props => {
|
||||
const { authenticatedUser, telemetryService, isSourcegraphApp } = props
|
||||
const { authenticatedUser, telemetryService } = props
|
||||
|
||||
if (!window.context?.codeInsightsEnabled) {
|
||||
return (
|
||||
@ -30,11 +29,5 @@ export const CodeInsightsRouter: FC<CodeInsightsRouterProps> = props => {
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<CodeInsightsAppLazyRouter
|
||||
authenticatedUser={authenticatedUser}
|
||||
telemetryService={telemetryService}
|
||||
isSourcegraphApp={isSourcegraphApp}
|
||||
/>
|
||||
)
|
||||
return <CodeInsightsAppLazyRouter authenticatedUser={authenticatedUser} telemetryService={telemetryService} />
|
||||
}
|
||||
|
||||
@ -3,12 +3,9 @@ import React from 'react'
|
||||
import { Page } from '../../../../components/Page'
|
||||
import { useUiFeatures } from '../../hooks'
|
||||
|
||||
import { CodeInsightsLimitedAccessAppBanner } from './limit-access-banner/CodeInsightsLimitAccessAppBanner'
|
||||
import { CodeInsightsLimitAccessBanner } from './limit-access-banner/CodeInsightsLimitAccessBanner'
|
||||
|
||||
interface CodeInsightsPageProps extends React.HTMLAttributes<HTMLDivElement> {
|
||||
isSourcegraphApp: boolean
|
||||
}
|
||||
interface CodeInsightsPageProps extends React.HTMLAttributes<HTMLDivElement> {}
|
||||
|
||||
/**
|
||||
* Shared common component for creation a typical code insights pages. Contains common styles
|
||||
@ -19,8 +16,7 @@ export const CodeInsightsPage: React.FunctionComponent<React.PropsWithChildren<C
|
||||
|
||||
return (
|
||||
<Page {...props}>
|
||||
{props.isSourcegraphApp && <CodeInsightsLimitedAccessAppBanner authenticatedUser={null} className="mb-4" />}
|
||||
{!licensed && !props.isSourcegraphApp && <CodeInsightsLimitAccessBanner className="mb-4" />}
|
||||
{!licensed && <CodeInsightsLimitAccessBanner className="mb-4" />}
|
||||
{props.children}
|
||||
</Page>
|
||||
)
|
||||
|
||||
@ -1,27 +0,0 @@
|
||||
import { AuthenticatedUser } from '@sourcegraph/shared/src/auth'
|
||||
import { addSourcegraphAppOutboundUrlParameters } from '@sourcegraph/shared/src/util/url'
|
||||
import { Link } from '@sourcegraph/wildcard'
|
||||
|
||||
import { LimitedAccessBanner } from '../../../../../components/LimitedAccessBanner'
|
||||
|
||||
interface Props {
|
||||
authenticatedUser: Pick<AuthenticatedUser, 'displayName' | 'emails'> | null | undefined
|
||||
className?: string
|
||||
}
|
||||
export const CodeInsightsLimitedAccessAppBanner: React.FC<Props> = props => (
|
||||
<LimitedAccessBanner storageKey="app.limitedAccessBannerDismissed.codeInsights" className={props.className}>
|
||||
Code Insights is currently available to try for free, up to 2 insights, while Sourcegraph App is in beta.
|
||||
Pricing and availability for Code Insights is subject to change in future releases.{' '}
|
||||
<strong>
|
||||
For unlimited access to Insights,{' '}
|
||||
<Link
|
||||
to={addSourcegraphAppOutboundUrlParameters(
|
||||
'https://about.sourcegraph.com/get-started?t=enterprise',
|
||||
'code-insights'
|
||||
)}
|
||||
>
|
||||
sign up for an Enterprise trial.
|
||||
</Link>
|
||||
</strong>
|
||||
</LimitedAccessBanner>
|
||||
)
|
||||
@ -53,7 +53,7 @@ export const GaConfirmationModalExample: React.FunctionComponent<React.PropsWith
|
||||
<TemporarySettingsContext.Provider value={settingsStorage}>
|
||||
<div>
|
||||
<H2>Some content</H2>
|
||||
<GaConfirmationModal isSourcegraphApp={false} />
|
||||
<GaConfirmationModal />
|
||||
</div>
|
||||
</TemporarySettingsContext.Provider>
|
||||
</CodeInsightsBackendContext.Provider>
|
||||
|
||||
@ -9,14 +9,11 @@ import { FourLineChart, LangStatsInsightChart, ThreeLineChart } from './componen
|
||||
|
||||
import styles from './GaConfirmationModal.module.scss'
|
||||
|
||||
interface Props {
|
||||
isSourcegraphApp: boolean
|
||||
}
|
||||
export const GaConfirmationModal: FC<Props> = props => {
|
||||
export const GaConfirmationModal: FC = () => {
|
||||
const [isGaAccepted, setGaAccepted] = useTemporarySetting('insights.freeGaExpiredAccepted', false)
|
||||
const { licensed } = useUiFeatures()
|
||||
|
||||
const showConfirmationModal = !licensed && isGaAccepted === false && !props.isSourcegraphApp
|
||||
const showConfirmationModal = !licensed && isGaAccepted === false
|
||||
|
||||
if (!showConfirmationModal) {
|
||||
return null
|
||||
|
||||
@ -105,7 +105,6 @@ describe('CodeInsightsRootPage', () => {
|
||||
<CodeInsightsRootPage
|
||||
activeTab={CodeInsightsRootPageTab.Dashboards}
|
||||
telemetryService={mockTelemetryService}
|
||||
isSourcegraphApp={false}
|
||||
/>,
|
||||
{
|
||||
route: '/insights/dashboards/foo',
|
||||
@ -121,7 +120,6 @@ describe('CodeInsightsRootPage', () => {
|
||||
<CodeInsightsRootPage
|
||||
activeTab={CodeInsightsRootPageTab.Dashboards}
|
||||
telemetryService={mockTelemetryService}
|
||||
isSourcegraphApp={false}
|
||||
/>,
|
||||
{
|
||||
route: '/insights/dashboards/foo',
|
||||
|
||||
@ -44,7 +44,6 @@ export enum CodeInsightsRootPageTab {
|
||||
interface CodeInsightsRootPageProps extends TelemetryProps {
|
||||
dashboardId?: string
|
||||
activeTab: CodeInsightsRootPageTab
|
||||
isSourcegraphApp: boolean
|
||||
}
|
||||
|
||||
export const CodeInsightsRootPage: FC<CodeInsightsRootPageProps> = memo(props => {
|
||||
@ -76,7 +75,7 @@ export const CodeInsightsRootPage: FC<CodeInsightsRootPageProps> = memo(props =>
|
||||
}
|
||||
|
||||
return (
|
||||
<CodeInsightsPage isSourcegraphApp={props.isSourcegraphApp}>
|
||||
<CodeInsightsPage>
|
||||
<PageHeader
|
||||
path={[{ icon: CodeInsightsIcon, text: 'Insights' }]}
|
||||
actions={
|
||||
@ -99,21 +98,14 @@ export const CodeInsightsRootPage: FC<CodeInsightsRootPageProps> = memo(props =>
|
||||
</TabList>
|
||||
<TabPanels className={styles.tabPanels}>
|
||||
<TabPanel tabIndex={-1}>
|
||||
<DashboardsView
|
||||
dashboardId={dashboardId}
|
||||
telemetryService={telemetryService}
|
||||
isSourcegraphApp={props.isSourcegraphApp}
|
||||
/>
|
||||
<DashboardsView dashboardId={dashboardId} telemetryService={telemetryService} />
|
||||
</TabPanel>
|
||||
<TabPanel tabIndex={-1}>
|
||||
<AllInsightsView telemetryService={telemetryService} />
|
||||
</TabPanel>
|
||||
<TabPanel tabIndex={-1}>
|
||||
<Suspense fallback={<LoadingSpinner aria-label="Loading Code Insights Getting started page" />}>
|
||||
<LazyCodeInsightsGettingStartedPage
|
||||
isSourcegraphApp={props.isSourcegraphApp}
|
||||
telemetryService={telemetryService}
|
||||
/>
|
||||
<LazyCodeInsightsGettingStartedPage telemetryService={telemetryService} />
|
||||
</Suspense>
|
||||
</TabPanel>
|
||||
</TabPanels>
|
||||
|
||||
@ -39,7 +39,7 @@ export const InsightsDashboardCreationLicensed: Story = () => {
|
||||
|
||||
return (
|
||||
<CodeInsightsBackendStoryMock mocks={codeInsightsBackend}>
|
||||
<InsightsDashboardCreationPage telemetryService={NOOP_TELEMETRY_SERVICE} isSourcegraphApp={false} />
|
||||
<InsightsDashboardCreationPage telemetryService={NOOP_TELEMETRY_SERVICE} />
|
||||
</CodeInsightsBackendStoryMock>
|
||||
)
|
||||
}
|
||||
@ -49,7 +49,7 @@ export const InsightsDashboardCreationUnlicensed: Story = () => {
|
||||
|
||||
return (
|
||||
<CodeInsightsBackendStoryMock mocks={codeInsightsBackend}>
|
||||
<InsightsDashboardCreationPage telemetryService={NOOP_TELEMETRY_SERVICE} isSourcegraphApp={false} />
|
||||
<InsightsDashboardCreationPage telemetryService={NOOP_TELEMETRY_SERVICE} />
|
||||
</CodeInsightsBackendStoryMock>
|
||||
)
|
||||
}
|
||||
|
||||
@ -19,9 +19,7 @@ import {
|
||||
|
||||
import styles from './InsightsDashboardCreationPage.module.scss'
|
||||
|
||||
interface InsightsDashboardCreationPageProps extends TelemetryProps {
|
||||
isSourcegraphApp: boolean
|
||||
}
|
||||
interface InsightsDashboardCreationPageProps extends TelemetryProps {}
|
||||
|
||||
export const InsightsDashboardCreationPage: React.FunctionComponent<
|
||||
React.PropsWithChildren<InsightsDashboardCreationPageProps>
|
||||
@ -58,7 +56,7 @@ export const InsightsDashboardCreationPage: React.FunctionComponent<
|
||||
}
|
||||
|
||||
return (
|
||||
<CodeInsightsPage className={classNames('col-8', styles.page)} isSourcegraphApp={props.isSourcegraphApp}>
|
||||
<CodeInsightsPage className={classNames('col-8', styles.page)}>
|
||||
<PageTitle title="Add dashboard - Code Insights" />
|
||||
|
||||
<PageHeader path={[{ icon: CodeInsightsIcon }, { text: 'Add new dashboard' }]} />
|
||||
@ -71,11 +69,7 @@ export const InsightsDashboardCreationPage: React.FunctionComponent<
|
||||
</span>
|
||||
|
||||
<Container className="mt-4">
|
||||
<InsightsDashboardCreationContent
|
||||
owners={owners}
|
||||
onSubmit={handleSubmit}
|
||||
isSourcegraphApp={props.isSourcegraphApp}
|
||||
>
|
||||
<InsightsDashboardCreationContent owners={owners} onSubmit={handleSubmit}>
|
||||
{formAPI => (
|
||||
<>
|
||||
<Button
|
||||
|
||||
@ -38,7 +38,6 @@ export interface InsightsDashboardCreationContentProps {
|
||||
owners: InsightsDashboardOwner[]
|
||||
onSubmit: (values: DashboardCreationFields) => Promise<SubmissionErrors>
|
||||
children: (formAPI: FormAPI<DashboardCreationFields>) => ReactNode
|
||||
isSourcegraphApp: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
@ -47,7 +46,7 @@ export interface InsightsDashboardCreationContentProps {
|
||||
export const InsightsDashboardCreationContent: React.FunctionComponent<
|
||||
InsightsDashboardCreationContentProps
|
||||
> = props => {
|
||||
const { initialValues, owners, onSubmit, children, isSourcegraphApp } = props
|
||||
const { initialValues, owners, onSubmit, children } = props
|
||||
|
||||
const { licensed } = useUiFeatures()
|
||||
|
||||
@ -150,18 +149,12 @@ export const InsightsDashboardCreationContent: React.FunctionComponent<
|
||||
<ErrorAlert error={formAPI.submitErrors[FORM_ERROR]} className="mt-2 mb-2" />
|
||||
)}
|
||||
|
||||
{!licensed && !isSourcegraphApp && (
|
||||
{!licensed && (
|
||||
<LimitedAccessLabel
|
||||
className={classNames(styles.limitedBanner)}
|
||||
message="Unlock Code Insights to create unlimited custom dashboards"
|
||||
/>
|
||||
)}
|
||||
{!licensed && isSourcegraphApp && (
|
||||
<LimitedAccessLabel
|
||||
className={classNames(styles.limitedBanner)}
|
||||
message="Dashboards aren't available yet for the Sourcegraph app"
|
||||
/>
|
||||
)}
|
||||
|
||||
<div className="d-flex flex-wrap justify-content-end mt-3">{children(formAPI)}</div>
|
||||
</form>
|
||||
|
||||
@ -168,11 +168,7 @@ const renderDashboardsContent = (
|
||||
...renderWithBrandedContext(
|
||||
<MockedTestProvider mocks={mocks}>
|
||||
<Wrapper>
|
||||
<DashboardsView
|
||||
dashboardId={dashboardID}
|
||||
telemetryService={mockTelemetryService}
|
||||
isSourcegraphApp={false}
|
||||
/>
|
||||
<DashboardsView dashboardId={dashboardID} telemetryService={mockTelemetryService} />
|
||||
</Wrapper>
|
||||
</MockedTestProvider>
|
||||
),
|
||||
|
||||
@ -18,11 +18,10 @@ export interface DashboardsViewProps extends TelemetryProps {
|
||||
* version of merged settings (all insights)
|
||||
*/
|
||||
dashboardId?: string
|
||||
isSourcegraphApp: boolean
|
||||
}
|
||||
|
||||
export const DashboardsView: FC<DashboardsViewProps> = props => {
|
||||
const { dashboardId, telemetryService, isSourcegraphApp } = props
|
||||
const { dashboardId, telemetryService } = props
|
||||
|
||||
const { dashboards } = useInsightDashboards()
|
||||
|
||||
@ -52,7 +51,6 @@ export const DashboardsView: FC<DashboardsViewProps> = props => {
|
||||
currentDashboard={currentDashboard}
|
||||
dashboards={dashboards}
|
||||
telemetryService={telemetryService}
|
||||
isSourcegraphApp={isSourcegraphApp}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
|
||||
@ -26,11 +26,10 @@ import styles from './DashboardsContent.module.scss'
|
||||
export interface DashboardsContentProps extends TelemetryProps {
|
||||
currentDashboard: CustomInsightDashboard | undefined
|
||||
dashboards: CustomInsightDashboard[]
|
||||
isSourcegraphApp: boolean
|
||||
}
|
||||
|
||||
export const DashboardsContent: FC<DashboardsContentProps> = props => {
|
||||
const { currentDashboard, dashboards, telemetryService, isSourcegraphApp } = props
|
||||
const { currentDashboard, dashboards, telemetryService } = props
|
||||
|
||||
const navigate = useNavigate()
|
||||
const [, setLasVisitedDashboard] = useTemporarySetting('insights.lastVisitedDashboardId', null)
|
||||
@ -103,7 +102,7 @@ export const DashboardsContent: FC<DashboardsContentProps> = props => {
|
||||
</Tooltip>
|
||||
</DashboardHeader>
|
||||
|
||||
{!licensed && !isSourcegraphApp && (
|
||||
{!licensed && (
|
||||
<LimitedAccessLabel
|
||||
className={classNames(styles.limitedAccessLabel)}
|
||||
message="Unlock Code Insights for full access to custom dashboards"
|
||||
|
||||
@ -35,14 +35,10 @@ import {
|
||||
|
||||
import styles from './EditDashboardPage.module.scss'
|
||||
|
||||
interface Props {
|
||||
isSourcegraphApp: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the edit (configure) dashboard page.
|
||||
*/
|
||||
export const EditDashboardPage: FC<Props> = props => {
|
||||
export const EditDashboardPage: FC = props => {
|
||||
const navigate = useNavigate()
|
||||
const { dashboardId } = useParams()
|
||||
|
||||
@ -88,7 +84,7 @@ export const EditDashboardPage: FC<Props> = props => {
|
||||
const handleCancel = (): void => navigate(-1)
|
||||
|
||||
return (
|
||||
<CodeInsightsPage className={classNames('col-8', styles.page)} isSourcegraphApp={props.isSourcegraphApp}>
|
||||
<CodeInsightsPage className={classNames('col-8', styles.page)}>
|
||||
<PageTitle title={`Configure ${dashboard.title} - Code Insights`} />
|
||||
|
||||
<PageHeader path={[{ icon: CodeInsightsIcon }, { text: 'Configure dashboard' }]} />
|
||||
@ -105,7 +101,6 @@ export const EditDashboardPage: FC<Props> = props => {
|
||||
initialValues={getDashboardInitialValues(dashboard, owners)}
|
||||
owners={owners}
|
||||
onSubmit={handleSubmit}
|
||||
isSourcegraphApp={props.isSourcegraphApp}
|
||||
>
|
||||
{formAPI => (
|
||||
<>
|
||||
|
||||
@ -11,27 +11,20 @@ import { InsightCreationPageType } from './InsightCreationPage'
|
||||
const IntroCreationLazyPage = lazyComponent(() => import('./intro/IntroCreationPage'), 'IntroCreationPage')
|
||||
const InsightCreationLazyPage = lazyComponent(() => import('./InsightCreationPage'), 'InsightCreationPage')
|
||||
|
||||
interface CreationRoutesProps extends TelemetryProps {
|
||||
isSourcegraphApp: boolean
|
||||
}
|
||||
interface CreationRoutesProps extends TelemetryProps {}
|
||||
|
||||
/**
|
||||
* Code insight sub-router for the creation area/routes.
|
||||
* Renders code insights creation routes (insight creation UI pages, creation intro page)
|
||||
*/
|
||||
export const CreationRoutes: FC<CreationRoutesProps> = props => {
|
||||
const { telemetryService, isSourcegraphApp } = props
|
||||
const { telemetryService } = props
|
||||
|
||||
const codeInsightsCompute = useExperimentalFeatures(settings => settings.codeInsightsCompute)
|
||||
|
||||
return (
|
||||
<Routes>
|
||||
<Route
|
||||
index={true}
|
||||
element={
|
||||
<IntroCreationLazyPage telemetryService={telemetryService} isSourcegraphApp={isSourcegraphApp} />
|
||||
}
|
||||
/>
|
||||
<Route index={true} element={<IntroCreationLazyPage telemetryService={telemetryService} />} />
|
||||
|
||||
<Route
|
||||
path="search"
|
||||
@ -39,7 +32,6 @@ export const CreationRoutes: FC<CreationRoutesProps> = props => {
|
||||
<InsightCreationLazyPage
|
||||
mode={InsightCreationPageType.Search}
|
||||
telemetryService={telemetryService}
|
||||
isSourcegraphApp={isSourcegraphApp}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
@ -50,7 +42,6 @@ export const CreationRoutes: FC<CreationRoutesProps> = props => {
|
||||
<InsightCreationLazyPage
|
||||
mode={InsightCreationPageType.CaptureGroup}
|
||||
telemetryService={telemetryService}
|
||||
isSourcegraphApp={isSourcegraphApp}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
@ -61,7 +52,6 @@ export const CreationRoutes: FC<CreationRoutesProps> = props => {
|
||||
<InsightCreationLazyPage
|
||||
mode={InsightCreationPageType.LangStats}
|
||||
telemetryService={telemetryService}
|
||||
isSourcegraphApp={isSourcegraphApp}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
@ -73,7 +63,6 @@ export const CreationRoutes: FC<CreationRoutesProps> = props => {
|
||||
<InsightCreationLazyPage
|
||||
mode={InsightCreationPageType.Compute}
|
||||
telemetryService={telemetryService}
|
||||
isSourcegraphApp={isSourcegraphApp}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
|
||||
@ -27,11 +27,10 @@ interface InsightCreateEvent {
|
||||
|
||||
interface InsightCreationPageProps extends TelemetryProps {
|
||||
mode: InsightCreationPageType
|
||||
isSourcegraphApp: boolean
|
||||
}
|
||||
|
||||
export const InsightCreationPage: FC<InsightCreationPageProps> = props => {
|
||||
const { mode, telemetryService, isSourcegraphApp } = props
|
||||
const { mode, telemetryService } = props
|
||||
|
||||
const navigate = useNavigate()
|
||||
const { createInsight } = useContext(CodeInsightsBackendContext)
|
||||
@ -76,7 +75,6 @@ export const InsightCreationPage: FC<InsightCreationPageProps> = props => {
|
||||
onInsightCreateRequest={handleInsightCreateRequest}
|
||||
onSuccessfulCreation={handleInsightSuccessfulCreation}
|
||||
onCancel={handleCancel}
|
||||
isSourcegraphApp={isSourcegraphApp}
|
||||
/>
|
||||
)
|
||||
}
|
||||
@ -89,7 +87,6 @@ export const InsightCreationPage: FC<InsightCreationPageProps> = props => {
|
||||
onInsightCreateRequest={handleInsightCreateRequest}
|
||||
onSuccessfulCreation={handleInsightSuccessfulCreation}
|
||||
onCancel={handleCancel}
|
||||
isSourcegraphApp={isSourcegraphApp}
|
||||
/>
|
||||
)
|
||||
}
|
||||
@ -102,7 +99,6 @@ export const InsightCreationPage: FC<InsightCreationPageProps> = props => {
|
||||
onInsightCreateRequest={handleInsightCreateRequest}
|
||||
onSuccessfulCreation={handleInsightSuccessfulCreation}
|
||||
onCancel={handleCancel}
|
||||
isSourcegraphApp={isSourcegraphApp}
|
||||
/>
|
||||
)
|
||||
}
|
||||
@ -114,7 +110,6 @@ export const InsightCreationPage: FC<InsightCreationPageProps> = props => {
|
||||
onInsightCreateRequest={handleInsightCreateRequest}
|
||||
onSuccessfulCreation={handleInsightSuccessfulCreation}
|
||||
onCancel={handleCancel}
|
||||
isSourcegraphApp={isSourcegraphApp}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
@ -29,7 +29,6 @@ export const CaptureGroupCreationPage: Story = () => {
|
||||
onSuccessfulCreation={noop}
|
||||
onInsightCreateRequest={() => Promise.resolve()}
|
||||
onCancel={noop}
|
||||
isSourcegraphApp={false}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
@ -20,7 +20,6 @@ interface CaptureGroupCreationPageProps extends TelemetryProps {
|
||||
onInsightCreateRequest: (event: { insight: MinimalCaptureGroupInsightData }) => Promise<unknown>
|
||||
onSuccessfulCreation: () => void
|
||||
onCancel: () => void
|
||||
isSourcegraphApp: boolean
|
||||
}
|
||||
|
||||
export const CaptureGroupCreationPage: FC<CaptureGroupCreationPageProps> = props => {
|
||||
@ -64,7 +63,7 @@ export const CaptureGroupCreationPage: FC<CaptureGroupCreationPageProps> = props
|
||||
}
|
||||
|
||||
return (
|
||||
<CodeInsightsPage isSourcegraphApp={props.isSourcegraphApp}>
|
||||
<CodeInsightsPage>
|
||||
<PageTitle title="Create detect and track patterns insight - Code Insights" />
|
||||
|
||||
<PageHeader
|
||||
|
||||
@ -38,7 +38,6 @@ export const ComputeInsightCreationPage: Story = () => {
|
||||
onInsightCreateRequest={fakeAPIRequest}
|
||||
onSuccessfulCreation={noop}
|
||||
onCancel={noop}
|
||||
isSourcegraphApp={false}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
@ -31,12 +31,10 @@ interface ComputeInsightCreationPageProps extends TelemetryProps {
|
||||
onInsightCreateRequest: (event: InsightCreateEvent) => Promise<unknown>
|
||||
onSuccessfulCreation: () => void
|
||||
onCancel: () => void
|
||||
isSourcegraphApp: boolean
|
||||
}
|
||||
|
||||
export const ComputeInsightCreationPage: FunctionComponent<ComputeInsightCreationPageProps> = props => {
|
||||
const { backUrl, telemetryService, onInsightCreateRequest, onSuccessfulCreation, onCancel, isSourcegraphApp } =
|
||||
props
|
||||
const { backUrl, telemetryService, onInsightCreateRequest, onSuccessfulCreation, onCancel } = props
|
||||
|
||||
const { licensed, insight } = useUiFeatures()
|
||||
const creationPermission = useObservable(useMemo(() => insight.getCreationPermissions(), [insight]))
|
||||
@ -83,7 +81,7 @@ export const ComputeInsightCreationPage: FunctionComponent<ComputeInsightCreatio
|
||||
}, [setInitialFormValues, telemetryService, onCancel])
|
||||
|
||||
return (
|
||||
<CodeInsightsPage isSourcegraphApp={isSourcegraphApp}>
|
||||
<CodeInsightsPage>
|
||||
<PageTitle title="Create group results insight - Code Insights" />
|
||||
|
||||
<PageHeader
|
||||
|
||||
@ -28,7 +28,7 @@ export const IntroPageLicensed: Story = () => {
|
||||
|
||||
return (
|
||||
<CodeInsightsBackendContext.Provider value={API}>
|
||||
<IntroCreationPage telemetryService={NOOP_TELEMETRY_SERVICE} isSourcegraphApp={false} />
|
||||
<IntroCreationPage telemetryService={NOOP_TELEMETRY_SERVICE} />
|
||||
</CodeInsightsBackendContext.Provider>
|
||||
)
|
||||
}
|
||||
@ -38,7 +38,7 @@ export const IntroPageUnLicensed: Story = () => {
|
||||
|
||||
return (
|
||||
<CodeInsightsBackendContext.Provider value={API}>
|
||||
<IntroCreationPage telemetryService={NOOP_TELEMETRY_SERVICE} isSourcegraphApp={false} />
|
||||
<IntroCreationPage telemetryService={NOOP_TELEMETRY_SERVICE} />
|
||||
</CodeInsightsBackendContext.Provider>
|
||||
)
|
||||
}
|
||||
|
||||
@ -19,9 +19,7 @@ import {
|
||||
|
||||
import styles from './IntroCreationPage.module.scss'
|
||||
|
||||
interface IntroCreationPageProps extends TelemetryProps {
|
||||
isSourcegraphApp: boolean
|
||||
}
|
||||
interface IntroCreationPageProps extends TelemetryProps {}
|
||||
|
||||
/** Displays intro page for insights creation UI. */
|
||||
export const IntroCreationPage: React.FunctionComponent<React.PropsWithChildren<IntroCreationPageProps>> = props => {
|
||||
@ -56,7 +54,7 @@ export const IntroCreationPage: React.FunctionComponent<React.PropsWithChildren<
|
||||
}, [telemetryService])
|
||||
|
||||
return (
|
||||
<CodeInsightsPage className={styles.container} isSourcegraphApp={props.isSourcegraphApp}>
|
||||
<CodeInsightsPage className={styles.container}>
|
||||
<PageTitle title="Create insight - Code Insights" />
|
||||
<PageHeader
|
||||
path={[{ icon: CodeInsightsIcon }, { text: 'Create new code insight' }]}
|
||||
|
||||
@ -67,7 +67,6 @@ export const LangStatsInsightCreationPage: Story = () => {
|
||||
onCancel={noop}
|
||||
onSuccessfulCreation={noop}
|
||||
telemetryService={NOOP_TELEMETRY_SERVICE}
|
||||
isSourcegraphApp={false}
|
||||
/>
|
||||
</MockedTestProvider>
|
||||
)
|
||||
|
||||
@ -41,13 +41,10 @@ export interface LangStatsInsightCreationPageProps extends TelemetryProps {
|
||||
* Whenever the user click on cancel button
|
||||
*/
|
||||
onCancel: () => void
|
||||
|
||||
isSourcegraphApp: boolean
|
||||
}
|
||||
|
||||
export const LangStatsInsightCreationPage: FC<LangStatsInsightCreationPageProps> = props => {
|
||||
const { backUrl, telemetryService, onInsightCreateRequest, onCancel, onSuccessfulCreation, isSourcegraphApp } =
|
||||
props
|
||||
const { backUrl, telemetryService, onInsightCreateRequest, onCancel, onSuccessfulCreation } = props
|
||||
|
||||
const { licensed, insight } = useUiFeatures()
|
||||
const creationPermission = useObservable(useMemo(() => insight.getCreationPermissions(), [insight]))
|
||||
@ -94,7 +91,7 @@ export const LangStatsInsightCreationPage: FC<LangStatsInsightCreationPageProps>
|
||||
}, [setInitialFormValues, telemetryService, onCancel])
|
||||
|
||||
return (
|
||||
<CodeInsightsPage isSourcegraphApp={isSourcegraphApp}>
|
||||
<CodeInsightsPage>
|
||||
<PageTitle title="Create language usage insight - Code Insights" />
|
||||
|
||||
<PageHeader
|
||||
|
||||
@ -38,7 +38,6 @@ export const SearchInsightCreationPage: Story = () => {
|
||||
onInsightCreateRequest={fakeAPIRequest}
|
||||
onSuccessfulCreation={noop}
|
||||
onCancel={noop}
|
||||
isSourcegraphApp={false}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
@ -42,13 +42,10 @@ export interface SearchInsightCreationPageProps extends TelemetryProps {
|
||||
* Whenever the user click on cancel button
|
||||
*/
|
||||
onCancel: () => void
|
||||
|
||||
isSourcegraphApp: boolean
|
||||
}
|
||||
|
||||
export const SearchInsightCreationPage: FC<SearchInsightCreationPageProps> = props => {
|
||||
const { backUrl, telemetryService, onInsightCreateRequest, onCancel, onSuccessfulCreation, isSourcegraphApp } =
|
||||
props
|
||||
const { backUrl, telemetryService, onInsightCreateRequest, onCancel, onSuccessfulCreation } = props
|
||||
|
||||
const { licensed, insight } = useUiFeatures()
|
||||
const creationPermission = useObservable(useMemo(() => insight.getCreationPermissions(), [insight]))
|
||||
@ -91,7 +88,7 @@ export const SearchInsightCreationPage: FC<SearchInsightCreationPageProps> = pro
|
||||
}, [telemetryService, setLocalStorageFormValues, onCancel])
|
||||
|
||||
return (
|
||||
<CodeInsightsPage isSourcegraphApp={isSourcegraphApp}>
|
||||
<CodeInsightsPage>
|
||||
<PageTitle title="Create track changes insight - Code Insights" />
|
||||
|
||||
<PageHeader
|
||||
|
||||
@ -24,11 +24,7 @@ import { EditLangStatsInsight } from './components/EditLangStatsInsight'
|
||||
import { EditSearchBasedInsight } from './components/EditSearchInsight'
|
||||
import { useEditPageHandlers } from './hooks/use-edit-page-handlers'
|
||||
|
||||
export interface EditInsightPageProps {
|
||||
isSourcegraphApp: boolean
|
||||
}
|
||||
|
||||
export const EditInsightPage: FC<EditInsightPageProps> = props => {
|
||||
export const EditInsightPage: FC = () => {
|
||||
/** Normalized insight id <type insight>.insight.<name of insight> */
|
||||
const { insightId } = useParams()
|
||||
|
||||
@ -51,7 +47,7 @@ export const EditInsightPage: FC<EditInsightPageProps> = props => {
|
||||
}
|
||||
|
||||
return (
|
||||
<CodeInsightsPage isSourcegraphApp={props.isSourcegraphApp}>
|
||||
<CodeInsightsPage>
|
||||
<PageTitle title="Edit insight - Code Insights" />
|
||||
|
||||
<PageHeader
|
||||
|
||||
@ -17,9 +17,7 @@ import { Standalone404Insight } from './components/standalone-404-insight/Standa
|
||||
|
||||
import styles from './CodeInsightIndependentPage.module.scss'
|
||||
|
||||
interface CodeInsightIndependentPage extends TelemetryProps {
|
||||
isSourcegraphApp: boolean
|
||||
}
|
||||
interface CodeInsightIndependentPage extends TelemetryProps {}
|
||||
|
||||
export const CodeInsightIndependentPage: FunctionComponent<CodeInsightIndependentPage> = props => {
|
||||
const { telemetryService } = props
|
||||
@ -42,7 +40,7 @@ export const CodeInsightIndependentPage: FunctionComponent<CodeInsightIndependen
|
||||
}
|
||||
|
||||
return (
|
||||
<CodeInsightsPage isSourcegraphApp={props.isSourcegraphApp} className={styles.root}>
|
||||
<CodeInsightsPage className={styles.root}>
|
||||
<PageTitle title={`${insight.title} - Code Insights`} />
|
||||
<PageHeader
|
||||
path={[{ to: '/insights/all', icon: CodeInsightsIcon }, { text: insight.title }]}
|
||||
|
||||
@ -11,7 +11,6 @@ import { Page } from '../../../../../components/Page'
|
||||
import { PageTitle } from '../../../../../components/PageTitle'
|
||||
import { CodeInsightsIcon } from '../../../../../insights/Icons'
|
||||
import { eventLogger } from '../../../../../tracking/eventLogger'
|
||||
import { CodeInsightsLimitedAccessAppBanner } from '../../../components/code-insights-page/limit-access-banner/CodeInsightsLimitAccessAppBanner'
|
||||
import { CodeInsightsLandingPageContext, CodeInsightsLandingPageType } from '../CodeInsightsLandingPageContext'
|
||||
import { CodeInsightsDescription } from '../getting-started/components/code-insights-description/CodeInsightsDescription'
|
||||
|
||||
@ -30,7 +29,6 @@ export const CodeInsightsDotComGetStarted: React.FunctionComponent<
|
||||
> = props => {
|
||||
const { telemetryService } = props
|
||||
const isSourcegraphDotCom = window.context.sourcegraphDotComMode
|
||||
const isSourcegraphApp = window.context.sourcegraphAppMode
|
||||
|
||||
useEffect(() => {
|
||||
telemetryService.logViewEvent('CloudInsightsGetStartedPage')
|
||||
@ -56,7 +54,6 @@ export const CodeInsightsDotComGetStarted: React.FunctionComponent<
|
||||
}
|
||||
className="mb-4"
|
||||
/>
|
||||
{isSourcegraphApp && <CodeInsightsLimitedAccessAppBanner authenticatedUser={props.authenticatedUser} />}
|
||||
<main className="pb-5">
|
||||
<Card as={CardBody} className={styles.heroSection}>
|
||||
<aside className={styles.heroVideoBlock}>
|
||||
|
||||
@ -10,14 +10,12 @@ import { DynamicCodeInsightExample } from './components/dynamic-code-insight-exa
|
||||
|
||||
import styles from './CodeInsightsGettingStartedPage.module.scss'
|
||||
|
||||
interface CodeInsightsGettingStartedPageProps extends TelemetryProps {
|
||||
isSourcegraphApp?: boolean
|
||||
}
|
||||
interface CodeInsightsGettingStartedPageProps extends TelemetryProps {}
|
||||
|
||||
export const CodeInsightsGettingStartedPage: React.FunctionComponent<
|
||||
React.PropsWithChildren<CodeInsightsGettingStartedPageProps>
|
||||
> = props => {
|
||||
const { telemetryService, isSourcegraphApp } = props
|
||||
const { telemetryService } = props
|
||||
|
||||
useEffect(() => {
|
||||
telemetryService.logViewEvent('InsightsGetStartedPage')
|
||||
@ -26,7 +24,7 @@ export const CodeInsightsGettingStartedPage: React.FunctionComponent<
|
||||
return (
|
||||
<main className="pb-5">
|
||||
<PageTitle title="Code Insights" />
|
||||
<DynamicCodeInsightExample isSourcegraphApp={isSourcegraphApp} telemetryService={telemetryService} />
|
||||
<DynamicCodeInsightExample telemetryService={telemetryService} />
|
||||
<CodeInsightsExamples telemetryService={telemetryService} className={styles.section} />
|
||||
<CodeInsightsTemplates telemetryService={telemetryService} className={styles.section} />
|
||||
</main>
|
||||
|
||||
@ -2,12 +2,10 @@ import React from 'react'
|
||||
|
||||
import { mdiOpenInNew } from '@mdi/js'
|
||||
|
||||
import { addSourcegraphAppOutboundUrlParameters } from '@sourcegraph/shared/src/util/url'
|
||||
import { H2, H3, Icon, Text, Link } from '@sourcegraph/wildcard'
|
||||
|
||||
interface Props {
|
||||
className?: string
|
||||
isSourcegraphApp?: boolean
|
||||
}
|
||||
|
||||
const productPageUrl = 'https://about.sourcegraph.com/code-insights'
|
||||
@ -15,7 +13,7 @@ const productPageUrl = 'https://about.sourcegraph.com/code-insights'
|
||||
/**
|
||||
* The product description for Code Insights.
|
||||
*/
|
||||
export const CodeInsightsDescription: React.FunctionComponent<Props> = ({ className, isSourcegraphApp }) => (
|
||||
export const CodeInsightsDescription: React.FunctionComponent<Props> = ({ className }) => (
|
||||
<section className={className}>
|
||||
<H2>Track what matters in your code</H2>
|
||||
|
||||
@ -48,11 +46,7 @@ export const CodeInsightsDescription: React.FunctionComponent<Props> = ({ classN
|
||||
</Link>
|
||||
</li>
|
||||
<li>
|
||||
<Link
|
||||
to={isSourcegraphApp ? addSourcegraphAppOutboundUrlParameters(productPageUrl) : productPageUrl}
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
>
|
||||
<Link to={productPageUrl} target="_blank" rel="noopener">
|
||||
Product page <Icon role="img" aria-label="Open in a new tab" svgPath={mdiOpenInNew} />
|
||||
</Link>
|
||||
</li>
|
||||
|
||||
@ -39,12 +39,10 @@ const INITIAL_INSIGHT_VALUES: CodeInsightExampleFormValues = {
|
||||
query: 'TODO',
|
||||
}
|
||||
|
||||
interface DynamicCodeInsightExampleProps extends TelemetryProps, React.HTMLAttributes<HTMLDivElement> {
|
||||
isSourcegraphApp?: boolean
|
||||
}
|
||||
interface DynamicCodeInsightExampleProps extends TelemetryProps, React.HTMLAttributes<HTMLDivElement> {}
|
||||
|
||||
export const DynamicCodeInsightExample: FC<DynamicCodeInsightExampleProps> = props => {
|
||||
const { telemetryService, isSourcegraphApp, ...otherProps } = props
|
||||
const { telemetryService, ...otherProps } = props
|
||||
|
||||
const { repositoryUrl, loading: repositoryValueLoading } = useExampleRepositoryUrl()
|
||||
|
||||
@ -138,7 +136,7 @@ export const DynamicCodeInsightExample: FC<DynamicCodeInsightExampleProps> = pro
|
||||
</form>
|
||||
|
||||
<div>
|
||||
<CodeInsightsDescription isSourcegraphApp={isSourcegraphApp} />
|
||||
<CodeInsightsDescription />
|
||||
<footer className={styles.footer}>
|
||||
<Button variant="primary" as={Link} to="/insights/create" onClick={handleGetStartedClick}>
|
||||
<Icon aria-hidden={true} svgPath={mdiPlus} /> Create your first insight
|
||||
|
||||
@ -197,12 +197,14 @@ export const GlobalNavbar: React.FunctionComponent<React.PropsWithChildren<Globa
|
||||
<NavBar
|
||||
ref={navbarReference}
|
||||
logo={
|
||||
<BrandLogo
|
||||
branding={branding}
|
||||
isLightTheme={isLightTheme}
|
||||
variant="symbol"
|
||||
className={styles.logo}
|
||||
/>
|
||||
!isSourcegraphApp && (
|
||||
<BrandLogo
|
||||
branding={branding}
|
||||
isLightTheme={isLightTheme}
|
||||
variant="symbol"
|
||||
className={styles.logo}
|
||||
/>
|
||||
)
|
||||
}
|
||||
>
|
||||
<NavGroup>
|
||||
@ -336,7 +338,7 @@ export const GlobalNavbar: React.FunctionComponent<React.PropsWithChildren<Globa
|
||||
</>
|
||||
)}
|
||||
{fuzzyFinderNavbar && FuzzyFinderNavItem(props.setFuzzyFinderIsVisible)}
|
||||
{props.authenticatedUser?.siteAdmin && (
|
||||
{props.authenticatedUser?.siteAdmin && !isSourcegraphApp && (
|
||||
<NavAction>
|
||||
<StatusMessagesNavItem isSourcegraphApp={isSourcegraphApp} />
|
||||
</NavAction>
|
||||
|
||||
@ -52,12 +52,16 @@ export interface NavLinkProps extends NavItemProps, Pick<LinkProps, 'to'> {
|
||||
export const NavBar = forwardRef(function NavBar({ children, logo }, reference): JSX.Element {
|
||||
return (
|
||||
<nav aria-label="Main" className={navBarStyles.navbar} ref={reference}>
|
||||
<H1 className={navBarStyles.logo}>
|
||||
<RouterNavLink className="d-flex align-items-center" to={PageRoutes.Search}>
|
||||
{logo}
|
||||
</RouterNavLink>
|
||||
</H1>
|
||||
<hr className={navBarStyles.divider} aria-hidden={true} />
|
||||
{logo && (
|
||||
<>
|
||||
<H1 className={navBarStyles.logo}>
|
||||
<RouterNavLink className="d-flex align-items-center" to={PageRoutes.Search}>
|
||||
{logo}
|
||||
</RouterNavLink>
|
||||
</H1>
|
||||
<hr className={navBarStyles.divider} aria-hidden={true} />
|
||||
</>
|
||||
)}
|
||||
{children}
|
||||
</nav>
|
||||
)
|
||||
|
||||
@ -149,7 +149,7 @@ export const UserNavItem: FC<UserNavItemProps> = props => {
|
||||
</MenuLink>
|
||||
)}
|
||||
{isSourcegraphApp && <AppUserConnectDotComAccount />}
|
||||
{!isSourcegraphDotCom && (
|
||||
{!isSourcegraphDotCom && !isSourcegraphApp && (
|
||||
<MenuLink as={Link} to="/teams">
|
||||
Teams
|
||||
</MenuLink>
|
||||
|
||||
@ -71,7 +71,6 @@ export const Default: Story = () => (
|
||||
{...props}
|
||||
telemetryService={NOOP_TELEMETRY_SERVICE}
|
||||
authenticatedUser={null}
|
||||
isSourcegraphApp={false}
|
||||
fetchNotebooks={fetchNotebooks}
|
||||
/>
|
||||
)}
|
||||
|
||||
@ -13,7 +13,6 @@ import { PageHeader, Button, useEventObservable, Alert, ButtonLink } from '@sour
|
||||
|
||||
import { AuthenticatedUser } from '../../auth'
|
||||
import { FilteredConnectionFilter } from '../../components/FilteredConnection'
|
||||
import { LimitedAccessBanner } from '../../components/LimitedAccessBanner'
|
||||
import { Page } from '../../components/Page'
|
||||
import { CreateNotebookVariables, NotebooksOrderBy } from '../../graphql-operations'
|
||||
import { EnterprisePageRoutes } from '../../routes.constants'
|
||||
@ -25,7 +24,6 @@ import { NotebooksListPageHeader } from './NotebooksListPageHeader'
|
||||
|
||||
export interface NotebooksListPageProps extends TelemetryProps {
|
||||
authenticatedUser: AuthenticatedUser | null
|
||||
isSourcegraphApp: boolean
|
||||
fetchNotebooks?: typeof _fetchNotebooks
|
||||
createNotebook?: typeof _createNotebook
|
||||
}
|
||||
@ -63,7 +61,6 @@ interface NotebooksFilter extends Pick<NotebooksListProps, 'creatorUserID' | 'st
|
||||
|
||||
export const NotebooksListPage: React.FunctionComponent<React.PropsWithChildren<NotebooksListPageProps>> = ({
|
||||
authenticatedUser,
|
||||
isSourcegraphApp,
|
||||
telemetryService,
|
||||
fetchNotebooks = _fetchNotebooks,
|
||||
createNotebook = _createNotebook,
|
||||
@ -260,14 +257,6 @@ export const NotebooksListPage: React.FunctionComponent<React.PropsWithChildren<
|
||||
<PageHeader.Breadcrumb icon={mdiBookOutline}>Notebooks</PageHeader.Breadcrumb>
|
||||
</PageHeader.Heading>
|
||||
</PageHeader>
|
||||
|
||||
{isSourcegraphApp && (
|
||||
<LimitedAccessBanner storageKey="app.limitedAccessBannerDismissed.notebooks" className="my-4">
|
||||
Notebooks is currently available to try for free while Sourcegraph App is in beta. Pricing and
|
||||
availability for Notebooks is subject to change in future releases.
|
||||
</LimitedAccessBanner>
|
||||
)}
|
||||
|
||||
{isErrorLike(importState) && (
|
||||
<Alert variant="danger">
|
||||
Error while importing the notebook: <strong>{importState.message}</strong>
|
||||
|
||||
@ -189,7 +189,7 @@ const LocalRepositoriesForm: FC<LocalRepositoriesFormProps> = props => {
|
||||
{initialState && (
|
||||
<Alert variant="secondary" className="mt-3 mb-0">
|
||||
<Text className="mb-0 text-muted">
|
||||
Pick a path to see a list of local repositories that you want to have in the Sourcegraph App
|
||||
Pick a path to see a list of local repositories that you want to have in the Cody App
|
||||
</Text>
|
||||
</Alert>
|
||||
)}
|
||||
@ -269,7 +269,7 @@ const BuiltInRepositories: FC<BuiltInRepositoriesProps> = props => {
|
||||
<hr />
|
||||
<H4 className="mt-3 mb-1">Built-in repositories</H4>
|
||||
<Text size="small" className="text-muted">
|
||||
You're running the Sourcegraph app from your terminal. We found the repositories below in your path.
|
||||
You're running the Cody app from your terminal. We found the repositories below in your path.
|
||||
</Text>
|
||||
<ul className={styles.list}>
|
||||
{foundRepositories.map(repository => (
|
||||
|
||||
@ -110,7 +110,7 @@ export const SiteAdminBackgroundJobsPage: React.FunctionComponent<
|
||||
<Text>Terminology:</Text>
|
||||
<ul>
|
||||
<li>
|
||||
<strong>Job</strong>: a bag of routines, started when the Sourcegraph app is launched
|
||||
<strong>Job</strong>: a bag of routines, started when the Cody app is launched
|
||||
</li>
|
||||
<li>
|
||||
<strong>Routine</strong>: a background process that repeatedly executes its task indefinitely, using
|
||||
|
||||
@ -365,7 +365,7 @@ export const SiteAdminUpdatesPage: React.FC<Props> = ({ telemetryService, isSour
|
||||
<Container className="mb-3">
|
||||
{isSourcegraphApp ? (
|
||||
<Text className="mb-1">
|
||||
We're making regular improvements to the Sourcegraph app.
|
||||
We're making regular improvements to the Cody app.
|
||||
<br /> For information on how to upgrade to the latest version, see{' '}
|
||||
<Link to="/help/app#upgrading" target="_blank" rel="noopener">
|
||||
our docs
|
||||
|
||||
@ -58,10 +58,10 @@ const REQUESTERS: Record<string, TokenRequester> = {
|
||||
callbackType: 'new-tab',
|
||||
},
|
||||
APP: {
|
||||
name: 'Sourcegraph App',
|
||||
name: 'Cody App',
|
||||
redirectURL: 'sourcegraph://app/auth/callback?code=$TOKEN',
|
||||
successMessage: 'Now opening the Sourcegraph App...',
|
||||
infoMessage: 'You will be redirected to Sourcegraph App.',
|
||||
successMessage: 'Now opening the Cody App...',
|
||||
infoMessage: 'You will be redirected to Cody App.',
|
||||
callbackType: 'open',
|
||||
onlyDotCom: true,
|
||||
forwardDestination: true,
|
||||
|
||||
@ -37,7 +37,7 @@ export const ProductResearchPage: React.FunctionComponent<React.PropsWithChildre
|
||||
<PageHeader headingElement="h2" path={[{ text: 'Product research and feedback' }]} className="mb-3" />
|
||||
{isSourcegraphApp && (
|
||||
<Container className="mb-2">
|
||||
<Text>Do you have feedback or need help with Sourcegraph App?</Text>
|
||||
<Text>Do you have feedback or need help with Cody App?</Text>
|
||||
{[
|
||||
{
|
||||
content: 'File an issue',
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 5.4 KiB |
Loading…
Reference in New Issue
Block a user