You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by li...@apache.org on 2023/01/10 08:49:44 UTC
[incubator-devlake] branch main updated: fix(config-ui): github search repo missed forks (#4173)
This is an automated email from the ASF dual-hosted git repository.
likyh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/main by this push:
new f1c72e82b fix(config-ui): github search repo missed forks (#4173)
f1c72e82b is described below
commit f1c72e82b7edc7c8021abece325df612178f0535
Author: 青湛 <0x...@gmail.com>
AuthorDate: Tue Jan 10 16:49:40 2023 +0800
fix(config-ui): github search repo missed forks (#4173)
* fix(config-ui): github search repo missed forks
* fix(config-ui): pipeline duration calculation error
* fix(config-ui): start from selector default value error
* refactor(config-ui): use space replace paramsSerializer
---
.../pages/blueprint/components/sync-policy/start-from-selector.tsx | 7 +------
config-ui/src/pages/blueprint/create/bp-context.tsx | 7 +++++--
config-ui/src/pages/pipeline/components/duration/index.tsx | 6 +++++-
config-ui/src/pages/pipeline/components/historical/index.tsx | 4 ++--
config-ui/src/pages/pipeline/types.ts | 6 +++---
.../plugins/github/components/repo-selector/use-repo-selector.ts | 2 +-
config-ui/src/utils/time.ts | 3 ++-
7 files changed, 19 insertions(+), 16 deletions(-)
diff --git a/config-ui/src/pages/blueprint/components/sync-policy/start-from-selector.tsx b/config-ui/src/pages/blueprint/components/sync-policy/start-from-selector.tsx
index 983ca5c8e..079aa8dd5 100644
--- a/config-ui/src/pages/blueprint/components/sync-policy/start-from-selector.tsx
+++ b/config-ui/src/pages/blueprint/components/sync-policy/start-from-selector.tsx
@@ -44,6 +44,7 @@ const StartFromSelector = ({ value, onChange }: Props) => {
ago30d.setDate(ago30d.getDate() - 30);
const ago1y = new Date(now);
ago1y.setUTCFullYear(ago1y.getFullYear() - 1);
+
return [
{ label: 'Last 6 months', date: ago6m },
{ label: 'Last 90 days', date: ago90d },
@@ -56,12 +57,6 @@ const StartFromSelector = ({ value, onChange }: Props) => {
onChange(val ? formatTime(val, 'YYYY-MM-DD[T]HH:mm:ssZ') : null);
};
- useEffect(() => {
- if (!value) {
- handleChangeDate(quickDates[0].date);
- }
- }, [value]);
-
return (
<S.FromTimeWrapper>
<div className="quick-selection">
diff --git a/config-ui/src/pages/blueprint/create/bp-context.tsx b/config-ui/src/pages/blueprint/create/bp-context.tsx
index 2907df7ed..08249f5b4 100644
--- a/config-ui/src/pages/blueprint/create/bp-context.tsx
+++ b/config-ui/src/pages/blueprint/create/bp-context.tsx
@@ -18,10 +18,11 @@
import React, { useState, useMemo, useContext } from 'react';
import { useHistory } from 'react-router-dom';
+import dayjs from 'dayjs';
import type { ConnectionItemType } from '@/store';
import { useConnection, ConnectionStatusEnum } from '@/store';
-import { operator } from '@/utils';
+import { operator, formatTime } from '@/utils';
import { ModeEnum, FromEnum } from '../types';
import { validRawPlan } from '../utils';
@@ -83,7 +84,9 @@ export const BPContextProvider = ({ from, projectName, children }: Props) => {
const [cronConfig, setCronConfig] = useState('0 0 * * *');
const [isManual, setIsManual] = useState(false);
const [skipOnFail, setSkipOnFail] = useState(true);
- const [createdDateAfter, setCreatedDateAfter] = useState<string | null>(null);
+ const [createdDateAfter, setCreatedDateAfter] = useState<string | null>(
+ formatTime(dayjs().subtract(6, 'month').startOf('day').toDate()),
+ );
const history = useHistory();
diff --git a/config-ui/src/pages/pipeline/components/duration/index.tsx b/config-ui/src/pages/pipeline/components/duration/index.tsx
index 042b787db..b3507c5e4 100644
--- a/config-ui/src/pages/pipeline/components/duration/index.tsx
+++ b/config-ui/src/pages/pipeline/components/duration/index.tsx
@@ -23,11 +23,15 @@ import { StatusEnum } from '../../types';
interface Props {
status: StatusEnum;
- beganAt: string;
+ beganAt: string | null;
finishedAt: string | null;
}
export const PipelineDuration = ({ status, beganAt, finishedAt }: Props) => {
+ if (!beganAt) {
+ return <span>-</span>;
+ }
+
if (![StatusEnum.CANCELLED, StatusEnum.COMPLETED, StatusEnum.FAILED].includes(status)) {
return <span>{dayjs(beganAt).toNow(true)}</span>;
}
diff --git a/config-ui/src/pages/pipeline/components/historical/index.tsx b/config-ui/src/pages/pipeline/components/historical/index.tsx
index 2a752ef15..ef6b0d8ca 100644
--- a/config-ui/src/pages/pipeline/components/historical/index.tsx
+++ b/config-ui/src/pages/pipeline/components/historical/index.tsx
@@ -90,13 +90,13 @@ export const PipelineHistorical = ({ blueprintId }: Props) => {
title: 'Started at',
dataIndex: 'beganAt',
key: 'beganAt',
- render: (val: string) => (val ? formatTime(val) : '-'),
+ render: (val: string | null) => (val ? formatTime(val) : '-'),
},
{
title: 'Completed at',
dataIndex: 'finishedAt',
key: 'finishedAt',
- render: (val: string) => (val ? formatTime(val) : '-'),
+ render: (val: string | null) => (val ? formatTime(val) : '-'),
},
{
title: 'Duration',
diff --git a/config-ui/src/pages/pipeline/types.ts b/config-ui/src/pages/pipeline/types.ts
index 4d35a1954..9ea6389a9 100644
--- a/config-ui/src/pages/pipeline/types.ts
+++ b/config-ui/src/pages/pipeline/types.ts
@@ -33,8 +33,8 @@ export enum StatusEnum {
export type PipelineType = {
id: ID;
status: StatusEnum;
- beganAt: string;
- finishedAt: string;
+ beganAt: string | null;
+ finishedAt: string | null;
stage: number;
finishedTasks: number;
totalTasks: number;
@@ -47,7 +47,7 @@ export type TaskType = {
status: StatusEnum;
pipelineRow: number;
pipelineCol: number;
- beganAt: string;
+ beganAt: string | null;
finishedAt: string | null;
options: string;
message: string;
diff --git a/config-ui/src/plugins/github/components/repo-selector/use-repo-selector.ts b/config-ui/src/plugins/github/components/repo-selector/use-repo-selector.ts
index 007a9a044..7c357f987 100644
--- a/config-ui/src/plugins/github/components/repo-selector/use-repo-selector.ts
+++ b/config-ui/src/plugins/github/components/repo-selector/use-repo-selector.ts
@@ -40,7 +40,7 @@ export const useRepoSelector = ({ connectionId }: UseRepoSelectorProps) => {
const timer = setTimeout(async () => {
try {
- const res = await API.searchRepo(prefix, { q: search });
+ const res = await API.searchRepo(prefix, { q: `${search} fork:true` });
setItems(
res.items.map((it: any) => ({
connectionId,
diff --git a/config-ui/src/utils/time.ts b/config-ui/src/utils/time.ts
index 92039f24d..33b5141b4 100644
--- a/config-ui/src/utils/time.ts
+++ b/config-ui/src/utils/time.ts
@@ -46,4 +46,5 @@ dayjs.extend(LocalizedFormat);
dayjs.extend(utc);
dayjs.updateLocale('en', localeConfiguration);
-export const formatTime = (val: string | null, format = 'YYYY-MM-DD HH:mm') => (val ? dayjs(val).format(format) : '-');
+export const formatTime = (val: Date | string | null, format = 'YYYY-MM-DD HH:mm') =>
+ val ? dayjs(val).format(format) : '-';