Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
quadrige
quadrige3-app
Commits
b28eda9a
Commit
b28eda9a
authored
Dec 23, 2020
by
PECQUOT
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[enh] sampling equipments as a module
parent
5867a5d6
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
84 additions
and
41 deletions
+84
-41
src/app/referential/list/referential-memory.table.html
src/app/referential/list/referential-memory.table.html
+3
-3
src/app/referential/referential-routing.module.ts
src/app/referential/referential-routing.module.ts
+3
-3
src/app/referential/referential.module.ts
src/app/referential/referential.module.ts
+0
-3
src/app/referential/sampling-equipment/sampling-equipment.model.ts
...eferential/sampling-equipment/sampling-equipment.model.ts
+0
-0
src/app/referential/sampling-equipment/sampling-equipment.module.ts
...ferential/sampling-equipment/sampling-equipment.module.ts
+35
-0
src/app/referential/sampling-equipment/sampling-equipment.service.ts
...erential/sampling-equipment/sampling-equipment.service.ts
+20
-4
src/app/referential/sampling-equipment/sampling-equipment.table.html
...erential/sampling-equipment/sampling-equipment.table.html
+1
-1
src/app/referential/sampling-equipment/sampling-equipment.table.scss
...erential/sampling-equipment/sampling-equipment.table.scss
+0
-0
src/app/referential/sampling-equipment/sampling-equipment.table.ts
...eferential/sampling-equipment/sampling-equipment.table.ts
+3
-3
src/app/referential/sampling-equipment/sampling-equipment.validator.ts
...ential/sampling-equipment/sampling-equipment.validator.ts
+2
-2
src/app/referential/services/referential.fragments.ts
src/app/referential/services/referential.fragments.ts
+0
-14
src/app/referential/table/referential.generic.table.html
src/app/referential/table/referential.generic.table.html
+7
-7
src/app/referential/table/referential.table.ts
src/app/referential/table/referential.table.ts
+4
-0
src/app/shared/table/component-dirty.guard.ts
src/app/shared/table/component-dirty.guard.ts
+6
-1
No files found.
src/app/referential/list/referential-memory.table.html
View file @
b28eda9a
...
...
@@ -36,7 +36,7 @@
<mat-table
[dataSource]=
"dataSource"
matSort
matSortActive=
"id"
matSortDirection=
"asc"
matSortDisableClear
[trackBy]=
"trackByFn"
[resizable]=
"resizable"
>
matSortDisableClear
[trackBy]=
"trackByFn"
>
<ng-container
matColumnDef=
"select"
>
<mat-header-cell
class=
"hidden-xs hidden-sm"
*matHeaderCellDef
>
...
...
@@ -62,7 +62,7 @@
<!-- Label column -->
<ng-container
matColumnDef=
"label"
>
<mat-header-cell
*matHeaderCellDef
mat-sort-header
[resizableColumn]=
"true"
[resizableColumnDef]=
"'label'"
>
<mat-header-cell
*matHeaderCellDef
mat-sort-header
>
<span
translate
>
REFERENTIAL.LABEL
</span>
</mat-header-cell>
<mat-cell
*matCellDef=
"let row"
>
...
...
@@ -76,7 +76,7 @@
<!-- Name column -->
<ng-container
matColumnDef=
"name"
>
<mat-header-cell
*matHeaderCellDef
[resizableColumn]=
"true"
[resizableColumnDef]=
"'name'"
>
<mat-header-cell
*matHeaderCellDef
>
<span
translate
>
REFERENTIAL.NAME
</span>
</mat-header-cell>
<mat-cell
*matCellDef=
"let row"
[class.mat-form-field-disabled]=
"!row.editing"
>
...
...
src/app/referential/referential-routing.module.ts
View file @
b28eda9a
...
...
@@ -5,7 +5,6 @@ import {SharedRoutingModule} from "sumaris-lib";
import
{
ReferentialMenu
}
from
"
@app/referential/menu/referential.menu
"
;
import
{
ReferentialGenericTable
}
from
"
@app/referential/table/referential.generic.table
"
;
import
{
ComponentDirtyGuard
}
from
"
@app/shared/table/component-dirty.guard
"
;
import
{
SamplingEquipmentTable
}
from
"
@app/referential/table/sampling-equipment.table
"
;
const
routes
:
Routes
=
[
{
...
...
@@ -17,8 +16,9 @@ const routes: Routes = [
children
:
[
{
path
:
'
SamplingEquipment
'
,
component
:
SamplingEquipmentTable
,
canDeactivate
:
[
ComponentDirtyGuard
],
// component: SamplingEquipmentTable,
// canDeactivate: [ComponentDirtyGuard],
loadChildren
:
()
=>
import
(
'
./sampling-equipment/sampling-equipment.module
'
).
then
(
m
=>
m
.
SamplingEquipmentModule
)
},
{
path
:
'
:entity
'
,
...
...
src/app/referential/referential.module.ts
View file @
b28eda9a
...
...
@@ -9,8 +9,6 @@ import {QuadrigeCoreModule} from "../core/quadrige.core.module";
import
{
QuadrigeSharedModule
}
from
"
../shared/quadrige.shared.module
"
;
import
{
ReferentialMenu
}
from
"
@app/referential/menu/referential.menu
"
;
import
{
ReferentialGenericTable
}
from
"
@app/referential/table/referential.generic.table
"
;
import
{
SamplingEquipmentTable
}
from
"
@app/referential/table/sampling-equipment.table
"
;
@
NgModule
({
imports
:
[
...
...
@@ -28,7 +26,6 @@ import {SamplingEquipmentTable} from "@app/referential/table/sampling-equipment.
ReferentialForm
,
ReferentialMemoryTable
,
ReferentialGenericTable
,
SamplingEquipmentTable
],
exports
:
[
QuadrigeCoreModule
,
...
...
src/app/referential/
model
/sampling-equipment.model.ts
→
src/app/referential/
sampling-equipment
/sampling-equipment.model.ts
View file @
b28eda9a
File moved
src/app/referential/sampling-equipment/sampling-equipment.module.ts
0 → 100644
View file @
b28eda9a
import
{
NgModule
}
from
"
@angular/core
"
;
import
{
TranslateModule
}
from
"
@ngx-translate/core
"
;
import
{
RouterModule
,
Routes
}
from
"
@angular/router
"
;
import
{
SamplingEquipmentTable
}
from
"
@app/referential/sampling-equipment/sampling-equipment.table
"
;
import
{
ComponentDirtyGuard
}
from
"
@app/shared/table/component-dirty.guard
"
;
import
{
QuadrigeSharedModule
}
from
"
@app/shared/quadrige.shared.module
"
;
import
{
QuadrigeCoreModule
}
from
"
@app/core/quadrige.core.module
"
;
const
routes
:
Routes
=
[
{
path
:
''
,
pathMatch
:
'
full
'
,
component
:
SamplingEquipmentTable
,
// canActivate: [AuthGuardService], useful ?
canDeactivate
:
[
ComponentDirtyGuard
],
data
:
{
profile
:
'
ADMIN
'
}
}
];
@
NgModule
({
imports
:
[
QuadrigeCoreModule
,
TranslateModule
,
RouterModule
.
forChild
(
routes
)
],
declarations
:
[
SamplingEquipmentTable
],
exports
:
[
SamplingEquipmentTable
]
})
export
class
SamplingEquipmentModule
{
}
src/app/referential/s
ervices
/sampling-equipment.service.ts
→
src/app/referential/s
ampling-equipment
/sampling-equipment.service.ts
View file @
b28eda9a
...
...
@@ -4,8 +4,24 @@ import {BaseReferentialService} from "@app/referential/services/base-referential
import
gql
from
"
graphql-tag
"
;
import
{
referentialFragments
}
from
"
@app/referential/services/referential.fragments
"
;
import
{
ReferentialQueries
}
from
"
@app/referential/services/referential.queries
"
;
import
{
SamplingEquipment
,
SamplingEquipmentFilter
}
from
"
@app/referential/
model
/sampling-equipment.model
"
;
import
{
SamplingEquipment
,
SamplingEquipmentFilter
}
from
"
@app/referential/
sampling-equipment
/sampling-equipment.model
"
;
const
fragments
=
{
samplingEquipment
:
gql
`fragment SamplingEquipmentFragment on SamplingEquipmentVO {
id
name
description
comments
size
unit {
...ReferentialFragment
}
updateDate
creationDate
statusId
__typename
}`
};
const
queries
:
ReferentialQueries
=
{
...
...
@@ -16,7 +32,7 @@ const queries: ReferentialQueries = {
...SamplingEquipmentFragment
}
}
${
referentialF
ragments
.
samplingEquipment
}
${
f
ragments
.
samplingEquipment
}
${
referentialFragments
.
referential
}
`
;
},
...
...
@@ -29,7 +45,7 @@ const queries: ReferentialQueries = {
}
count:samplingEquipmentsCount(filter: $filter)
}
${
referentialF
ragments
.
samplingEquipment
}
${
f
ragments
.
samplingEquipment
}
${
referentialFragments
.
referential
}
`
;
},
...
...
@@ -41,7 +57,7 @@ const queries: ReferentialQueries = {
...SamplingEquipmentFragment
}
}
${
referentialF
ragments
.
samplingEquipment
}
${
f
ragments
.
samplingEquipment
}
${
referentialFragments
.
referential
}
`
;
},
...
...
src/app/referential/
table
/sampling-equipment.table.html
→
src/app/referential/
sampling-equipment
/sampling-equipment.table.html
View file @
b28eda9a
<app-toolbar
[title]=
"
title$|async
|translate"
color=
"primary"
>
<app-toolbar
[title]=
"
'REFERENTIAL.ENTITY.SAMPLING_EQUIPMENT'
|translate"
color=
"primary"
>
</app-toolbar>
<ion-content
class=
"ion-no-padding"
>
...
...
src/app/referential/
table
/sampling-equipment.table.scss
→
src/app/referential/
sampling-equipment
/sampling-equipment.table.scss
View file @
b28eda9a
File moved
src/app/referential/
table
/sampling-equipment.table.ts
→
src/app/referential/
sampling-equipment
/sampling-equipment.table.ts
View file @
b28eda9a
import
{
ChangeDetectionStrategy
,
Component
,
Inject
,
Injector
}
from
"
@angular/core
"
;
import
{
EntitiesTableDataSource
,
EnvironmentService
,
RESERVED_END_COLUMNS
,
RESERVED_START_COLUMNS
}
from
"
sumaris-lib
"
;
import
{
ReferentialTable
}
from
"
@app/referential/table/referential.table
"
;
import
{
SamplingEquipment
,
SamplingEquipmentFilter
}
from
"
@app/referential/
model
/sampling-equipment.model
"
;
import
{
SamplingEquipment
,
SamplingEquipmentFilter
}
from
"
@app/referential/
sampling-equipment
/sampling-equipment.model
"
;
import
{
ActivatedRoute
}
from
"
@angular/router
"
;
import
{
SamplingEquipmentService
}
from
"
@app/referential/s
ervices
/sampling-equipment.service
"
;
import
{
SamplingEquipmentValidator
}
from
"
@app/referential/
validator
/sampling-equipment.validator
"
;
import
{
SamplingEquipmentService
}
from
"
@app/referential/s
ampling-equipment
/sampling-equipment.service
"
;
import
{
SamplingEquipmentValidator
}
from
"
@app/referential/
sampling-equipment
/sampling-equipment.validator
"
;
import
{
CdkDragDrop
,
moveItemInArray
}
from
"
@angular/cdk/drag-drop
"
;
import
{
ReferentialGenericService
}
from
"
@app/referential/services/referential-generic.service
"
;
...
...
src/app/referential/
validator
/sampling-equipment.validator.ts
→
src/app/referential/
sampling-equipment
/sampling-equipment.validator.ts
View file @
b28eda9a
import
{
Injectable
}
from
"
@angular/core
"
;
import
{
AbstractControlOptions
,
FormBuilder
,
FormGroup
,
Validators
}
from
"
@angular/forms
"
;
import
{
AppValidatorService
,
Referential
,
SharedValidators
,
toNumber
}
from
"
sumaris-lib
"
;
import
{
SamplingEquipment
}
from
"
@app/referential/
model
/sampling-equipment.model
"
;
import
{
AppValidatorService
,
SharedValidators
,
toNumber
}
from
"
sumaris-lib
"
;
import
{
SamplingEquipment
}
from
"
@app/referential/
sampling-equipment
/sampling-equipment.model
"
;
@
Injectable
({
providedIn
:
'
root
'
})
export
class
SamplingEquipmentValidator
...
...
src/app/referential/services/referential.fragments.ts
View file @
b28eda9a
...
...
@@ -43,19 +43,5 @@ export const referentialFragments = {
__typename
}
__typename
}`
,
samplingEquipment
:
gql
`fragment SamplingEquipmentFragment on SamplingEquipmentVO {
id
name
description
comments
size
unit {
...ReferentialFragment
}
updateDate
creationDate
statusId
__typename
}`
};
src/app/referential/table/referential.generic.table.html
View file @
b28eda9a
...
...
@@ -119,7 +119,7 @@
<ion-label
color=
"danger"
class=
"error"
[innerHTML]=
"error|translate"
></ion-label>
</ion-item>
<mat-table
#table
[dataSource]=
"dataSource"
class=
"trips-table"
matSort
matSortActive=
"id"
matSortDirection=
"asc"
[resizable]=
"true"
<mat-table
#table
[dataSource]=
"dataSource"
class=
"trips-table"
matSort
matSortActive=
"id"
matSortDirection=
"asc"
matSortDisableClear
[trackBy]=
"trackByFn"
>
<ng-container
matColumnDef=
"select"
>
...
...
@@ -136,7 +136,7 @@
<!-- Id/code column -->
<ng-container
matColumnDef=
"id"
>
<mat-header-cell
class=
"hidden-xs hidden-sm"
*matHeaderCellDef
mat-sort-header
[resizableColumn]=
"true"
[resizableColumnDef]=
"'id'"
>
<mat-header-cell
class=
"hidden-xs hidden-sm"
*matHeaderCellDef
mat-sort-header
>
<app-loading-spinner
[loading]=
"loadingSubject|async"
>
<ion-label
translate
>
{{idLabel$|async}}
</ion-label>
</app-loading-spinner>
...
...
@@ -156,7 +156,7 @@
<!-- Name column -->
<ng-container
matColumnDef=
"name"
>
<mat-header-cell
*matHeaderCellDef
mat-sort-header
[resizableColumn]=
"true"
[resizableColumnDef]=
"'name'"
>
<mat-header-cell
*matHeaderCellDef
mat-sort-header
>
<span
translate
>
REFERENTIAL.NAME
</span>
</mat-header-cell>
<mat-cell
*matCellDef=
"let row"
[class.mat-form-field-disabled]=
"!row.editing"
>
...
...
@@ -171,7 +171,7 @@
<!-- Label column -->
<ng-container
matColumnDef=
"label"
>
<mat-header-cell
*matHeaderCellDef
mat-sort-header
[resizableColumn]=
"true"
[resizableColumnDef]=
"'label'"
>
<mat-header-cell
*matHeaderCellDef
mat-sort-header
>
<span
translate
>
REFERENTIAL.LABEL
</span>
</mat-header-cell>
<mat-cell
*matCellDef=
"let row"
>
...
...
@@ -185,7 +185,7 @@
<!-- Description column -->
<ng-container
matColumnDef=
"description"
>
<mat-header-cell
*matHeaderCellDef
mat-sort-header
[resizableColumn]=
"true"
[resizableColumnDef]=
"'description'"
>
<mat-header-cell
*matHeaderCellDef
mat-sort-header
>
<span
translate
>
REFERENTIAL.DESCRIPTION
</span>
</mat-header-cell>
<mat-cell
*matCellDef=
"let row"
>
...
...
@@ -199,7 +199,7 @@
<!-- Comment column -->
<ng-container
matColumnDef=
"comments"
>
<mat-header-cell
*matHeaderCellDef
class=
"hidden-xs hidden-sm"
[resizableColumn]=
"false"
[resizableColumnDef]=
"'comment'"
>
<mat-header-cell
*matHeaderCellDef
class=
"hidden-xs hidden-sm"
>
<span
translate
>
REFERENTIAL.COMMENTS
</span>
</mat-header-cell>
<mat-cell
*matCellDef=
"let row"
class=
"hidden-xs hidden-sm"
>
...
...
@@ -213,7 +213,7 @@
<!-- Status column -->
<ng-container
matColumnDef=
"status"
>
<mat-header-cell
*matHeaderCellDef
mat-sort-header
[resizableColumn]=
"false"
[resizableColumnDef]=
"'status'"
>
<mat-header-cell
*matHeaderCellDef
mat-sort-header
>
<span
translate
>
REFERENTIAL.STATUS
</span>
</mat-header-cell>
<mat-cell
*matCellDef=
"let row"
[class.mat-form-field-disabled]=
"!row.editing"
>
...
...
src/app/referential/table/referential.table.ts
View file @
b28eda9a
...
...
@@ -89,6 +89,10 @@ export abstract class ReferentialTable<E extends Referential<E> = Referential,
return
this
.
save
();
}
doCancel
()
{
this
.
onRefresh
.
emit
();
}
save
():
Promise
<
boolean
>
{
return
super
.
save
();
}
...
...
src/app/shared/table/component-dirty.guard.ts
View file @
b28eda9a
...
...
@@ -10,12 +10,14 @@ export interface CanLeave {
isValid
():
boolean
;
doSave
():
Promise
<
boolean
>
;
doCancel
();
}
@
Injectable
()
export
class
ComponentDirtyGuard
implements
CanDeactivate
<
CanLeave
>
{
private
debug
=
tru
e
;
private
debug
=
fals
e
;
constructor
(
protected
translate
:
TranslateService
,
...
...
@@ -110,6 +112,9 @@ export class ComponentDirtyGuard implements CanDeactivate<CanLeave> {
if
(
this
.
debug
)
console
.
info
(
`[ReferentialGuard] save failed, cancel deactivate`
);
return
false
;
}
}
else
{
if
(
this
.
debug
)
console
.
info
(
`[ReferentialGuard] do cancel`
);
component
.
doCancel
();
}
// Allow deactivate
...
...
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