Skip to content

Commit

Permalink
UTC Time Labeling (#1113)
Browse files Browse the repository at this point in the history
* Add UTC label to every UTC time display in the plan page except for subset simulation times

* add UTC to creation time label in Activity Directive panel

* fix code formatting

---------

Co-authored-by: Dan Delany <daniel.t.delany@jpl.nasa.gov>
  • Loading branch information
AaronPlave and dandelany authored Feb 17, 2024
1 parent efbac36 commit cdab7e4
Show file tree
Hide file tree
Showing 15 changed files with 39 additions and 35 deletions.
2 changes: 1 addition & 1 deletion src/components/activity/ActivityDirectiveChangelog.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
const currentStartTimeDoy = getDoyTimeFromInterval(planStartTimeYmd, current.start_offset);
const previousStartTimeDoy = getDoyTimeFromInterval(planStartTimeYmd, previous.start_offset);
differences['Start Time'] = {
differences['Start Time (UTC)'] = {
currentValue: currentStartTimeDoy,
previousValue: previousStartTimeDoy,
};
Expand Down
10 changes: 6 additions & 4 deletions src/components/activity/ActivityDirectiveForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@
<DatePickerField
disabled={!editable || activityDirective.anchor_id !== null}
field={startTimeDoyField}
label="Start Time - YYYY-DDDThh:mm:ss"
label="Start Time (UTC) - YYYY-DDDThh:mm:ss"
layout="inline"
name="start-time"
use={[
Expand Down Expand Up @@ -579,15 +579,17 @@

<Highlight highlight={highlightKeysMap.created_at}>
<Input layout="inline">
<label use:tooltip={{ content: 'Creation Time', placement: 'top' }} for="creationTime">Creation Time</label>
<label use:tooltip={{ content: 'Creation Time (UTC)', placement: 'top' }} for="creationTime">
Creation Time (UTC)
</label>
<input class="st-input w-100" disabled name="creationTime" value={activityDirective.created_at} />
</Input>
</Highlight>

<Highlight highlight={highlightKeysMap.last_modified_at}>
<Input layout="inline">
<label use:tooltip={{ content: 'Last Modified Time', placement: 'top' }} for="lastModifiedTime">
Last Modified Time
<label use:tooltip={{ content: 'Last Modified Time (UTC)', placement: 'top' }} for="lastModifiedTime">
Last Modified Time (UTC)
</label>
<input class="st-input w-100" disabled name="lastModifiedTime" value={activityDirective.last_modified_at} />
</Input>
Expand Down
6 changes: 3 additions & 3 deletions src/components/activity/ActivityDirectivesTablePanel.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
derived_start_time: {
field: 'derived_start_time',
filter: 'text',
headerName: 'Absolute Start Time',
headerName: 'Absolute Start Time (UTC)',
hide: true,
resizable: true,
sortable: true,
Expand Down Expand Up @@ -140,15 +140,15 @@
last_modified_at: {
field: 'last_modified_at',
filter: 'text',
headerName: 'Last Modified At',
headerName: 'Last Modified At (UTC)',
hide: true,
resizable: true,
sortable: true,
},
last_modified_by: {
field: 'last_modified_by',
filter: 'text',
headerName: 'Last Modified By',
headerName: 'Last Modified By (UTC)',
hide: true,
resizable: true,
sortable: true,
Expand Down
4 changes: 2 additions & 2 deletions src/components/activity/ActivitySpanForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,12 @@
</Input>

<Input layout="inline">
<label use:tooltip={{ content: 'Start Time', placement: 'top' }} for="startTime">Start Time</label>
<label use:tooltip={{ content: 'Start Time (UTC)', placement: 'top' }} for="startTime">Start Time (UTC)</label>
<input class="st-input w-100" disabled name="startTime" value={startTimeDoy} />
</Input>

<Input layout="inline">
<label use:tooltip={{ content: 'End Time', placement: 'top' }} for="endTime">End Time</label>
<label use:tooltip={{ content: 'End Time (UTC)', placement: 'top' }} for="endTime">End Time (UTC)</label>
<input class="st-input w-100" disabled name="endTime" value={endTimeDoy ?? 'None'} />
</Input>
</Collapse>
Expand Down
4 changes: 2 additions & 2 deletions src/components/activity/ActivitySpansTablePanel.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
derived_start_time: {
field: 'derived_start_time',
filter: 'text',
headerName: 'Absolute Start Time',
headerName: 'Absolute Start Time (UTC)',
hide: true,
resizable: true,
sortable: true,
Expand All @@ -64,7 +64,7 @@
derived_end_time: {
field: 'derived_end_time',
filter: 'text',
headerName: 'Absolute End Time',
headerName: 'Absolute End Time (UTC)',
hide: true,
resizable: true,
sortable: true,
Expand Down
5 changes: 3 additions & 2 deletions src/components/constraints/ConstraintViolationButton.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@

<button class="st-button tertiary violation-button" on:click={() => zoomToViolation(window)}>
<div>
{startYear}-<span class="st-typography-bold">{startDoy}</span> T {startHours}:{startMins}:{startSecs}.{startMsecs}
{startYear}-<span class="st-typography-bold">{startDoy}</span> T {startHours}:{startMins}:{startSecs}.{startMsecs} UTC
</div>

<div class="separator">–</div>
<div>
{endYear}-<span class="st-typography-bold">{endDoy}</span> T {endHours}:{endMins}:{endSecs}.{endMsecs}
{endYear}-<span class="st-typography-bold">{endDoy}</span> T {endHours}:{endMins}:{endSecs}.{endMsecs} UTC
</div>
</button>

Expand Down
4 changes: 2 additions & 2 deletions src/components/constraints/ConstraintsPanel.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@
<div>
<DatePickerField
field={startTimeDoyField}
label="Violation Start Time"
label="Violation Start Time (UTC)"
layout="inline"
name="start-time"
on:change={onUpdateStartTime}
Expand All @@ -250,7 +250,7 @@
</DatePickerField>
<DatePickerField
field={endTimeDoyField}
label="Violation End Time"
label="Violation End Time (UTC)"
layout="inline"
name="end-time"
on:change={onUpdateEndTime}
Expand Down
5 changes: 3 additions & 2 deletions src/components/plan/PlanForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,12 @@
<input class="st-input w-100" disabled name="modelVersion" value={plan.model.version} />
</Input>
<Input layout="inline">
<label use:tooltip={{ content: 'Start Time', placement: 'top' }} for="startTime">Start Time</label>
<label use:tooltip={{ content: 'Start Time (UTC)', placement: 'top' }} for="startTime">Start Time (UTC)</label
>
<input class="st-input w-100" disabled name="startTime" value={plan.start_time_doy} />
</Input>
<Input layout="inline">
<label use:tooltip={{ content: 'End Time', placement: 'top' }} for="endTime">End Time</label>
<label use:tooltip={{ content: 'End Time (UTC)', placement: 'top' }} for="endTime">End Time (UTC)</label>
<input class="st-input w-100" disabled name="endTime" value={plan.end_time_doy} />
</Input>
<Input layout="inline">
Expand Down
4 changes: 2 additions & 2 deletions src/components/simulation/SimulationPanel.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@
<Collapse title="General">
<DatePickerField
field={startTimeDoyField}
label="Start Time"
label="Start Time (UTC)"
layout="inline"
name="start-time"
use={[
Expand All @@ -339,7 +339,7 @@
</DatePickerField>
<DatePickerField
field={endTimeDoyField}
label="End Time"
label="End Time (UTC)"
layout="inline"
name="end-time"
use={[
Expand Down
2 changes: 1 addition & 1 deletion src/components/timeline/TimelineCursors.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
{#if cursorEnabled && cursorWithinView}
<TimelineCursor
x={cursorX}
label={cursorDOY}
label={`${cursorDOY} UTC`}
maxWidth={cursorMaxWidth}
on:click={() => addVerticalGuide(cursorDOY)}
activeCursor
Expand Down
8 changes: 4 additions & 4 deletions src/components/timeline/TimelineTimeDisplay.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
</script>

<div style:width={`${width ?? 10}px`} class="timeline-time-display">
<div use:tooltip={{ content: 'Plan Start Time' }} class="timeline-time-display--date st-typography-medium">
{planStartTimeDoy}
<div use:tooltip={{ content: 'Plan Start Time (UTC)' }} class="timeline-time-display--date st-typography-medium">
{planStartTimeDoy} UTC
</div>

<div use:tooltip={{ content: 'Plan End Time' }} class="timeline-time-display--date st-typography-medium">
{planEndTimeDoy}
<div use:tooltip={{ content: 'Plan End Time (UTC)' }} class="timeline-time-display--date st-typography-medium">
{planEndTimeDoy} UTC
</div>
</div>

Expand Down
4 changes: 2 additions & 2 deletions src/components/timeline/Tooltip.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@
<div class='tooltip-row'>
<span>Time:</span>
<span class='tooltip-value-highlight st-typography-medium'>
${getDoyTime(new Date(x))}
${getDoyTime(new Date(x))} UTC
</span>
</div>
<div class='tooltip-row'>
Expand Down Expand Up @@ -320,7 +320,7 @@
<div class='tooltip-row'>
<span>Start:</span>
<span class='tooltip-value-highlight st-typography-medium'>
${getDoyTime(new Date(x))}
${getDoyTime(new Date(x))} UTC
</span>
</div>
<div class='tooltip-row'>
Expand Down
3 changes: 1 addition & 2 deletions src/components/timeline/form/TimelineEditorPanel.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@
<div class="editor-section-labeled-grid-container">
<CssGrid columns="1fr 168px 24px 24px" gap="8px" class="editor-section-grid">
<div>Label</div>
<div>Date</div>
<div>Date (UTC)</div>
</CssGrid>
<div class="guides timeline-elements">
{#each verticalGuides as verticalGuide (verticalGuide.id)}
Expand All @@ -558,7 +558,6 @@
/>
</Input>
<Input layout="stacked" class="editor-input">
<label for="timestamp">Time</label>
<DatePicker
name="timestamp"
minDate={new Date($maxTimeRange.start)}
Expand Down
2 changes: 1 addition & 1 deletion src/enums/view.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export enum ViewConstants {
MIN_ROW_HEIGHT = 80,
MIN_MARGIN_LEFT = 160,
MIN_MARGIN_LEFT = 190,
}
11 changes: 6 additions & 5 deletions src/utilities/view.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Ajv from 'ajv';
import { ViewConstants } from '../enums/view';
import jsonSchema from '../schemas/ui-view-schema.json';
import type { ActivityType } from '../types/activity';
import type { ResourceType } from '../types/simulation';
Expand All @@ -20,7 +21,7 @@ export function generateDefaultView(activityTypes: ActivityType[] = [], resource
const now = new Date().toISOString();
const types: string[] = activityTypes.map(({ name }) => name);

const timeline = createTimeline([], { marginLeft: 160, marginRight: 30 });
const timeline = createTimeline([], { marginLeft: ViewConstants.MIN_MARGIN_LEFT, marginRight: 30 });
const timelines = [timeline];

const activityLayer = createTimelineActivityLayer(timelines, {
Expand Down Expand Up @@ -217,7 +218,7 @@ export function generateDefaultView(activityTypes: ActivityType[] = [], resource
{
field: 'derived_start_time',
filter: 'text',
headerName: 'Absolute Start Time',
headerName: 'Absolute Start Time (UTC)',
resizable: true,
sortable: true,
width: 200,
Expand All @@ -237,7 +238,7 @@ export function generateDefaultView(activityTypes: ActivityType[] = [], resource
{
field: 'created_at',
filter: 'text',
headerName: 'Created At',
headerName: 'Created At (UTC)',
hide: true,
resizable: true,
sortable: true,
Expand Down Expand Up @@ -287,15 +288,15 @@ export function generateDefaultView(activityTypes: ActivityType[] = [], resource
{
field: 'derived_start_time',
filter: 'text',
headerName: 'Absolute Start Time',
headerName: 'Absolute Start Time (UTC)',
hide: false,
resizable: true,
sortable: true,
},
{
field: 'derived_end_time',
filter: 'text',
headerName: 'Absolute End Time',
headerName: 'Absolute End Time (UTC)',
hide: false,
resizable: true,
sortable: true,
Expand Down

0 comments on commit cdab7e4

Please sign in to comment.