) {
+ super(store);
+ }
+
+ ngOnInit(): void {
+ this.dateFormatFormControl = new UntypedFormControl(this.dateFormat.format, [Validators.required]);
+ this.dateFormatFormControl.valueChanges.subscribe((value: string) => {
+ this.previewText = this.date.transform(Date.now(), value);
+ });
+ this.previewText = this.date.transform(Date.now(), this.dateFormat.format);
+ }
+
+ cancel() {
+ this.popover?.hide();
+ }
+
+ applyDateFormat() {
+ this.dateFormat.format = this.dateFormatFormControl.value;
+ this.dateFormatApplied.emit(this.dateFormat);
+ }
+
+}
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/font-settings-panel.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/font-settings-panel.component.html
index 8cf2e4e9e3..140c525ac2 100644
--- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/font-settings-panel.component.html
+++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/font-settings-panel.component.html
@@ -23,11 +23,7 @@
-
-
- {{ cssUnit }}
-
-
+
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/font-settings-panel.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/font-settings-panel.component.ts
index 9369167746..91a71bc8d7 100644
--- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/font-settings-panel.component.ts
+++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/font-settings-panel.component.ts
@@ -28,7 +28,6 @@ import { PageComponent } from '@shared/components/page.component';
import {
commonFonts,
ComponentStyle,
- cssUnits,
Font,
fontStyles,
fontStyleTranslations,
@@ -66,8 +65,6 @@ export class FontSettingsPanelComponent extends PageComponent implements OnInit
@ViewChild('familyInput', {static: true}) familyInput: ElementRef;
- cssUnitsList = cssUnits;
-
fontWeightsList = fontWeights;
fontWeightTranslationsMap = fontWeightTranslations;
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/widget-settings.module.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/widget-settings.module.ts
index 1a9834dd91..68b84578c1 100644
--- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/widget-settings.module.ts
+++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/widget-settings.module.ts
@@ -276,6 +276,11 @@ import { ColorSettingsComponent } from '@home/components/widget/lib/settings/com
import {
ColorSettingsPanelComponent
} from '@home/components/widget/lib/settings/common/color-settings-panel.component';
+import { CssUnitSelectComponent } from '@home/components/widget/lib/settings/common/css-unit-select.component';
+import { DateFormatSelectComponent } from '@home/components/widget/lib/settings/common/date-format-select.component';
+import {
+ DateFormatSettingsPanelComponent
+} from '@home/components/widget/lib/settings/common/date-format-settings-panel.component';
@NgModule({
declarations: [
@@ -383,7 +388,10 @@ import {
FontSettingsComponent,
FontSettingsPanelComponent,
ColorSettingsComponent,
- ColorSettingsPanelComponent
+ ColorSettingsPanelComponent,
+ CssUnitSelectComponent,
+ DateFormatSelectComponent,
+ DateFormatSettingsPanelComponent
],
imports: [
CommonModule,
@@ -495,7 +503,10 @@ import {
FontSettingsComponent,
FontSettingsPanelComponent,
ColorSettingsComponent,
- ColorSettingsPanelComponent
+ ColorSettingsPanelComponent,
+ CssUnitSelectComponent,
+ DateFormatSelectComponent,
+ DateFormatSettingsPanelComponent
]
})
export class WidgetSettingsModule {
diff --git a/ui-ngx/src/app/shared/components/help-markdown.component.ts b/ui-ngx/src/app/shared/components/help-markdown.component.ts
index 97bd326b46..90ac325c55 100644
--- a/ui-ngx/src/app/shared/components/help-markdown.component.ts
+++ b/ui-ngx/src/app/shared/components/help-markdown.component.ts
@@ -24,6 +24,7 @@ import {
import { BehaviorSubject } from 'rxjs';
import { share } from 'rxjs/operators';
import { HelpService } from '@core/services/help.service';
+import { coerceBoolean } from '@shared/decorators/coercion';
@Component({
selector: 'tb-help-markdown',
@@ -36,7 +37,9 @@ export class HelpMarkdownComponent implements OnDestroy, OnInit, OnChanges {
@Input() helpContent: string;
- @Input() visible: boolean;
+ @Input()
+ @coerceBoolean()
+ visible: boolean;
@Input() style: { [klass: string]: any } = {};
diff --git a/ui-ngx/src/app/shared/components/unit-input.component.html b/ui-ngx/src/app/shared/components/unit-input.component.html
index 3686796dbf..d001a43ef2 100644
--- a/ui-ngx/src/app/shared/components/unit-input.component.html
+++ b/ui-ngx/src/app/shared/components/unit-input.component.html
@@ -15,7 +15,7 @@
limitations under the License.
-->
-
+
0) {
- let res = this.translate.instant(`timewindow.${i}`, {[i]: counter});
+ let res = this.translate.instant(`timewindow.${i+(short ? '-short' : '')}`, {[i]: counter});
if (applyAgo) {
res += ' ' + this.translate.instant('timewindow.ago');
}
diff --git a/ui-ngx/src/assets/help/en_US/date/date-format.md b/ui-ngx/src/assets/help/en_US/date/date-format.md
new file mode 100644
index 0000000000..502ab7d4f7
--- /dev/null
+++ b/ui-ngx/src/assets/help/en_US/date/date-format.md
@@ -0,0 +1,88 @@
+#### Pre-defined format options
+
+| Option | Equivalent to | Examples (given in `en-US` locale) |
+|------------|---------------------------------|-----------------------------------------------|
+| short | M/d/yy, h:mm a | 6/15/15, 9:03 AM |
+| medium | MMM d, y, h:mm:ss a | Jun 15, 2015, 9:03:01 AM |
+| long | MMMM d, y, h:mm:ss a z | June 15, 2015 at 9:03:01 AM GMT+1 |
+| full | EEEE, MMMM d, y, h:mm:ss a zzzz | Monday, June 15, 2015 at 9:03:01 AM GMT+01:00 |
+| shortDate | M/d/yy | 6/15/15 |
+| mediumDate | MMM d, y | Jun 15, 2015 |
+| longDate | MMMM d, y | June 15, 2015 |
+| fullDate | EEEE, MMMM d, y | Monday, June 15, 2015 |
+| shortTime | h:mm a | 9:03 AM |
+| mediumTime | h:mm:ss a | 9:03:01 AM |
+| longTime | h:mm:ss a z | 9:03:01 AM GMT+1 |
+| fullTime | h:mm:ss a zzzz | 9:03:01 AM GMT+01:00 |
+
+#### Custom format options
+
+You can construct a format string using symbols to specify the components
+of a date-time value, as described in the following table.
+Format details depend on the locale.
+Fields marked with (*) are only available in the extra data set for the given locale.
+
+| Field type | Format | Description | Example Value |
+|---------------------|-------------|--------------------------------------------------------------|------------------------------------------------------------|
+| Era | G, GG & GGG | Abbreviated | AD |
+| | GGGG | Wide | Anno Domini |
+| | GGGGG | Narrow | A |
+| Year | y | Numeric: minimum digits | 2, 20, 201, 2017, 20173 |
+| | yy | Numeric: 2 digits + zero padded | 02, 20, 01, 17, 73 |
+| | yyy | Numeric: 3 digits + zero padded | 002, 020, 201, 2017, 20173 |
+| | yyyy | Numeric: 4 digits or more + zero padded | 0002, 0020, 0201, 2017, 20173 |
+| Week-numbering year | Y | Numeric: minimum digits | 2, 20, 201, 2017, 20173 |
+| | YY | Numeric: 2 digits + zero padded | 02, 20, 01, 17, 73 |
+| | YYY | Numeric: 3 digits + zero padded | 002, 020, 201, 2017, 20173 |
+| | YYYY | Numeric: 4 digits or more + zero padded | 0002, 0020, 0201, 2017, 20173 |
+| Month | M | Numeric: 1 digit | 9, 12 |
+| | MM | Numeric: 2 digits + zero padded | 09, 12 |
+| | MMM | Abbreviated | Sep |
+| | MMMM | Wide | September |
+| | MMMMM | Narrow | S |
+| Month standalone | L | Numeric: 1 digit | 9, 12 |
+| | LL | Numeric: 2 digits + zero padded | 09, 12 |
+| | LLL | Abbreviated | Sep |
+| | LLLL | Wide | September |
+| | LLLLL | Narrow | S |
+| Week of year | w | Numeric: minimum digits | 1... 53 |
+| | ww | Numeric: 2 digits + zero padded | 01... 53 |
+| Week of month | W | Numeric: 1 digit | 1... 5 |
+| Day of month | d | Numeric: minimum digits | 1 |
+| | dd | Numeric: 2 digits + zero padded | 01 |
+| Week day | E, EE & EEE | Abbreviated | Tue |
+| | EEEE | Wide | Tuesday |
+| | EEEEE | Narrow | T |
+| | EEEEEE | Short | Tu |
+| Week day standalone | c, cc | Numeric: 1 digit | 2 |
+| | ccc | Abbreviated | Tue |
+| | cccc | Wide | Tuesday |
+| | ccccc | Narrow | T |
+| | cccccc | Short | Tu |
+| Period | a, aa & aaa | Abbreviated | am/pm or AM/PM |
+| | aaaa | Wide (fallback to `a` when missing) | ante meridiem/post meridiem |
+| | aaaaa | Narrow | a/p |
+| Period* | B, BB & BBB | Abbreviated | mid. |
+| | BBBB | Wide | am, pm, midnight, noon, morning, afternoon, evening, night |
+| | BBBBB | Narrow | md |
+| Period standalone* | b, bb & bbb | Abbreviated | mid. |
+| | bbbb | Wide | am, pm, midnight, noon, morning, afternoon, evening, night |
+| | bbbbb | Narrow | md |
+| Hour 1-12 | h | Numeric: minimum digits | 1, 12 |
+| | hh | Numeric: 2 digits + zero padded | 01, 12 |
+| Hour 0-23 | H | Numeric: minimum digits | 0, 23 |
+| | HH | Numeric: 2 digits + zero padded | 00, 23 |
+| Minute | m | Numeric: minimum digits | 8, 59 |
+| | mm | Numeric: 2 digits + zero padded | 08, 59 |
+| Second | s | Numeric: minimum digits | 0... 59 |
+| | ss | Numeric: 2 digits + zero padded | 00... 59 |
+| Fractional seconds | S | Numeric: 1 digit | 0... 9 |
+| | SS | Numeric: 2 digits + zero padded | 00... 99 |
+| | SSS | Numeric: 3 digits + zero padded (= milliseconds) | 000... 999 |
+| Zone | z, zz & zzz | Short specific non location format (fallback to O) | GMT-8 |
+| | zzzz | Long specific non location format (fallback to OOOO) | GMT-08:00 |
+| | Z, ZZ & ZZZ | ISO8601 basic format | -0800 |
+| | ZZZZ | Long localized GMT format | GMT-8:00 |
+| | ZZZZZ | ISO8601 extended format + Z indicator for offset 0 (= XXXXX) | -08:00 |
+| | O, OO & OOO | Short localized GMT format | GMT-8 |
+| | OOOO | Long localized GMT format | GMT-08:00 |
diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json
index 1a93bf03db..291fe0cda0 100644
--- a/ui-ngx/src/assets/locale/locale.constant-en_US.json
+++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json
@@ -940,6 +940,13 @@
"edges": "Customer edge instances",
"manage-edges": "Manage edges"
},
+ "date": {
+ "last-update-n-ago": "Last update N ago",
+ "last-update-n-ago-text": "Last update {{ agoText }}",
+ "custom-date": "Custom date",
+ "format": "Format",
+ "preview": "Preview"
+ },
"datetime": {
"date-from": "Date from",
"time-from": "Time from",
@@ -3832,15 +3839,22 @@
"timewindow": {
"timewindow": "Timewindow",
"years": "{ years, plural, =1 { year } other {# years } }",
+ "years-short": "{{ years }}y",
"months": "{ months, plural, =1 { month } other {# months } }",
+ "months-short": "{{ months }}M",
"weeks": "{ weeks, plural, =1 { week } other {# weeks } }",
+ "weeks-short": "{{ weeks }}w",
"days": "{ days, plural, =1 { day } other {# days } }",
+ "days-short": "{{ days }}d",
"hours": "{ hours, plural, =0 { hour } =1 {1 hour } other {# hours } }",
"hr": "{{ hr }} hr",
+ "hr-short": "{{ hr }}h",
"minutes": "{ minutes, plural, =0 { minute } =1 {1 minute } other {# minutes } }",
"min": "{{ min }} min",
+ "min-short": "{{ min }}m",
"seconds": "{ seconds, plural, =0 { second } =1 {1 second } other {# seconds } }",
"sec": "{{ sec }} sec",
+ "sec-short": "{{ sec }}s",
"short": {
"days": "{ days, plural, =1 {1 day } other {# days } }",
"hours": "{ hours, plural, =1 {1 hour } other {# hours } }",
@@ -3859,6 +3873,7 @@
"hide": "Hide",
"interval": "Interval",
"just-now": "Just now",
+ "just-now-lower": "just now",
"ago": "ago"
},
"unit": {
@@ -4208,6 +4223,7 @@
"decimals": "Number of digits after floating point",
"units-short": "Units",
"decimals-short": "Decimals",
+ "decimals-suffix": "decimals",
"timewindow": "Timewindow",
"use-dashboard-timewindow": "Use dashboard timewindow",
"use-widget-timewindow": "Use widget timewindow",
@@ -5235,7 +5251,10 @@
"layout-simplified": "Simplified",
"layout-horizontal": "Horizontal",
"layout-horizontal-reversed": "Horizontal reversed",
- "label": "Label"
+ "label": "Label",
+ "icon": "Icon",
+ "value": "Value",
+ "date": "Date"
},
"table": {
"common-table-settings": "Common Table Settings",