* Add date/time format setting in portal
Currently, the format used for rendering dates and times is derived from the language/locale selected by the user. The formats used in the en-US locale ("English" in Harbor's GUI) are ambiguous and hard to understand for many users.
For example, is 10/11/21 the 10th of November, 2021, the 11th of October, 2021, or even something else like the 21nd of November, 2010? Even if one does know how to interpret it in theory, such dates are essentially enciphered and must be mentally deciphered by the user every time, incurring unnecessary cognitive load.
Similarly, many users are used to the 24-hour clock rather than the 12-hour clock (AM/PM), and so on.
This PR adds a dropdown next to the existing language selector that lets the user choose between the default format for the current locale and the internationally standardized, unambiguous ISO 8601 format. For example, when viewing a list of resources, the ISO 8601 option makes points in time display as
> 2021-10-11, 13:37
instead of
> 10/11/21, 1:37 PM
thereby improving the user experience considerably for users not familiar with the US date/time format (or, in general, the default format for the locale they have selected).
The localized versions of the "Default" label are copied from `SCANNER.DEFAULT` in each locale.
Signed-off-by: Simon Alling <alling.simon@gmail.com>
* Fix indentation
Signed-off-by: Simon Alling <alling.simon@gmail.com>
* Remove redundant localStorage existence check
Signed-off-by: Simon Alling <alling.simon@gmail.com>
* Run 'npm run lint -- --fix'
Signed-off-by: yminer <yminer@vmmware.com>
test ut_install.sh
Signed-off-by: yminer <yminer@vmmware.com>
test ut_install.sh001
Signed-off-by: yminer <yminer@vmmware.com>
test ut_install002
Signed-off-by: yminer <yminer@vmmware.com>
use curl binary to download golangcilint instead of go get
Signed-off-by: yminer <yminer@vmmware.com>
test ut-ci make lint
Signed-off-by: yminer <yminer@vmmware.com>
check ci GO111MODULE
Signed-off-by: yminer <yminer@vmmware.com>
test ci go env
Signed-off-by: yminer <yminer@vmmware.com>
test ci goenv 002
Signed-off-by: yminer <yminer@vmmware.com>
test ci GO111MODULE=auto
Signed-off-by: yminer <yminer@vmmware.com>
ci test entire ut_install.sh
Signed-off-by: yminer <yminer@vmmware.com>
remove needless debug comment
Signed-off-by: yminer <yminer@vmmware.com>
Co-authored-by: yminer <yminer@vmmware.com>
This PR fixes all lint errors reported by TSLint (`npm run lint` in `src/portal/`).
TSLint also reports multiple warnings (see #16798), but this PR doesn't fix any of them.
Signed-off-by: Simon Alling <alling.simon@gmail.com>
* Refactor portal language code
This PR makes the following improvements:
* The language code is DRYed up by defining `supportedLangs` in terms of `LANGUAGES` (previously `languageNames`).
* The language selection dropdown code is DRYed up similarly.
* The Angular locale registration code is DRYed up similarly: the omission of a supported language is now a static type error.
The above improvements mean that it's now impossible to forget to include a supported language in any of those contexts.
Furthermore:
* The type of supported languages is replaced by a more accurate one than `string`, namely `SupportedLanguage`.
* The value acquired from localStorage will never be used unless it is in fact a supported language. (Today, the GUI breaks pretty badly and errors are spammed in the console if localStorage contains an invalid value.)
* Redundant implicit existence checks such as `localStorage &&` and `browserCultureLang &&` are removed.
* The implementation of `initLangauge` is generally simplified and clarified.
Signed-off-by: Simon Alling <alling.simon@gmail.com>
* Restore accidentally deleted date check
Signed-off-by: Simon Alling <alling.simon@gmail.com>