From 6398e5ec70bf937f2ab15416fb6cf8d7f0ff0f6a Mon Sep 17 00:00:00 2001 From: whyour Date: Wed, 9 Mar 2022 00:17:33 +0800 Subject: [PATCH 01/18] =?UTF-8?q?=E4=BF=AE=E5=A4=8Ddockerfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index e346ee88..597470db 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -24,6 +24,6 @@ RUN git clone -b ${QL_BRANCH} ${QL_URL} ${QL_DIR} \ && rm -rf /root/.pnpm-store \ && rm -rf /root/.cache \ && git clone -b ${QL_BRANCH} https://github.com/${QL_MAINTAINER}/qinglong-static.git /static \ - && cp -rf /static/* ${QL_DIR} \ + && cp -rf /static/* ${QL_DIR}/static \ && rm -rf /static ENTRYPOINT ["./docker/docker-entrypoint.sh"] From e0eef05f5cfe643b704362b210e1f08e0653e4de Mon Sep 17 00:00:00 2001 From: whyour Date: Wed, 9 Mar 2022 00:24:36 +0800 Subject: [PATCH 02/18] =?UTF-8?q?=E4=BF=AE=E5=A4=8Ddockerfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/Dockerfile b/docker/Dockerfile index 597470db..2cbc1f05 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -24,6 +24,7 @@ RUN git clone -b ${QL_BRANCH} ${QL_URL} ${QL_DIR} \ && rm -rf /root/.pnpm-store \ && rm -rf /root/.cache \ && git clone -b ${QL_BRANCH} https://github.com/${QL_MAINTAINER}/qinglong-static.git /static \ + && mkdir -p ${QL_DIR}/static \ && cp -rf /static/* ${QL_DIR}/static \ && rm -rf /static ENTRYPOINT ["./docker/docker-entrypoint.sh"] From 6ca098f9e2c6b428897214aa807fe8d2629d5ad9 Mon Sep 17 00:00:00 2001 From: whyour Date: Wed, 9 Mar 2022 22:32:50 +0800 Subject: [PATCH 03/18] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E6=89=8B=E6=9C=BA=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build_base.yml | 59 -------------------------------- docker/Dockerfile | 36 ++++++++++++++++--- docker/base/Dockerfile | 49 -------------------------- src/pages/crontab/detail.tsx | 8 +++-- src/pages/crontab/index.less | 27 +++++++++++---- src/pages/crontab/index.tsx | 1 + 6 files changed, 59 insertions(+), 121 deletions(-) delete mode 100644 .github/workflows/build_base.yml delete mode 100644 docker/base/Dockerfile diff --git a/.github/workflows/build_base.yml b/.github/workflows/build_base.yml deleted file mode 100644 index 1ee30b15..00000000 --- a/.github/workflows/build_base.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: Build QL BASE - -on: - schedule: - - cron: '00 18 * * *' # GMT 14:00 => 北京时间 2:00 - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-latest - - permissions: - packages: write - contents: read - - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 - with: - node-version: '14' - - - name: Set time zone - uses: szenius/set-timezone@v1.0 - with: - timezoneLinux: "Asia/Shanghai" - timezoneMacos: "Asia/Shanghai" - timezoneWindows: "China Standard Time" - - - name: Login to DockerHub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Login to GHCR - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - - name: Build and push - id: docker_build - uses: docker/build-push-action@v2 - with: - build-args: | - MAINTAINER=${{ github.repository_owner }} - QL_BRANCH=${{ github.ref_name }} - platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64 - context: . - file: docker/base/Dockerfile - push: true - tags: whyour/ql:base diff --git a/docker/Dockerfile b/docker/Dockerfile index 2cbc1f05..2af17b8d 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,5 @@ -FROM whyour/ql:base +FROM node:alpine + ARG QL_MAINTAINER="whyour" LABEL maintainer="${QL_MAINTAINER}" ARG QL_URL=https://github.com/${QL_MAINTAINER}/qinglong.git @@ -13,18 +14,45 @@ ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \ WORKDIR ${QL_DIR} -RUN git clone -b ${QL_BRANCH} ${QL_URL} ${QL_DIR} \ +RUN set -x \ + && sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \ + && apk update -f \ + && apk upgrade \ + && apk --no-cache add -f bash \ + coreutils \ + moreutils \ + git \ + curl \ + wget \ + tzdata \ + perl \ + openssl \ + nginx \ + python3 \ + jq \ + openssh \ + py3-pip \ + && rm -rf /var/cache/apk/* \ + && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \ + && echo "Asia/Shanghai" > /etc/timezone \ + && touch ~/.bashrc \ + && git config --global user.email "qinglong@@users.noreply.github.com" \ + && git config --global user.name "qinglong" \ + && npm install -g pnpm \ + && pnpm install -g pm2 \ + && pnpm install -g ts-node typescript tslib \ + && git clone -b ${QL_BRANCH} ${QL_URL} ${QL_DIR} \ && cd ${QL_DIR} \ && cp -f .env.example .env \ && chmod 777 ${QL_DIR}/shell/*.sh \ && chmod 777 ${QL_DIR}/docker/*.sh \ - && cp -rf /node_modules ./ \ - && rm -rf /node_modules \ && pnpm install --prod \ && rm -rf /root/.pnpm-store \ && rm -rf /root/.cache \ + && rm -rf /root/.npm \ && git clone -b ${QL_BRANCH} https://github.com/${QL_MAINTAINER}/qinglong-static.git /static \ && mkdir -p ${QL_DIR}/static \ && cp -rf /static/* ${QL_DIR}/static \ && rm -rf /static + ENTRYPOINT ["./docker/docker-entrypoint.sh"] diff --git a/docker/base/Dockerfile b/docker/base/Dockerfile deleted file mode 100644 index d50387f9..00000000 --- a/docker/base/Dockerfile +++ /dev/null @@ -1,49 +0,0 @@ -FROM node:alpine -ARG QL_MAINTAINER="whyour" -LABEL maintainer="${QL_MAINTAINER}" - -ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \ - LANG=zh_CN.UTF-8 \ - SHELL=/bin/bash \ - PS1="\u@\h:\w \$ " - -COPY package.json / - -RUN set -x \ - && sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \ - && apk update -f \ - && apk upgrade \ - && apk --no-cache add -f bash \ - coreutils \ - moreutils \ - git \ - curl \ - wget \ - tzdata \ - perl \ - openssl \ - nginx \ - python3 \ - jq \ - openssh \ - py3-pip \ - python2 \ - g++ \ - make \ - && rm -rf /var/cache/apk/* \ - && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \ - && echo "Asia/Shanghai" > /etc/timezone \ - && touch ~/.bashrc \ - && git config --global user.email "qinglong@@users.noreply.github.com" \ - && git config --global user.name "qinglong" \ - && npm install -g pnpm \ - && pnpm install -g pm2 \ - && pnpm install -g ts-node typescript tslib \ - && cd / && pnpm install --prod \ - && apk --purge del python2 g++ make \ - && rm -rf /root/.npm \ - && rm -rf /root/.pnpm-store \ - && rm -rf /root/.cache \ - && rm -f /package.json - -CMD [ "node" ] diff --git a/src/pages/crontab/detail.tsx b/src/pages/crontab/detail.tsx index e739e8b1..fdaa178c 100644 --- a/src/pages/crontab/detail.tsx +++ b/src/pages/crontab/detail.tsx @@ -50,11 +50,13 @@ const CronDetailModal = ({ handleCancel, visible, theme, + isPhone, }: { cron?: any; visible: boolean; handleCancel: (needUpdate?: boolean) => void; theme: string; + isPhone: boolean; }) => { const [activeTabKey, setActiveTabKey] = useState('log'); const [loading, setLoading] = useState(true); @@ -213,11 +215,11 @@ const CronDetailModal = ({ forceRender footer={false} onCancel={() => handleCancel()} - width={'80vw'} - bodyStyle={{ background: '#eee', padding: 12 }} + wrapClassName="crontab-detail" + width={!isPhone ? '80vw' : ''} >
- +
状态
diff --git a/src/pages/crontab/index.less b/src/pages/crontab/index.less index b127061f..d5663256 100644 --- a/src/pages/crontab/index.less +++ b/src/pages/crontab/index.less @@ -8,15 +8,30 @@ } } -.cron-detail-info-item { - flex: auto; +.crontab-detail { + background: '#eee'; + padding: 12px; - .cron-detail-info-title { - color: #888; + .ant-card:first-child { + overflow-x: auto; + + .ant-body { + display: 'flex'; + justify-content: space-between; + min-width: 700px; + } } - .cron-detail-info-value { - margin-top: 18px; + .cron-detail-info-item { + flex: auto; + + .cron-detail-info-title { + color: #888; + } + + .cron-detail-info-value { + margin-top: 18px; + } } } diff --git a/src/pages/crontab/index.tsx b/src/pages/crontab/index.tsx index 03b43ce4..9a670ad0 100644 --- a/src/pages/crontab/index.tsx +++ b/src/pages/crontab/index.tsx @@ -968,6 +968,7 @@ const Crontab = ({ headerStyle, isPhone, theme }: any) => { }} cron={detailCron} theme={theme} + isPhone={isPhone} /> ); From b2017301004d97c7c8863f179cad33b4a0f1755c Mon Sep 17 00:00:00 2001 From: whyour Date: Wed, 9 Mar 2022 23:40:59 +0800 Subject: [PATCH 04/18] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/crontab/index.less | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/pages/crontab/index.less b/src/pages/crontab/index.less index d5663256..04c2f634 100644 --- a/src/pages/crontab/index.less +++ b/src/pages/crontab/index.less @@ -9,14 +9,16 @@ } .crontab-detail { - background: '#eee'; - padding: 12px; + .ant-modal-body { + background: #eee; + padding: 12px; + } .ant-card:first-child { overflow-x: auto; - .ant-body { - display: 'flex'; + .ant-card-body { + display: flex; justify-content: space-between; min-width: 700px; } From ff9bf20e57be42b71e324c38e1f949392bb8ad79 Mon Sep 17 00:00:00 2001 From: whyour Date: Thu, 10 Mar 2022 00:29:28 +0800 Subject: [PATCH 05/18] =?UTF-8?q?=E6=B7=BB=E5=8A=A0podman=E5=AE=89?= =?UTF-8?q?=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/README.md b/README.md index cabb86aa..7b54c520 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,27 @@ # 待完善 ``` +### podman 部署 + +1. podman 安装 + +```bash +https://podman.io/getting-started/installation +``` + +2. 启动容器 + +```bash +podman run -dit \ + --network bridge \ + -v $PWD/ql:/ql/data \ + -p 5700:5700 \ + --name qinglong \ + --hostname qinglong \ + --restart unless-stopped \ + docker.io/whyour/qinglong:latest +``` + ### docker 部署 1. docker 安装 From 9f08245b6dee52a45a233cc90e604db278ea816f Mon Sep 17 00:00:00 2001 From: whyour Date: Thu, 10 Mar 2022 22:37:44 +0800 Subject: [PATCH 06/18] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=BA=94=E7=94=A8=E5=88=9D=E5=A7=8B=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .umirc.ts | 4 ++++ package.json | 2 ++ src/pages/setting/index.tsx | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.umirc.ts b/.umirc.ts index 16204613..e8c58209 100644 --- a/.umirc.ts +++ b/.umirc.ts @@ -16,6 +16,10 @@ export default defineConfig({ }, favicon: '/images/g5.ico', proxy: { + '/api/public': { + target: 'http://127.0.0.1:5400/', + changeOrigin: true, + }, '/api': { target: 'http://127.0.0.1:5600/', changeOrigin: true, diff --git a/package.json b/package.json index da65f87e..6376fd46 100644 --- a/package.json +++ b/package.json @@ -4,10 +4,12 @@ "start": "concurrently -n w: npm:start:*", "start:front": "umi dev", "start:back": "nodemon", + "start:public": "ts-node back/public.ts", "build:front": "umi build", "build:back": "tsc -p tsconfig.back.json", "panel": "npm run build:back && node static/build/app.js", "schedule": "npm run build:back && node static/build/schedule.js", + "public": "npm run build:back && node static/build/public.js", "prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'", "prepare": "umi generate tmp", "test": "umi-test", diff --git a/src/pages/setting/index.tsx b/src/pages/setting/index.tsx index 7894375e..36131352 100644 --- a/src/pages/setting/index.tsx +++ b/src/pages/setting/index.tsx @@ -120,7 +120,7 @@ const Setting = ({ const [theme, setTheme] = useState(defaultDarken); const [dataSource, setDataSource] = useState([]); const [isModalVisible, setIsModalVisible] = useState(false); - const [editedApp, setEditedApp] = useState(); + const [editedApp, setEditedApp] = useState(); const [tabActiveKey, setTabActiveKey] = useState('security'); const [loginLogData, setLoginLogData] = useState([]); const [notificationInfo, setNotificationInfo] = useState(); @@ -143,6 +143,7 @@ const Setting = ({ }; const addApp = () => { + setEditedApp(null); setIsModalVisible(true); }; From 1d536cdd5317b1484bcad61677487678a9f8b3fa Mon Sep 17 00:00:00 2001 From: whyour Date: Thu, 10 Mar 2022 23:53:39 +0800 Subject: [PATCH 07/18] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=80=80=E5=87=BA?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layouts/index.less | 28 +++++++++++++++++++--------- src/layouts/index.tsx | 2 +- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/layouts/index.less b/src/layouts/index.less index 2362815e..8efe8d14 100644 --- a/src/layouts/index.less +++ b/src/layouts/index.less @@ -26,6 +26,7 @@ .monaco-editor:not(.rename-box) { height: calc(100vh - 128px) !important; height: calc(100vh - var(--vh-offset, 0px) - 128px) !important; + .view-overlays .current-line { border-width: 0; } @@ -33,6 +34,7 @@ .rename-box { height: 0; + .rename-input { height: 0; padding: 0 !important; @@ -43,6 +45,7 @@ .ant-pro-grid-content.wide { max-width: unset !important; overflow: auto; + .ant-pro-page-container-children-content { overflow: auto; height: 100%; @@ -57,6 +60,7 @@ .ant-tooltip { max-width: 500px !important; + .ant-tooltip-inner { word-break: break-all !important; } @@ -72,6 +76,7 @@ .log-select { width: 250px; } + .ant-page-header-heading-left { min-width: 100px; } @@ -81,6 +86,7 @@ .config-select { width: 250px; } + .ant-page-header-heading-left { min-width: 100px; } @@ -119,10 +125,13 @@ flex-direction: column; height: calc(100vh - 48px); height: calc(100vh - var(--vh-offset, 0px) - 48px); + .ant-pro-grid-content.wide { flex: 1; + .ant-pro-grid-content-children { height: calc(100% - 36px); + > div, .log-container, .react-codemirror2, @@ -197,6 +206,7 @@ .Resizer.disabled { cursor: not-allowed; } + .Resizer.disabled:hover { border-color: transparent; } @@ -209,6 +219,7 @@ .inline-countdown.ant-statistic { display: inline-block; + .ant-statistic-content { font-size: 14px; padding: 0 3px; @@ -253,6 +264,7 @@ .ant-pro-basicLayout-content { margin: 18px; + .ant-pro-page-container { margin: -18px -18px -18px; } @@ -280,25 +292,23 @@ .side-menu-user-drop-menu { position: relative; - margin: 0; - padding: 4px 0; text-align: left; - background-clip: padding-box; outline: none; - background-color: #fff; + padding: 4px 0; + border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 4px; - box-shadow: 0 6px 16px -8px rgb(0 0 0 / 8%), 0 9px 28px 0 rgb(0 0 0 / 5%), - 0 12px 48px 16px rgb(0 0 0 / 3%); - .ant-dropdown-menu-item:hover { - color: #1890ff; - } + background-color: #373739; + box-shadow: 0 4px 10px rgb(0 0 0 / 10%); + overflow: auto; } .ant-pro-sider-logo { padding: 16px 8px !important; + h1 { margin-left: 5px !important; } + img { width: 32px !important; border-radius: 52% !important; diff --git a/src/layouts/index.tsx b/src/layouts/index.tsx index 2ba49ca7..dd4edbeb 100644 --- a/src/layouts/index.tsx +++ b/src/layouts/index.tsx @@ -272,7 +272,7 @@ export default function (props: any) { collapsed={collapsed} rightContentRender={() => ctx.isPhone && ( - + } /> admin From 7639b588d8983fe375bbf175b6e1a6e5c69ce576 Mon Sep 17 00:00:00 2001 From: whyour Date: Thu, 10 Mar 2022 23:58:57 +0800 Subject: [PATCH 08/18] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=80=80=E5=87=BA?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layouts/index.less | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/layouts/index.less b/src/layouts/index.less index 8efe8d14..4951b2f4 100644 --- a/src/layouts/index.less +++ b/src/layouts/index.less @@ -297,9 +297,13 @@ padding: 4px 0; border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 4px; - background-color: #373739; box-shadow: 0 4px 10px rgb(0 0 0 / 10%); overflow: auto; + background-color: #fff; +} + +[data-dark='true'] .side-menu-user-drop-menu { + background-color: #373739; } .ant-pro-sider-logo { From a7a56c03ce8ac41ed9906994c98fe4d9af17c872 Mon Sep 17 00:00:00 2001 From: whyour Date: Sat, 12 Mar 2022 16:14:18 +0800 Subject: [PATCH 09/18] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=80=80=E5=87=BA?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E5=92=8C=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layouts/index.tsx | 4 ++-- src/pages/crontab/index.tsx | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/layouts/index.tsx b/src/layouts/index.tsx index dd4edbeb..1b6cc552 100644 --- a/src/layouts/index.tsx +++ b/src/layouts/index.tsx @@ -272,7 +272,7 @@ export default function (props: any) { collapsed={collapsed} rightContentRender={() => ctx.isPhone && ( - + } /> admin @@ -289,7 +289,7 @@ export default function (props: any) { }} > {!collapsed && !ctx.isPhone && ( - + } /> admin diff --git a/src/pages/crontab/index.tsx b/src/pages/crontab/index.tsx index 9a670ad0..1d128148 100644 --- a/src/pages/crontab/index.tsx +++ b/src/pages/crontab/index.tsx @@ -96,7 +96,7 @@ const Crontab = ({ headerStyle, isPhone, theme }: any) => { style={{ cursor: 'point' }} onClick={(e) => { e.stopPropagation(); - setSearchText(`label:${label}`); + setSearchValue(`label:${label}`); }} > {label} @@ -364,6 +364,7 @@ const Crontab = ({ headerStyle, isPhone, theme }: any) => { const [tableScrollHeight, setTableScrollHeight] = useState(); const [isDetailModalVisible, setIsDetailModalVisible] = useState(false); const [detailCron, setDetailCron] = useState(); + const [searchValue, setSearchValue] = useState(''); const goToScriptManager = (record: any) => { const cmd = record.command.split(' ') as string[]; @@ -842,7 +843,8 @@ const Crontab = ({ headerStyle, isPhone, theme }: any) => { enterButton allowClear loading={loading} - value={searchText} + value={searchValue} + onChange={(e) => setSearchValue(e.target.value)} onSearch={onSearch} />, ) } - bodyStyle={{ height: 'calc(80vh - 188px)', overflowY: 'auto' }} + bodyStyle={{ height: 'calc(80vh - 238px)', overflowY: 'auto' }} > {contentList[activeTabKey]} @@ -320,6 +326,7 @@ const CronDetailModal = ({ }} cron={cron} data={log} + logUrl={logUrl} /> ); diff --git a/src/pages/crontab/index.less b/src/pages/crontab/index.less index 04c2f634..6ca67a55 100644 --- a/src/pages/crontab/index.less +++ b/src/pages/crontab/index.less @@ -14,13 +14,42 @@ padding: 12px; } + .ant-card-body { + padding: 18px; + } + .ant-card-head { + padding: 0 18px; + } + .ant-card:first-child { + max-height: 66px; + overflow: auto; + + .ant-card-body { + min-width: 600px; + } + + .cron-detail-info-item { + display: flex; + + .cron-detail-info-title { + width: 50px; + } + + .cron-detail-info-value { + flex: 1; + margin-top: 0; + } + } + } + + .ant-card:nth-child(2) { overflow-x: auto; .ant-card-body { display: flex; justify-content: space-between; - min-width: 700px; + min-width: 600px; } } @@ -32,7 +61,7 @@ } .cron-detail-info-value { - margin-top: 18px; + margin-top: 12px; } } } diff --git a/src/pages/crontab/index.tsx b/src/pages/crontab/index.tsx index 1d128148..3ec94523 100644 --- a/src/pages/crontab/index.tsx +++ b/src/pages/crontab/index.tsx @@ -40,7 +40,7 @@ import { getTableScroll } from '@/utils/index'; import { history } from 'umi'; import './index.less'; -const { Text } = Typography; +const { Text, Paragraph } = Typography; const { Search } = Input; export enum CrontabStatus { @@ -130,16 +130,16 @@ const Crontab = ({ headerStyle, isPhone, theme }: any) => { align: 'center' as const, render: (text: string, record: any) => { return ( - {text} - + ); }, sorter: { @@ -628,7 +628,8 @@ const Crontab = ({ headerStyle, isPhone, theme }: any) => { index: number; }> = ({ record, index }) => ( void; data?: string; + logUrl?: string; }) => { const [value, setValue] = useState('启动中...'); const [loading, setLoading] = useState(true); @@ -38,7 +40,7 @@ const CronLogModal = ({ setLoading(true); } request - .get(`${config.apiPrefix}crons/${cron.id}/log`) + .get(logUrl ? logUrl : `${config.apiPrefix}crons/${cron.id}/log`) .then((data: any) => { if (localStorage.getItem('logCron') === String(cron.id)) { const log = data.data as string; @@ -99,10 +101,10 @@ const CronLogModal = ({ }; useEffect(() => { - if (cron && cron.id) { + if (cron && cron.id && visible) { getCronLog(true); } - }, [cron]); + }, [cron, visible]); useEffect(() => { if (data) { diff --git a/src/pages/env/index.tsx b/src/pages/env/index.tsx index c3dd1e37..303b6a4d 100644 --- a/src/pages/env/index.tsx +++ b/src/pages/env/index.tsx @@ -27,7 +27,7 @@ import { HTML5Backend } from 'react-dnd-html5-backend'; import './index.less'; import { getTableScroll } from '@/utils/index'; -const { Text } = Typography; +const { Text, Paragraph } = Typography; const { Search } = Input; enum Status { @@ -119,18 +119,18 @@ const Env = ({ headerStyle, isPhone, theme }: any) => { key: 'value', align: 'center' as const, width: '35%', - ellipsis: { - showTitle: false, - }, render: (text: string, record: any) => { return ( - - {text} - + {text} + ); }, }, From fc9bc7bea23826c9cde90c71ada3c89ac93ecd5b Mon Sep 17 00:00:00 2001 From: whyour Date: Sat, 12 Mar 2022 23:57:38 +0800 Subject: [PATCH 12/18] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=90=8D=E7=A7=B0=E6=A0=87=E7=AD=BE=E6=8F=90?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/crontab/index.tsx | 48 ++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/src/pages/crontab/index.tsx b/src/pages/crontab/index.tsx index 3ec94523..ae213976 100644 --- a/src/pages/crontab/index.tsx +++ b/src/pages/crontab/index.tsx @@ -85,28 +85,32 @@ const Crontab = ({ headerStyle, isPhone, theme }: any) => { goToScriptManager(record); }} > - - {record.labels?.map((label: string) => ( - { - e.stopPropagation(); - setSearchValue(`label:${label}`); - }} - > - {label} - - ))} -
- } - > - {record.name || '-'} - + {record.labels && record.labels.length > 0 ? ( + + {record.labels?.map((label: string) => ( + { + e.stopPropagation(); + setSearchValue(`label:${label}`); + }} + > + {label} + + ))} +
+ } + > + {record.name || '-'} + + ) : ( + record.name || '-' + )} {record.isPinned ? ( From ab19f303429d48ebf8d2aa5bb3a6639b00d40453 Mon Sep 17 00:00:00 2001 From: whyour Date: Sun, 13 Mar 2022 00:03:58 +0800 Subject: [PATCH 13/18] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=97=B6=E9=97=B4=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/setting/checkUpdate.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/setting/checkUpdate.tsx b/src/pages/setting/checkUpdate.tsx index d3c04340..fed7677b 100644 --- a/src/pages/setting/checkUpdate.tsx +++ b/src/pages/setting/checkUpdate.tsx @@ -177,7 +177,7 @@ const CheckUpdate = ({ socketMessage }: any) => { 秒后自动刷新 ), - duration: 10, + duration: 30, }); setTimeout(() => { window.location.reload(); From 92ebb70eaac9299611a40362178193b4872af5d8 Mon Sep 17 00:00:00 2001 From: whyour Date: Sun, 13 Mar 2022 00:06:24 +0800 Subject: [PATCH 14/18] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=90=8D=E7=A7=B0=E6=A0=87=E7=AD=BE=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/crontab/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/crontab/index.tsx b/src/pages/crontab/index.tsx index ae213976..2a52ca96 100644 --- a/src/pages/crontab/index.tsx +++ b/src/pages/crontab/index.tsx @@ -85,7 +85,7 @@ const Crontab = ({ headerStyle, isPhone, theme }: any) => { goToScriptManager(record); }} > - {record.labels && record.labels.length > 0 ? ( + {record.labels?.length > 0 && record.labels[0] !== '' ? ( Date: Sun, 13 Mar 2022 11:09:31 +0800 Subject: [PATCH 15/18] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E4=BA=A4=E4=BA=92=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/crontab/detail.tsx | 12 ++++++++---- src/pages/crontab/index.less | 13 +++++++++++++ 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/pages/crontab/detail.tsx b/src/pages/crontab/detail.tsx index ce718297..706ebd4c 100644 --- a/src/pages/crontab/detail.tsx +++ b/src/pages/crontab/detail.tsx @@ -67,6 +67,7 @@ const CronDetailModal = ({ const editorRef = useRef(null); const [scriptInfo, setScriptInfo] = useState({}); const [logUrl, setLogUrl] = useState(''); + const [validTabs, setValidTabs] = useState(tabList); const contentList: any = { log: ( @@ -146,6 +147,8 @@ const CronDetailModal = ({ .then((data) => { setValue(data.data); }); + } else { + setValidTabs([validTabs[0]]); } }; @@ -204,7 +207,9 @@ const CronDetailModal = ({ title={ <> {cron.name} - + {cron.labels?.length > 0 && cron.labels[0] !== '' && ( + + )} {cron.labels?.length > 0 && cron.labels[0] !== '' && cron.labels?.map((label: string, i: number) => ( @@ -222,7 +227,7 @@ const CronDetailModal = ({ wrapClassName="crontab-detail" width={!isPhone ? '80vw' : ''} > -
+
任务
@@ -298,7 +303,7 @@ const CronDetailModal = ({ { onTabChange(key); @@ -314,7 +319,6 @@ const CronDetailModal = ({ ) } - bodyStyle={{ height: 'calc(80vh - 238px)', overflowY: 'auto' }} > {contentList[activeTabKey]} diff --git a/src/pages/crontab/index.less b/src/pages/crontab/index.less index 6ca67a55..44ffdf67 100644 --- a/src/pages/crontab/index.less +++ b/src/pages/crontab/index.less @@ -9,6 +9,19 @@ } .crontab-detail { + .card-wrapper { + height: 80vh; + height: calc(80vh - var(--vh-offset, 0px)); + + .ant-card:last-child { + .ant-card-body { + height: calc(80vh - 238px); + height: calc(80vh - var(--vh-offset, 0px) - 238px); + overflow-y: auto; + } + } + } + .ant-modal-body { background: #eee; padding: 12px; From be597355a753a9195e2a3f35d80c635c37c34a61 Mon Sep 17 00:00:00 2001 From: whyour Date: Sun, 13 Mar 2022 13:21:00 +0800 Subject: [PATCH 16/18] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E5=B1=95=E7=A4=BA=E8=84=9A=E6=9C=AC=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/crontab/detail.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/crontab/detail.tsx b/src/pages/crontab/detail.tsx index 706ebd4c..b2742de9 100644 --- a/src/pages/crontab/detail.tsx +++ b/src/pages/crontab/detail.tsx @@ -132,6 +132,7 @@ const CronDetailModal = ({ const getScript = () => { const cmd = cron.command.split(' ') as string[]; if (cmd[0] === 'task') { + setValidTabs(validTabs); if (cmd[1].startsWith('/ql/data/scripts')) { cmd[1] = cmd[1].replace('/ql/data/scripts/', ''); } From 5a24f62a627f7d836b29ec04b380adf4d7b9508b Mon Sep 17 00:00:00 2001 From: whyour Date: Thu, 17 Mar 2022 23:45:37 +0800 Subject: [PATCH 17/18] =?UTF-8?q?=E6=9B=B4=E6=96=B0bot.sh?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/bot.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/shell/bot.sh b/shell/bot.sh index 87e7f075..a0a59d55 100644 --- a/shell/bot.sh +++ b/shell/bot.sh @@ -22,9 +22,9 @@ if [[ ! -d ${repo_path}/.git ]]; then git_clone_scripts ${url} ${repo_path} "main" fi -cp -rf "$repo_path/jbot" $dir_root -if [[ ! -f "$dir_root/config/bot.json" ]]; then - cp -f "$repo_path/config/bot.json" "$dir_root/config" +cp -rf "$repo_path/jbot" $dir_data +if [[ ! -f "$dir_config/bot.json" ]]; then + cp -f "$repo_path/config/bot.json" "$dir_config" fi echo -e "\nbot文件下载成功...\n" @@ -32,7 +32,7 @@ echo -e "3、安装python3依赖...\n" if [[ $PipMirror ]]; then pip3 config set global.index-url $PipMirror fi -cp -f "$repo_path/jbot/requirements.txt" "$dir_root" +cp -f "$repo_path/jbot/requirements.txt" "$dir_data" cd $dir_root cat requirements.txt | while read LREAD @@ -46,7 +46,7 @@ echo -e "\npython3依赖安装成功...\n" echo -e "4、启动bot程序...\n" make_dir $dir_log/bot -cd $dir_root +cd $dir_data ps -ef | grep "python3 -m jbot" | grep -v grep | awk '{print $1}' | xargs kill -9 2>/dev/null nohup python3 -m jbot >$dir_log/bot/nohup.log 2>&1 & echo -e "bot启动成功...\n" From 7cc6081d151bbb4fd2df25700a56fd5d5c97211a Mon Sep 17 00:00:00 2001 From: whyour Date: Sat, 19 Mar 2022 16:44:00 +0800 Subject: [PATCH 18/18] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbot=E4=BE=9D=E8=B5=96?= =?UTF-8?q?=E5=AE=89=E8=A3=85=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/bot.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/bot.sh b/shell/bot.sh index a0a59d55..808b009a 100644 --- a/shell/bot.sh +++ b/shell/bot.sh @@ -34,7 +34,7 @@ if [[ $PipMirror ]]; then fi cp -f "$repo_path/jbot/requirements.txt" "$dir_data" -cd $dir_root +cd $dir_data cat requirements.txt | while read LREAD do if [[ ! $(pip3 show "${LREAD%%=*}" 2>/dev/null) ]]; then