Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
course-search-enroll-fe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Scott Berg
course-search-enroll-fe
Commits
e279b9b3
Commit
e279b9b3
authored
6 years ago
by
pnogal
Committed by
Paulina Nogal
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Use services/api.service for typeahead api request
parent
b4bb22a7
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/app/app.component.ts
+5
-5
5 additions, 5 deletions
src/app/app.component.ts
src/app/core/data.service.ts
+0
-11
0 additions, 11 deletions
src/app/core/data.service.ts
src/app/degree-planner/services/api.service.ts
+10
-0
10 additions, 0 deletions
src/app/degree-planner/services/api.service.ts
with
15 additions
and
16 deletions
src/app/app.component.ts
+
5
−
5
View file @
e279b9b3
import
{
D
ata
Service
}
from
'
./
core/data
.service
'
;
import
{
D
egreePlannerApi
Service
}
from
'
./
degree-planner/services/api
.service
'
;
import
{
FormBuilder
,
FormGroup
}
from
'
@angular/forms
'
;
import
{
FormBuilder
,
FormGroup
}
from
'
@angular/forms
'
;
import
{
SidenavService
}
from
'
./core/service/sidenav.service
'
;
import
{
SidenavService
}
from
'
./core/service/sidenav.service
'
;
import
{
Component
,
ViewChild
,
OnInit
}
from
'
@angular/core
'
;
import
{
Component
,
ViewChild
,
OnInit
}
from
'
@angular/core
'
;
...
@@ -27,10 +27,10 @@ export class AppComponent implements OnInit {
...
@@ -27,10 +27,10 @@ export class AppComponent implements OnInit {
@
ViewChild
(
'
rightAddCourse
'
)
public
rightAddCourse
:
MatSidenav
;
@
ViewChild
(
'
rightAddCourse
'
)
public
rightAddCourse
:
MatSidenav
;
constructor
(
constructor
(
public
dialog
:
MatDialog
,
public
dialog
:
MatDialog
,
private
dataService
:
DataService
,
private
route
:
ActivatedRoute
,
private
route
:
ActivatedRoute
,
private
sidenavService
:
SidenavService
,
private
sidenavService
:
SidenavService
,
private
fb
:
FormBuilder
)
{
private
fb
:
FormBuilder
,
private
api
:
DegreePlannerApiService
)
{
this
.
coursesInput
=
new
FormControl
(
''
,
[
Validators
.
required
]);
this
.
coursesInput
=
new
FormControl
(
''
,
[
Validators
.
required
]);
this
.
selectedDegreePlan
=
520224
;
this
.
selectedDegreePlan
=
520224
;
}
}
...
@@ -43,13 +43,13 @@ export class AppComponent implements OnInit {
...
@@ -43,13 +43,13 @@ export class AppComponent implements OnInit {
this
.
courses
=
this
.
coursesForm
.
get
(
'
coursesInput
'
).
valueChanges
this
.
courses
=
this
.
coursesForm
.
get
(
'
coursesInput
'
).
valueChanges
.
pipe
(
.
pipe
(
debounceTime
(
300
),
debounceTime
(
300
),
switchMap
(
value
=>
this
.
dataService
.
autocomplete
(
value
)),
switchMap
(
value
=>
this
.
api
.
autocomplete
(
value
)),
tap
(
x
=>
console
.
log
(
x
))
tap
(
x
=>
console
.
log
(
x
))
);
);
}
}
openCourseDetailsDialog
(
course
)
{
openCourseDetailsDialog
(
course
)
{
this
.
dataService
.
getCourseDetails
(
course
.
termCode
,
course
.
payload
.
subject
.
subjectCode
,
course
.
payload
.
courseId
)
this
.
api
.
getCourseDetails
(
course
.
payload
.
subject
.
subjectCode
,
course
.
payload
.
courseId
)
.
subscribe
(
courseDetails
=>
{
.
subscribe
(
courseDetails
=>
{
const
dialogRef
=
this
.
dialog
.
open
(
CourseDetailsDialogComponent
,
{
const
dialogRef
=
this
.
dialog
.
open
(
CourseDetailsDialogComponent
,
{
data
:
{
courseDetails
:
courseDetails
}
data
:
{
courseDetails
:
courseDetails
}
...
...
This diff is collapsed.
Click to expand it.
src/app/core/data.service.ts
+
0
−
11
View file @
e279b9b3
...
@@ -103,17 +103,6 @@ export class DataService {
...
@@ -103,17 +103,6 @@ export class DataService {
.
pipe
(
catchError
(
this
.
errorHandler
));
.
pipe
(
catchError
(
this
.
errorHandler
));
}
}
autocomplete
(
search
:
string
)
{
const
data
=
{
subjectCode
:
'
104
'
,
termCode
:
'
0000
'
,
matchText
:
search
};
return
this
.
http
.
post
(
'
/api/search/v1/autocomplete
'
,
data
,
httpOptions
)
.
pipe
(
catchError
(
this
.
errorHandler
));
}
addCourse
(
planId
,
subjectCode
,
courseId
,
termCode
)
{
addCourse
(
planId
,
subjectCode
,
courseId
,
termCode
)
{
return
this
.
http
.
post
(
this
.
plannerApiUrl
+
'
/degreePlan/
'
+
planId
+
'
/courses
'
,
{
subjectCode
,
courseId
,
termCode
},
httpOptions
)
return
this
.
http
.
post
(
this
.
plannerApiUrl
+
'
/degreePlan/
'
+
planId
+
'
/courses
'
,
{
subjectCode
,
courseId
,
termCode
},
httpOptions
)
.
pipe
(
catchError
(
this
.
errorHandler
));
.
pipe
(
catchError
(
this
.
errorHandler
));
...
...
This diff is collapsed.
Click to expand it.
src/app/degree-planner/services/api.service.ts
+
10
−
0
View file @
e279b9b3
...
@@ -85,6 +85,16 @@ export class DegreePlannerApiService {
...
@@ -85,6 +85,16 @@ export class DegreePlannerApiService {
);
);
}
}
public
autocomplete
(
search
:
string
)
{
const
data
=
{
subjectCode
:
'
104
'
,
termCode
:
'
0000
'
,
matchText
:
search
};
return
this
.
http
.
post
(
'
/api/search/v1/autocomplete
'
,
data
,
HTTP_OPTIONS
);
}
public
addCourse
(
public
addCourse
(
planId
:
number
,
planId
:
number
,
subjectCode
:
string
,
subjectCode
:
string
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment