Skip to content

Commit

Permalink
Add basic ActivitiesView table
Browse files Browse the repository at this point in the history
  • Loading branch information
lcharette committed Sep 29, 2024
1 parent db4a26b commit b06771c
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 9 deletions.
58 changes: 54 additions & 4 deletions app/assets/views/ActivitiesView.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,60 @@
<script setup>
import { ref } from 'vue'
import axios from 'axios'
import moment from 'moment'
// TODO : Change to pinia (non-persisting) to avoid reactivity issues
// TODO : Use an interface for the data, maybe rework the API
// TODO : Reenable typescript
const data = ref({})
axios.get('/api/activities?size=10&page=0&sorts%5Boccurred_at%5D=desc')
.then((response) => {
data.value = response.data
})
.catch((err) => {
console.error(err)
})
</script>

<template>
<h3 class="uk-margin-remove">Activities</h3>
<p class="uk-text-meta uk-margin-remove-top">A listing of user activities.</p>

<UFCardBox>
<template #header>
<font-awesome-icon icon="list-check" /> Activities
</template>
<table class="uk-table uk-table-striped">
<thead>
<tr>
<th>Activity Time</th>
<th>User</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr v-for="row in data.rows" :key="row.id">
<td>
<div>{{ moment(row.occurred_at).format('dddd')}}</div>
<div>{{ moment(row.occurred_at).format('MMM Do, YYYY h:mm a')}}</div>
</td>
<td>
<strong>
<RouterLink :to="{ name: 'admin.user', params: { user_name: row.user.user_name } }">
{{row.user.full_name}} ({{row.user.user_name}})
</RouterLink>
</strong>
<div class="uk-text-meta">{{row.user.email}}</div>
</td>
<td>
<div>
{{row.ip_address}}
</div>
<div>
<i>{{row.description}}</i>
</div>
</td>
</tr>
</tbody>
</table>

</UFCardBox>
</template>
</template>
12 changes: 12 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,17 @@
"app/assets",
"dist/"
],
"dependencies": {},
"dependencies": {
"moment": "^2.30.1"
},
"peerDependencies": {
"vue": "^3.4.21",
"vue-router": "^4.2.4",
"@userfrosting/sprinkle-account": "git+https://github.com/userfrosting/sprinkle-account.git#6.0",
"@userfrosting/sprinkle-core": "git+https://github.com/userfrosting/sprinkle-core.git#6.0",
"axios": "^1.5.0",
"pinia": "^2.1.6",
"pinia-plugin-persistedstate": "^3.2.0",
"@userfrosting/sprinkle-core": "git+https://github.com/userfrosting/sprinkle-core.git#6.0",
"@userfrosting/sprinkle-account": "git+https://github.com/userfrosting/sprinkle-account.git#6.0"
"vue": "^3.4.21",
"vue-router": "^4.2.4"
},
"devDependencies": {
"@rushstack/eslint-patch": "^1.8.0",
Expand Down

0 comments on commit b06771c

Please sign in to comment.