Skip to content

Commit

Permalink
Rename "Timestamp" column label to "Created" (#2269)
Browse files Browse the repository at this point in the history
  • Loading branch information
julieg18 authored Aug 29, 2022
1 parent 0e0c4e2 commit 07a2f2a
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 41 deletions.
4 changes: 2 additions & 2 deletions extension/src/experiments/columns/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ColumnType } from '../webview/contract'

export const timestampColumn = {
hasChildren: false,
label: 'Timestamp',
path: 'Timestamp',
label: 'Created',
path: 'Created',
type: ColumnType.TIMESTAMP
}
4 changes: 2 additions & 2 deletions extension/src/experiments/columns/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ type Columns = {
deps: DepColumns | undefined
metrics: MetricOrParamColumns | undefined
params: MetricOrParamColumns | undefined
Timestamp: string | null | undefined
Created: string | null | undefined
}

export const extractColumns = (
Expand All @@ -89,7 +89,7 @@ export const extractColumns = (
].join('\n')

const columns: Columns = {
Timestamp: experiment?.timestamp,
Created: experiment?.timestamp,
deps: extractDeps(experiment.deps, branch),
metrics: metricsData?.columns,
params: paramsData?.columns
Expand Down
6 changes: 3 additions & 3 deletions extension/src/experiments/model/collect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,13 @@ const transformColumns = (
experimentFields: ExperimentFields,
branch?: Experiment
) => {
const { error, metrics, params, deps, Timestamp } = extractColumns(
const { error, metrics, params, deps, Created } = extractColumns(
experimentFields,
branch
)

if (Timestamp) {
experiment.Timestamp = Timestamp
if (Created) {
experiment.Created = Created
}
if (metrics) {
experiment.metrics = metrics
Expand Down
18 changes: 9 additions & 9 deletions extension/src/experiments/model/status/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ describe('canSelect', () => {
describe('limitToMaxSelected', () => {
const mockedExperiments = [
{ id: '1', label: 'A' },
{ Timestamp: null, id: '2', label: 'B' },
{ Timestamp: '2022-02-20T09:10:52', id: '3', label: 'C' },
{ Timestamp: '2022-02-20T09:10:53', id: '4', label: 'D' },
{ Timestamp: '2022-02-20T09:10:54', id: '5', label: 'E' },
{ Timestamp: '2022-02-20T09:10:55', id: '6', label: 'F' },
{ Timestamp: '2022-02-20T09:10:56', id: '7', label: 'G' },
{ Timestamp: '2022-02-20T09:10:57', id: '8', label: 'H' },
{ Timestamp: '2022-02-20T09:10:58', id: '9', label: 'I' }
{ Created: null, id: '2', label: 'B' },
{ Created: '2022-02-20T09:10:52', id: '3', label: 'C' },
{ Created: '2022-02-20T09:10:53', id: '4', label: 'D' },
{ Created: '2022-02-20T09:10:54', id: '5', label: 'E' },
{ Created: '2022-02-20T09:10:55', id: '6', label: 'F' },
{ Created: '2022-02-20T09:10:56', id: '7', label: 'G' },
{ Created: '2022-02-20T09:10:57', id: '8', label: 'H' },
{ Created: '2022-02-20T09:10:58', id: '9', label: 'I' }
] as Experiment[]

it('should return the first 7 selected by Timestamp', () => {
it('should return the first 7 selected by Created', () => {
expect(
limitToMaxSelected(mockedExperiments)
.map(({ label }) => label)
Expand Down
2 changes: 1 addition & 1 deletion extension/src/experiments/model/status/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const getEpoch = (timestamp: string | null | undefined) =>
new Date(timestamp || 0).getTime()

const compareTimestamps = (a: Experiment, b: Experiment) =>
getEpoch(b.Timestamp) - getEpoch(a.Timestamp)
getEpoch(b.Created) - getEpoch(a.Created)

export const limitToMaxSelected = (experiments: Experiment[]) =>
experiments
Expand Down
2 changes: 1 addition & 1 deletion extension/src/experiments/webview/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export interface Experiment extends BaseExperimentFields {
selected?: boolean
sha?: string
starred?: boolean
Timestamp?: string
Created?: string
}

export interface Row extends Experiment {
Expand Down
2 changes: 1 addition & 1 deletion extension/src/test/fixtures/expShow/dataTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export const rows: Row[] = [
selected: true,
sha: '53c3851f46955fa3e2b8f6e1c52999acc8c9ea77',
starred: false,
Timestamp: '2020-11-21T19:58:22'
Created: '2020-11-21T19:58:22'
}
]

Expand Down
2 changes: 1 addition & 1 deletion extension/src/test/fixtures/expShow/deeplyNested.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ export const rows = [
{
id: 'main',
label: 'main',
Timestamp: '2020-11-21T19:58:22',
Created: '2020-11-21T19:58:22',
queued: false,
running: false,
executor: null,
Expand Down
30 changes: 15 additions & 15 deletions extension/src/test/fixtures/expShow/rows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ const data: Row[] = [
selected: false,
sha: 'd1343a87c6ee4a2e82d19525964d2fb2cb6756c9',
starred: false,
Timestamp: '2020-12-29T15:31:51'
Created: '2020-12-29T15:31:51'
},
{
checkpoint_tip: '4fb124aebddb2adf1545030907687fa9a4c80e70',
Expand Down Expand Up @@ -461,10 +461,10 @@ const data: Row[] = [
selected: false,
sha: '1ee5f2ecb0fa4d83cbf614386536344cf894dd53',
starred: false,
Timestamp: '2020-12-29T15:31:44'
Created: '2020-12-29T15:31:44'
}
],
Timestamp: '2020-12-29T15:31:52'
Created: '2020-12-29T15:31:52'
},
{
checkpoint_parent: '217312476f8854dda1865450b737eb6bc7a3ba1b',
Expand Down Expand Up @@ -649,7 +649,7 @@ const data: Row[] = [
selected: false,
starred: false,
sha: '217312476f8854dda1865450b737eb6bc7a3ba1b',
Timestamp: '2020-12-29T15:28:57'
Created: '2020-12-29T15:28:57'
},
{
checkpoint_tip: '42b8736b08170529903cd203a1f40382a4b4a8cd',
Expand Down Expand Up @@ -742,10 +742,10 @@ const data: Row[] = [
selected: false,
sha: '9523bde67538cf31230efaff2dbc47d38a944ab5',
starred: false,
Timestamp: '2020-12-29T15:28:50'
Created: '2020-12-29T15:28:50'
}
],
Timestamp: '2020-12-29T15:28:59'
Created: '2020-12-29T15:28:59'
},
{
checkpoint_parent: '22e40e1fa3c916ac567f69b85969e3066a91dda4',
Expand Down Expand Up @@ -930,7 +930,7 @@ const data: Row[] = [
selected: false,
sha: '22e40e1fa3c916ac567f69b85969e3066a91dda4',
starred: false,
Timestamp: '2020-12-29T15:27:01'
Created: '2020-12-29T15:27:01'
},
{
checkpoint_tip: '1ba7bcd6ce6154e72e18b155475663ecbbd1f49d',
Expand Down Expand Up @@ -1023,7 +1023,7 @@ const data: Row[] = [
selected: false,
sha: '91116c1eae4b79cb1f5ab0312dfd9b3e43608e15',
starred: false,
Timestamp: '2020-12-29T15:26:55'
Created: '2020-12-29T15:26:55'
},
{
checkpoint_parent: 'c658f8b14ac819ac2a5ea0449da6c15dbe8eb880',
Expand Down Expand Up @@ -1116,7 +1116,7 @@ const data: Row[] = [
selected: false,
sha: 'e821416bfafb4bc28b3e0a8ddb322505b0ad2361',
starred: false,
Timestamp: '2020-12-29T15:26:49'
Created: '2020-12-29T15:26:49'
},
{
checkpoint_parent: '23250b33e3d6dd0e136262d1d26a2face031cb03',
Expand Down Expand Up @@ -1209,7 +1209,7 @@ const data: Row[] = [
selected: false,
sha: 'c658f8b14ac819ac2a5ea0449da6c15dbe8eb880',
starred: false,
Timestamp: '2020-12-29T15:26:43'
Created: '2020-12-29T15:26:43'
},
{
checkpoint_parent: '53c3851f46955fa3e2b8f6e1c52999acc8c9ea77',
Expand Down Expand Up @@ -1302,10 +1302,10 @@ const data: Row[] = [
selected: false,
sha: '23250b33e3d6dd0e136262d1d26a2face031cb03',
starred: false,
Timestamp: '2020-12-29T15:26:36'
Created: '2020-12-29T15:26:36'
}
],
Timestamp: '2020-12-29T15:27:02'
Created: '2020-12-29T15:27:02'
},
{
displayColor: colorsList[5],
Expand Down Expand Up @@ -1400,7 +1400,7 @@ const data: Row[] = [
selected: true,
sha: 'f0f918662b4f8c47819ca154a23029bf9b47d4f3',
starred: false,
Timestamp: '2020-12-29T15:26:36'
Created: '2020-12-29T15:26:36'
},
{
deps: {
Expand Down Expand Up @@ -1476,10 +1476,10 @@ const data: Row[] = [
queued: true,
sha: '90aea7f2482117a55dfcadcdb901aaa6610fbbc9',
starred: false,
Timestamp: '2020-12-29T15:25:27'
Created: '2020-12-29T15:25:27'
}
],
Timestamp: '2020-11-21T19:58:22'
Created: '2020-11-21T19:58:22'
}
]

Expand Down
8 changes: 4 additions & 4 deletions webview/src/experiments/components/Experiments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const ExperimentHeader = () => (
)

const TimestampHeader = () => (
<div className={styles.timestampHeader}>Timestamp</div>
<div className={styles.timestampHeader}>Created</div>
)

const DateCellContents: React.FC<{ value: string }> = ({ value }) => {
Expand Down Expand Up @@ -111,10 +111,10 @@ const getColumns = (columns: Column[]): TableColumn<Row>[] => {
)
},
Header: TimestampHeader,
accessor: 'Timestamp',
accessor: 'Created',
group: ColumnType.TIMESTAMP,
id: 'Timestamp',
name: 'Timestamp',
id: 'Created',
name: 'Created',
width: 100
})
}
Expand Down
2 changes: 1 addition & 1 deletion webview/src/experiments/components/table/Table.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ describe('Table', () => {
{
...headerBasicProps,
id: 'timestamp',
render: () => 'Timestamp'
render: () => 'Created'
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion webview/src/experiments/components/table/TableHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const TableHeader: React.FC<TableHeaderProps> = ({
const hasFilter = !!(column.id && filters.includes(column.id))
const isSortable =
!column.placeholderOf &&
!['id', 'timestamp'].includes(column.id) &&
!['id', 'Created'].includes(column.id) &&
!column.columns
const isTimestamp = column.group === ColumnType.TIMESTAMP

Expand Down

0 comments on commit 07a2f2a

Please sign in to comment.