Skip to content

Commit 4247b0c

Browse files
committed
feat: move workspace setting to homepage
1 parent 7e80121 commit 4247b0c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1050
-581
lines changed

client/packages/openblocks-design/src/components/Dropdown.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ export function Dropdown<T extends OptionsType>(props: {
152152
allowClear?: boolean;
153153
itemNode?: (value: string) => JSX.Element;
154154
preNode?: () => JSX.Element;
155+
showSearch?: boolean;
155156
}) {
156157
const { placement = "right" } = props;
157158
const valueInfoMap = _.fromPairs(props.options.map((option) => [option.value, option]));
@@ -168,7 +169,7 @@ export function Dropdown<T extends OptionsType>(props: {
168169
<DropdownContainer placement={placement}>
169170
<CustomSelect
170171
dropdownClassName="ob-dropdown-control-select"
171-
showSearch={!props.border}
172+
showSearch={props.showSearch}
172173
filterOption={(input, option) => {
173174
if (!option?.value) {
174175
return false;
Lines changed: 23 additions & 0 deletions
Loading
Lines changed: 23 additions & 0 deletions
Loading

client/packages/openblocks-design/src/icons/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,3 +204,5 @@ export { ReactComponent as CollapsibleContainerCompIcon } from "./icon-collapsib
204204
export { ReactComponent as ToggleButtonCompIcon } from "./icon-toggle-button.svg";
205205
export { ReactComponent as GoogleSheetsIcon } from "./icon-query-GoogleSheets.svg";
206206
export { ReactComponent as imageEditorIcon } from "./icon-insert-imageEditor.svg";
207+
export { ReactComponent as HomeSettingsIcon } from "./icon-home-settings.svg";
208+
export { ReactComponent as HomeSettingsActiveIcon } from "./icon-home-settings-active.svg";

client/packages/openblocks/src/app.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,12 @@ class AppIndex extends React.Component<AppIndexProps, any> {
113113
FOLDERS_URL,
114114
FOLDER_URL,
115115
TRASH_URL,
116+
SETTING,
116117
]}
117118
// component={ApplicationListPage}
118119
component={ApplicationHome}
119120
/>
120121
<LazyRoute path={USER_AUTH_URL} load={() => import("@openblocks-ee/pages/userAuth")} />
121-
<LazyRoute
122-
path={SETTING}
123-
fallback="outAppLayout"
124-
load={() => import("pages/setting")}
125-
/>
126122
<LazyRoute
127123
path={INVITE_LANDING_URL}
128124
load={() => import("pages/common/inviteLanding")}

client/packages/openblocks/src/components/ApplicationSelect.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export default function ApplicationSelect(props: IAppSelectProps) {
4040
}
4141
return (
4242
<Dropdown
43+
showSearch={true}
4344
value={value}
4445
onChange={(id: string) => onChange?.(id)}
4546
options={applications.map((i) => {

client/packages/openblocks/src/components/Table.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ export const Table = styled(AntdTable)`
4848
.ant-table-thead:after {
4949
content: "";
5050
position: absolute;
51-
left: 8px;
52-
right: 8px;
51+
left: 12px;
52+
right: 12px;
5353
bottom: 0;
5454
background: #e1e3eb;
5555
height: 1px;
@@ -59,8 +59,8 @@ export const Table = styled(AntdTable)`
5959
.ant-table-row:after {
6060
content: "";
6161
position: absolute;
62-
left: 8px;
63-
right: 8px;
62+
left: 12px;
63+
right: 12px;
6464
bottom: 0;
6565
background: #f0f0f0;
6666
height: 1px;
@@ -105,4 +105,7 @@ export const Table = styled(AntdTable)`
105105
.ant-table-ping-right:not(.ant-table-has-fix-right) .ant-table-container::after {
106106
box-shadow: none;
107107
}
108+
.ant-table-thead > tr > th, .ant-table-tbody > tr > td {
109+
padding: 16px 12px;
110+
}
108111
`;

client/packages/openblocks/src/components/layout/SideBar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const Sider = styled(Layout.Sider)`
2525
export default function SideBar(props: SiderProps) {
2626
const { children, ...otherProps } = props;
2727
return (
28-
<Sider theme="light" width={240} {...otherProps}>
28+
<Sider theme="light" width={244} {...otherProps}>
2929
{props.children}
3030
</Sider>
3131
);

client/packages/openblocks/src/components/layout/SubSideBar.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,27 @@ import { PropsWithChildren } from "react";
22
import styled from "styled-components";
33

44
const Wrapper = styled.div`
5-
min-width: 227px;
6-
width: 227px;
5+
min-width: 232px;
6+
width: 232px;
77
height: 100%;
88
background: #ffffff;
99
border-right: 1px solid #f0f0f0;
1010
box-sizing: border-box;
1111
border-radius: 2px;
12-
padding: 32px 24px 0 24px;
12+
padding: 32px 16px 0 16px;
1313
1414
h2 {
1515
font-weight: 500;
16-
font-size: 18px;
16+
font-size: 20px;
1717
color: #222222;
18-
line-height: 18px;
1918
margin: 0 0 20px 12px;
2019
}
20+
.ant-menu-inline .ant-menu-item {
21+
margin: 4px 0;
22+
}
23+
.ant-menu-item:hover, .ant-menu-item-selected {
24+
border-radius: 4px;
25+
}
2126
`;
2227

2328
interface IProps {

client/packages/openblocks/src/comps/comps/layout/layoutMenuItemComp.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ function AppSelectorPropertyView(props: {
4848

4949
return (
5050
<Dropdown
51+
showSearch={true}
5152
value={appId}
5253
options={options}
5354
label={trans("aggregation.chooseApp")}

client/packages/openblocks/src/comps/comps/tableComp/column/columnTypeComp.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ export class ColumnTypeComp extends TypedColumnTypeComp {
8383
return (
8484
<>
8585
<Dropdown
86+
showSearch={true}
8687
value={this.children.compType.getView()}
8788
options={actionOptions}
8889
label={trans("table.columnType")}

client/packages/openblocks/src/comps/controls/actionSelector/executeCompAction.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ export function executeCompAction(params: ExecuteCompActionOptions) {
153153
<CompNameContext.Consumer>
154154
{(compName) => (
155155
<Dropdown
156+
showSearch={true}
156157
value={name}
157158
options={compList
158159
.filter(
@@ -189,7 +190,9 @@ export function executeCompAction(params: ExecuteCompActionOptions) {
189190
/>
190191
</BranchDiv>
191192
)}
192-
{!!params?.length && <BranchDiv>{this.children.params.propertyView(params)}</BranchDiv>}
193+
{!!params?.length && (
194+
<BranchDiv>{this.children.params.propertyView(params)}</BranchDiv>
195+
)}
193196
</>
194197
);
195198
}}

client/packages/openblocks/src/comps/controls/actionSelector/executeQueryAction.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ export class ExecuteQueryAction extends ExecuteQueryTmpAction {
8181
{(editorState) => (
8282
<>
8383
<Dropdown
84+
showSearch={true}
8485
value={this.children.queryName.getView()}
8586
options={getQueryOptions(editorState)}
8687
label={trans("eventHandler.selectQuery")}

client/packages/openblocks/src/comps/controls/querySelectControl.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ function QuerySelect(props: IProps) {
1515
const editorState = useContext(EditorContext);
1616
return (
1717
<Dropdown
18+
showSearch={true}
1819
allowClear
1920
value={value}
2021
options={editorState.queryCompInfoList().map((info) => ({

client/packages/openblocks/src/comps/queries/redisQuery.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ export class RedisQuery extends RedisTmpQuery {
286286
<QueryConfigLabelMethod />
287287
<div style={{ width: "184px", flexGrow: 1 }}>
288288
<Dropdown
289+
showSearch={true}
289290
options={CommandOptions}
290291
value={this.children.compType.getView()}
291292
onChange={(value) => this.dispatch(changeValueAction({ compType: value, comp: {} }))}

client/packages/openblocks/src/comps/queries/sqlQuery/tableNameComp.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const PropertyView = (props: { value: string; dispatch: DispatchType }) => {
1919
})) ?? [];
2020
return (
2121
<Dropdown
22+
showSearch={true}
2223
label={trans("sqlQuery.table")}
2324
placeholder={"table"}
2425
placement={"bottom"}

client/packages/openblocks/src/constants/orgConstants.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ export type OrgGroup = {
2828
// the backend create user groups by default, not displayed in some conditions
2929
allUsersGroup?: boolean;
3030
devGroup?: boolean;
31+
createTime?: string;
32+
visitorRole?: string;
3133
};
3234

3335
// user info in group
@@ -50,6 +52,7 @@ export type Org = {
5052
contactPhoneNumber?: string;
5153
createdBy: string;
5254
commonSettings: CommonSettingResponseData;
55+
createTime?: string;
5356
};
5457

5558
export type OrgAndRole = {

client/packages/openblocks/src/constants/routesURL.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@ export const COMPONENT_DOC_URL = "/components";
99
export const SETTING = "/setting";
1010
export const PERMISSION_SETTING = "/setting/permission";
1111
export const ORGANIZATION_SETTING = "/setting/organization";
12-
export const AUDIT_SETTING = "/setting/audit";
1312
export const THEME_SETTING = "/setting/theme";
1413
export const THEME_DETAIL = "/setting/theme/detail";
1514

16-
export const ADVANCED_SETTING = "/setting/advanced";
17-
export const PERMISSION_USERS = `${PERMISSION_SETTING}/users`;
15+
export const PERMISSION_SETTING_DETAIL = `${PERMISSION_SETTING}/:groupId`;
16+
export const ORGANIZATION_SETTING_DETAIL = `${ORGANIZATION_SETTING}/:orgId`;
1817

1918
export const ALL_APPLICATIONS_URL = "/apps";
2019
export const MODULE_APPLICATIONS_URL = "/apps/module";
@@ -70,3 +69,7 @@ export const buildAppRouteWithState = (
7069
export function preview(applicationId: string) {
7170
window.open(APPLICATION_VIEW_URL(applicationId, "preview"));
7271
}
72+
73+
export const buildGroupId = (groupId: string) => `${PERMISSION_SETTING}/${groupId}`
74+
75+
export const buildOrgId = (orgId: string) => `${ORGANIZATION_SETTING}/${orgId}`

client/packages/openblocks/src/i18n/locales/en.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,9 @@ export const en = {
233233
primary: "Brand color",
234234
primaryDesc: "Most components use the default primary color",
235235
textDark: "Text dark color",
236+
textDarkDesc: "Apply when the background color is light",
236237
textLight: "Text light color",
238+
textLightDesc: "Apply when the background color is dark",
237239
canvas: "Canvas color",
238240
canvasDesc: "The default background color of the app",
239241
primarySurface: "Container color",
@@ -1204,6 +1206,8 @@ export const en = {
12041206
inviteCopyError: "Copy fails, you can manually select and copy",
12051207
inviteText:
12061208
'{userName} invites you to join the workspace "{organization}", Click on the link to join: {inviteLink}',
1209+
groupName: "Group name",
1210+
createTime: "Create time",
12071211
},
12081212
orgSettings: {
12091213
newOrg: "New workspace",
@@ -1220,6 +1224,7 @@ export const en = {
12201224
inviteSuccessMessage: "Join the workspace successfully",
12211225
inviteFailMessage: "Failed to join workspace",
12221226
uploadErrorMessage: "Upload error",
1227+
orgName: "Workspace name",
12231228
},
12241229
freeLimit: "Free trial",
12251230
tabbedContainer: {
@@ -1377,10 +1382,7 @@ export const en = {
13771382
goList: "Back to the list",
13781383
saveBtn: "Save the settings",
13791384
mainColor: "Main colors",
1380-
text: "Text",
1381-
textColor: "Text colors",
1382-
textDesc:
1383-
"Light and dark text colors are available. The component automatically uses the most readable option.",
1385+
text: "Text colors",
13841386
defaultTheme: "Default",
13851387
yellow: "Yellow",
13861388
green: "Green",

client/packages/openblocks/src/pages/ApplicationV2/HomeTableView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export const HomeTableView = (props: { resources: HomeRes[] }) => {
5454
return (
5555
<>
5656
<Table
57-
style={{ padding: "0 20px 80px", color: "#8B8FA3" }}
57+
style={{ padding: "0 24px 80px", color: "#8B8FA3" }}
5858
tableLayout={"auto"}
5959
scroll={{ x: "100%" }}
6060
pagination={false}

client/packages/openblocks/src/pages/ApplicationV2/TrashTableView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export const TrashTableView = (props: { resources: HomeRes[] }) => {
3636

3737
return (
3838
<Table
39-
style={{ padding: " 0 20px 80px", color: "#8B8FA3" }}
39+
style={{ padding: " 0 24px 80px", color: "#8B8FA3" }}
4040
tableLayout={"auto"}
4141
scroll={{ x: "100%" }}
4242
pagination={false}

client/packages/openblocks/src/pages/ApplicationV2/index.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
MODULE_APPLICATIONS_URL,
88
QUERY_LIBRARY_URL,
99
TRASH_URL,
10+
SETTING,
1011
} from "constants/routesURL";
1112
import { getCurrentUser, isFetchingUser } from "redux/selectors/usersSelectors";
1213
import { useDispatch, useSelector } from "react-redux";
@@ -25,6 +26,8 @@ import {
2526
PointIcon,
2627
RecyclerActiveIcon,
2728
RecyclerIcon,
29+
HomeSettingsActiveIcon,
30+
HomeSettingsIcon,
2831
} from "openblocks-design";
2932
import React, { useEffect, useState } from "react";
3033
import { fetchAllApplications, fetchHomeData } from "redux/reduxActions/applicationActions";
@@ -48,6 +51,7 @@ import { useCreateFolder } from "./useCreateFolder";
4851
import { EllipsisTextCss } from "openblocks-design";
4952
import { trans } from "../../i18n";
5053
import { foldersSelector } from "../../redux/selectors/folderSelector";
54+
import Setting from "pages/setting";
5155

5256
const TabLabel = styled.div`
5357
font-weight: 500;
@@ -324,6 +328,20 @@ export default function ApplicationHome() {
324328
visible: ({ user }) => user.orgDev,
325329
onSelected: (_, currentPath) => currentPath.split("/")[1] === "datasource",
326330
},
331+
{
332+
text: <TabLabel>{trans("settings.title")}</TabLabel>,
333+
routePath: SETTING,
334+
routePathExact: false,
335+
routeComp: Setting,
336+
icon: ({ selected, ...otherProps }) =>
337+
selected ? (
338+
<HomeSettingsActiveIcon {...otherProps} />
339+
) : (
340+
<HomeSettingsIcon {...otherProps} />
341+
),
342+
visible: ({ user }) => user.orgDev,
343+
onSelected: (_, currentPath) => currentPath.split("/")[1] === "setting",
344+
},
327345
],
328346
},
329347
]}

0 commit comments

Comments
 (0)