Files page Recently Used api done
This commit is contained in:
@@ -3,8 +3,9 @@ import { createPinia } from "pinia";
|
|||||||
|
|
||||||
import App from "./App.vue";
|
import App from "./App.vue";
|
||||||
import router from "./router";
|
import router from "./router";
|
||||||
import axios from 'axios'
|
import axios from 'axios';
|
||||||
import VueAxios from 'vue-axios'
|
import VueAxios from 'vue-axios';
|
||||||
|
import moment from 'moment';
|
||||||
|
|
||||||
import "./assets/main.css";
|
import "./assets/main.css";
|
||||||
|
|
||||||
@@ -15,6 +16,8 @@ pinia.use(({ store }) => {
|
|||||||
store.$router = markRaw(router)
|
store.$router = markRaw(router)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// can use `this.$moment` in Vue.js
|
||||||
|
app.config.globalProperties.$moment = moment;
|
||||||
app.use(pinia);
|
app.use(pinia);
|
||||||
app.use(router);
|
app.use(router);
|
||||||
app.use(VueAxios, axios);
|
app.use(VueAxios, axios);
|
||||||
|
|||||||
@@ -6,21 +6,21 @@
|
|||||||
<!-- card group 最多六個-->
|
<!-- card group 最多六個-->
|
||||||
<ul class="flex justify-start items-center gap-4 overflow-x-auto w-full scrollbar whitespace-nowrap pb-4">
|
<ul class="flex justify-start items-center gap-4 overflow-x-auto w-full scrollbar whitespace-nowrap pb-4">
|
||||||
<!-- card item v-for -->
|
<!-- card item v-for -->
|
||||||
<li class="w-[216px] h-[168px] p-4 border rounded border-neutral-300 hover:text-primary hover:bg-primary/50 hover:border-primary duration-300 ">
|
<li class="min-w-[216px] h-[168px] p-4 border rounded border-neutral-300 hover:text-primary hover:bg-primary/50 hover:border-primary duration-300" v-for="(file, index) in recentlyUsedFiles.slice(0, 6)" :key="file.id">
|
||||||
<a href="" class="h-full flex flex-col justify-between">
|
<a href="" class="h-full flex flex-col justify-between">
|
||||||
<div>
|
<div>
|
||||||
<figure class="mb-2">
|
<figure class="mb-2">
|
||||||
<IconDataFormat class="w-8 h-8 hover:fill-primary"></IconDataFormat>
|
<IconDataFormat class="w-8 h-8 hover:fill-primary"></IconDataFormat>
|
||||||
</figure>
|
</figure>
|
||||||
<h3 class="text-sm font-medium mb-2">
|
<h3 class="text-sm font-medium mb-2">
|
||||||
File type
|
{{ file.name }}
|
||||||
</h3>
|
</h3>
|
||||||
<p class="text-sm text-neutral-500 whitespace-nowrap break-keep text-ellipsis overflow-hidden">
|
<p class="text-sm text-neutral-500 whitespace-nowrap break-keep text-ellipsis overflow-hidden">
|
||||||
Daily operation recggggggggggggly operation records of Daily operation records of Daily operation records of Daily operation records of
|
{{ file.parentLog }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<p class="text-sm text-neutral-500">
|
<p class="text-sm text-neutral-500">
|
||||||
Edited just now
|
{{ file.accessed_at }}
|
||||||
</p>
|
</p>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
@@ -29,10 +29,14 @@
|
|||||||
<section>
|
<section>
|
||||||
<div class="py-4 mb-4 border-b flex justify-between items-center border-neutral-500">
|
<div class="py-4 mb-4 border-b flex justify-between items-center border-neutral-500">
|
||||||
<h2 class="font-bold">All Files</h2>
|
<h2 class="font-bold">All Files</h2>
|
||||||
<figure class="flex items-center">
|
<ul class="flex items-center">
|
||||||
<IconList class="mr-4"></IconList>
|
<li class="mr-4">
|
||||||
|
<IconList></IconList>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
<IconGrid></IconGrid>
|
<IconGrid></IconGrid>
|
||||||
</figure>
|
</li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<!-- All Files type of List -->
|
<!-- All Files type of List -->
|
||||||
<div style="margin-left: -16px; margin-right: -16px;" class="overflow-y-scroll overflow-x-hidden max-h-[calc(100vh_-_480px)] scrollbar">
|
<div style="margin-left: -16px; margin-right: -16px;" class="overflow-y-scroll overflow-x-hidden max-h-[calc(100vh_-_480px)] scrollbar">
|
||||||
@@ -41,24 +45,34 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th>
|
<th>
|
||||||
Name
|
Name
|
||||||
<IconVector class="inline-block ml-2 fill-neutral-500" ></IconVector>
|
<span class="ml-2 cursor-pointer">
|
||||||
|
<IconVector class="inline-block fill-neutral-500"></IconVector>
|
||||||
|
</span>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
Parent log
|
Parent log
|
||||||
<IconVector class="inline-block ml-2 fill-neutral-500"></IconVector>
|
<span class="ml-2 cursor-pointer">
|
||||||
|
<IconVector class="inline-block fill-neutral-500"></IconVector>
|
||||||
|
</span>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
File type
|
File type
|
||||||
<IconVector class="inline-block ml-2 fill-neutral-500"></IconVector>
|
<span class="ml-2 cursor-pointer">
|
||||||
|
<IconVector class="inline-block fill-neutral-500"></IconVector>
|
||||||
|
</span>
|
||||||
</th>
|
</th>
|
||||||
<!-- 後端暫時沒做 Owner -->
|
<!-- 後端暫時沒做 Owner -->
|
||||||
<!-- <th>
|
<!-- <th>
|
||||||
Owner
|
Owner
|
||||||
<IconVector class="inline-block ml-2 fill-neutral-500"></IconVector>
|
<span class="ml-2 cursor-pointer">
|
||||||
|
<IconVector class="inline-block fill-neutral-500"></IconVector>
|
||||||
|
</span>
|
||||||
</th> -->
|
</th> -->
|
||||||
<th>
|
<th>
|
||||||
Last update
|
Last update
|
||||||
<IconVector class="inline-block ml-2 fill-neutral-500"></IconVector>
|
<span class="ml-2 cursor-pointer">
|
||||||
|
<IconVector class="inline-block fill-neutral-500"></IconVector>
|
||||||
|
</span>
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -142,6 +156,11 @@
|
|||||||
return { ...itemFilter, parentLog: itemFilter.log.name }
|
return { ...itemFilter, parentLog: itemFilter.log.name }
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
// 時間排序,如果沒有 accessed_at 就不加入 data
|
||||||
|
recentlyUsedFiles: function() {
|
||||||
|
let recentlyUsedFiles = this.allFiles.filter(item => item.accessed_at !== null);
|
||||||
|
return recentlyUsedFiles.sort((n, o) => o - n);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -155,7 +174,11 @@
|
|||||||
const response = await this.$http.get(api);
|
const response = await this.$http.get(api);
|
||||||
|
|
||||||
this.allFilter = response.data;
|
this.allFilter = response.data;
|
||||||
this.allFilter.map(o => o.fileType = "Filter");
|
this.allFilter.map(o => {
|
||||||
|
o.fileType = "Filter";
|
||||||
|
o.updated_at = this.$moment(o.updated_at).format('YYYY-MM-DD HH:MM');
|
||||||
|
o.accessed_at = this.$moment(o.accessed_at).format('YYYY-MM-DD HH:MM');
|
||||||
|
});
|
||||||
} catch(error) {
|
} catch(error) {
|
||||||
} finally {};
|
} finally {};
|
||||||
},
|
},
|
||||||
@@ -172,11 +195,16 @@
|
|||||||
this.allEventLog.map(o => {
|
this.allEventLog.map(o => {
|
||||||
o.parentLog = "-";
|
o.parentLog = "-";
|
||||||
o.fileType = "Log";
|
o.fileType = "Log";
|
||||||
|
o.updated_at = this.$moment(o.updated_at).format('YYYY-MM-DD HH:MM');
|
||||||
|
o.accessed_at = this.$moment(o.accessed_at).format('YYYY-MM-DD HH:MM');
|
||||||
return this.allEventLog
|
return this.allEventLog
|
||||||
})
|
})
|
||||||
} catch(error) {
|
} catch(error) {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* Sort Files item
|
||||||
|
*/
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.fetchFilter();
|
this.fetchFilter();
|
||||||
|
|||||||
Reference in New Issue
Block a user