This is the codeAbility Sharing Platform! Learn more about the
codeAbility Sharing Platform
.
Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
development
sharing
sharing plugin Demo
Commits
4f2ea52b
Commit
4f2ea52b
authored
Apr 27, 2021
by
Michael Breu
💬
Browse files
Intermediate commit. Still inconsistent
parent
cdad7952
Changes
39
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
646 additions
and
3 deletions
+646
-3
.jhipster/Search.json
.jhipster/Search.json
+15
-0
.yo-rc.json
.yo-rc.json
+2
-1
pom.xml
pom.xml
+1
-1
src/main/java/org/codeability/sharing/demo/service/SharingDemoService.java
.../codeability/sharing/demo/service/SharingDemoService.java
+6
-0
src/main/java/org/codeability/sharing/demo/web/rest/SharingDemoResource.java
...odeability/sharing/demo/web/rest/SharingDemoResource.java
+16
-0
src/main/webapp/app/entities/entity.module.ts
src/main/webapp/app/entities/entity.module.ts
+4
-0
src/main/webapp/app/entities/search/search-delete-dialog.component.html
...p/app/entities/search/search-delete-dialog.component.html
+24
-0
src/main/webapp/app/entities/search/search-delete-dialog.component.ts
...app/app/entities/search/search-delete-dialog.component.ts
+26
-0
src/main/webapp/app/entities/search/search-detail.component.html
...n/webapp/app/entities/search/search-detail.component.html
+26
-0
src/main/webapp/app/entities/search/search-detail.component.ts
...ain/webapp/app/entities/search/search-detail.component.ts
+22
-0
src/main/webapp/app/entities/search/search-update.component.html
...n/webapp/app/entities/search/search-update.component.html
+26
-0
src/main/webapp/app/entities/search/search-update.component.ts
...ain/webapp/app/entities/search/search-update.component.ts
+72
-0
src/main/webapp/app/entities/search/search.component.html
src/main/webapp/app/entities/search/search.component.html
+59
-0
src/main/webapp/app/entities/search/search.component.ts
src/main/webapp/app/entities/search/search.component.ts
+49
-0
src/main/webapp/app/entities/search/search.module.ts
src/main/webapp/app/entities/search/search.module.ts
+16
-0
src/main/webapp/app/entities/search/search.route.ts
src/main/webapp/app/entities/search/search.route.ts
+83
-0
src/main/webapp/app/entities/search/search.service.ts
src/main/webapp/app/entities/search/search.service.ts
+38
-0
src/main/webapp/app/home/home.component.ts
src/main/webapp/app/home/home.component.ts
+41
-1
src/main/webapp/app/home/search/search.component.html
src/main/webapp/app/home/search/search.component.html
+54
-0
src/main/webapp/app/home/search/search.component.ts
src/main/webapp/app/home/search/search.component.ts
+66
-0
No files found.
.jhipster/Search.json
0 → 100644
View file @
4f2ea52b
{
"fluentMethods"
:
true
,
"clientRootFolder"
:
""
,
"relationships"
:
[],
"fields"
:
[],
"changelogDate"
:
"20210427172437"
,
"dto"
:
"no"
,
"searchEngine"
:
false
,
"service"
:
"no"
,
"entityTableName"
:
"search"
,
"databaseType"
:
"sql"
,
"readOnly"
:
false
,
"jpaMetamodelFiltering"
:
false
,
"pagination"
:
"no"
}
.yo-rc.json
View file @
4f2ea52b
...
...
@@ -37,6 +37,7 @@
"enableTranslation"
:
true
,
"nativeLanguage"
:
"en"
,
"languages"
:
[
"en"
],
"blueprints"
:
[]
"blueprints"
:
[],
"lastLiquibaseTimestamp"
:
1619544277000
}
}
pom.xml
View file @
4f2ea52b
...
...
@@ -111,7 +111,7 @@
<dependency>
<groupId>
org.codeability.sharing
</groupId>
<artifactId>
SharingPluginPlatformAPI
</artifactId>
<version>
0.
0.2
</version>
<version>
0.
1.0-Snapshot
</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.glassfish.jersey.core/jersey-client -->
<dependency>
...
...
src/main/java/org/codeability/sharing/demo/service/SharingDemoService.java
View file @
4f2ea52b
...
...
@@ -16,11 +16,14 @@ import javax.ws.rs.core.MediaType;
import
org.apache.commons.io.FileUtils
;
import
org.codeability.sharing.demo.web.rest.dto.SharingInfoDTO
;
import
org.codeability.sharing.plugins.api.ShoppingBasket
;
import
org.codeability.sharing.plugins.api.search.SearchRequestDTO
;
import
org.codeability.sharing.plugins.api.search.SearchResultsDTO
;
import
org.glassfish.jersey.client.ClientConfig
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.data.util.Pair
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
com.google.common.cache.CacheBuilder
;
import
com.google.common.cache.CacheLoader
;
...
...
@@ -50,6 +53,9 @@ public class SharingDemoService {
return
Optional
.
of
(
shoppingBasket
);
}
public
SearchResultsDTO
searchPageDetails
(
@RequestBody
SearchRequestDTO
searchRequest
)
throws
IOException
{
return
null
;
}
LoadingCache
<
Pair
<
String
,
Integer
>,
File
>
repositoryCache
=
CacheBuilder
.
newBuilder
()
.
maximumSize
(
10000
)
...
...
src/main/java/org/codeability/sharing/demo/web/rest/SharingDemoResource.java
View file @
4f2ea52b
...
...
@@ -11,6 +11,8 @@ import java.util.zip.ZipInputStream;
import
org.codeability.sharing.demo.service.SharingDemoService
;
import
org.codeability.sharing.demo.web.rest.dto.SharingInfoDTO
;
import
org.codeability.sharing.plugins.api.ShoppingBasket
;
import
org.codeability.sharing.plugins.api.search.SearchRequestDTO
;
import
org.codeability.sharing.plugins.api.search.SearchResultsDTO
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.http.ResponseEntity
;
...
...
@@ -50,6 +52,20 @@ public class SharingDemoResource {
return
ResponseUtil
.
wrapOrNotFound
(
sharingInfoDTO
);
}
/**
* {@code SEARCH /search/page-details} : search for the searchResults corresponding
* to the query.
*
* @param query the query of the searchResult search.
* @return the result of the search.
*/
@PostMapping
(
"/sharingImport/search"
)
public
SearchResultsDTO
searchPageDetails
(
@RequestBody
SearchRequestDTO
searchRequest
)
throws
IOException
{
return
searchPageDetails
(
searchRequest
);
}
public
static
class
SharingSetupInfo
{
SharingInfoDTO
sharingInfo
;
int
exercisePosition
;
...
...
src/main/webapp/app/entities/entity.module.ts
View file @
4f2ea52b
...
...
@@ -4,6 +4,10 @@ import { RouterModule } from '@angular/router';
@
NgModule
({
imports
:
[
RouterModule
.
forChild
([
{
path
:
'
search
'
,
loadChildren
:
()
=>
import
(
'
./search/search.module
'
).
then
(
m
=>
m
.
PluginDemoSearchModule
),
},
/* jhipster-needle-add-entity-route - JHipster will add entity modules routes here */
]),
],
...
...
src/main/webapp/app/entities/search/search-delete-dialog.component.html
0 → 100644
View file @
4f2ea52b
<form
*ngIf=
"search"
name=
"deleteForm"
(ngSubmit)=
"confirmDelete(search?.id!)"
>
<div
class=
"modal-header"
>
<h4
class=
"modal-title"
jhiTranslate=
"entity.delete.title"
>
Confirm delete operation
</h4>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-hidden=
"true"
(click)=
"cancel()"
>
×
</button>
</div>
<div
class=
"modal-body"
>
<jhi-alert-error></jhi-alert-error>
<p
id=
"jhi-delete-search-heading"
jhiTranslate=
"pluginDemoApp.search.delete.question"
[translateValues]=
"{ id: search.id }"
>
Are you sure you want to delete this Search?
</p>
</div>
<div
class=
"modal-footer"
>
<button
type=
"button"
class=
"btn btn-secondary"
data-dismiss=
"modal"
(click)=
"cancel()"
>
<fa-icon
icon=
"ban"
></fa-icon>
<span
jhiTranslate=
"entity.action.cancel"
>
Cancel
</span>
</button>
<button
id=
"jhi-confirm-delete-search"
type=
"submit"
class=
"btn btn-danger"
>
<fa-icon
icon=
"times"
></fa-icon>
<span
jhiTranslate=
"entity.action.delete"
>
Delete
</span>
</button>
</div>
</form>
src/main/webapp/app/entities/search/search-delete-dialog.component.ts
0 → 100644
View file @
4f2ea52b
import
{
Component
}
from
'
@angular/core
'
;
import
{
NgbActiveModal
}
from
'
@ng-bootstrap/ng-bootstrap
'
;
import
{
JhiEventManager
}
from
'
ng-jhipster
'
;
import
{
ISearch
}
from
'
app/shared/model/search-entity.model
'
;
import
{
SearchService
}
from
'
./search.service
'
;
@
Component
({
templateUrl
:
'
./search-delete-dialog.component.html
'
,
})
export
class
SearchDeleteDialogComponent
{
search
?:
ISearch
;
constructor
(
protected
searchService
:
SearchService
,
public
activeModal
:
NgbActiveModal
,
protected
eventManager
:
JhiEventManager
)
{}
cancel
():
void
{
this
.
activeModal
.
dismiss
();
}
confirmDelete
(
id
:
number
):
void
{
this
.
searchService
.
delete
(
id
).
subscribe
(()
=>
{
this
.
eventManager
.
broadcast
(
'
searchListModification
'
);
this
.
activeModal
.
close
();
});
}
}
src/main/webapp/app/entities/search/search-detail.component.html
0 → 100644
View file @
4f2ea52b
<div
class=
"row justify-content-center"
>
<div
class=
"col-8"
>
<div
*ngIf=
"search"
>
<h2><span
jhiTranslate=
"pluginDemoApp.search.detail.title"
>
Search
</span>
{{ search.id }}
</h2>
<hr>
<jhi-alert-error></jhi-alert-error>
<dl
class=
"row-md jh-entity-details"
>
</dl>
<button
type=
"submit"
(click)=
"previousState()"
class=
"btn btn-info"
>
<fa-icon
icon=
"arrow-left"
></fa-icon>
<span
jhiTranslate=
"entity.action.back"
>
Back
</span>
</button>
<button
type=
"button"
[routerLink]=
"['/search', search.id, 'edit']"
class=
"btn btn-primary"
>
<fa-icon
icon=
"pencil-alt"
></fa-icon>
<span
jhiTranslate=
"entity.action.edit"
>
Edit
</span>
</button>
</div>
</div>
</div>
src/main/webapp/app/entities/search/search-detail.component.ts
0 → 100644
View file @
4f2ea52b
import
{
Component
,
OnInit
}
from
'
@angular/core
'
;
import
{
ActivatedRoute
}
from
'
@angular/router
'
;
import
{
ISearch
}
from
'
app/shared/model/search-entity.model
'
;
@
Component
({
selector
:
'
jhi-search-detail
'
,
templateUrl
:
'
./search-detail.component.html
'
,
})
export
class
SearchDetailComponent
implements
OnInit
{
search
:
ISearch
|
null
=
null
;
constructor
(
protected
activatedRoute
:
ActivatedRoute
)
{}
ngOnInit
():
void
{
this
.
activatedRoute
.
data
.
subscribe
(({
search
})
=>
(
this
.
search
=
search
));
}
previousState
():
void
{
window
.
history
.
back
();
}
}
src/main/webapp/app/entities/search/search-update.component.html
0 → 100644
View file @
4f2ea52b
<div
class=
"row justify-content-center"
>
<div
class=
"col-8"
>
<form
name=
"editForm"
role=
"form"
novalidate
(ngSubmit)=
"save()"
[formGroup]=
"editForm"
>
<h2
id=
"jhi-search-heading"
jhiTranslate=
"pluginDemoApp.search.home.createOrEditLabel"
>
Create or edit a Search
</h2>
<div>
<jhi-alert-error></jhi-alert-error>
<div
class=
"form-group"
[hidden]=
"!editForm.get('id')!.value"
>
<label
for=
"id"
jhiTranslate=
"global.field.id"
>
ID
</label>
<input
type=
"text"
class=
"form-control"
id=
"id"
name=
"id"
formControlName=
"id"
readonly
/>
</div>
</div>
<div>
<button
type=
"button"
id=
"cancel-save"
class=
"btn btn-secondary"
(click)=
"previousState()"
>
<fa-icon
icon=
"ban"
></fa-icon>
<span
jhiTranslate=
"entity.action.cancel"
>
Cancel
</span>
</button>
<button
type=
"submit"
id=
"save-entity"
[disabled]=
"editForm.invalid || isSaving"
class=
"btn btn-primary"
>
<fa-icon
icon=
"save"
></fa-icon>
<span
jhiTranslate=
"entity.action.save"
>
Save
</span>
</button>
</div>
</form>
</div>
</div>
src/main/webapp/app/entities/search/search-update.component.ts
0 → 100644
View file @
4f2ea52b
import
{
Component
,
OnInit
}
from
'
@angular/core
'
;
import
{
HttpResponse
}
from
'
@angular/common/http
'
;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import
{
FormBuilder
,
Validators
}
from
'
@angular/forms
'
;
import
{
ActivatedRoute
}
from
'
@angular/router
'
;
import
{
Observable
}
from
'
rxjs
'
;
import
{
ISearch
,
Search
}
from
'
app/shared/model/search-entity.model
'
;
import
{
SearchService
}
from
'
./search.service
'
;
@
Component
({
selector
:
'
jhi-search-update
'
,
templateUrl
:
'
./search-update.component.html
'
,
})
export
class
SearchUpdateComponent
implements
OnInit
{
isSaving
=
false
;
editForm
=
this
.
fb
.
group
({
id
:
[],
});
constructor
(
protected
searchService
:
SearchService
,
protected
activatedRoute
:
ActivatedRoute
,
private
fb
:
FormBuilder
)
{}
ngOnInit
():
void
{
this
.
activatedRoute
.
data
.
subscribe
(({
search
})
=>
{
this
.
updateForm
(
search
);
});
}
updateForm
(
search
:
ISearch
):
void
{
this
.
editForm
.
patchValue
({
id
:
search
.
id
,
});
}
previousState
():
void
{
window
.
history
.
back
();
}
save
():
void
{
this
.
isSaving
=
true
;
const
search
=
this
.
createFromForm
();
if
(
search
.
id
!==
undefined
)
{
this
.
subscribeToSaveResponse
(
this
.
searchService
.
update
(
search
));
}
else
{
this
.
subscribeToSaveResponse
(
this
.
searchService
.
create
(
search
));
}
}
private
createFromForm
():
ISearch
{
return
{
...
new
Search
(),
id
:
this
.
editForm
.
get
([
'
id
'
])
!
.
value
,
};
}
protected
subscribeToSaveResponse
(
result
:
Observable
<
HttpResponse
<
ISearch
>>
):
void
{
result
.
subscribe
(
()
=>
this
.
onSaveSuccess
(),
()
=>
this
.
onSaveError
()
);
}
protected
onSaveSuccess
():
void
{
this
.
isSaving
=
false
;
this
.
previousState
();
}
protected
onSaveError
():
void
{
this
.
isSaving
=
false
;
}
}
src/main/webapp/app/entities/search/search.component.html
0 → 100644
View file @
4f2ea52b
<div>
<h2
id=
"page-heading"
>
<span
jhiTranslate=
"pluginDemoApp.search.home.title"
>
Searches
</span>
<button
id=
"jh-create-entity"
class=
"btn btn-primary float-right jh-create-entity create-search"
[routerLink]=
"['/search/new']"
>
<fa-icon
icon=
"plus"
></fa-icon>
<span
jhiTranslate=
"pluginDemoApp.search.home.createLabel"
>
Create a new Search
</span>
</button>
</h2>
<jhi-alert-error></jhi-alert-error>
<jhi-alert></jhi-alert>
<div
class=
"alert alert-warning"
id=
"no-result"
*ngIf=
"searches?.length === 0"
>
<span
jhiTranslate=
"pluginDemoApp.search.home.notFound"
>
No searches found
</span>
</div>
<div
class=
"table-responsive"
id=
"entities"
*ngIf=
"searches && searches.length > 0"
>
<table
class=
"table table-striped"
aria-describedby=
"page-heading"
>
<thead>
<tr>
<th
scope=
"col"
><span
jhiTranslate=
"global.field.id"
>
ID
</span></th>
<th
scope=
"col"
></th>
</tr>
</thead>
<tbody>
<tr
*ngFor=
"let search of searches ;trackBy: trackId"
>
<td><a
[routerLink]=
"['/search', search.id, 'view']"
>
{{ search.id }}
</a></td>
<td
class=
"text-right"
>
<div
class=
"btn-group"
>
<button
type=
"submit"
[routerLink]=
"['/search', search.id, 'view']"
class=
"btn btn-info btn-sm"
>
<fa-icon
icon=
"eye"
></fa-icon>
<span
class=
"d-none d-md-inline"
jhiTranslate=
"entity.action.view"
>
View
</span>
</button>
<button
type=
"submit"
[routerLink]=
"['/search', search.id, 'edit']"
class=
"btn btn-primary btn-sm"
>
<fa-icon
icon=
"pencil-alt"
></fa-icon>
<span
class=
"d-none d-md-inline"
jhiTranslate=
"entity.action.edit"
>
Edit
</span>
</button>
<button
type=
"submit"
(click)=
"delete(search)"
class=
"btn btn-danger btn-sm"
>
<fa-icon
icon=
"times"
></fa-icon>
<span
class=
"d-none d-md-inline"
jhiTranslate=
"entity.action.delete"
>
Delete
</span>
</button>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
src/main/webapp/app/entities/search/search.component.ts
0 → 100644
View file @
4f2ea52b
import
{
Component
,
OnInit
,
OnDestroy
}
from
'
@angular/core
'
;
import
{
HttpResponse
}
from
'
@angular/common/http
'
;
import
{
Subscription
}
from
'
rxjs
'
;
import
{
JhiEventManager
}
from
'
ng-jhipster
'
;
import
{
NgbModal
}
from
'
@ng-bootstrap/ng-bootstrap
'
;
import
{
ISearch
}
from
'
app/shared/model/search-entity.model
'
;
import
{
SearchService
}
from
'
./search.service
'
;
import
{
SearchDeleteDialogComponent
}
from
'
./search-delete-dialog.component
'
;
@
Component
({
selector
:
'
jhi-search
'
,
templateUrl
:
'
./search.component.html
'
,
})
export
class
SearchComponent
implements
OnInit
,
OnDestroy
{
searches
?:
ISearch
[];
eventSubscriber
?:
Subscription
;
constructor
(
protected
searchService
:
SearchService
,
protected
eventManager
:
JhiEventManager
,
protected
modalService
:
NgbModal
)
{}
loadAll
():
void
{
this
.
searchService
.
query
().
subscribe
((
res
:
HttpResponse
<
ISearch
[]
>
)
=>
(
this
.
searches
=
res
.
body
||
[]));
}
ngOnInit
():
void
{
this
.
loadAll
();
this
.
registerChangeInSearches
();
}
ngOnDestroy
():
void
{
if
(
this
.
eventSubscriber
)
{
this
.
eventManager
.
destroy
(
this
.
eventSubscriber
);
}
}
trackId
(
index
:
number
,
item
:
ISearch
):
number
{
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
return
item
.
id
!
;
}
registerChangeInSearches
():
void
{
this
.
eventSubscriber
=
this
.
eventManager
.
subscribe
(
'
searchListModification
'
,
()
=>
this
.
loadAll
());
}
delete
(
search
:
ISearch
):
void
{
const
modalRef
=
this
.
modalService
.
open
(
SearchDeleteDialogComponent
,
{
size
:
'
lg
'
,
backdrop
:
'
static
'
});
modalRef
.
componentInstance
.
search
=
search
;
}
}
src/main/webapp/app/entities/search/search.module.ts
0 → 100644
View file @
4f2ea52b
import
{
NgModule
}
from
'
@angular/core
'
;
import
{
RouterModule
}
from
'
@angular/router
'
;
import
{
PluginDemoSharedModule
}
from
'
app/shared/shared.module
'
;
import
{
SearchComponent
}
from
'
./search.component
'
;
import
{
SearchDetailComponent
}
from
'
./search-detail.component
'
;
import
{
SearchUpdateComponent
}
from
'
./search-update.component
'
;
import
{
SearchDeleteDialogComponent
}
from
'
./search-delete-dialog.component
'
;
import
{
searchRoute
}
from
'
./search.route
'
;
@
NgModule
({
imports
:
[
PluginDemoSharedModule
,
RouterModule
.
forChild
(
searchRoute
)],
declarations
:
[
SearchComponent
,
SearchDetailComponent
,
SearchUpdateComponent
,
SearchDeleteDialogComponent
],
entryComponents
:
[
SearchDeleteDialogComponent
],
})
export
class
PluginDemoSearchModule
{}
src/main/webapp/app/entities/search/search.route.ts
0 → 100644
View file @
4f2ea52b
import
{
Injectable
}
from
'
@angular/core
'
;
import
{
HttpResponse
}
from
'
@angular/common/http
'
;
import
{
Resolve
,
ActivatedRouteSnapshot
,
Routes
,
Router
}
from
'
@angular/router
'
;
import
{
Observable
,
of
,
EMPTY
}
from
'
rxjs
'
;
import
{
flatMap
}
from
'
rxjs/operators
'
;
import
{
Authority
}
from
'
app/shared/constants/authority.constants
'
;
import
{
UserRouteAccessService
}
from
'
app/core/auth/user-route-access-service
'
;
import
{
ISearch
,
Search
}
from
'
app/shared/model/search-entity.model
'
;
import
{
SearchService
}
from
'
./search.service
'
;
import
{
SearchComponent
}
from
'
./search.component
'
;
import
{
SearchDetailComponent
}
from
'
./search-detail.component
'
;
import
{
SearchUpdateComponent
}
from
'
./search-update.component
'
;
@
Injectable
({
providedIn
:
'
root
'
})
export
class
SearchResolve
implements
Resolve
<
ISearch
>
{
constructor
(
private
service
:
SearchService
,
private
router
:
Router
)
{}
resolve
(
route
:
ActivatedRouteSnapshot
):
Observable
<
ISearch
>
|
Observable
<
never
>
{
const
id
=
route
.
params
[
'
id
'
];
if
(
id
)
{
return
this
.
service
.
find
(
id
).
pipe
(
flatMap
((
search
:
HttpResponse
<
Search
>
)
=>
{
if
(
search
.
body
)
{
return
of
(
search
.
body
);
}
else
{
this
.
router
.
navigate
([
'
404
'
]);
return
EMPTY
;
}
})
);
}
return
of
(
new
Search
());
}
}
export
const
searchRoute
:
Routes
=
[
{
path
:
''
,
component
:
SearchComponent
,
data
:
{
authorities
:
[
Authority
.
USER
],
pageTitle
:
'
pluginDemoApp.search.home.title
'
,
},
canActivate
:
[
UserRouteAccessService
],
},
{
path
:
'
:id/view
'
,
component
:
SearchDetailComponent
,
resolve
:
{
search
:
SearchResolve
,
},
data
:
{
authorities
:
[
Authority
.
USER
],
pageTitle
:
'
pluginDemoApp.search.home.title
'
,
},
canActivate
:
[
UserRouteAccessService
],
},
{
path
:
'
new
'
,
component
:
SearchUpdateComponent
,
resolve
:
{
search
:
SearchResolve
,
},
data
:
{
authorities
:
[
Authority
.
USER
],
pageTitle
:
'
pluginDemoApp.search.home.title
'
,
},
canActivate
:
[
UserRouteAccessService
],
},
{
path
:
'
:id/edit
'
,
component
:
SearchUpdateComponent
,
resolve
:
{
search
:
SearchResolve
,
},
data
:
{
authorities
:
[
Authority
.
USER
],
pageTitle
:
'
pluginDemoApp.search.home.title
'
,
},
canActivate
:
[
UserRouteAccessService
],
},
];
src/main/webapp/app/entities/search/search.service.ts
0 → 100644
View file @
4f2ea52b
import
{
Injectable
}
from
'
@angular/core
'
;
import
{
HttpClient
,
HttpResponse
}
from
'
@angular/common/http
'
;
import
{
Observable
}
from
'
rxjs
'
;
import
{
SERVER_API_URL
}
from
'
app/app.constants
'
;
import
{
createRequestOption
}
from
'
app/shared/util/request-util
'
;
import
{
ISearch
}
from
'
app/shared/model/search-entity.model
'
;
type
EntityResponseType
=
HttpResponse
<
ISearch
>
;
type
EntityArrayResponseType
=
HttpResponse
<
ISearch
[]
>
;
@
Injectable
({
providedIn
:
'
root
'
})
export
class
SearchService
{
public
resourceUrl
=
SERVER_API_URL
+
'
api/searches
'
;
constructor
(
protected
http
:
HttpClient
)
{}
create
(
search
:
ISearch
):
Observable
<
EntityResponseType
>
{
return
this
.
http
.
post
<
ISearch
>
(
this
.
resourceUrl
,
search
,
{
observe
:
'
response
'
});
}
update
(
search
:
ISearch
):
Observable
<
EntityResponseType
>
{
return
this
.
http
.
put
<
ISearch
>
(
this
.
resourceUrl
,
search
,
{
observe
:
'
response
'
});
}
find
(
id
:
number
):
Observable
<
EntityResponseType
>
{
return
this
.
http
.
get
<
ISearch
>
(
`
${
this
.
resourceUrl
}
/
${
id
}
`
,
{
observe
:
'
response
'
});
}
query
(
req
?:
any
):
Observable
<
EntityArrayResponseType
>
{
const
options
=
createRequestOption
(
req
);
return
this
.
http
.
get
<
ISearch
[]
>
(
this
.
resourceUrl
,
{
params
:
options
,
observe
:
'
response
'
});
}
delete
(
id
:
number
):
Observable
<
HttpResponse
<
{}
>>
{
return
this
.
http
.
delete
(
`
${
this
.
resourceUrl
}
/
${
id
}
`
,
{
observe
:
'
response
'
});
}
}
src/main/webapp/app/home/home.component.ts
View file @
4f2ea52b
import
{
Component
,
OnInit
}
from
'
@angular/core
'
;
import
{
FormBuilder
,
Validators
}
from
'
@angular/forms
'
;
import
{
LoginService
}
from
'
app/core/login/login.service
'
;
import
{
AccountService
}
from
'
app/core/auth/account.service
'
;
import
{
Account
}
from
'
app/core/user/account.model
'
;
import
{
SharingSearchService
}
from
'
app/sharing/search/sharingSearch.service
'
@
Component
({
selector
:
'
jhi-home
'
,
templateUrl
:
'
./home.component.html
'
,
...
...
@@ -11,8 +14,15 @@ import { Account } from 'app/core/user/account.model';
})
export
class
HomeComponent
implements
OnInit
{
account
:
Account
|
null
=
null
;
isSaving
=
false
;