Unverified Commit 31e565d6 authored by Tao Feng's avatar Tao Feng Committed by GitHub

fix: make last run state in dashboard page optional (#814)

* fix: make last run state in dashboard page optional
Signed-off-by: 's avatarfeng-tao <fengtao04@gmail.com>

* update
Signed-off-by: 's avatarfeng-tao <fengtao04@gmail.com>

* update
Signed-off-by: 's avatarfeng-tao <fengtao04@gmail.com>

* update
Signed-off-by: 's avatarfeng-tao <fengtao04@gmail.com>
parent b730effa
...@@ -160,6 +160,8 @@ export class DashboardPage extends React.Component< ...@@ -160,6 +160,8 @@ export class DashboardPage extends React.Component<
const { dashboard, isLoading } = this.props; const { dashboard, isLoading } = this.props;
const hasDescription = const hasDescription =
dashboard.description && dashboard.description.length > 0; dashboard.description && dashboard.description.length > 0;
const hasLastRunState =
dashboard.last_run_state && dashboard.last_run_state.length > 0;
if (isLoading) { if (isLoading) {
return <LoadingSpinner />; return <LoadingSpinner />;
...@@ -294,40 +296,42 @@ export class DashboardPage extends React.Component< ...@@ -294,40 +296,42 @@ export class DashboardPage extends React.Component<
uriKey={this.props.dashboard.uri} uriKey={this.props.dashboard.uri}
/> />
</EditableSection> </EditableSection>
<section className="metadata-section"> {hasLastRunState && [
<div className="section-title title-3"> <section className="metadata-section">
Last Successful Run <div className="section-title title-3">
</div> Last Successful Run
<time className="last-successful-run-timestamp body-2 text-primary"> </div>
{dashboard.last_successful_run_timestamp <time className="last-successful-run-timestamp body-2 text-primary">
? formatDateTimeShort({ {dashboard.last_successful_run_timestamp
epochTimestamp:
dashboard.last_successful_run_timestamp,
})
: NO_TIMESTAMP_TEXT}
</time>
</section>
<section className="metadata-section">
<div className="section-title title-3">Last Run</div>
<div>
<time className="last-run-timestamp body-2 text-primary">
{dashboard.last_run_timestamp
? formatDateTimeShort({ ? formatDateTimeShort({
epochTimestamp: dashboard.last_run_timestamp, epochTimestamp:
dashboard.last_successful_run_timestamp,
}) })
: NO_TIMESTAMP_TEXT} : NO_TIMESTAMP_TEXT}
</time> </time>
<div className="last-run-state"> </section>,
<span className="status">{STATUS_TEXT}</span> <section className="metadata-section">
<ResourceStatusMarker <div className="section-title title-3">Last Run</div>
stateText={dashboard.last_run_state} <div>
succeeded={this.mapStatusToBoolean( <time className="last-run-timestamp body-2 text-primary">
dashboard.last_run_state {dashboard.last_run_timestamp
)} ? formatDateTimeShort({
/> epochTimestamp: dashboard.last_run_timestamp,
})
: NO_TIMESTAMP_TEXT}
</time>
<div className="last-run-state">
<span className="status">{STATUS_TEXT}</span>
<ResourceStatusMarker
stateText={dashboard.last_run_state}
succeeded={this.mapStatusToBoolean(
dashboard.last_run_state
)}
/>
</div>
</div> </div>
</div> </section>,
</section> ]}
</section> </section>
</section> </section>
<ImagePreview uri={this.state.uri} redirectUrl={dashboard.url} /> <ImagePreview uri={this.state.uri} redirectUrl={dashboard.url} />
......
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