Skip to content
Next
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Minds Frontend
Project
Project
Details
Activity
Releases
Dependency List
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
799
Issues
799
List
Boards
Labels
Service Desk
Milestones
Merge Requests
59
Merge Requests
59
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Packages
Packages
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
1f281c63
Commit
1f281c63
authored
55 minutes ago
by
Guy Thouret
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(fix) Display 'No Results' text when searching help questions instead of no feedback - fixes
#1501
parent
ad554ffc
fix/1501-help-results
1 merge request
!435
(fix) Display 'No Results' text when searching help questions instead of no feedback - fixes #1501
Pipeline
#70119512
running with stages
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
5 deletions
+75
-5
dashboard.component.html
src/app/modules/helpdesk/dashboard/dashboard.component.html
+8
-0
dashboard.component.spec.ts
...pp/modules/helpdesk/dashboard/dashboard.component.spec.ts
+60
-1
dashboard.component.ts
src/app/modules/helpdesk/dashboard/dashboard.component.ts
+7
-4
No files found.
src/app/modules/helpdesk/dashboard/dashboard.component.html
View file @
1f281c63
...
...
@@ -27,6 +27,14 @@
</div>
</div>
<div
*
ngIf=
"noResults"
class=
"m-helpdeskSearch__results m-border"
>
<div
class=
"m-helpdeskSearch__result"
>
<span>
No Results Found
</span>
</div>
</div>
<div
class=
"m-helpdesk__dashboardButtons"
*
ngIf=
"session.isAdmin()"
>
<button
class=
"m-btn m-btn--slim"
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/helpdesk/dashboard/dashboard.component.spec.ts
View file @
1f281c63
import
{
async
,
ComponentFixture
,
TestBed
}
from
'
@angular/core/testing
'
;
import
{
async
,
ComponentFixture
,
fakeAsync
,
TestBed
,
tick
}
from
'
@angular/core/testing
'
;
import
{
FormsModule
,
ReactiveFormsModule
}
from
'
@angular/forms
'
;
import
{
RouterTestingModule
}
from
'
@angular/router/testing
'
;
...
...
@@ -49,6 +49,9 @@ describe('HelpdeskDashboardComponent', () => {
beforeEach
((
done
)
=>
{
jasmine
.
MAX_PRETTY_PRINT_DEPTH
=
10
;
jasmine
.
clock
().
uninstall
();
jasmine
.
clock
().
install
();
clientMock
.
response
=
{};
clientMock
.
response
[
'
api/v2/helpdesk/questions/top
'
]
=
{
'
status
'
:
'
success
'
,
...
...
@@ -91,6 +94,10 @@ describe('HelpdeskDashboardComponent', () => {
}
});
afterEach
(()
=>
{
jasmine
.
clock
().
uninstall
();
});
it
(
"
should have a 'How can we help you @username?' title
"
,
()
=>
{
const
h2
=
fixture
.
debugElement
.
query
(
By
.
css
(
'
.m-helpdesk--dashboard--section h2
'
));
...
...
@@ -151,4 +158,56 @@ describe('HelpdeskDashboardComponent', () => {
expect
(
subtext
.
nativeElement
.
textContent
).
toContain
(
'
Support with purchasing the Minds Token or your hosted Minds Node
'
);
});
it
(
'
should have a list of questions
'
,
fakeAsync
(()
=>
{
clientMock
.
get
.
calls
.
reset
();
clientMock
.
response
[
'
api/v2/helpdesk/questions/search
'
]
=
{
status
:
'
success
'
,
entities
:
[
{
uuid
:
'
aab9b00d-2481-4bbc-b4b0-bfe861867336
'
,
question
:
'
How can I tell if I have a message?
'
,
answer
:
'
look at it
'
,
category_uuid
:
'
e101ff2e-6fb8-48c3-9902-53f3063ed7ea
'
},
{
uuid
:
'
74fdd3b7-9e43-4312-ae2c-f0d0eab66bbe
'
,
question
:
'
How can I tell if someone is online?
'
,
answer
:
'
an icon
'
,
category_uuid
:
'
e101ff2e-6fb8-48c3-9902-53f3063ed7ea
'
}
]
};
comp
.
query
=
'
how to
'
;
comp
.
search
();
fixture
.
detectChanges
();
tick
();
expect
(
clientMock
.
get
).
toHaveBeenCalled
();
expect
(
clientMock
.
get
.
calls
.
mostRecent
().
args
[
1
]).
toEqual
({
q
:
'
how to
'
,
limit
:
8
});
expect
(
comp
.
noResults
).
toBe
(
false
);
expect
(
comp
.
results
.
length
).
toBe
(
2
);
expect
(
comp
.
results
[
0
].
question
).
toBe
(
'
How can I tell if I have a message?
'
);
expect
(
comp
.
results
[
1
].
question
).
toBe
(
'
How can I tell if someone is online?
'
);
}));
it
(
'
should display message when no search results
'
,
fakeAsync
(()
=>
{
clientMock
.
get
.
calls
.
reset
();
clientMock
.
response
[
'
api/v2/helpdesk/questions/search
'
]
=
{
status
:
'
success
'
,
entities
:
[]
};
comp
.
query
=
'
tell me
'
;
comp
.
search
();
fixture
.
detectChanges
();
tick
();
expect
(
clientMock
.
get
).
toHaveBeenCalled
();
expect
(
clientMock
.
get
.
calls
.
mostRecent
().
args
[
1
]).
toEqual
({
q
:
'
tell me
'
,
limit
:
8
});
expect
(
comp
.
noResults
).
toBe
(
true
);
expect
(
comp
.
results
.
length
).
toBe
(
0
);
}));
});
This diff is collapsed.
Click to expand it.
src/app/modules/helpdesk/dashboard/dashboard.component.ts
View file @
1f281c63
...
...
@@ -14,7 +14,8 @@ export class HelpdeskDashboardComponent implements OnInit {
query
:
string
=
''
;
results
:
any
[]
=
[];
searching
:
boolean
=
false
;
searching
=
false
;
noResults
=
false
;
private
throttle
;
@
ViewChild
(
'
input
'
,
{
static
:
false
})
private
input
:
ElementRef
;
...
...
@@ -69,6 +70,7 @@ export class HelpdeskDashboardComponent implements OnInit {
*/
onBlur
()
{
this
.
searching
=
false
;
this
.
noResults
=
false
;
}
setQuestion
(
question
,
$event
?)
{
...
...
@@ -99,10 +101,12 @@ export class HelpdeskDashboardComponent implements OnInit {
limit
:
8
,
})
.
then
(({
entities
})
=>
{
if
(
!
entities
)
{
if
(
!
entities
||
entities
.
length
===
0
)
{
this
.
noResults
=
true
;
return
;
}
this
.
noResults
=
false
;
this
.
results
=
entities
;
})
.
catch
((
e
)
=>
{
...
...
@@ -110,5 +114,4 @@ export class HelpdeskDashboardComponent implements OnInit {
});
});
}
}
\ No newline at end of file
}
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