Skip to content

Commit

Permalink
Update Activities route
Browse files Browse the repository at this point in the history
  • Loading branch information
lcharette committed Sep 29, 2024
1 parent a6c1f22 commit db4a26b
Show file tree
Hide file tree
Showing 29 changed files with 213 additions and 220 deletions.
4 changes: 1 addition & 3 deletions app/assets/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import SidebarMenuItems from './SidebarMenuItems.vue'

export {
SidebarMenuItems
}
export { SidebarMenuItems }
4 changes: 1 addition & 3 deletions app/assets/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@ import type { App } from 'vue'

/* Install plugins */
export default {
install: (app: App, options: { }) => {

}
install: (app: App, options: {}) => {}
}
14 changes: 7 additions & 7 deletions app/assets/router/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const AdminDashboardRoutes = [
name: 'admin.dashboard',
meta: {
auth: {
redirect: { name: 'account.login' },
redirect: { name: 'account.login' }
}
},
component: () => import('../views/DashboardView.vue')
Expand All @@ -17,7 +17,7 @@ const AdminActivitiesRoutes = [
name: 'admin.activities',
meta: {
auth: {
redirect: { name: 'account.login' },
redirect: { name: 'account.login' }
}
},
component: () => import('../views/ActivitiesView.vue')
Expand All @@ -30,7 +30,7 @@ const AdminGroupsRoutes = [
name: 'admin.groups',
meta: {
auth: {
redirect: { name: 'account.login' },
redirect: { name: 'account.login' }
}
},
component: () => import('../views/GroupsView.vue'),
Expand All @@ -50,7 +50,7 @@ const AdminPermissionsRoutes = [
name: 'admin.permissions',
meta: {
auth: {
redirect: { name: 'account.login' },
redirect: { name: 'account.login' }
}
},
component: () => import('../views/PermissionsView.vue'),
Expand All @@ -69,7 +69,7 @@ const AdminRolesRoutes = [
name: 'admin.roles',
meta: {
auth: {
redirect: { name: 'account.login' },
redirect: { name: 'account.login' }
}
},
component: () => import('../views/RolesView.vue'),
Expand All @@ -89,7 +89,7 @@ const AdminUsersRoutes = [
name: 'admin.users',
meta: {
auth: {
redirect: { name: 'account.login' },
redirect: { name: 'account.login' }
}
},
component: () => import('../views/UsersView.vue'),
Expand All @@ -109,7 +109,7 @@ const AdminRoutes = [
...AdminGroupsRoutes,
...AdminPermissionsRoutes,
...AdminRolesRoutes,
...AdminUsersRoutes,
...AdminUsersRoutes
]

export default AdminRoutes
Expand Down
11 changes: 9 additions & 2 deletions app/assets/views/ActivitiesView.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<template>
<div>Activities View</div>
</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>
</UFCardBox>
</template>
95 changes: 58 additions & 37 deletions app/assets/views/DashboardView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,33 @@ import axios from 'axios'
// TODO : Change to pinia (non-persisting) to avoid reactivity issues
// TODO : Use an interface for the data, maybe rework the API
const data = ref({
"counter": {
"users": 0,
"roles": 0,
"groups": 0
counter: {
users: 0,
roles: 0,
groups: 0
},
"info": {
"version": {
"framework": "",
"php": ""
info: {
version: {
framework: '',
php: ''
},
"database": {
"connection": "",
"name": "",
"type": "",
"version": ""
database: {
connection: '',
name: '',
type: '',
version: ''
},
"environment": {},
"path": {
"project": ""
environment: {},
path: {
project: ''
}
},
"sprinkles": {},
"users": []
sprinkles: {},
users: []
})
axios.get('/api/dashboard')
axios
.get('/api/dashboard')
.then((response) => {
data.value = response.data
})
Expand All @@ -44,17 +45,17 @@ axios.get('/api/dashboard')

<div class="uk-grid uk-child-width-1-3" uk-grid>
<div>
<RouterLink :to="{ name: 'admin.users'}">
<RouterLink :to="{ name: 'admin.users' }" class="uk-text-decoration-none">
<UFInfoBox :value="data.counter.users" label="Users" faIcon="user" />
</RouterLink>
</div>
<div>
<RouterLink :to="{ name: 'admin.roles'} " class="uk-text-decoration-none">
<RouterLink :to="{ name: 'admin.roles' }" class="uk-text-decoration-none">
<UFInfoBox :value="data.counter.roles" label="Roles" faIcon="address-card" />
</RouterLink>
</div>
<div>
<RouterLink :to="{ name: 'admin.groups'} " class="uk-text-decoration-none">
<RouterLink :to="{ name: 'admin.groups' }" class="uk-text-decoration-none">
<UFInfoBox :value="data.counter.groups" label="Groups" faIcon="users" />
</RouterLink>
</div>
Expand All @@ -73,52 +74,72 @@ axios.get('/api/dashboard')
</div>
</div>
<div class="uk-card-body">
<div class="uk-grid uk-flex-center" uk-grid>
<div class="uk-grid uk-flex-center" uk-grid>
<div v-for="user in data.users" :key="user.id" class="uk-text-center">
<RouterLink :to="{ name: 'admin.user', params: { user_name: user.user_name } }" class="uk-text-decoration-none uk-link-text">
<img :src="user.avatar" alt="User Image" class="uk-border-circle">
<p class="uk-margin-remove">{{user.full_name}}</p>
<RouterLink
:to="{ name: 'admin.user', params: { user_name: user.user_name } }"
class="uk-text-decoration-none uk-link-text">
<img :src="user.avatar" alt="User Image" class="uk-border-circle" />
<p class="uk-margin-remove">{{ user.full_name }}</p>
<p class="uk-margin-remove uk-text-meta">{{ user.registered }}</p>
</RouterLink>
</div>
</div>
</div>
<div class="uk-card-footer uk-text-center">
<RouterLink :to="{ name: 'admin.users' }" class="uk-button uk-button-text">View All Users</RouterLink>
<RouterLink :to="{ name: 'admin.users' }" class="uk-button uk-button-text"
>View All Users</RouterLink
>
</div>
</div>
<br />
<UFCardBox title="System Information">
<dl class="uk-description-list">
<dt>Frameword version</dt>
<dd><pre><code>{{data.info.version.framework}}</code></pre></dd>
<dd>
<pre><code>{{data.info.version.framework}}</code></pre>
</dd>

<dt>PHP version</dt>
<dd><pre><code>{{data.info.version.php}}</code></pre></dd>
<dd>
<pre><code>{{data.info.version.php}}</code></pre>
</dd>

<dt>Webserver software</dt>
<dd><pre><code>{{data.info.environment.SERVER_SOFTWARE}}</code></pre></dd>
<dd>
<pre><code>{{data.info.environment.SERVER_SOFTWARE}}</code></pre>
</dd>

<dt>Database connection</dt>
<dd><pre><code>{{data.info.database.connection}}</code></pre></dd>
<dd>
<pre><code>{{data.info.database.connection}}</code></pre>
</dd>

<dt>Database version</dt>
<dd><pre><code>{{data.info.database.type}} {{data.info.database.version}}</code></pre></dd>
<dd>
<pre><code>{{data.info.database.type}} {{data.info.database.version}}</code></pre>
</dd>

<dt>Database name</dt>
<dd><pre><code>{{data.info.database.name}}</code></pre></dd>
<dd>
<pre><code>{{data.info.database.name}}</code></pre>
</dd>

<dt>Project directory</dt>
<dd><pre><code>{{data.info.path.project}}</code></pre></dd>
<dd>
<pre><code>{{data.info.path.project}}</code></pre>
</dd>

<dt>Site root url</dt>
<dd><pre><code><!-- {{site.uri.public}} --></code></pre></dd>
<dd>
<pre><code><!-- {{site.uri.public}} --></code></pre>
</dd>

<dt>Loaded sprinkles</dt>
<dd>
<ul class="uk-list uk-list-disc uk-list-collapse">
<li v-for="sprinkle in data.sprinkles" :key="sprinkle.name">
{{sprinkle}}
{{ sprinkle }}
</li>
</ul>
</dd>
Expand All @@ -129,4 +150,4 @@ axios.get('/api/dashboard')
<UFCardBox title="Activities"></UFCardBox>
</div>
</div>
</template>
</template>
2 changes: 1 addition & 1 deletion app/assets/views/GroupView.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<template>
<div>Group View</div>
</template>
</template>
2 changes: 1 addition & 1 deletion app/assets/views/GroupsView.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<template>
<div>Groups View</div>
</template>
</template>
2 changes: 1 addition & 1 deletion app/assets/views/PermissionView.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<template>
<div>Permission View</div>
</template>
</template>
2 changes: 1 addition & 1 deletion app/assets/views/PermissionsView.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<template>
<div>Permissions View</div>
</template>
</template>
2 changes: 1 addition & 1 deletion app/assets/views/RoleView.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<template>
<div>Role View</div>
</template>
</template>
2 changes: 1 addition & 1 deletion app/assets/views/RolesView.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<template>
<div>Roles View</div>
</template>
</template>
2 changes: 1 addition & 1 deletion app/assets/views/UserView.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<template>
<div>User View</div>
</template>
</template>
14 changes: 12 additions & 2 deletions app/assets/views/UsersView.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
<template>
<div>Users View</div>
</template>
<h3 class="uk-margin-remove">Users</h3>
<p class="uk-text-meta uk-margin-remove-top">A listing of the users for your site. Provides management tools including the ability to edit user details, manually activate users, enable/disable users, and more.</p>

<UFCardBox>
<template #header>
<font-awesome-icon icon="user" /> Users
</template>
<template #footer>
<a href="#" class="uk-button uk-button-primary">Create User</a>
</template>
</UFCardBox>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Slim\Views\Twig;
use UserFrosting\Sprinkle\Account\Authenticate\Authenticator;
use UserFrosting\Sprinkle\Account\Authorize\AuthorizationManager;
use UserFrosting\Sprinkle\Account\Exceptions\ForbiddenException;
Expand All @@ -30,43 +29,24 @@
* This page requires authentication.
* Request type: GET
*/
class ActivitiesPageAction
class ActivitiesSprunje
{
/** @var string Page template */
protected string $template = 'pages/activities.html.twig';

/**
* Inject dependencies.
*/
public function __construct(
protected AuthorizationManager $authorizer,
protected Authenticator $authenticator,
protected ActivitySprunje $sprunje,
protected Twig $view,
) {
}

/**
* Receive the request, dispatch to the handler, and return the payload to
* the response.
*
* @param Request $request
* @param Response $response
*/
public function __invoke(Request $request, Response $response): Response
{
$this->validateAccess();

return $this->view->render($response, $this->template);
}

/**
* Sprunje / api handler tied to this page.
*
* @param Request $request
* @param Response $response
*/
public function sprunje(Request $request, Response $response): Response
public function __invoke(Request $request, Response $response): Response
{
$this->validateAccess();

Expand Down
Loading

0 comments on commit db4a26b

Please sign in to comment.