Skip to content
Next
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Minds Frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
887
Issues
887
List
Boards
Labels
Service Desk
Milestones
Merge Requests
49
Merge Requests
49
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Security & Compliance
Security & Compliance
Dependency List
Packages
Packages
List
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minds
Minds Frontend
Commits
cace737e
Commit
cace737e
authored
59 minutes ago
by
Mark Harding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(chore): various fixes
parent
aa2f0263
feat/entity-centric-metrics
1 merge request
!579
WIP: Entity centric metrics (analytics v2)
Pipeline
#88853832
failed with stages
in 4 minutes and 40 seconds
Changes
9
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
45 additions
and
29 deletions
+45
-29
src/app/modules/analytics/v2/components/chart/chart.component.ts
.../modules/analytics/v2/components/chart/chart.component.ts
+2
-1
src/app/modules/analytics/v2/components/metrics/metrics.component.scss
...es/analytics/v2/components/metrics/metrics.component.scss
+4
-0
src/app/modules/analytics/v2/components/metrics/metrics.component.ts
...ules/analytics/v2/components/metrics/metrics.component.ts
+9
-2
src/app/modules/analytics/v2/components/table/table.component.html
...odules/analytics/v2/components/table/table.component.html
+0
-7
src/app/modules/analytics/v2/components/table/table.component.scss
...odules/analytics/v2/components/table/table.component.scss
+2
-2
src/app/modules/analytics/v2/components/table/table.component.ts
.../modules/analytics/v2/components/table/table.component.ts
+5
-3
src/app/modules/analytics/v2/dashboard.service.ts
src/app/modules/analytics/v2/dashboard.service.ts
+6
-6
src/app/modules/analytics/v2/layouts/layout-chart/layout-chart.component.html
...ytics/v2/layouts/layout-chart/layout-chart.component.html
+3
-0
src/app/modules/analytics/v2/layouts/layout-chart/layout-chart.component.ts
...alytics/v2/layouts/layout-chart/layout-chart.component.ts
+14
-8
No files found.
src/app/modules/analytics/v2/components/chart/chart.component.ts
View file @
cace737e
...
...
@@ -92,6 +92,7 @@ export class AnalyticsChartComponent implements OnInit, OnDestroy {
}
catch
(
err
)
{
console
.
log
(
err
);
}
this
.
detectChanges
();
});
this
.
timespanSubscription
=
this
.
analyticsService
.
timespan$
.
subscribe
(
...
...
@@ -231,7 +232,7 @@ export class AnalyticsChartComponent implements OnInit, OnDestroy {
this
.
hoverInfo
[
'
date
'
]
=
this
.
segments
[
0
].
buckets
[
this
.
hoverPoint
].
date
;
this
.
hoverInfo
[
'
value
'
]
=
this
.
segments
[
0
].
buckets
[
this
.
hoverPoint
].
value
;
if
(
this
.
isComparison
)
{
if
(
this
.
isComparison
&&
this
.
segments
[
1
]
)
{
this
.
hoverInfo
[
'
comparisonValue
'
]
=
this
.
segments
[
1
].
buckets
[
this
.
hoverPoint
].
value
;
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/analytics/v2/components/metrics/metrics.component.scss
View file @
cace737e
...
...
@@ -117,6 +117,10 @@ m-analytics__metrics {
transition
:
background-color
0
.3s
cubic-bezier
(
0
.23
,
1
,
0
.32
,
1
);
}
}
m-tooltip
{
vertical-align
:
middle
;
margin-left
:
4px
;
}
.metricSummary
{
font-size
:
17px
;
margin-top
:
8px
;
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/analytics/v2/components/metrics/metrics.component.ts
View file @
cace737e
...
...
@@ -2,6 +2,7 @@ import {
Component
,
OnInit
,
ChangeDetectionStrategy
,
ChangeDetectorRef
,
OnDestroy
,
}
from
'
@angular/core
'
;
import
{
Observable
,
Subscription
}
from
'
rxjs
'
;
...
...
@@ -49,12 +50,13 @@ export class AnalyticsMetricsComponent implements OnInit, OnDestroy {
constructor
(
private
analyticsService
:
AnalyticsDashboardService
,
public
session
:
Session
public
session
:
Session
,
private
cd
:
ChangeDetectorRef
)
{}
ngOnInit
()
{
this
.
user
=
this
.
session
.
getLoggedInUser
();
if
(
this
.
user
.
isAdmin
)
{
if
(
this
.
session
.
isAdmin
()
)
{
this
.
userRoles
.
push
(
'
admin
'
);
}
if
(
this
.
user
.
pro
)
{
...
...
@@ -104,6 +106,11 @@ export class AnalyticsMetricsComponent implements OnInit, OnDestroy {
this
.
analyticsService
.
updateMetric
(
metric
.
id
);
}
detectChanges
()
{
this
.
cd
.
markForCheck
();
this
.
cd
.
detectChanges
();
}
ngOnDestroy
()
{
// this.subscription.unsubscribe();
}
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/analytics/v2/components/table/table.component.html
View file @
cace737e
<div
class=
"spinnerContainer"
>
<div
class=
"mdl-spinner mdl-js-spinner is-active"
[
mdl
]
[hidden]=
"!loading"
></div>
</div>
<div
class=
"tableWrapper"
[hidden]=
"loading"
>
<div
class=
"header row"
>
<div
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/analytics/v2/components/table/table.component.scss
View file @
cace737e
div
.filterableChartWrapper
{
.tableWrapper
.filterableChartWrapper
{
padding
:
0
;
width
:
100%
;
}
div
.filtersContainer
{
.tableWrapper
.filtersContainer
{
display
:
none
;
}
.tableWrapper
{
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/analytics/v2/components/table/table.component.ts
View file @
cace737e
...
...
@@ -72,6 +72,8 @@ export class AnalyticsTableComponent implements OnInit, OnDestroy {
const
reformattedBucket
=
{};
const
reformattedValues
=
[];
if
(
!
bucket
.
values
[
'
entity
'
])
return
;
this
.
columns
.
forEach
((
column
,
i
)
=>
{
if
(
i
===
0
)
{
reformattedBucket
[
'
entity
'
]
=
this
.
reformatEntity
(
...
...
@@ -123,12 +125,12 @@ export class AnalyticsTableComponent implements OnInit, OnDestroy {
const
routesByType
=
[
{
ids
:
[
'
image
'
,
'
video
'
],
route
:
'
media/
'
+
entity
.
urn
.
split
(
'
:
'
)[
2
],
route
:
'
/
media/
'
+
entity
.
urn
.
split
(
'
:
'
)[
2
],
},
{
ids
:
[
'
activity
'
,
'
remind
'
],
route
:
`newsfeed/
${
entity
.
urn
.
split
(
'
:
'
)[
2
]}
`
,
route
:
`
/
newsfeed/
${
entity
.
urn
.
split
(
'
:
'
)[
2
]}
`
,
},
{
ids
:
[
'
blog
'
],
...
...
@@ -136,7 +138,7 @@ export class AnalyticsTableComponent implements OnInit, OnDestroy {
},
{
ids
:
[
'
channel
'
],
route
:
entity
.
name
,
route
:
'
/
'
+
entity
.
name
,
},
];
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/analytics/v2/dashboard.service.ts
View file @
cace737e
...
...
@@ -166,11 +166,11 @@ export class AnalyticsDashboardService {
);
metrics$
=
this
.
state$
.
pipe
(
map
(
state
=>
state
.
metrics
),
//
distinctUntilChanged(deepDiff),
distinctUntilChanged
((
prev
,
curr
)
=>
{
console
.
log
(
JSON
.
stringify
(
prev
),
JSON
.
stringify
(
curr
));
return
deepDiff
(
prev
,
curr
);
}),
distinctUntilChanged
(
deepDiff
),
//
distinctUntilChanged((prev, curr) => {
//
console.log(JSON.stringify(prev), JSON.stringify(curr));
//
return deepDiff(prev, curr);
//
}),
tap
(
metrics
=>
console
.
log
(
'
metrics changed
'
,
metrics
))
);
filter$
=
this
.
state$
.
pipe
(
...
...
@@ -317,7 +317,7 @@ export class AnalyticsDashboardService {
console
.
log
(
'
update category called:
'
+
category
);
// TODO: uncomment this
// this.updateState({ ..._state, category, metrics: [], loading: true });
this
.
updateState
({
...
_state
,
category
,
loading
:
true
});
this
.
updateState
({
...
_state
,
category
,
metrics
:
[],
loading
:
true
});
}
updateTimespan
(
timespan
:
string
)
{
console
.
log
(
'
update timespan called:
'
+
timespan
);
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/analytics/v2/layouts/layout-chart/layout-chart.component.html
View file @
cace737e
<div
class=
"spinnerContainer"
*ngIf=
"loading$ | async"
>
<div
class=
"mdl-spinner mdl-js-spinner is-active"
[
mdl
]
></div>
</div>
<ng-container
*ngIf=
"selectedMetric && selectedMetric.visualisation"
>
<m-analytics
__metrics
*ngIf=
"selectedMetric.visualisation.type === 'chart'"
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/analytics/v2/layouts/layout-chart/layout-chart.component.ts
View file @
cace737e
...
...
@@ -4,7 +4,7 @@ import {
ChangeDetectionStrategy
,
ChangeDetectorRef
,
}
from
'
@angular/core
'
;
import
{
Observable
,
Subscription
}
from
'
rxjs
'
;
import
{
Observable
,
Subscription
,
combineLatest
}
from
'
rxjs
'
;
import
{
map
}
from
'
rxjs/operators
'
;
import
{
AnalyticsDashboardService
}
from
'
../../dashboard.service
'
;
...
...
@@ -15,13 +15,14 @@ import { AnalyticsDashboardService } from '../../dashboard.service';
})
export
class
AnalyticsLayoutChartComponent
implements
OnInit
{
subscription
:
Subscription
;
selectedMetric$
=
this
.
analyticsService
.
metrics$
.
pipe
(
map
(
metrics
=>
{
console
.
log
(
metrics
,
metrics
.
find
(
metric
=>
metric
.
visualisation
!==
null
)
);
return
metrics
.
find
(
metric
=>
metric
.
visualisation
!==
null
);
loading$
=
this
.
analyticsService
.
loading$
;
selectedMetric$
=
combineLatest
(
this
.
analyticsService
.
metrics$
,
this
.
analyticsService
.
metric$
,
this
.
analyticsService
.
category$
).
pipe
(
map
(([
metrics
,
id
,
category
])
=>
{
return
metrics
.
find
(
metric
=>
metric
.
id
==
id
);
})
);
selectedMetric
;
...
...
@@ -33,6 +34,7 @@ export class AnalyticsLayoutChartComponent implements OnInit {
ngOnInit
()
{
this
.
subscription
=
this
.
selectedMetric$
.
subscribe
(
metric
=>
{
console
.
log
(
'
new metric
'
);
this
.
selectedMetric
=
metric
;
this
.
detectChanges
();
});
...
...
@@ -42,4 +44,8 @@ export class AnalyticsLayoutChartComponent implements OnInit {
this
.
cd
.
markForCheck
();
this
.
cd
.
detectChanges
();
}
ngOnDestroy
()
{
this
.
subscription
.
unsubscribe
();
}
}
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment