Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 31 additions & 29 deletions src/plugins/clock/components/ClockIndicator.vue
Original file line number Diff line number Diff line change
@@ -1,25 +1,3 @@
<!--
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dont remove the license

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved it and re-added the license which was previously removed.

Open MCT, Copyright (c) 2014-2024, United States Government
as represented by the Administrator of the National Aeronautics and Space
Administration. All rights reserved.

Open MCT is licensed under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0.

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.

Open MCT includes source code licensed under additional open source
licenses. See the Open Source Licenses file (LICENSES.md) included with
this source code distribution or the Licensing information page available
at runtime from the About dialog for additional information.
-->

<template>
<div
aria-label="Clock Indicator"
Expand All @@ -31,6 +9,20 @@
{{ timeTextValue }}
</span>
</div>

<div
aria-label="Toggle Clock Format"
class="c-indicator t-indicator-timer icon-timer no-minify c-indicator--clickable c-icon-button"
role="button"
aria-live="off"
tabindex="0"
@click="toggleTimeStandard"
@keydown.enter="toggleTimeStandard"
>
<span class="label c-indicator__label">
{{ timeStandard === 'UTC' ? 'LT' : 'UTC' }}
</span>
</div>
</template>

<script>
Expand All @@ -46,28 +38,38 @@ export default {
}
},
data() {
const clock = this.openmct.time.getClock();
return {
timestamp: this.openmct.time.getClock() ? this.openmct.time.now() : undefined
timestamp: clock ? this.openmct.time.now() : undefined,
timeStandard: 'UTC' // default to UTC, can start with LT if preferred
};
},
computed: {
timeTextValue() {
return `${moment.utc(this.timestamp).format(this.indicatorFormat)} ${
this.openmct.time.getTimeSystem().name
}`;
const format = this.indicatorFormat;
const timeSystemName = this.timeStandard === 'LT' ? 'LT' : 'UTC';

if (this.timeStandard === 'LT') {
return `${moment(this.timestamp).format(format)} ${timeSystemName}`;
} else {
return `${moment.utc(this.timestamp).format(format)} ${timeSystemName}`;
}
}
},
mounted() {
this.tick = raf(this.tick);
this.openmct.time.on('tick', this.tick);
this.tick(this.timestamp);
this.tick(this.openmct.time.now());
},
beforeUnmount() {
this.openmct.time.off('tick', this.tick);
},
methods: {
tick(timestamp) {
this.timestamp = timestamp;
tick(now) {
this.timestamp = now;
},
toggleTimeStandard() {
this.timeStandard = this.timeStandard === 'UTC' ? 'LT' : 'UTC';
}
}
};
Expand Down
57 changes: 55 additions & 2 deletions src/styles/_constants.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,21 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/


/************************** PATHS */

// Paths need to be relative to /platform/commonUI/theme/<theme-name>/css/ directory
$dirImgs: 'images/';

/************************** TIMINGS */

$controlFadeMs: 100ms;
$browseToEditAnimMs: 400ms;
$editBorderPulseMs: 500ms;
$moveBarOutDelay: 500ms;

/************************** SPATIAL */

$interiorMarginSm: 3px;
$interiorMargin: 5px;
$interiorMarginLg: 10px;
Expand All @@ -51,15 +55,21 @@ $shellMainBrowseBarH: 22px;
$shellTimeConductorH: 25px;
$shellToolBarH: 29px;
$fadeTruncateW: 7px;

/*************** Items */

$itemPadLR: 5px;
$gridItemDesk: 175px;
$gridItemMobile: 32px;

/*************** Tabular */

$tabularHeaderH: 22px;
$tabularTdPadLR: $itemPadLR;
$tabularTdPadTB: 2px;

/*************** Plots */

$plotYBarW: 60px;
$plotYLabelMinH: 20px;
$plotYLabelW: 10px;
Expand All @@ -71,48 +81,90 @@ $plotSwatchD: 12px;
$plotDisplayArea: (0, 0, $plotXBarH, $plotYBarW); // 1: Top, 2: right, 3: bottom, 4: left
$plotMinH: 95px;
$controlBarH: 25px;

/*************** Imagery */

$imageMainControlBarH: 25px;
$imageThumbsD: 100px;
$imageThumbsWrapperH: 155px;
$imageThumbPad: 1px;

/*************** Bubbles */

$bubbleArwSize: 10px;
$bubblePad: $interiorMargin;
$bubbleMinW: 100px;
$bubbleMaxW: 300px;

/*************** Menus */

$paletteMenuMinW: 128px; // Min-width of palettes when in a dropdown menu

/*************** Forms */

$formLabelMinW: 120px;
$formLabelW: 30%;

/*************** Wait Spinner */

$waitSpinnerD: 32px;
$waitSpinnerBorderW: 5px;
$waitSpinnerTreeD: 20px;
$waitSpinnerTreeBorderW: 3px;

/*************** Messages */

$messageIconD: 80px;
$messageListIconD: 32px;

/*************** Tables */

$tableResizeColHitareaD: 6px;

/*************** Misc */

$drawingObjBorderW: 3px;
$tagBorderRadius: 3px;

/************************** MOBILE */

$mobileMenuIconD: 24px; // Used
$mobileTreeItemH: 35px; // Used

/************************** UI ELEMENTS */


/*************** Progress Bar */

$colorProgressBarHolder: rgba(black, 0.2);
$colorProgressBar: #0085ad;
$progressAnimW: 500px;
$progressBarMinH: 4px;

/************************** FONT STYLING */
$listFontSizes: 8, 9, 10, 11, 12, 13, 14, 16, 18, 20, 24, 28, 32, 36, 42, 48, 72, 96, 128;

$listFontSizes: 8,
9,
10,
11,
12,
13,
14,
16,
18,
20,
24,
28,
32,
36,
42,
48,
72,
96,
128;

/************************** GLYPH CHAR UNICODES */

$glyph-icon-alert-rect: '\e900';
$glyph-icon-alert-triangle: '\e901';
$glyph-icon-arrow-up: '\e902';
Expand Down Expand Up @@ -281,6 +333,7 @@ $glyph-icon-notebook-shift-log: '\eb31';
$glyph-icon-plot-scatter: '\eb30';

/************************** GLYPHS AS DATA URI */

// Only objects have been converted, for use in Create menu and folder views
$bg-icon-alert-rect: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3e%3cpath d='M448 0H64C28.7.1.1 28.7 0 64v384c.1 35.3 28.7 63.9 64 64h384c35.3-.1 63.9-28.7 64-64V64c-.1-35.3-28.7-63.9-64-64zM288 448h-64v-64h64v64zm10.9-192L280 352h-48l-18.9-96V64H299v192z' fill='%23000000'/%3e%3c/svg%3e");
$bg-icon-alert-triangle: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3e%3cpath d='M499.1 424.4L287.8 54.6c-17.5-30.6-46-30.6-63.5 0L12.9 424.4C-4.6 455 9.9 480 45.1 480h421.7c35.3 0 49.8-25 32.3-55.6zM288 448h-64v-64h64v64zm10.9-192L280 352h-48l-18.9-96V128H299v128z' fill='%23000000'/%3e%3c/svg%3e");
Expand Down Expand Up @@ -334,4 +387,4 @@ $bg-icon-notebook-shift-log: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns=
$bg-icon-telemetry-aggregate: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3e%3cg data-name='Layer 2'%3e%3cg data-name='Layer 3'%3e%3cpath d='M39 197.72c7-20.72 18.74-50.4 34.6-74.18C92.91 94.65 114.79 80 138.67 80s45.75 14.65 65 43.54c15.86 23.78 27.57 53.46 34.6 74.18 15.44 45.48 31.56 67.49 39 73.27 7.47-5.78 23.6-27.79 39-73.27 7-20.72 18.74-50.4 34.61-74.18q13.9-20.85 29.56-31.75A207.78 207.78 0 0 0 208 0C93.12 0 0 93.12 0 208a208.14 208.14 0 0 0 7.39 55.09c8.39-10.87 20.2-31.67 31.61-65.37Z'/%3e%3cpath d='M377 218.28c-7 20.72-18.74 50.4-34.6 74.18-19.28 28.89-41.16 43.54-65 43.54s-45.75-14.65-65-43.54c-15.86-23.78-27.57-53.46-34.6-74.18-15.44-45.48-31.57-67.49-39-73.27-7.47 5.78-23.6 27.79-39 73.27-7.19 20.72-18.9 50.4-34.8 74.18q-13.9 20.85-29.56 31.75A207.78 207.78 0 0 0 208 416c114.88 0 208-93.12 208-208a208.14 208.14 0 0 0-7.39-55.09c-8.39 10.87-20.2 31.67-31.61 65.37Z'/%3e%3cpath d='M460.78 167.31A258.4 258.4 0 0 1 464 208a255.84 255.84 0 0 1-256 256 258.4 258.4 0 0 1-40.69-3.22A207.23 207.23 0 0 0 304 512c114.88 0 208-93.12 208-208a207.23 207.23 0 0 0-51.22-136.69Z'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e");
$bg-icon-trash: url("data:image/svg+xml;charset=UTF-8,%3csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' width='512px' height='512px' viewBox='0 0 512 512' enable-background='new 0 0 512 512' xml:space='preserve'%3e%3cpath d='M416,64h-96.18V32c0-17.6-14.4-32-32-32h-64c-17.6,0-32,14.4-32,32v32H96c-52.8,0-96,36-96,80s0,80,0,80h32v192 c0,52.8,43.2,96,96,96h256c52.8,0,96-43.2,96-96V224h32c0,0,0-36,0-80S468.8,64,416,64z M160,416H96V224h64V416z M288,416h-64V224 h64V416z M416,416h-64V224h64V416z'/%3e%3c/svg%3e");
$bg-icon-eye-open: url("data:image/svg+xml;charset=UTF-8,%3csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 512 512' style='enable-background:new 0 0 512 512;' xml:space='preserve'%3e%3cstyle type='text/css'%3e .st0%7bfill:%2300A14B;%7d %3c/style%3e%3ctitle%3eicon-eye-open-v2%3c/title%3e%3cg%3e%3cpath class='st0' d='M256,58.2c-122.9,0-226.1,84-255.4,197.8C29.9,369.7,133.1,453.8,256,453.8s226.1-84,255.4-197.8 C482.1,142.3,378.9,58.2,256,58.2z M414.6,294.2c-11.3,17.2-25.3,32.4-41.5,45.2c-16.4,12.9-34.5,22.8-54,29.7 c-20.2,7.1-41.4,10.7-63,10.7s-42.9-3.6-63-10.7c-19.5-6.9-37.7-16.9-54-29.7c-16.2-12.8-30.2-27.9-41.5-45.2 c-7.9-12-14.4-24.8-19.3-38.2c5-13.4,11.5-26.2,19.3-38.2c11.3-17.2,25.3-32.4,41.5-45.2c16.4-12.9,34.5-22.8,54-29.7 c20.2-7.1,41.4-10.7,63-10.7s42.9,3.6,63,10.7c19.5,6.9,37.7,16.9,54,29.7c16.2,12.8,30.2,27.9,41.5,45.2 c7.9,12,14.4,24.8,19.3,38.2C429,269.4,422.5,282.2,414.6,294.2z'/%3e%3ccircle class='st0' cx='256' cy='256' r='96'/%3e%3c/g%3e%3c/svg%3e");
$bg-icon-camera: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3e%3ctitle%3eicon-camera-v2%3c/title%3e%3cpath d='M448,128H384L320,0H192L128,128H64A64.2,64.2,0,0,0,0,192V448a64.2,64.2,0,0,0,64,64H448a64.2,64.2,0,0,0,64-64V192A64.2,64.2,0,0,0,448,128ZM256,432A128,128,0,1,1,384,304,128,128,0,0,1,256,432Z'/%3e%3c/svg%3e");
$bg-icon-camera: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3e%3ctitle%3eicon-camera-v2%3c/title%3e%3cpath d='M448,128H384L320,0H192L128,128H64A64.2,64.2,0,0,0,0,192V448a64.2,64.2,0,0,0,64,64H448a64.2,64.2,0,0,0,64-64V192A64.2,64.2,0,0,0,448,128ZM256,432A128,128,0,1,1,384,304,128,128,0,0,1,256,432Z'/%3e%3c/svg%3e");
Loading