Skip to content

Commit

Permalink
Implement Activity Sprunje
Browse files Browse the repository at this point in the history
  • Loading branch information
lcharette committed Oct 5, 2024
1 parent 3ca39a3 commit ead8395
Show file tree
Hide file tree
Showing 18 changed files with 4,802 additions and 4,819 deletions.
87 changes: 34 additions & 53 deletions app/assets/views/ActivitiesView.vue
Original file line number Diff line number Diff line change
@@ -1,63 +1,44 @@
<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>
<UFHeaderPage title="Activities" caption="A listing of user activities." />

<UFCardBox>
<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>
<UFSprunjeTable dataUrl='/api/activities'>
<template #header>
<UFSprunjeHeader>Activity Time</UFSprunjeHeader>
<UFSprunjeHeader>User</UFSprunjeHeader>
<UFSprunjeHeader>Description</UFSprunjeHeader>
</template>

<template #body="{ item }">
<UFSprunjeColumn>
<div>{{ moment(item.occurred_at).format('dddd') }}</div>
<div>{{ moment(item.occurred_at).format('MMM Do, YYYY h:mm a') }}</div>
</UFSprunjeColumn>
<UFSprunjeColumn>
<strong>
<RouterLink
:to="{
name: 'admin.user',
params: { user_name: item.user.user_name }
}">
{{ item.user.full_name }} ({{ item.user.user_name }})
</RouterLink>
</strong>
<div class="uk-text-meta">{{ item.user.email }}</div>
</UFSprunjeColumn>
<UFSprunjeColumn>
<div>
{{ item.ip_address }}
</div>
<div>
<i>{{ item.description }}</i>
</div>
</UFSprunjeColumn>
</template>
</UFSprunjeTable>
</UFCardBox>
</template>
84 changes: 84 additions & 0 deletions dist/ActivitiesView-B5_vaB0M.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import { resolveComponent as u, openBlock as U, createElementBlock as v, Fragment as F, createVNode as e, withCtx as n, createTextVNode as a, createElementVNode as o, toDisplayString as r, unref as i } from "vue";
import { h as _ } from "./moment-h96o7c8I.js";
const x = { class: "uk-text-meta" }, C = {
__name: "ActivitiesView",
setup(S) {
return (g, l) => {
const p = u("UFHeaderPage"), s = u("UFSprunjeHeader"), d = u("UFSprunjeColumn"), c = u("RouterLink"), m = u("UFSprunjeTable"), f = u("UFCardBox");
return U(), v(F, null, [
e(p, {
title: "Activities",
caption: "A listing of user activities."
}),
e(f, null, {
default: n(() => [
e(m, { dataUrl: "/api/activities" }, {
header: n(() => [
e(s, null, {
default: n(() => l[0] || (l[0] = [
a("Activity Time")
])),
_: 1
}),
e(s, null, {
default: n(() => l[1] || (l[1] = [
a("User")
])),
_: 1
}),
e(s, null, {
default: n(() => l[2] || (l[2] = [
a("Description")
])),
_: 1
})
]),
body: n(({ item: t }) => [
e(d, null, {
default: n(() => [
o("div", null, r(i(_)(t.occurred_at).format("dddd")), 1),
o("div", null, r(i(_)(t.occurred_at).format("MMM Do, YYYY h:mm a")), 1)
]),
_: 2
}, 1024),
e(d, null, {
default: n(() => [
o("strong", null, [
e(c, {
to: {
name: "admin.user",
params: { user_name: t.user.user_name }
}
}, {
default: n(() => [
a(r(t.user.full_name) + " (" + r(t.user.user_name) + ") ", 1)
]),
_: 2
}, 1032, ["to"])
]),
o("div", x, r(t.user.email), 1)
]),
_: 2
}, 1024),
e(d, null, {
default: n(() => [
o("div", null, r(t.ip_address), 1),
o("div", null, [
o("i", null, r(t.description), 1)
])
]),
_: 2
}, 1024)
]),
_: 1
})
]),
_: 1
})
], 64);
};
}
};
export {
C as default
};
70 changes: 0 additions & 70 deletions dist/ActivitiesView-CnMRYZmu.js

This file was deleted.

1 change: 1 addition & 0 deletions dist/ActivitiesView-DwqQmUZS.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),l=require("./moment-Bp7fbP4q.cjs"),s={class:"uk-text-meta"},c={__name:"ActivitiesView",setup(p){return(m,o)=>{const a=e.resolveComponent("UFHeaderPage"),n=e.resolveComponent("UFSprunjeHeader"),r=e.resolveComponent("UFSprunjeColumn"),i=e.resolveComponent("RouterLink"),d=e.resolveComponent("UFSprunjeTable"),u=e.resolveComponent("UFCardBox");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(a,{title:"Activities",caption:"A listing of user activities."}),e.createVNode(u,null,{default:e.withCtx(()=>[e.createVNode(d,{dataUrl:"/api/activities"},{header:e.withCtx(()=>[e.createVNode(n,null,{default:e.withCtx(()=>o[0]||(o[0]=[e.createTextVNode("Activity Time")])),_:1}),e.createVNode(n,null,{default:e.withCtx(()=>o[1]||(o[1]=[e.createTextVNode("User")])),_:1}),e.createVNode(n,null,{default:e.withCtx(()=>o[2]||(o[2]=[e.createTextVNode("Description")])),_:1})]),body:e.withCtx(({item:t})=>[e.createVNode(r,null,{default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(e.unref(l.hooks)(t.occurred_at).format("dddd")),1),e.createElementVNode("div",null,e.toDisplayString(e.unref(l.hooks)(t.occurred_at).format("MMM Do, YYYY h:mm a")),1)]),_:2},1024),e.createVNode(r,null,{default:e.withCtx(()=>[e.createElementVNode("strong",null,[e.createVNode(i,{to:{name:"admin.user",params:{user_name:t.user.user_name}}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.user.full_name)+" ("+e.toDisplayString(t.user.user_name)+") ",1)]),_:2},1032,["to"])]),e.createElementVNode("div",s,e.toDisplayString(t.user.email),1)]),_:2},1024),e.createVNode(r,null,{default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(t.ip_address),1),e.createElementVNode("div",null,[e.createElementVNode("i",null,e.toDisplayString(t.description),1)])]),_:2},1024)]),_:1})]),_:1})],64)}}};exports.default=c;
1 change: 0 additions & 1 deletion dist/ActivitiesView-WL_MAW63.cjs

This file was deleted.

1 change: 0 additions & 1 deletion dist/DashboardView-9BJfKLki.cjs

This file was deleted.

Loading

0 comments on commit ead8395

Please sign in to comment.