feat: Compare file sort Dropdown done.

This commit is contained in:
chiayin
2024-02-22 10:12:45 +08:00
parent f429d21584
commit d852d7be06

View File

@@ -108,7 +108,7 @@
<h2 class="font-bold">All Files</h2> <h2 class="font-bold">All Files</h2>
<ul class="flex items-center gap-x-4"> <ul class="flex items-center gap-x-4">
<li> <li>
<Dropdown v-model="gridSort" :options="columnType" optionLabel="name" placeholder="Grid Sort" class="w-full !border-neutral-500" inputClass="!text-sm" @change="getGridSortData($event)"></Dropdown> <Dropdown v-model="gridSort" :options="columnType" optionLabel="name" placeholder="Sort" class="w-full !border-neutral-500" inputClass="!text-sm" @change="getGridSortData($event)"></Dropdown>
</li> </li>
<li> <li>
<IconGrid class="hover:bg-neutral-50 duration-300"></IconGrid> <IconGrid class="hover:bg-neutral-50 duration-300"></IconGrid>
@@ -262,16 +262,14 @@
secondaryDragData: [], secondaryDragData: [],
gridSort: null, gridSort: null,
columnType: [ columnType: [
{ name: 'name a-z', code: 'nameAscending'}, { name: 'By File Name (A to Z)', code: 'nameAscending'},
{ name: 'name z-a', code: 'nameDescending'}, { name: 'By File Name (Z to A)', code: 'nameDescending'},
{ name: 'Dependency a-z', code: 'parentLogAscending'}, { name: 'By Dependency (A to Z)', code: 'parentLogAscending'},
{ name: 'Dependency z-a', code: 'parentLogDescending'}, { name: 'By Dependency (Z to A)', code: 'parentLogDescending'},
{ name: 'File Type a-z', code: 'fileAscending'}, { name: 'By File Type (A to Z)', code: 'fileAscending'},
{ name: 'File Type z-a', code: 'fileDescending'}, { name: 'By File Type (Z to A)', code: 'fileDescending'},
{ name: 'Owner a-z', code: 'ownerAscending'}, { name: 'By Last Update (A to Z)', code: 'updatedAscending'},
{ name: 'Owner z-a', code: 'ownerDescending'}, { name: 'By Last Update (Z to A)', code: 'updatedDescending'},
{ name: 'Last Update 遠-近', code: 'updatedAscending'},
{ name: 'Last Update 近-遠', code: 'updatedDescending'},
], ],
} }
}, },
@@ -541,12 +539,6 @@
case 'fileDescending': case 'fileDescending':
this.compareData = this.compareData.sort((a, b) => a.fileType.toLowerCase().localeCompare(b.fileType.toLowerCase())).reverse(); this.compareData = this.compareData.sort((a, b) => a.fileType.toLowerCase().localeCompare(b.fileType.toLowerCase())).reverse();
break; break;
case 'ownerAscending':
this.compareData = this.compareData.sort((a, b) => a.ownerName.toLowerCase().localeCompare(b.ownerName.toLowerCase()));
break;
case 'ownerDescending':
this.compareData = this.compareData.sort((a, b) => a.ownerName.toLowerCase().localeCompare(b.ownerName.toLowerCase())).reverse();
break;
case 'updatedAscending': case 'updatedAscending':
this.compareData = this.compareData.sort((a, b) => new Date(a.updated_base) - new Date(b.updated_base)); this.compareData = this.compareData.sort((a, b) => new Date(a.updated_base) - new Date(b.updated_base));
break; break;