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
zzha zzha
OpenXG-RAN
Commits
e3d38b5c
Commit
e3d38b5c
authored
Apr 22, 2022
by
El Mghazli Yacine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tables and new API with IColumn and IRow
parent
86f36e80
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
86 additions
and
7 deletions
+86
-7
common/utils/websrv/frontend/src/app/api/commands.api.ts
common/utils/websrv/frontend/src/app/api/commands.api.ts
+10
-2
common/utils/websrv/frontend/src/app/components/commands/commands.component.html
...ntend/src/app/components/commands/commands.component.html
+57
-0
common/utils/websrv/frontend/src/app/components/commands/commands.component.ts
...rontend/src/app/components/commands/commands.component.ts
+17
-4
common/utils/websrv/frontend/src/environments/environment.ts
common/utils/websrv/frontend/src/environments/environment.ts
+2
-1
No files found.
common/utils/websrv/frontend/src/app/api/commands.api.ts
View file @
e3d38b5c
...
...
@@ -33,8 +33,16 @@ export interface ILog {
enabled
:
boolean
;
}
export
interface
ILog2
{
enabled
:
boolean
;
export
interface
IColumn
{
//should use IVariable ?
name
:
string
;
type
:
IArgType
;
modifiable
:
boolean
;
//set command ?
}
export
type
IRow
=
string
[]
export
interface
ITable
{
columns
:
IColumn
[];
rows
:
IRow
[];
}
export
interface
IResp
{
...
...
common/utils/websrv/frontend/src/app/components/commands/commands.component.html
View file @
e3d38b5c
...
...
@@ -49,4 +49,61 @@
</div>
</div>
<mat-table
mat-table
[dataSource]=
"logs$"
multiTemplateDataRows
class=
"mat-elevation-z8"
>
<!-- For anyone who has set the multiTemplateDataRows property of mat-table to true,
you can't use index. Instead you have use either dataIndex or renderIndex.
See https://github.com/angular/material2/issues/12793 -->
<div
matColumnDef=
"component"
>
<mat-header-cell
*matHeaderCellDef
>
Component
</mat-header-cell>
<mat-cell
*matCellDef=
"let log"
>
<div
fxLayout=
"row"
fxLayoutAlign=
"start end"
>
<p>
{{log.component}}
</p>
</div>
</mat-cell>
</div>
<div
matColumnDef=
"level"
>
<mat-header-cell
*matHeaderCellDef
>
Level
</mat-header-cell>
<mat-cell
*matCellDef=
"let log"
>
<div
fxLayout=
"row"
fxLayoutAlign=
"start end"
>
<p>
{{log.level}}
</p>
</div>
</mat-cell>
</div>
<div
matColumnDef=
"output"
>
<mat-header-cell
*matHeaderCellDef
>
Output
</mat-header-cell>
<mat-cell
*matCellDef=
"let log"
>
<div
fxLayout=
"row"
fxLayoutAlign=
"start end"
>
<p>
{{log.output}}
</p>
</div>
</mat-cell>
</div>
<div
matColumnDef=
"enabled"
>
<mat-header-cell
*matHeaderCellDef
>
Enabled
</mat-header-cell>
<mat-cell
*matCellDef=
"let log"
>
<div
fxLayout=
"row"
fxLayoutAlign=
"start end"
>
<p>
{{log.enabled}}
</p>
</div>
</mat-cell>
</div>
<mat-header-row
*matHeaderRowDef=
"DISPLAYED_COLUMNS"
></mat-header-row>
<mat-row
*matRowDef=
"let stageCtrl; columns: DISPLAYED_COLUMNS"
></mat-row>
</mat-table>
</div>
\ No newline at end of file
common/utils/websrv/frontend/src/app/components/commands/commands.component.ts
View file @
e3d38b5c
import
{
Component
}
from
'
@angular/core
'
;
import
{
Observable
}
from
'
rxjs/internal/Observable
'
;
import
{
map
}
from
'
rxjs/internal/operators/map
'
;
import
{
CommandsApi
,
IArgType
}
from
'
src/app/api/commands.api
'
;
import
{
tap
,
mergeMap
}
from
'
rxjs/operators
'
;
import
{
CommandsApi
,
IArgType
,
ILog
}
from
'
src/app/api/commands.api
'
;
import
{
CmdCtrl
}
from
'
src/app/controls/cmd.control
'
;
import
{
VarCtrl
}
from
'
src/app/controls/var.control
'
;
import
{
DialogService
}
from
'
src/app/services/dialog.service
'
;
...
...
@@ -30,6 +31,16 @@ export class CommandsComponent {
args$
?:
Observable
<
VarCtrl
[]
>
// selectedArg?: VarCtrl
//table columns
DISPLAYED_COLUMNS
=
[
'
component
'
,
'
level
'
,
'
output
'
,
'
enabled
'
]
logs$
:
Observable
<
ILog
[]
>
=
new
Observable
<
ILog
[]
>
()
constructor
(
public
commandsApi
:
CommandsApi
,
public
loadingService
:
LoadingService
,
...
...
@@ -45,6 +56,7 @@ export class CommandsComponent {
);
}
onModuleSelect
(
control
:
CmdCtrl
)
{
this
.
selectedModule
=
control
...
...
@@ -80,9 +92,10 @@ export class CommandsComponent {
}
onCmdSubmit
(
control
:
CmdCtrl
)
{
this
.
commandsApi
.
runCommand$
(
control
.
api
(),
`
${
this
.
selectedModule
!
.
nameFC
.
value
}
`
).
pipe
(
map
(
resp
=>
this
.
success
(
'
runCommand
'
+
control
.
nameFC
.
value
+
'
OK
'
,
resp
.
display
!
.
join
(
"
</p><p>
"
)))
).
subscribe
();
this
.
logs$
=
this
.
commandsApi
.
runCommand$
(
control
.
api
(),
`
${
this
.
selectedModule
!
.
nameFC
.
value
}
`
).
pipe
(
tap
(
resp
=>
this
.
success
(
'
runCommand
'
+
control
.
nameFC
.
value
+
'
OK
'
,
resp
.
display
!
.
join
(
"
</p><p>
"
))),
map
(
iresp
=>
iresp
.
logs
!
)
);
}
private
success
=
(
mess
:
string
,
str
:
string
)
=>
this
.
dialogService
.
openDialog
({
...
...
common/utils/websrv/frontend/src/environments/environment.ts
View file @
e3d38b5c
...
...
@@ -4,7 +4,8 @@
export
const
environment
=
{
production
:
false
,
backend
:
'
http://10.130.163.206:8090
'
backend
:
'
http://10.133.10.152:8090
'
// backend: 'http://10.130.163.206:8090'
};
/*
...
...
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