Commit Graph

7 Commits

Author SHA1 Message Date
Lichao Xue dee73a44f3
Fix UI bugs (#20364)
Signed-off-by: xuelichao <xuel@vmware.com>
2024-04-26 06:56:23 +00:00
Shijun Sun 10cb2fd2c7
Update the way for generating new cli secret (#17744)
Update the way for refreshing cli-secret

Signed-off-by: AllForNothing <sshijun@vmware.com>

Signed-off-by: AllForNothing <sshijun@vmware.com>
2022-11-03 21:04:04 +08:00
Shijun Sun a9063d240d
Modify HarborDatetimePipe to pure pipe to improve performance (#16906)
Signed-off-by: AllForNothing <sshijun@vmware.com>
2022-05-25 10:43:29 +08:00
Simon Alling c4b782bc95
Add date/time format setting in portal (#16796)
* 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'
2022-05-24 17:45:34 +08:00
Shijun Sun 73295ff891
migrate tslint to eslint (#16856)
Signed-off-by: AllForNothing <sshijun@vmware.com>
2022-05-13 16:00:45 +08:00
Simon Alling bb007f70bb
Refactor portal language code (#16795)
* 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>
2022-05-05 13:16:41 +08:00
Will Sun 2d84b62fe2
Refactor UI routing and remove redundant code (#14166)
Signed-off-by: AllForNothing <sshijun@vmware.com>
2021-02-18 09:12:23 +08:00