From 82c67aba30c09a2481725ae9fecf94a441aeb2a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivar=20Conradi=20=C3=98sthus?= Date: Sat, 26 Sep 2020 22:14:56 +0200 Subject: [PATCH] fix: add created date for applications --- frontend/CHANGELOG.md | 3 ++ .../application-edit-component-test.js.snap | 36 ++++++++++++++++--- .../application/application-edit-component.js | 12 +++++-- frontend/src/component/common/util.js | 14 ++++++++ 4 files changed, 58 insertions(+), 7 deletions(-) diff --git a/frontend/CHANGELOG.md b/frontend/CHANGELOG.md index 51619148b9..09a1356d67 100644 --- a/frontend/CHANGELOG.md +++ b/frontend/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/). The latest version of this document is always available in [releases][releases-url]. +# 3.6.2 +- fix: show notification when app updates + # 3.6.1 - fix: minor css tweaks for mobile - fix: should support 409 responses as well diff --git a/frontend/src/component/application/__tests__/__snapshots__/application-edit-component-test.js.snap b/frontend/src/component/application/__tests__/__snapshots__/application-edit-component-test.js.snap index 2f04a733d4..fcbf7276f8 100644 --- a/frontend/src/component/application/__tests__/__snapshots__/application-edit-component-test.js.snap +++ b/frontend/src/component/application/__tests__/__snapshots__/application-edit-component-test.js.snap @@ -31,8 +31,22 @@ exports[`renders correctly with permissions 1`] = `   test-app - - app description + +

+ app description +

+

+ Created: + + Invalid Date + +

- - app description + +

+ app description +

+

+ Created: + + Invalid Date + +

this.setState({ loading: false })); } formatFullDateTime = v => formatFullDateTimeWithLocale(v, this.props.location.locale); + formatDate = v => formatDateWithLocale(v, this.props.location.locale); deleteApplication = async evt => { evt.preventDefault(); @@ -50,7 +51,7 @@ class ClientApplications extends PureComponent { return

Application ({this.props.appName}) not found

; } const { application, storeApplicationMetaData, hasPermission } = this.props; - const { appName, instances, strategies, seenToggles, url, description, icon = 'apps' } = application; + const { appName, instances, strategies, seenToggles, url, description, icon = 'apps', createdAt } = application; const content = this.state.activeTab === 0 ? ( @@ -71,7 +72,12 @@ class ClientApplications extends PureComponent {  {appName} - {description && {description}} + +

{description || ''}

+

+ Created: {this.formatDate(createdAt)} +

+
{url && ( diff --git a/frontend/src/component/common/util.js b/frontend/src/component/common/util.js index 86f0dd7493..d68733576f 100644 --- a/frontend/src/component/common/util.js +++ b/frontend/src/component/common/util.js @@ -8,6 +8,13 @@ const dateTimeOptions = { minute: '2-digit', second: '2-digit', }; + +const dateOptions = { + day: '2-digit', + month: '2-digit', + year: 'numeric', +}; + export const formatFullDateTimeWithLocale = (v, locale, tz) => { if (tz) { dateTimeOptions.timeZone = tz; @@ -15,6 +22,13 @@ export const formatFullDateTimeWithLocale = (v, locale, tz) => { return new Date(v).toLocaleString(locale, dateTimeOptions); }; +export const formatDateWithLocale = (v, locale, tz) => { + if (tz) { + dateTimeOptions.timeZone = tz; + } + return new Date(v).toLocaleString(locale, dateOptions); +}; + export const trim = value => { if (value && value.trim) { return value.trim();