Fix Bug 2344: OSM Version is not showing while refreshing the UI dashboard
[osm/NG-UI.git] / src / services / SharedService.ts
index ba805e6..2a5f50f 100644 (file)
@@ -414,6 +414,7 @@ export class SharedService {
             const version: string[] = res.version.split('+');
             if (!isNullOrUndefined(version[0])) {
                 this.osmVersion = version[0];
+                sessionStorage.setItem('version', version[0]);
             } else {
                 this.osmVersion = null;
             }
@@ -468,6 +469,19 @@ export class SharedService {
         }));
     }
 
+    /** Sorting the list based on date @public */
+    public compareFunction = (dir: number, a: string, b: string): number => {
+        const first: number = new Date(a).getTime();
+        const second: number = new Date(b).getTime();
+        if (first < second) {
+            return -1 * dir;
+        }
+        if (first > second) {
+            return dir;
+        }
+        return 0;
+    };
+
     /** Method to validate file extension and size @private */
     private vaildataFileInfo(fileInfo: File, fileType: string): boolean {
         const extension: string = fileInfo.name.substring(fileInfo.name.lastIndexOf('.') + 1);