Skip to content

Commit

Permalink
Merge branch 'main' into feat-gitlab-tx-inc
Browse files Browse the repository at this point in the history
  • Loading branch information
klesh authored Sep 10, 2024
2 parents 4eabe80 + b72d445 commit 8585d14
Show file tree
Hide file tree
Showing 36 changed files with 238 additions and 336 deletions.
11 changes: 8 additions & 3 deletions backend/plugins/circleci/impl/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,14 @@ func (p Circleci) PrepareTaskData(taskCtx plugin.TaskContext, options map[string
return nil, errors.Default.Wrap(err, "unable to get Circleci connection by the given connection ID")
}

apiClient, err := tasks.NewCircleciApiClient(taskCtx, connection)
if err != nil {
return nil, errors.Default.Wrap(err, "unable to get Circleci API client instance")
var apiClient *helper.ApiAsyncClient
syncPolicy := taskCtx.SyncPolicy()
if !syncPolicy.SkipCollectors {
newApiClient, err := tasks.NewCircleciApiClient(taskCtx, connection)
if err != nil {
return nil, errors.Default.Wrap(err, "unable to get Circleci API client instance")
}
apiClient = newApiClient
}
project := &models.CircleciProject{}
err = taskCtx.GetDal().First(project, dal.Where("slug = ?", op.ProjectSlug))
Expand Down
11 changes: 5 additions & 6 deletions config-ui/src/api/project/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@
*/

import type { IProject } from '@/types';
import { encodeName } from '@/routes';
import { request } from '@/utils';

export const list = (data: Pagination & { keyword?: string }): Promise<{ count: number; projects: IProject[] }> =>
request('/projects', { data });

export const get = (name: string): Promise<IProject> => request(`/projects/${encodeName(name)}`);
export const get = (name: string): Promise<IProject> => request(`/projects/${encodeURIComponent(name)}`);

export const checkName = (name: string) => request(`/projects/${encodeName(name)}/check`);
export const checkName = (name: string) => request(`/projects/${encodeURIComponent(name)}/check`);

export const create = (data: Pick<IProject, 'name' | 'description' | 'metrics'>) =>
request('/projects', {
Expand All @@ -34,15 +33,15 @@ export const create = (data: Pick<IProject, 'name' | 'description' | 'metrics'>)
});

export const remove = (name: string) =>
request(`/projects/${encodeName(name)}`, {
request(`/projects/${encodeURIComponent(name)}`, {
method: 'delete',
});

export const update = (name: string, data: Pick<IProject, 'name' | 'description' | 'metrics'>) =>
request(`/projects/${encodeName(name)}`, {
request(`/projects/${encodeURIComponent(name)}`, {
method: 'patch',
data: {
...data,
name: encodeName(data.name),
name: encodeURIComponent(data.name),
},
});
205 changes: 105 additions & 100 deletions config-ui/src/app/routrer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,105 +43,110 @@ import { App } from '../App';

const PATH_PREFIX = import.meta.env.DEVLAKE_PATH_PREFIX ?? '/';

export const router = createBrowserRouter([
export const router = createBrowserRouter(
[
{
path: '/',
element: <App />,
errorElement: <Error />,
children: [
{
index: true,
element: <Navigate to="projects" />,
},
{
path: 'db-migrate',
element: <DBMigrate />,
},
{
path: 'onboard',
element: <Onboard />,
},
{
path: 'projects/:pname',
element: <ProjectLayout />,
children: [
{
index: true,
element: <Navigate to="general-settings" />,
},
{
path: 'general-settings',
element: <ProjectGeneralSettings />,
},
{
path: 'general-settings/:unique',
element: <BlueprintConnectionDetailPage />,
},
{
path: 'webhooks',
element: <ProjectWebhook />,
},
{
path: 'additional-settings',
element: <ProjectAdditionalSettings />,
},
],
},
{
path: '',
element: <Layout />,
children: [
{
index: true,
element: <Navigate to="projects" />,
},
{
path: 'projects',
element: <ProjectHomePage />,
},
{
path: 'connections',
element: <Connections />,
},
{
path: 'connections/:plugin/:id',
element: <Connection />,
},
{
path: 'advanced',
children: [
{
path: 'blueprints',
element: <BlueprintHomePage />,
},
{
path: 'blueprints/:id',
element: <BlueprintDetailPage />,
},
{
path: 'blueprints/:bid/:unique',
element: <BlueprintConnectionDetailPage />,
},
{
path: 'pipelines',
element: <Pipelines />,
},
{
path: 'pipeline/:id',
element: <Pipeline />,
},
],
},
{
path: 'keys',
element: <ApiKeys />,
},
],
},
],
},
{
path: '*',
element: <NotFound />,
},
],
{
path: PATH_PREFIX,
element: <App />,
errorElement: <Error />,
children: [
{
index: true,
element: <Navigate to="projects" />,
},
{
path: 'db-migrate',
element: <DBMigrate />,
},
{
path: 'onboard',
element: <Onboard />,
},
{
path: 'projects/:pname',
element: <ProjectLayout />,
children: [
{
index: true,
element: <Navigate to="general-settings" />,
},
{
path: 'general-settings',
element: <ProjectGeneralSettings />,
},
{
path: 'general-settings/:unique',
element: <BlueprintConnectionDetailPage />,
},
{
path: 'webhooks',
element: <ProjectWebhook />,
},
{
path: 'additional-settings',
element: <ProjectAdditionalSettings />,
},
],
},
{
path: '',
element: <Layout />,
children: [
{
index: true,
element: <Navigate to="projects" />,
},
{
path: 'projects',
element: <ProjectHomePage />,
},
{
path: 'connections',
element: <Connections />,
},
{
path: 'connections/:plugin/:id',
element: <Connection />,
},
{
path: 'advanced',
children: [
{
path: 'blueprints',
element: <BlueprintHomePage />,
},
{
path: 'blueprints/:id',
element: <BlueprintDetailPage />,
},
{
path: 'blueprints/:bid/:unique',
element: <BlueprintConnectionDetailPage />,
},
{
path: 'pipelines',
element: <Pipelines />,
},
{
path: 'pipeline/:id',
element: <Pipeline />,
},
],
},
{
path: 'keys',
element: <ApiKeys />,
},
],
},
],
basename: PATH_PREFIX,
},
{
path: '*',
element: <NotFound />,
},
]);
);
1 change: 0 additions & 1 deletion config-ui/src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@
export * from './cron';
export * from './endpoint';
export * from './entities';
export * from './paths';
37 changes: 0 additions & 37 deletions config-ui/src/config/paths.ts

This file was deleted.

3 changes: 1 addition & 2 deletions config-ui/src/plugins/components/connection-list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import styled from 'styled-components';

import { selectConnections, removeConnection } from '@/features/connections';
import { Message } from '@/components';
import { PATHS } from '@/config';
import { useAppDispatch, useAppSelector } from '@/hooks';
import { getPluginConfig, ConnectionStatus, ConnectionForm } from '@/plugins';
import { WebHookConnection } from '@/plugins/register/webhook';
Expand Down Expand Up @@ -140,7 +139,7 @@ export const ConnectionList = ({ plugin, onCreate }: Props) => {
width: 300,
render: (_, { plugin, id }) => (
<>
<Button type="link" icon={<EyeOutlined />} onClick={() => navigate(PATHS.CONNECTION(plugin, id))}>
<Button type="link" icon={<EyeOutlined />} onClick={() => navigate(`/connections/${plugin}/${id}`)}>
Details
</Button>
<Button type="link" icon={<EditOutlined />} onClick={() => handleShowModal('update', id)}>
Expand Down
3 changes: 1 addition & 2 deletions config-ui/src/plugins/components/data-scope-select/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import type { McsItem } from 'miller-columns-select';
import MillerColumnsSelect from 'miller-columns-select';

import API from '@/api';
import { PATHS } from '@/config';
import { Loading, Block, ExternalLink, Message } from '@/components';
import { useRefreshData } from '@/hooks';
import { getPluginScopeId } from '@/plugins';
Expand Down Expand Up @@ -183,7 +182,7 @@ export const DataScopeSelect = ({
</Flex>
) : (
<Flex>
<ExternalLink link={PATHS.CONNECTION(plugin, connectionId)}>
<ExternalLink link={`/connections/${plugin}/${connectionId}`}>
<Button type="primary" icon={<PlusOutlined />}>
Add Data Scope
</Button>
Expand Down
3 changes: 1 addition & 2 deletions config-ui/src/plugins/components/scope-config/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import styled from 'styled-components';

import API from '@/api';
import { IconButton, Message } from '@/components';
import { PATHS } from '@/config';
import { getPluginConfig } from '@/plugins';
import { operator } from '@/utils';

Expand Down Expand Up @@ -94,7 +93,7 @@ export const ScopeConfig = ({
});

if (success) {
window.open(PATHS.PROJECT(pname));
window.open(`/projects/${pname}`);
}
};

Expand Down
3 changes: 1 addition & 2 deletions config-ui/src/routes/api-keys/api-keys.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import dayjs from 'dayjs';

import API from '@/api';
import { PageHeader, Block, ExternalLink, CopyText, Message } from '@/components';
import { PATHS } from '@/config';
import { useRefreshData } from '@/hooks';
import { operator, formatTime } from '@/utils';

Expand Down Expand Up @@ -93,7 +92,7 @@ export const ApiKeys = () => {

return (
<PageHeader
breadcrumbs={[{ name: 'API Keys', path: PATHS.APIKEYS() }]}
breadcrumbs={[{ name: 'API Keys', path: '/keys' }]}
description="You can generate and manage your API keys to access the DevLake API."
>
<Flex style={{ marginBottom: 16 }} justify="flex-end">
Expand Down
Loading

0 comments on commit 8585d14

Please sign in to comment.