Skip to content
Projects
Groups
Snippets
Help
Sign in / Register
Toggle navigation
Minds Frontend
Project overview
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
352
Merge Requests
54
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 Frontend
Commits
28f84e84
Commit
28f84e84
authored
1 minute ago
by
Olivia Madrid
Browse files
Options
Download
removed metrics component again
parent
dd18174b
epic/wallet-80
1 merge request
!686
WIP: Epic/wallet 80
Pipeline
#106886775
running with stages
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
136 deletions
+0
-136
src/app/modules/analytics/v2/components/metrics/metrics.component.html
deleted
100644 → 0
View file @
dd18174b
<ng-container
*ngIf=
"metrics$ | async as metrics"
>
<ng-container
*ngFor=
"let metric of metrics"
>
<div
class=
"m-analytics__metric m-shadowboxLayout__headerItem"
(click)=
"updateMetric(metric)"
[ngClass]=
"{ active: metric.visualisation }"
*ngIf=
"metric.permissionGranted"
>
<div
class=
"m-analytics__metricLabel"
>
<span>
{{ metric.label }}
</span>
<m-tooltip
[anchor]=
"top"
icon=
"help"
>
{{ metric.description }}
</m-tooltip>
</div>
<div
class=
"m-analytics__metricSummary"
*ngIf=
"metric.summary"
>
<ng-container
*ngIf=
"metric.unit === 'number'"
>
{{ metric.summary.current_value | number }}
</ng-container>
<ng-container
*ngIf=
"metric.unit === 'usd'"
>
<span>
$
</span
>
{{ metric.summary.current_value / 100 | number: '1.2-2' }}
</ng-container>
</div>
<div
*ngIf=
"metric.summary"
class=
"m-analytics__metricDelta"
[ngClass]=
"{
goodChange: metric.hasChanged && metric.positiveTrend,
badChange: metric.hasChanged && !metric.positiveTrend
}"
>
<ng-container
*ngIf=
"metric.hasChanged"
>
<i
class=
"material-icons"
*ngIf=
"metric.delta > 0"
>
arrow_upward
</i>
<i
class=
"material-icons"
*ngIf=
"metric.delta < 0"
>
arrow_downward
</i>
</ng-container>
<span
*ngIf=
"metric.delta"
>
{{ metric.delta | percent: '1.0-1' }}
</span>
</div>
</div>
</ng-container>
</ng-container>
This diff is collapsed.
src/app/modules/analytics/v2/components/metrics/metrics.component.ts
deleted
100644 → 0
View file @
dd18174b
import
{
Component
,
OnInit
}
from
'
@angular/core
'
;
import
{
Subscription
}
from
'
rxjs
'
;
import
{
map
}
from
'
rxjs/operators
'
;
import
{
AnalyticsDashboardService
,
Metric
as
MetricBase
,
}
from
'
../../dashboard.service
'
;
import
{
Session
}
from
'
../../../../../services/session
'
;
interface
MetricExtended
extends
MetricBase
{
delta
:
number
;
hasChanged
:
boolean
;
positiveTrend
:
boolean
;
permissionGranted
:
boolean
;
}
export
{
MetricExtended
as
Metric
};
@
Component
({
selector
:
'
m-analytics__metrics
'
,
templateUrl
:
'
./metrics.component.html
'
,
})
export
class
AnalyticsMetricsComponent
implements
OnInit
{
subscription
:
Subscription
;
user
;
userRoles
:
string
[]
=
[
'
user
'
];
metrics$
;
constructor
(
private
analyticsService
:
AnalyticsDashboardService
,
public
session
:
Session
)
{}
ngOnInit
()
{
this
.
user
=
this
.
session
.
getLoggedInUser
();
if
(
this
.
session
.
isAdmin
())
{
this
.
userRoles
.
push
(
'
admin
'
);
}
if
(
this
.
user
.
pro
)
{
this
.
userRoles
.
push
(
'
pro
'
);
}
this
.
metrics$
=
this
.
analyticsService
.
metrics$
.
pipe
(
map
(
_metrics
=>
{
const
metrics
=
_metrics
.
map
(
metric
=>
({
...
metric
}));
// Clone to avoid updating
for
(
const
metric
of
metrics
)
{
metric
[
'
permissionGranted
'
]
=
metric
.
permissions
.
some
(
role
=>
this
.
userRoles
.
includes
(
role
)
);
if
(
metric
.
summary
)
{
const
cur
:
number
=
metric
.
summary
.
current_value
||
0
;
const
cmp
:
number
=
metric
.
summary
.
comparison_value
||
0
;
let
delta
:
number
,
hasChanged
:
boolean
,
positiveTrend
:
boolean
;
if
(
cur
===
cmp
)
{
// Same values, no changes
hasChanged
=
false
;
delta
=
0
;
}
else
if
(
cmp
===
0
)
{
// Comparison value is 0, cannot calculate %
hasChanged
=
true
;
delta
=
Infinity
;
// Will display infinity symbol
positiveTrend
=
cur
>
0
;
}
else
{
// Normal cases
hasChanged
=
true
;
delta
=
(
cur
-
cmp
)
/
cmp
;
positiveTrend
=
delta
>
0
;
}
if
(
!
metric
.
summary
.
comparison_positive_inclination
)
{
// If "comparison positive inclination" is not true, it
// represents a "not-so-good" metric. So we'll flip the colors.
// Upwards will be "bad"
// Downwards will be "good"
positiveTrend
=
!
positiveTrend
;
}
metric
[
'
delta
'
]
=
delta
;
metric
[
'
hasChanged
'
]
=
hasChanged
;
metric
[
'
positiveTrend
'
]
=
positiveTrend
;
}
}
return
metrics
;
})
);
}
updateMetric
(
metric
)
{
// TODO: if clicked metric is not fully visible, slide() until it is
this
.
analyticsService
.
updateMetric
(
metric
.
id
);
}
}
This diff is collapsed.
Please
register
or
sign in
to comment