Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lizhongxiao
OpenXG-RAN
Commits
39a8aa34
Commit
39a8aa34
authored
Apr 22, 2022
by
El Mghazli Yacine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
confirm dialog before sending cmd
parent
e18753db
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
55 additions
and
7 deletions
+55
-7
common/utils/websrv/frontend/package.json
common/utils/websrv/frontend/package.json
+1
-1
common/utils/websrv/frontend/src/app/app.module.ts
common/utils/websrv/frontend/src/app/app.module.ts
+2
-0
common/utils/websrv/frontend/src/app/components/commands/commands.component.ts
...rontend/src/app/components/commands/commands.component.ts
+9
-6
common/utils/websrv/frontend/src/app/components/confirm/confirm.component.css
...frontend/src/app/components/confirm/confirm.component.css
+0
-0
common/utils/websrv/frontend/src/app/components/confirm/confirm.component.html
...rontend/src/app/components/confirm/confirm.component.html
+6
-0
common/utils/websrv/frontend/src/app/components/confirm/confirm.component.ts
.../frontend/src/app/components/confirm/confirm.component.ts
+20
-0
common/utils/websrv/frontend/src/app/services/dialog.service.ts
.../utils/websrv/frontend/src/app/services/dialog.service.ts
+17
-0
No files found.
common/utils/websrv/frontend/package.json
View file @
39a8aa34
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
"lint"
:
"ng lint"
,
"lint"
:
"ng lint"
,
"build"
:
"ng build"
,
"build"
:
"ng build"
,
"dev"
:
"ng serve --configuration=development"
,
"dev"
:
"ng serve --configuration=development"
,
"prod"
:
"ng serve
--configuration=production"
"prod"
:
"ng serve --configuration=production"
},
},
"private"
:
true
,
"private"
:
true
,
"dependencies"
:
{
"dependencies"
:
{
...
...
common/utils/websrv/frontend/src/app/app.module.ts
View file @
39a8aa34
...
@@ -29,6 +29,7 @@ import { CommandsApi } from './api/commands.api';
...
@@ -29,6 +29,7 @@ import { CommandsApi } from './api/commands.api';
import
{
AppRoutingModule
}
from
'
./app-routing.module
'
;
import
{
AppRoutingModule
}
from
'
./app-routing.module
'
;
import
{
AppComponent
}
from
'
./app.component
'
;
import
{
AppComponent
}
from
'
./app.component
'
;
import
{
CommandsComponent
}
from
'
./components/commands/commands.component
'
;
import
{
CommandsComponent
}
from
'
./components/commands/commands.component
'
;
import
{
ConfirmDialogComponent
}
from
'
./components/confirm/confirm.component
'
;
import
{
ErrorDialogComponent
}
from
'
./components/error-dialog/error-dialog.component
'
;
import
{
ErrorDialogComponent
}
from
'
./components/error-dialog/error-dialog.component
'
;
import
{
NavComponent
}
from
'
./components/nav/nav.component
'
;
import
{
NavComponent
}
from
'
./components/nav/nav.component
'
;
import
{
InterceptorProviders
}
from
'
./interceptors/interceptors
'
;
import
{
InterceptorProviders
}
from
'
./interceptors/interceptors
'
;
...
@@ -40,6 +41,7 @@ import { LoadingService } from './services/loading.service';
...
@@ -40,6 +41,7 @@ import { LoadingService } from './services/loading.service';
NavComponent
,
NavComponent
,
ErrorDialogComponent
,
ErrorDialogComponent
,
CommandsComponent
,
CommandsComponent
,
ConfirmDialogComponent
],
],
imports
:
[
imports
:
[
BrowserModule
,
BrowserModule
,
...
...
common/utils/websrv/frontend/src/app/components/commands/commands.component.ts
View file @
39a8aa34
import
{
Component
}
from
'
@angular/core
'
;
import
{
Component
}
from
'
@angular/core
'
;
import
{
Observable
}
from
'
rxjs/internal/Observable
'
;
import
{
Observable
}
from
'
rxjs/internal/Observable
'
;
import
{
map
}
from
'
rxjs/internal/operators/map
'
;
import
{
map
}
from
'
rxjs/internal/operators/map
'
;
import
{
tap
,
mergeMap
}
from
'
rxjs/operators
'
;
import
{
tap
,
mergeMap
,
filter
}
from
'
rxjs/operators
'
;
import
{
CommandsApi
,
IArgType
,
ILog
}
from
'
src/app/api/commands.api
'
;
import
{
CommandsApi
,
IArgType
,
ILog
}
from
'
src/app/api/commands.api
'
;
import
{
CmdCtrl
}
from
'
src/app/controls/cmd.control
'
;
import
{
CmdCtrl
}
from
'
src/app/controls/cmd.control
'
;
import
{
VarCtrl
}
from
'
src/app/controls/var.control
'
;
import
{
VarCtrl
}
from
'
src/app/controls/var.control
'
;
...
@@ -92,16 +92,19 @@ export class CommandsComponent {
...
@@ -92,16 +92,19 @@ export class CommandsComponent {
}
}
onCmdSubmit
(
control
:
CmdCtrl
)
{
onCmdSubmit
(
control
:
CmdCtrl
)
{
this
.
logs$
=
this
.
commandsApi
.
runCommand$
(
control
.
api
(),
`
${
this
.
selectedModule
!
.
nameFC
.
value
}
`
).
pipe
(
this
.
logs$
=
this
.
dialogService
.
openConfirmDialog
().
pipe
(
mergeMap
(()
=>
this
.
commandsApi
.
runCommand$
(
control
.
api
(),
`
${
this
.
selectedModule
!
.
nameFC
.
value
}
`
)),
tap
(
resp
=>
this
.
success
(
'
runCommand
'
+
control
.
nameFC
.
value
+
'
OK
'
,
resp
.
display
!
.
join
(
"
</p><p>
"
))),
tap
(
resp
=>
this
.
success
(
'
runCommand
'
+
control
.
nameFC
.
value
+
'
OK
'
,
resp
.
display
!
.
join
(
"
</p><p>
"
))),
map
(
iresp
=>
iresp
.
logs
!
)
map
(
iresp
=>
iresp
.
logs
!
)
);
);
}
}
private
success
=
(
mess
:
string
,
str
:
string
)
=>
this
.
dialogService
.
openDialog
({
private
success
=
(
mess
:
string
,
str
:
string
)
=>
{
title
:
mess
,
return
this
.
dialogService
.
openDialog
({
body
:
str
,
title
:
mess
,
});
body
:
str
,
})
};
}
}
\ No newline at end of file
common/utils/websrv/frontend/src/app/components/confirm/confirm.component.css
0 → 100644
View file @
39a8aa34
common/utils/websrv/frontend/src/app/components/confirm/confirm.component.html
0 → 100644
View file @
39a8aa34
<h1>
Really ?
</h1>
<div
fxLayoutGap=
"10px"
mat-dialog-actions
fxLayout=
"row"
fxLayoutAlign=
"center start"
>
<button
mat-button
[mat-dialog-close]=
"true"
cdkFocusInitial
>
Ok
</button>
<button
mat-button
(click)=
"onNoClick()"
>
Cancel
</button>
</div>
\ No newline at end of file
common/utils/websrv/frontend/src/app/components/confirm/confirm.component.ts
0 → 100644
View file @
39a8aa34
/* eslint-disable @typescript-eslint/naming-convention */
import
{
Component
}
from
'
@angular/core
'
;
import
{
MatDialogRef
}
from
'
@angular/material/dialog
'
;
@
Component
({
selector
:
'
app-confirm
'
,
templateUrl
:
'
./confirm.component.html
'
,
styleUrls
:
[
'
./confirm.component.css
'
]
})
export
class
ConfirmDialogComponent
{
constructor
(
public
dialogRef
:
MatDialogRef
<
void
>
)
{
}
onNoClick
()
{
this
.
dialogRef
.
close
();
}
}
common/utils/websrv/frontend/src/app/services/dialog.service.ts
View file @
39a8aa34
import
{
Injectable
}
from
'
@angular/core
'
;
import
{
Injectable
}
from
'
@angular/core
'
;
import
{
MatDialog
}
from
'
@angular/material/dialog
'
;
import
{
MatDialog
}
from
'
@angular/material/dialog
'
;
import
{
MatSnackBar
}
from
'
@angular/material/snack-bar
'
;
import
{
MatSnackBar
}
from
'
@angular/material/snack-bar
'
;
import
{
of
}
from
'
rxjs/internal/observable/of
'
;
import
{
tap
}
from
'
rxjs/internal/operators/tap
'
;
import
{
ConfirmDialogComponent
}
from
'
../components/confirm/confirm.component
'
;
import
{
ErrorDialogComponent
}
from
'
../components/error-dialog/error-dialog.component
'
;
import
{
ErrorDialogComponent
}
from
'
../components/error-dialog/error-dialog.component
'
;
@
Injectable
({
@
Injectable
({
...
@@ -39,4 +42,18 @@ export class DialogService {
...
@@ -39,4 +42,18 @@ export class DialogService {
verticalPosition
:
'
bottom
'
,
verticalPosition
:
'
bottom
'
,
});
});
}
}
openConfirmDialog
()
{
if
(
this
.
isDialogOpen
)
{
return
of
(
undefined
);
}
this
.
isDialogOpen
=
true
;
return
this
.
_dialog
.
open
(
ConfirmDialogComponent
,
{
width
:
'
300px
'
})
.
afterClosed
()
.
pipe
(
tap
(()
=>
this
.
isDialogOpen
=
false
));
}
}
}
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