Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 10 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,13 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: |
set -e
export BROWSERSLIST_IGNORE_OLD_DATA=1

echo 'Installing...'
node common/scripts/install-run-rush.js install

echo 'Checking Changes...'
node common/scripts/install-run-rush.js change -v

echo 'Building...'
node common/scripts/install-run-rush.js build

echo 'Testing...'
node common/scripts/install-run-rush.js test --verbose

- name: Install dependencies
run: node common/scripts/install-run-rush.js install
env:
BROWSERSLIST_IGNORE_OLD_DATA: 1
- name: Check change files
run: node common/scripts/install-run-rush.js change -v
- name: Build
run: node common/scripts/install-run-rush.js build --timeline
- name: Test
run: node common/scripts/install-run-rush.js test --verbose
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@itwin/imodel-browser-react",
"comment": "Display last modified date in iModel table instead of created date",
"type": "minor"
}
],
"packageName": "@itwin/imodel-browser-react"
}
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ const IModelGridInternal = ({
tableColumnFavorites: "",
tableColumnName: "Name",
tableColumnDescription: "Description",
tableColumnCreatedDate: "Created Date",
tableColumnLastModified: "Last Modified",
tableLoadingData: "Loading...",
noIModelSearch: "No results found",
noIModelSearchSubtext:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export interface IModelTableStrings {
tableColumnName: string;
/** Displayed for table description header. */
tableColumnDescription: string;
/** Displayed for table created date header. */
tableColumnCreatedDate: string;
/** Displayed for table last modified date header. */
tableColumnLastModified: string;
/** Displayed for table favorites header. */
tableColumnFavorites: string;
/** Text for adding an iModel to favorites. */
Expand Down Expand Up @@ -117,14 +117,19 @@ export const useIModelTableConfig = ({
),
},
{
id: IModelCellColumn.CreatedDateTime,
Header: strings.tableColumnCreatedDate,
accessor: "createdDateTime",
id: IModelCellColumn.LastModified,
Header: strings.tableColumnLastModified,
accessor: (row: IModelFull) =>
row.lastChangesetPushDateTime ?? row.createdDateTime ?? "",
maxWidth: 350,
Cell: (props: CellProps<IModelFull>) => {
const date = props.data[props.row.index].createdDateTime;
return cellOverrides.createdDateTime
? cellOverrides.createdDateTime(props)
const date =
props.data[props.row.index].lastChangesetPushDateTime ??
props.data[props.row.index].createdDateTime;
const lastModifiedOverride =
cellOverrides.lastModified ?? cellOverrides.createdDateTime;
return lastModifiedOverride
? lastModifiedOverride(props)
: date
? new Date(date).toDateString()
: "";
Expand Down Expand Up @@ -167,14 +172,24 @@ export const useIModelTableConfig = ({
) : null;
},
},
].filter(({ id }) => !cellOverrides.hideColumns?.includes(id)),
].filter(
({ id }) =>
!cellOverrides.hideColumns?.includes(id) &&
// Support deprecated CreatedDateTime alias for the LastModified column
!(
id === IModelCellColumn.LastModified &&
cellOverrides.hideColumns?.includes(
IModelCellColumn.CreatedDateTime
)
)
),
},
],
[
strings.tableColumnFavorites,
strings.tableColumnName,
strings.tableColumnDescription,
strings.tableColumnCreatedDate,
strings.tableColumnLastModified,
strings.addToFavorites,
strings.removeFromFavorites,
favoritesContext,
Expand Down
7 changes: 7 additions & 0 deletions packages/modules/imodel-browser/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ export interface IModelFull {

/** Thumbnail for the iModel */
thumbnail?: string;

/** "Date when the last changeset was pushed to the iModel." */
lastChangesetPushDateTime?: string | null;
}

/** Full representation of an iTwin */
Expand Down Expand Up @@ -123,12 +126,16 @@ export enum IModelCellColumn {
Favorite = "Favorite",
Name = "name",
Description = "description",
LastModified = "lastChangesetPushDateTime",
/** @deprecated Since 4.1.0. Use `LastModified` instead. */
CreatedDateTime = "createdDateTime",
Options = "options",
}
export type IModelCellOverrides = {
name?: (cellData: CellProps<IModelFull>) => React.ReactNode;
description?: (cellData: CellProps<IModelFull>) => React.ReactNode;
lastModified?: (cellData: CellProps<IModelFull>) => React.ReactNode;
/** @deprecated Since 4.1.0. Use `lastModified` instead. */
createdDateTime?: (cellData: CellProps<IModelFull>) => React.ReactNode;
hideColumns?: IModelCellColumn[];
};
Expand Down
Loading