From 8c5bd3b510f801189a9e7ff27fcf30e095145988 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Janis=20Daniel=20Da=CC=88hne?=
 <janis.daehne2@student.uni-halle.de>
Date: Tue, 19 Nov 2019 23:00:16 +0100
Subject: [PATCH] - added list releases for execises sorting by automaticEndAt
 and releasedAt - added small check if localstorage throws

---
 i18n/en.ts                                    |  2 +-
 i18n/i18nRoot.ts                              |  2 +-
 .../releasesSite/listView.tsx                 | 44 ++++++++++++++++---
 src/constants.ts                              |  2 +-
 src/helpers/frontendSettingsManager.ts        |  8 +++-
 5 files changed, 48 insertions(+), 10 deletions(-)

diff --git a/i18n/en.ts b/i18n/en.ts
index 7a1b5a4c..2e18146b 100644
--- a/i18n/en.ts
+++ b/i18n/en.ts
@@ -665,7 +665,7 @@ export const lang_en: LangObj = {
   "Unlimited": "Unlimited",
   "unlimited": "unlimited",
   "Start at": "Start at",
-  "If the start type is automatic then the automatic start time is changed to the actual start time.": "If the start type is automatic then the automatic start time is changed to the actual start time.",
+  "The actual date and time when the release was released. If the release is not yet released then this is empty.": "The actual date and time when the release was released. If the release is not yet released then this is empty.",
   "End at": "End at",
   "This cannot be changed after the release is created" : "This cannot be changed after the release is created",
 
diff --git a/i18n/i18nRoot.ts b/i18n/i18nRoot.ts
index f2866bad..408d77d7 100644
--- a/i18n/i18nRoot.ts
+++ b/i18n/i18nRoot.ts
@@ -670,7 +670,7 @@ export interface LangObj {
   "Unlimited": string
   "unlimited": string
   "Start at": string
-  "If the start type is automatic then the automatic start time is changed to the actual start time.": string
+  "The actual date and time when the release was released. If the release is not yet released then this is empty.": string
   "End at": string
   "This cannot be changed after the release is created": string
 
diff --git a/src/components/sites/manageOwnOrGroupExerciseComponents/releasesSite/listView.tsx b/src/components/sites/manageOwnOrGroupExerciseComponents/releasesSite/listView.tsx
index be3efd74..b6cf376f 100644
--- a/src/components/sites/manageOwnOrGroupExerciseComponents/releasesSite/listView.tsx
+++ b/src/components/sites/manageOwnOrGroupExerciseComponents/releasesSite/listView.tsx
@@ -127,20 +127,52 @@ class ListView extends React.Component<Props, any> {
                   getI18n(this.props.langId, 'Release code')
                 }
               </Table.HeaderCell>
-              <Table.HeaderCell>
-                <span className="mar-right-half">
+              <Table.HeaderCell
+                sorted={
+                  isCurrentSortingColumnPaginated<ExerciseReleaseFromBackend>(this.props.sortByKey, 'releasedAt',
+                                                                              this.props.sortDirection
+                  )
+                }
+              >
+                 <span className="clickable mar-right-half"
+                       onClick={() => {
+                         this.props.setSortByKey('releasedAt',
+                                                 rotateSorting<ExerciseReleaseFromBackend>(this.props.sortDirection,
+                                                                                           this.props.sortByKey,
+                                                                                           'releasedAt'
+                                                 )
+                         )
+                       }}
+                 >
                   {
                     getI18n(this.props.langId, 'Start at')
                   }
                 </span>
                 <HelpPopup defaultText={getI18n(this.props.langId,
-                                                'If the start type is automatic then the automatic start time is changed to the actual start time.'
+                                                'The actual date and time when the release was released. If the release is not yet released then this is empty.'
                 )}/>
               </Table.HeaderCell>
-              <Table.HeaderCell>
-                {
-                  getI18n(this.props.langId, 'End at')
+              <Table.HeaderCell
+                sorted={
+                  isCurrentSortingColumnPaginated<ExerciseReleaseFromBackend>(this.props.sortByKey, 'automaticEndAt',
+                                                                              this.props.sortDirection
+                  )
                 }
+              >
+                <span className="clickable"
+                      onClick={() => {
+                        this.props.setSortByKey('automaticEndAt',
+                                                rotateSorting<ExerciseReleaseFromBackend>(this.props.sortDirection,
+                                                                                          this.props.sortByKey,
+                                                                                          'automaticEndAt'
+                                                )
+                        )
+                      }}
+                >
+                  {
+                    getI18n(this.props.langId, 'End at')
+                  }
+                </span>
               </Table.HeaderCell>
               <Table.HeaderCell>
                 {
diff --git a/src/constants.ts b/src/constants.ts
index 37fbf51a..bcf6511f 100644
--- a/src/constants.ts
+++ b/src/constants.ts
@@ -13,7 +13,7 @@ import Logger from './helpers/logger'
  * y - breaking changes / new features
  * z - fixes, small changes
  */
-export const versionString = '2.6.0'
+export const versionString = '2.6.1'
 
 
 export const supportMail = 'yapex@informatik.uni-halle.de'
diff --git a/src/helpers/frontendSettingsManager.ts b/src/helpers/frontendSettingsManager.ts
index c3f5bd4c..be795d27 100644
--- a/src/helpers/frontendSettingsManager.ts
+++ b/src/helpers/frontendSettingsManager.ts
@@ -474,7 +474,13 @@ export class FrontendSettingsManager {
       FrontendSettingsManager.hasReadFrontendSettingsFromLocalStorage = true
       if (supportsLocalStorage()) {
         Logger.debug("frontendSettingsManager", "reading frontend settings")
-        const json = localStorage.getItem(FrontendSettingsManager.localStorageKey)
+        //this can fail... some inode error or something... then login and logout (works on linux)
+        let json: string | null = null
+        try {
+          json = localStorage.getItem(FrontendSettingsManager.localStorageKey)
+        } catch(err) {
+            Logger.warn("couldn't access local storage (some inode error?)... maybe sing out and sign in in the os might help")
+        }
 
         if (json) {
           try {
-- 
GitLab