Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Maarch
MaarchCourrier
Commits
d2ec0280
Commit
d2ec0280
authored
Jun 07, 2021
by
Hamza HRAMCHI
Committed by
Alex ORLUC
Jun 07, 2021
Browse files
FIX #16932 TIME 0:20 disable view menu if tile error
parent
17189d45
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/frontend/app/home/dashboard/dashboard.component.html
View file @
d2ec0280
...
...
@@ -20,9 +20,9 @@
<mat-divider
*ngIf=
"menu==='delete'"
></mat-divider>
<button
*ngIf=
"['view', 'color'].indexOf(menu) === -1"
mat-menu-item
(click)=
"launchAction(menu, tile)"
>
{{'lang.'+ menu | translate}}
</button>
<button
*ngIf=
"menu==='view'"
mat-menu-item
<button
*ngIf=
"menu==='view'
&& !hasError(tile.id)
"
mat-menu-item
[matMenuTriggerFor]=
"toolMenuView"
>
{{'lang.chartView' | translate}}
</button>
<button
*ngIf=
"menu==='color'"
mat-menu-item
<button
*ngIf=
"menu==='color'
&& !hasError(tile.id)
"
mat-menu-item
[matMenuTriggerFor]=
"toolMenuColors"
>
{{'lang.'+ menu | translate}}
</button>
</ng-container>
</mat-menu>
...
...
@@ -66,7 +66,7 @@
</div>
</mat-menu>
</div>
<app-tile
#tileComponent
*ngIf=
"tile.id !== null"
[tile]=
"tile"
[view]=
"tile.view"
<app-tile
#tileComponent
(hasError)=
"tileErrors.push($event);"
*ngIf=
"tile.id !== null"
[tile]=
"tile"
[view]=
"tile.view"
style=
"display: flex;height: 100%;flex-direction: column;width: 100%;"
>
</app-tile>
<button
mat-button
color=
"secondary"
mat-icon-button
[title]=
"'lang.addTile' | translate"
...
...
src/frontend/app/home/dashboard/dashboard.component.ts
View file @
d2ec0280
...
...
@@ -25,6 +25,7 @@ export class DashboardComponent implements OnInit, AfterViewInit {
tiles
:
any
=
[];
hoveredTool
:
boolean
=
false
;
tileErrors
:
any
[]
=
[];
constructor
(
...
...
@@ -211,4 +212,9 @@ export class DashboardComponent implements OnInit, AfterViewInit {
emptyDashboard
()
{
return
this
.
tiles
.
filter
((
item
:
any
)
=>
item
.
id
!==
null
).
length
===
0
;
}
hasError
(
idTile
:
any
)
{
const
getTile
:
any
=
this
.
tileErrors
.
find
((
tile
:
any
)
=>
tile
.
id
===
idTile
);
return
getTile
!==
undefined
?
getTile
.
error
:
false
;
}
}
src/frontend/app/home/dashboard/tile/tile.component.ts
View file @
d2ec0280
import
{
Component
,
OnInit
,
AfterViewInit
,
Input
}
from
'
@angular/core
'
;
import
{
Component
,
OnInit
,
AfterViewInit
,
Input
,
EventEmitter
,
Output
}
from
'
@angular/core
'
;
import
{
HttpClient
}
from
'
@angular/common/http
'
;
import
{
TranslateService
}
from
'
@ngx-translate/core
'
;
import
{
AppService
}
from
'
@service/app.service
'
;
...
...
@@ -19,6 +19,8 @@ export class TileDashboardComponent implements OnInit, AfterViewInit {
@
Input
()
tile
:
any
=
null
;
@
Output
()
hasError
=
new
EventEmitter
<
any
>
();
loading
:
boolean
=
true
;
onError
:
boolean
=
false
;
errorMessage
:
string
=
''
;
...
...
@@ -81,6 +83,7 @@ export class TileDashboardComponent implements OnInit, AfterViewInit {
console
.
log
(
err
);
this
.
notify
.
error
(
this
.
translate
.
instant
(
'
lang.tileLoadError
'
,
{
0
:
(
this
.
tile
.
position
+
1
)
}));
this
.
onError
=
true
;
this
.
hasError
.
emit
({
id
:
this
.
tile
.
id
,
error
:
this
.
onError
});
this
.
errorMessage
=
err
.
error
.
errors
;
resolve
(
false
);
return
of
(
false
);
...
...
@@ -100,6 +103,7 @@ export class TileDashboardComponent implements OnInit, AfterViewInit {
console
.
log
(
err
);
this
.
notify
.
error
(
this
.
translate
.
instant
(
'
lang.tileLoadError
'
,
{
0
:
(
this
.
tile
.
position
+
1
)
}));
this
.
onError
=
true
;
this
.
hasError
.
emit
({
id
:
this
.
tile
.
id
,
error
:
this
.
onError
});
this
.
errorMessage
=
err
.
error
.
errors
;
resolve
(
false
);
return
of
(
false
);
...
...
@@ -122,6 +126,7 @@ export class TileDashboardComponent implements OnInit, AfterViewInit {
console
.
log
(
err
);
this
.
notify
.
error
(
this
.
translate
.
instant
(
'
lang.tileLoadError
'
,
{
0
:
(
this
.
tile
.
position
+
1
)
}));
this
.
onError
=
true
;
this
.
hasError
.
emit
({
id
:
this
.
tile
.
id
,
error
:
this
.
onError
});
this
.
errorMessage
=
err
.
error
.
errors
;
resolve
(
false
);
return
of
(
false
);
...
...
Write
Preview
Supports
Markdown
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