Unverified Commit 234a53de authored by Tamika Tannis's avatar Tamika Tannis Committed by GitHub

fix: Fix dashboard timestamp & dashboard owner text color (#472)

* Update UI for dashboard related timestamps when they don't exist

* Fix AvatarLabel text color in resource detail left panel

* Code cleanup
parent 9b073e5d
...@@ -116,6 +116,12 @@ $resource-header-height: 84px; ...@@ -116,6 +116,12 @@ $resource-header-height: 84px;
font-size: 16px; font-size: 16px;
} }
} }
.avatar-label-component {
.avatar-label {
color: $text-primary;
}
}
} }
> .right-panel { > .right-panel {
......
...@@ -23,6 +23,8 @@ import * as LogUtils from 'utils/logUtils'; ...@@ -23,6 +23,8 @@ import * as LogUtils from 'utils/logUtils';
import { ResourceType } from 'interfaces'; import { ResourceType } from 'interfaces';
import { NO_TIMESTAMP_TEXT } from 'components/constants';
const MOCK_DISPLAY_NAME = 'displayName'; const MOCK_DISPLAY_NAME = 'displayName';
const MOCK_ICON_CLASS = 'dashboard-icon'; const MOCK_ICON_CLASS = 'dashboard-icon';
...@@ -184,6 +186,24 @@ describe('DashboardPage', () => { ...@@ -184,6 +186,24 @@ describe('DashboardPage', () => {
it('renders an ImagePreview with correct props', () => { it('renders an ImagePreview with correct props', () => {
expect(wrapper.find(ImagePreview).props().uri).toBe(wrapper.state().uri); expect(wrapper.find(ImagePreview).props().uri).toBe(wrapper.state().uri);
}) })
describe('renders timestamps correctly when unavailable', () => {
const { wrapper } = setup({
dashboard: {
...dashboardMetadata,
last_run_timestamp: null,
last_successful_run_timestamp: null
}
});
it('last_run_timestamp', () => {
expect(wrapper.find('.last-run-timestamp').text()).toEqual(NO_TIMESTAMP_TEXT)
});
it('last_successful_run_timestamp', () => {
expect(wrapper.find('.last-successful-run-timestamp').text()).toEqual(NO_TIMESTAMP_TEXT)
});
});
}); });
describe('renderTabs', () => { describe('renderTabs', () => {
......
...@@ -20,7 +20,7 @@ import { DashboardMetadata } from 'interfaces/Dashboard'; ...@@ -20,7 +20,7 @@ import { DashboardMetadata } from 'interfaces/Dashboard';
import ImagePreview from './ImagePreview'; import ImagePreview from './ImagePreview';
import QueryList from 'components/DashboardPage/QueryList'; import QueryList from 'components/DashboardPage/QueryList';
import ChartList from 'components/DashboardPage/ChartList'; import ChartList from 'components/DashboardPage/ChartList';
import { formatDateTimeShort } from '../../utils/dateUtils'; import { formatDateTimeShort } from 'utils/dateUtils';
import ResourceList from 'components/common/ResourceList'; import ResourceList from 'components/common/ResourceList';
import { import {
ADD_DESC_TEXT, ADD_DESC_TEXT,
...@@ -38,6 +38,8 @@ import { getSourceDisplayName, getSourceIconClass } from 'config/config-utils'; ...@@ -38,6 +38,8 @@ import { getSourceDisplayName, getSourceIconClass } from 'config/config-utils';
import { getLoggingParams } from 'utils/logUtils'; import { getLoggingParams } from 'utils/logUtils';
import { NO_TIMESTAMP_TEXT } from 'components/constants';
import './styles.scss'; import './styles.scss';
export interface RouteProps { export interface RouteProps {
...@@ -259,15 +261,23 @@ export class DashboardPage extends React.Component<DashboardPageProps, Dashboard ...@@ -259,15 +261,23 @@ export class DashboardPage extends React.Component<DashboardPageProps, Dashboard
</EditableSection> </EditableSection>
<section className="metadata-section"> <section className="metadata-section">
<div className="section-title title-3">Last Successful Run</div> <div className="section-title title-3">Last Successful Run</div>
<div className="body-2 text-primary"> <div className="last-successful-run-timestamp body-2 text-primary">
{ formatDateTimeShort({ epochTimestamp: dashboard.last_successful_run_timestamp }) } {
dashboard.last_successful_run_timestamp ?
formatDateTimeShort({ epochTimestamp: dashboard.last_successful_run_timestamp }) :
NO_TIMESTAMP_TEXT
}
</div> </div>
</section> </section>
<section className="metadata-section"> <section className="metadata-section">
<div className="section-title title-3">Last Run</div> <div className="section-title title-3">Last Run</div>
<div> <div>
<div className="body-2 text-primary"> <div className="last-run-timestamp body-2 text-primary">
{ formatDateTimeShort({ epochTimestamp: dashboard.last_run_timestamp }) } {
dashboard.last_run_timestamp ?
formatDateTimeShort({ epochTimestamp: dashboard.last_run_timestamp }) :
NO_TIMESTAMP_TEXT
}
</div> </div>
<div className="last-run-state"> <div className="last-run-state">
<Flag <Flag
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
margin-left: 4px; margin-left: 4px;
width: calc(100% - 28px); width: calc(100% - 28px);
word-break: break-word; word-break: break-word;
color: $text-primary;
} }
} }
......
...@@ -15,6 +15,8 @@ const MOCK_DISPLAY_NAME = 'displayName'; ...@@ -15,6 +15,8 @@ const MOCK_DISPLAY_NAME = 'displayName';
const MOCK_ICON_CLASS = 'test-class'; const MOCK_ICON_CLASS = 'test-class';
const MOCK_DATE = 'Jan 1, 2000'; const MOCK_DATE = 'Jan 1, 2000';
import { NO_TIMESTAMP_TEXT } from 'components/constants';
import { dashboardSummary } from 'fixtures/metadata/dashboard'; import { dashboardSummary } from 'fixtures/metadata/dashboard';
jest.mock('config/config-utils', () => ( jest.mock('config/config-utils', () => (
...@@ -120,7 +122,7 @@ describe('DashboardListItem', () => { ...@@ -120,7 +122,7 @@ describe('DashboardListItem', () => {
}); });
describe('for successful run timestamp', () => { describe('for successful run timestamp', () => {
it('does not render timestamp if it doesnt exist', () => { it('renders default text if it doesnt exist', () => {
const { props, wrapper } = setup({ dashboard: { const { props, wrapper } = setup({ dashboard: {
group_name: 'Amundsen Team', group_name: 'Amundsen Team',
group_url: 'product/group', group_url: 'product/group',
...@@ -133,7 +135,8 @@ describe('DashboardListItem', () => { ...@@ -133,7 +135,8 @@ describe('DashboardListItem', () => {
cluster: 'cluster', cluster: 'cluster',
last_successful_run_timestamp: null last_successful_run_timestamp: null
}}); }});
expect(wrapper.find('.resource-badges').children()).toHaveLength(1); expect(wrapper.find('.resource-badges').find('.title-3').text()).toBe(Constants.LAST_RUN_TITLE);
expect(wrapper.find('.resource-badges').find('.body-secondary-3').text()).toBe(NO_TIMESTAMP_TEXT);
}); });
it('renders if timestamp exists', () => { it('renders if timestamp exists', () => {
......
...@@ -13,6 +13,7 @@ import { ResourceType, DashboardResource } from 'interfaces'; ...@@ -13,6 +13,7 @@ import { ResourceType, DashboardResource } from 'interfaces';
import { formatDate } from 'utils/dateUtils'; import { formatDate } from 'utils/dateUtils';
import * as Constants from './constants'; import * as Constants from './constants';
import { NO_TIMESTAMP_TEXT } from 'components/constants';
export interface DashboardListItemProps { export interface DashboardListItemProps {
dashboard: DashboardResource; dashboard: DashboardResource;
...@@ -53,15 +54,16 @@ class DashboardListItem extends React.Component<DashboardListItemProps, {}> { ...@@ -53,15 +54,16 @@ class DashboardListItem extends React.Component<DashboardListItemProps, {}> {
{ getSourceDisplayName(dashboard.product, dashboard.type) } { getSourceDisplayName(dashboard.product, dashboard.type) }
</div> </div>
<div className="resource-badges"> <div className="resource-badges">
{ <div>
dashboard.last_successful_run_timestamp && <div className="title-3">{ Constants.LAST_RUN_TITLE }</div>
<div> <div className="body-secondary-3">
<div className="title-3">{ Constants.LAST_RUN_TITLE }</div> {
<div className="body-secondary-3"> dashboard.last_successful_run_timestamp ?
{ formatDate({ epochTimestamp: dashboard.last_successful_run_timestamp }) } formatDate({ epochTimestamp: dashboard.last_successful_run_timestamp }) :
</div> NO_TIMESTAMP_TEXT
}
</div> </div>
} </div>
<img className="icon icon-right" /> <img className="icon icon-right" />
</div> </div>
</Link> </Link>
......
/* This file should contain any constants shared across multiple components */
export const NO_TIMESTAMP_TEXT = 'No timestamp available';
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment