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
838
Issues
838
List
Boards
Labels
Service Desk
Milestones
Merge Requests
45
Merge Requests
45
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
178c8c16
Commit
178c8c16
authored
1 hour ago
by
Mark Harding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(fix): clicking on selected option does not break
parent
f970d35b
epic/pro-affiliate-launch
1 merge request
!590
WIP: Epic/pro affiliate launch
Pipeline
#89236828
running with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
18 deletions
+6
-18
src/app/modules/analytics/v2/dashboard.service.ts
src/app/modules/analytics/v2/dashboard.service.ts
+6
-18
No files found.
src/app/modules/analytics/v2/dashboard.service.ts
View file @
178c8c16
...
...
@@ -112,18 +112,9 @@ export interface UserState {
metrics
:
Metric
[];
filter
?:
string
[];
filters
?:
Filter
[];
loading
:
boolean
;
}
// ʕ •ᴥ•ʔ
let
_state
:
UserState
=
fakeData
[
0
];
// {
// // loading: false,
// // filter: ['platform::browser'],
// // filters: [],
// // metric: 'views',
// // metrics: [],
// };
const
deepDiff
=
(
prev
,
curr
)
=>
JSON
.
stringify
(
prev
)
===
JSON
.
stringify
(
curr
);
...
...
@@ -172,10 +163,7 @@ export class AnalyticsDashboardService {
map
(
state
=>
state
.
filters
),
distinctUntilChanged
(
deepDiff
)
);
loading$
=
this
.
state$
.
pipe
(
map
(
state
=>
state
.
loading
),
distinctUntilChanged
()
);
loading$
=
new
BehaviorSubject
<
boolean
>
(
false
);
ready$
=
new
BehaviorSubject
<
boolean
>
(
false
);
/**
...
...
@@ -195,6 +183,7 @@ export class AnalyticsDashboardService {
console
.
log
(
'
caught error
'
);
return
of
(
null
);
}),
tap
(()
=>
this
.
loading$
.
next
(
true
)),
switchMap
(([
category
,
timespan
,
metric
,
filter
])
=>
{
// console.log(category, timespan, metric, filter);
try
{
...
...
@@ -228,8 +217,8 @@ export class AnalyticsDashboardService {
filters
:
dashboard
.
filters
,
metric
:
dashboard
.
metric
,
metrics
:
dashboard
.
metrics
,
loading
:
false
,
});
this
.
loading$
.
next
(
false
);
});
}
...
...
@@ -264,18 +253,16 @@ export class AnalyticsDashboardService {
category
,
description
:
null
,
metrics
:
[],
loading
:
true
,
});
}
updateTimespan
(
timespan
:
string
)
{
this
.
updateState
({
...
_state
,
timespan
,
loading
:
true
,
});
}
updateMetric
(
metric
:
string
)
{
this
.
updateState
({
...
_state
,
metric
,
loading
:
true
});
this
.
updateState
({
...
_state
,
metric
});
}
updateFilter
(
selectedFilterStr
:
string
)
{
if
(
_state
.
filter
.
includes
(
selectedFilterStr
))
{
...
...
@@ -298,7 +285,7 @@ export class AnalyticsDashboardService {
console
.
log
(
'
update filter called:
'
+
selectedFilterStr
);
console
.
log
(
filter
);
this
.
updateState
({
...
_state
,
filter
,
loading
:
true
});
this
.
updateState
({
...
_state
,
filter
});
}
// // ------- Private Methods ------------------------
...
...
@@ -316,6 +303,7 @@ export class AnalyticsDashboardService {
metric
:
string
,
filter
:
string
[]
):
Observable
<
Response
>
{
this
.
loading$
.
next
(
true
);
return
this
.
http
.
get
(
`api/v2/analytics/dashboards/
${
category
}
`
,
{
metric
,
...
...
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