Skip to content

Commit

Permalink
Yun002 (#2)
Browse files Browse the repository at this point in the history
* feat(independent-page): set independent-page

* feat(plugin): add fuzhijia clock plugin

* feat(clock): complete fuzhijia clock

* fix(clock): map issue after refreshing page

* fix(clock): tmap clock issue

* feat(wxcom-auth): add wxcom auth plugin

* fix(merge): merge from main

---------

Co-authored-by: jessetalk <>
  • Loading branch information
jessetalk committed May 25, 2024
1 parent bdde49e commit 219cb48
Show file tree
Hide file tree
Showing 85 changed files with 3,786 additions and 89 deletions.
10 changes: 7 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM node:20-bullseye as builder
ARG VERDACCIO_URL=http://host.docker.internal:10104/
ARG VERDACCIO_URL=http://106.75.16.42:10104/
ARG COMMIT_HASH
ARG APPEND_PRESET_LOCAL_PLUGINS
ARG BEFORE_PACK_NOCOBASE="ls -l"
Expand All @@ -8,11 +8,13 @@ ARG PLUGINS_DIRS
ENV PLUGINS_DIRS=${PLUGINS_DIRS}


RUN npx npm-cli-adduser --username test --password test -e test@nocobase.com -r $VERDACCIO_URL

RUN sed -i "s@http://\(deb\|security\).debian.org@http://mirrors.tencent.com@g" /etc/apt/sources.list
RUN apt-get update && apt-get install -y jq
WORKDIR /tmp
COPY . /tmp
RUN npx npm-cli-adduser --username test --password test -e test@nocobase.com -r $VERDACCIO_URL
# RUN npx npm-cli-login -u test -p test -e test@nocobase.com -r $VERDACCIO_URL

RUN cd /tmp && \
NEWVERSION="$(cat lerna.json | jq '.version' | tr -d '"').$(date +'%Y%m%d%H%M%S')" \
&& tmp=$(mktemp) \
Expand Down Expand Up @@ -43,7 +45,9 @@ RUN cd /app \
&& tar -zcf ./nocobase.tar.gz -C /app/my-nocobase-app .
FROM node:20-bullseye-slim
RUN sed -i "s@http://\(deb\|security\).debian.org@http://mirrors.tencent.com@g" /etc/apt/sources.list
RUN apt-get update && apt-get install -y nginx
RUN rm -rf /etc/nginx/sites-enabled/default
COPY ./docker/nocobase/nocobase.conf /etc/nginx/sites-enabled/nocobase.conf
Expand Down
16 changes: 8 additions & 8 deletions packages/core/client/src/powered-by/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ export const PoweredBy = () => {

return (
<div
className={cx(style, 'nb-brand')}
dangerouslySetInnerHTML={{
__html: parseHTML(
customBrandPlugin?.options?.options?.brand ||
`Powered by <a href="${urls[i18n.language] || urls['en-US']}" target="_blank">NocoBase</a>`,
{ appVersion },
),
}}
// className={cx(style, 'nb-brand')}
// dangerouslySetInnerHTML={{
// __html: parseHTML(
// customBrandPlugin?.options?.options?.brand ||
// `Powered by <a href="${urls[i18n.language] || urls['en-US']}" target="__blank">NocoBase</a>`,
// { appVersion },
// ),
// }}
></div>
);
};
169 changes: 92 additions & 77 deletions packages/core/client/src/route-switch/antd/admin-layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { useSessionStorageState } from 'ahooks';
import { App, ConfigProvider, Divider, Layout } from 'antd';
import { createGlobalStyle } from 'antd-style';
import React, { createContext, useContext, useEffect, useMemo, useRef, useState } from 'react';
import { Link, Outlet, useLocation, useMatch, useNavigate, useParams } from 'react-router-dom';
import { Link, Outlet, useLocation, useMatch, useNavigate, useParams, useSearchParams } from 'react-router-dom';
import {
ACLRolesCheckProvider,
CurrentAppInfoProvider,
Expand Down Expand Up @@ -315,6 +315,8 @@ export const InternalAdminLayout = () => {
const result = useSystemSettings();
const { token } = useToken();
const sideMenuRef = useRef<HTMLDivElement>();
const [searchParams] = useSearchParams();
const [independentPage, setIndependentPage] = useState<boolean>();

const layoutHeaderCss = useMemo(() => {
return css`
Expand Down Expand Up @@ -359,82 +361,92 @@ export const InternalAdminLayout = () => {
token.colorTextHeaderMenu,
]);

useEffect(() => {
// TODO: 临时方案,后面看看能不能采用其他更好的方式
setIndependentPage(searchParams.get('independent-page') === 'true');
}, []);

return (
<Layout>
<GlobalStyleForAdminLayout />
<Layout.Header className={layoutHeaderCss}>
<div
style={{
position: 'relative',
width: '100%',
height: '100%',
display: 'flex',
}}
>
<div
style={{
position: 'relative',
zIndex: 1,
flex: '1 1 auto',
display: 'flex',
height: '100%',
}}
>
{!independentPage && (
<>
<Layout.Header className={layoutHeaderCss}>
<div
className={css`
width: 200px;
display: inline-flex;
flex-shrink: 0;
color: #fff;
padding: 0;
align-items: center;
`}
style={{
position: 'relative',
width: '100%',
height: '100%',
display: 'flex',
}}
>
<img
<div
style={{
position: 'relative',
zIndex: 1,
flex: '1 1 auto',
display: 'flex',
height: '100%',
}}
>
<div
className={css`
width: 200px;
display: inline-flex;
flex-shrink: 0;
color: #fff;
padding: 0;
align-items: center;
`}
>
<img
className={css`
padding: 0 16px;
object-fit: contain;
width: 100%;
height: 100%;
`}
src={result?.data?.data?.logo?.url}
/>
</div>
<div
className={css`
flex: 1 1 auto;
width: 0;
`}
>
<SetThemeOfHeaderSubmenu>
<MenuEditor sideMenuRef={sideMenuRef} />
</SetThemeOfHeaderSubmenu>
</div>
</div>
<div
className={css`
padding: 0 16px;
object-fit: contain;
width: 100%;
position: relative;
flex-shrink: 0;
height: 100%;
z-index: 10;
`}
src={result?.data?.data?.logo?.url}
/>
</div>
<div
className={css`
flex: 1 1 auto;
width: 0;
`}
>
<SetThemeOfHeaderSubmenu>
<MenuEditor sideMenuRef={sideMenuRef} />
</SetThemeOfHeaderSubmenu>
>
<PinnedPluginList />
<ConfigProvider
theme={{
token: {
colorSplit: 'rgba(255, 255, 255, 0.1)',
},
}}
>
<Divider type="vertical" />
</ConfigProvider>
<Help />
<CurrentUser />
</div>
</div>
</div>
<div
className={css`
position: relative;
flex-shrink: 0;
height: 100%;
z-index: 10;
`}
>
<PinnedPluginList />
<ConfigProvider
theme={{
token: {
colorSplit: 'rgba(255, 255, 255, 0.1)',
},
}}
>
<Divider type="vertical" />
</ConfigProvider>
<Help />
<CurrentUser />
</div>
</div>
</Layout.Header>
<AdminSideBar sideMenuRef={sideMenuRef} />
</Layout.Header>
<AdminSideBar sideMenuRef={sideMenuRef} />
</>
)}

<Layout.Content
className={css`
display: flex;
Expand All @@ -456,15 +468,18 @@ export const InternalAdminLayout = () => {
}
`}
>
<header
className={css`
flex-shrink: 0;
height: var(--nb-header-height);
line-height: var(--nb-header-height);
background: transparent;
pointer-events: none;
`}
></header>
{!independentPage && (
<header
className={css`
flex-shrink: 0;
height: var(--nb-header-height);
line-height: var(--nb-header-height);
background: transparent;
pointer-events: none;
`}
></header>
)}

<Outlet />
{/* {service.contentLoading ? render() : <Outlet />} */}
</Layout.Content>
Expand Down
2 changes: 1 addition & 1 deletion packages/core/client/src/user/Help.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const SettingsMenu: React.FC<{
},
];

return <Menu items={items} />;
return <Menu />;
};

const helpClassName = css`
Expand Down
2 changes: 2 additions & 0 deletions packages/plugins/@yun002/plugin-dingtalk-auth/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/node_modules
/src
1 change: 1 addition & 0 deletions packages/plugins/@yun002/plugin-dingtalk-auth/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# @yun002/plugin-dingtalk-auth
2 changes: 2 additions & 0 deletions packages/plugins/@yun002/plugin-dingtalk-auth/client.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './dist/client';
export { default } from './dist/client';
1 change: 1 addition & 0 deletions packages/plugins/@yun002/plugin-dingtalk-auth/client.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('./dist/client/index.js');
14 changes: 14 additions & 0 deletions packages/plugins/@yun002/plugin-dingtalk-auth/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "@yun002/plugin-dingtalk-auth",
"version": "1.0.0-alpha.5",
"main": "dist/server/index.js",
"dependencies": {
"dingtalk-h5-remote-debug": "^0.1.3",
"dingtalk-jsapi": "^3.0.33"
},
"peerDependencies": {
"@nocobase/client": "1.x",
"@nocobase/server": "1.x",
"@nocobase/test": "1.x"
}
}
2 changes: 2 additions & 0 deletions packages/plugins/@yun002/plugin-dingtalk-auth/server.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './dist/server';
export { default } from './dist/server';
1 change: 1 addition & 0 deletions packages/plugins/@yun002/plugin-dingtalk-auth/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('./dist/server/index.js');
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import React, { useEffect, useMemo } from 'react';
import { useAPIClient, useAppSpin, useRequest } from '@nocobase/client';
import { Card, Form, Button, Input, message, Collapse, Divider } from 'antd';

interface DingtalkSettingModel {
key: string;
secret: string;
}

const DingtalkSettingConfiguration: React.FC<any> = () => {
const { render } = useAppSpin();
const [form] = Form.useForm();
const apiClient = useAPIClient();

const data = useRequest<DingtalkSettingModel>(
{
url: 'DingtalkSetting:get/1',
},
{
onSuccess(data) {
form.setFieldsValue(data.data);
},
},
);

if (data.loading) {
return render();
}

const onSubmit = async (values) => {
try {
await apiClient.request({
url: 'DingtalkSetting:enable',
method: 'POST',
data: values,
});
message.success('保存成功');
} catch (err) {
throw err;
}
};

const onSync = async () => {
try {
await apiClient.request({
url: 'DingtalkSetting:sync',
method: 'POST',
});
message.success('同步成功');
} catch (err) {
throw err;
}
};

return (
<Collapse bordered={false}>
<Collapse.Panel key="step1" header="2. 对接信息录入">
<Form form={form} onFinish={onSubmit} layout="vertical">
<Form.Item name="corpId" required label="Corp Id">
<Input />
</Form.Item>
<Form.Item name="key" required label="Client Key">
<Input />
</Form.Item>
<Form.Item name="secret" required label="Client Secret">
<Input />
</Form.Item>
<Form.Item>
<Button type="primary" htmlType="submit">
启用
</Button>
</Form.Item>
</Form>
</Collapse.Panel>

<Collapse.Panel key="step2" header="3. 同步通讯录">
<Button type="primary" htmlType="button" onClick={onSync}>
同步通讯录
</Button>
</Collapse.Panel>
</Collapse>
);
};

export const DingtalkSetting = () => {
return (
<Card>
<DingtalkSettingConfiguration></DingtalkSettingConfiguration>
</Card>
);
};
Loading

0 comments on commit 219cb48

Please sign in to comment.