Skip to content
Next
Projects
Groups
Snippets
Help
Sign in / Register
Toggle navigation
Minds Backend - Engine
Project overview
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
294
Merge Requests
40
CI / CD
Security & Compliance
Packages
Wiki
Snippets
Members
Collapse sidebar
Close sidebar
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minds
Minds Backend - Engine
Commits
97246e55
Commit
97246e55
authored
1 hour ago
by
Mark Harding
Browse files
Options
Download
(feat): implement summary tab
parent
3d2d8c4c
master
goal/withdrawals-approval
No related merge requests found
Pipeline
#94680872
waiting for manual action with stages
in 7 minutes and 19 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
107 additions
and
0 deletions
+107
-0
Core/Analytics/Dashboards/Manager.php
View file @
97246e55
...
...
@@ -4,6 +4,7 @@ namespace Minds\Core\Analytics\Dashboards;
class
Manager
{
const
DASHBOARDS
=
[
'summary'
=>
SummaryDashboard
::
class
,
'traffic'
=>
TrafficDashboard
::
class
,
'trending'
=>
TrendingDashboard
::
class
,
'earnings'
=>
EarningsDashboard
::
class
,
...
...
This diff is collapsed.
Core/Analytics/Dashboards/SummaryDashboard.php
0 → 100644
View file @
97246e55
<?php
/**
* Summary Dashboard
*/
namespace
Minds\Core\Analytics\Dashboards
;
use
Minds\Entities\User
;
use
Minds\Traits\MagicAttributes
;
/**
* @method TrafficDashboard setTimespanId(string $timespanId)
* @method TrafficDashboard setFilterIds(array $filtersIds)
* @method TrafficDashboard setUser(User $user)
*/
class
SummaryDashboard
implements
DashboardInterface
{
use
MagicAttributes
;
/** @var string */
private
$timespanId
=
'30d'
;
/** @var string[] */
private
$filterIds
=
[
'platform::browser'
];
/** @var string */
private
$metricId
=
'active_users'
;
/** @var Timespans\TimespansCollection */
private
$timespansCollection
;
/** @var Metrics\MetricsCollection */
private
$metricsCollection
;
/** @var Filters\FiltersCollection */
private
$filtersCollection
;
/** @var User */
private
$user
;
public
function
__construct
(
$timespansCollection
=
null
,
$metricsCollection
=
null
,
$filtersCollection
=
null
)
{
$this
->
timespansCollection
=
$timespansCollection
??
new
Timespans\TimespansCollection
();
$this
->
metricsCollection
=
$metricsCollection
??
new
Metrics\MetricsCollection
();
$this
->
filtersCollection
=
$filtersCollection
??
new
Filters\FiltersCollection
();
}
/**
* Build the dashboard
* @return self
*/
public
function
build
()
:
self
{
$this
->
timespansCollection
->
setSelectedId
(
$this
->
timespanId
)
->
addTimespans
(
new
Timespans\TodayTimespan
(),
new
Timespans\_30dTimespan
(),
new
Timespans\_1yTimespan
(),
new
Timespans\MtdTimespan
(),
new
Timespans\YtdTimespan
()
);
$this
->
filtersCollection
->
setSelectedIds
(
$this
->
filterIds
)
->
setUser
(
$this
->
user
)
->
addFilters
(
// new Filters\PlatformFilter(),
new
Filters\ViewTypeFilter
(),
new
Filters\ChannelFilter
()
);
$this
->
metricsCollection
->
setTimespansCollection
(
$this
->
timespansCollection
)
->
setFiltersCollection
(
$this
->
filtersCollection
)
->
setSelectedId
(
$this
->
metricId
)
->
setUser
(
$this
->
user
)
->
addMetrics
(
new
Metrics\ActiveUsersMetric
()
)
->
build
();
return
$this
;
}
/**
* Export
* @param array $extras
* @return array
*/
public
function
export
(
array
$extras
=
[])
:
array
{
$this
->
build
();
return
[
'category'
=>
'summary'
,
'label'
=>
'Summary'
,
'description'
=>
null
,
'timespan'
=>
$this
->
timespansCollection
->
getSelected
()
->
getId
(),
'timespans'
=>
$this
->
timespansCollection
->
export
(),
'metric'
=>
$this
->
metricsCollection
->
getSelected
()
->
getId
(),
'metrics'
=>
$this
->
metricsCollection
->
export
(),
'filter'
=>
$this
->
filtersCollection
->
getSelectedIds
(),
'filters'
=>
$this
->
filtersCollection
->
export
(),
];
}
}
This diff is collapsed.
Please
register
or
sign in
to comment