Skip to content

Commit 5467971

Browse files
Merge pull request #1806 from iamfaran/feat/time-col-org
[Feat]: Add Create/Update Time column on the Orgs Page
2 parents fdbac9e + 9b8295c commit 5467971

File tree

6 files changed

+50
-4
lines changed

6 files changed

+50
-4
lines changed

client/packages/lowcoder/src/api/userApi.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ export interface GetMyOrgsResponse extends ApiResponse {
6565
data: Array<{
6666
orgId: string;
6767
orgName: string;
68+
createdAt?: number;
69+
updatedAt?: number;
6870
}>;
6971
pageNum: number;
7072
pageSize: number;

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ export type Org = {
5454
createdBy: string;
5555
commonSettings: CommonSettingResponseData;
5656
createTime?: string;
57+
createdAt?: number;
58+
updatedAt?: number;
5759
};
5860

5961
export type OrgAndRole = {

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3068,7 +3068,9 @@ export const en = {
30683068
"inviteSuccessMessage": "Join the Workspace Successfully",
30693069
"inviteFailMessage": "Failed to Join Workspace",
30703070
"uploadErrorMessage": "Upload Error",
3071-
"orgName": "Workspace Name"
3071+
"orgName": "Workspace Name",
3072+
"createdAt": "Created",
3073+
"updatedAt": "Updated"
30723074
},
30733075
"freeLimit": "Free Trial",
30743076

client/packages/lowcoder/src/pages/setting/organization/orgList.tsx

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@ import { isSaasMode } from "util/envUtils";
1919
import { selectSystemConfig } from "redux/selectors/configSelectors";
2020
import { default as Form } from "antd/es/form";
2121
import { default as Input } from "antd/es/input";
22-
import { Pagination, Spin } from "antd";
22+
import { Pagination, Spin, Tooltip } from "antd";
2323
import { getUser } from "redux/selectors/usersSelectors";
2424
import { getOrgCreateStatus } from "redux/selectors/orgSelectors";
2525
import { useWorkspaceManager } from "util/useWorkspaceManager";
2626
import { Org } from "constants/orgConstants";
2727
import { useState } from "react";
2828
import { SwapOutlined } from "@ant-design/icons";
29+
import dayjs from "dayjs";
2930

3031
const OrgName = styled.div`
3132
display: flex;
@@ -170,6 +171,8 @@ type DataItemInfo = {
170171
del: boolean;
171172
orgName: string;
172173
logoUrl: string;
174+
createdAt?: number;
175+
updatedAt?: number;
173176
};
174177

175178
function OrganizationSetting() {
@@ -194,6 +197,7 @@ function OrganizationSetting() {
194197
});
195198

196199

200+
197201
// Filter to only show orgs where user has admin permissions
198202
const adminOrgs = displayWorkspaces.filter((org: Org) => {
199203
const role = user.orgRoleMap.get(org.id);
@@ -205,10 +209,14 @@ function OrganizationSetting() {
205209
del: adminOrgs.length > 1,
206210
orgName: org.name,
207211
logoUrl: org.logoUrl || "",
212+
createdAt: org.createdAt,
213+
updatedAt: org.updatedAt,
208214
}));
209215

216+
217+
210218
return (
211-
<Level1SettingPageContentWithList>
219+
<Level1SettingPageContentWithList style={{ minWidth: "1000px" }}>
212220
<Level1SettingPageTitleWithBtn>
213221
{trans("settings.organization")}
214222
{isSaasMode(sysConfig) && (
@@ -249,7 +257,7 @@ function OrganizationSetting() {
249257
onClick: () => history.push(buildOrgId((record as DataItemInfo).id)),
250258
})}
251259
columns={[
252-
{
260+
{
253261
title: trans("orgSettings.orgName"),
254262
dataIndex: "orgName",
255263
ellipsis: true,
@@ -264,6 +272,34 @@ function OrganizationSetting() {
264272
);
265273
},
266274
},
275+
{
276+
title: trans("orgSettings.createdAt"),
277+
dataIndex: "createdAt",
278+
width: "150px",
279+
render: (createdAt: number) => {
280+
if (!createdAt) return "-";
281+
return (
282+
<Tooltip title={dayjs.unix(createdAt).format("YYYY/MM/DD HH:mm:ss")}
283+
placement="bottom">
284+
<span style={{ color: "#8b8fa3" }}>{dayjs.unix(createdAt).fromNow()}</span>
285+
</Tooltip>
286+
);
287+
},
288+
},
289+
{
290+
title: trans("orgSettings.updatedAt"),
291+
dataIndex: "updatedAt",
292+
width: "150px",
293+
render: (updatedAt: number) => {
294+
if (!updatedAt) return "-";
295+
return (
296+
<Tooltip title={dayjs.unix(updatedAt).format("YYYY/MM/DD HH:mm:ss")}
297+
placement="bottom">
298+
<span style={{ color: "#8b8fa3" }}>{dayjs.unix(updatedAt).fromNow()}</span>
299+
</Tooltip>
300+
);
301+
},
302+
},
267303
{ title: " ", dataIndex: "operation", width: "208px" },
268304
]}
269305
dataSource={dataSource.map((item, i) => ({

client/packages/lowcoder/src/redux/sagas/orgSagas.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,8 @@ export function* fetchWorkspacesSaga(action: ReduxAction<{page: number, pageSize
370370
const transformedItems = apiData.data.map(item => ({
371371
id: item.orgId,
372372
name: item.orgName,
373+
createdAt: item.createdAt,
374+
updatedAt: item.updatedAt,
373375
}));
374376

375377
yield put({

client/packages/lowcoder/src/util/useWorkspaceManager.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ export function useWorkspaceManager({
9393
const transformedItems = apiData.data.map(item => ({
9494
id: item.orgId,
9595
name: item.orgName,
96+
createdAt: item.createdAt,
97+
updatedAt: item.updatedAt,
9698
}));
9799

98100
dispatch({

0 commit comments

Comments
 (0)