Skip to content

Commit

Permalink
Add last processed date to sources table
Browse files Browse the repository at this point in the history
  • Loading branch information
dlabrecq committed Aug 18, 2023
1 parent 6a4d51c commit 1ae3ce8
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 3 deletions.
6 changes: 6 additions & 0 deletions locales/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -9609,6 +9609,12 @@
"value": "Infrastructure"
}
],
"lastProcessed": [
{
"type": 0,
"value": "Last processed"
}
],
"learnMore": [
{
"type": 0,
Expand Down
1 change: 1 addition & 0 deletions locales/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@
"inactiveSourcesTitle": "A problem was detected with {value}",
"inactiveSourcesTitleMultiplier": "A problem was detected with the following sources",
"infrastructure": "Infrastructure",
"lastProcessed": "Last processed",
"learnMore": "Learn more",
"limits": "Limits",
"loadingStateDesc": "Searching for your sources. Do not refresh the browser",
Expand Down
1 change: 1 addition & 0 deletions src/api/costModels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type { Rate, RateRequest } from './rates';

export interface CostModelProvider {
name: string;
last_processed?: string;
uuid: string;
}

Expand Down
5 changes: 5 additions & 0 deletions src/locales/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2174,6 +2174,11 @@ export default defineMessages({
description: 'Infrastructure',
id: 'infrastructure',
},
lastProcessed: {
defaultMessage: 'Last processed',
description: 'Last processed',
id: 'lastProcessed',
},
learnMore: {
defaultMessage: 'Learn more',
description: 'Learn more',
Expand Down
19 changes: 16 additions & 3 deletions src/routes/settings/costModels/costModel/sourcesTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ interface SourcesTableStateProps {
type SourcesTableProps = SourcesTableOwnProps & SourcesTableStateProps & WrappedComponentProps;

const SourcesTable: React.FC<SourcesTableProps> = ({ canWrite, costModels, intl, showDeleteDialog }) => {
const rows: (IRow | string[])[] = costModels.length > 0 ? costModels[0].sources.map(source => [source.name]) : [];
const rows: (IRow | string[])[] = costModels.length > 0 ? costModels[0].sources : [];

return (
<TableComposable
Expand All @@ -36,13 +36,26 @@ const SourcesTable: React.FC<SourcesTableProps> = ({ canWrite, costModels, intl,
<Thead>
<Tr>
<Th>{intl.formatMessage(messages.names, { count: 1 })}</Th>
<Th>{intl.formatMessage(messages.lastProcessed)}</Th>
<Th></Th>
</Tr>
</Thead>
<Tbody>
{rows.map((r: any, rowIndex) => (
{rows.map((row: any, rowIndex) => (
<Tr key={rowIndex}>
<Td>{r}</Td>
<Td>{row.name}</Td>
<Td>
{intl.formatDate(row.last_processed, {
day: 'numeric',
hour: 'numeric',
hour12: false,
minute: 'numeric',
month: 'short',
timeZone: 'UTC',
timeZoneName: 'short',
year: 'numeric',
})}
</Td>
<Td isActionCell>
<ReadOnlyTooltip key="action" isDisabled={!canWrite}>
<Button
Expand Down

0 comments on commit 1ae3ce8

Please sign in to comment.