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
9ca2d78f
Commit
9ca2d78f
authored
Apr 01, 2022
by
El Mghazli Yacine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
working with first API version
parent
14321bfe
Changes
10
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
777 additions
and
732 deletions
+777
-732
common/utils/websrv/frontend/package-lock.json
common/utils/websrv/frontend/package-lock.json
+576
-634
common/utils/websrv/frontend/src/app/api/commands.api.ts
common/utils/websrv/frontend/src/app/api/commands.api.ts
+22
-36
common/utils/websrv/frontend/src/app/app-routing.module.ts
common/utils/websrv/frontend/src/app/app-routing.module.ts
+1
-1
common/utils/websrv/frontend/src/app/components/commands/commands.component.html
...ntend/src/app/components/commands/commands.component.html
+26
-8
common/utils/websrv/frontend/src/app/components/commands/commands.component.ts
...rontend/src/app/components/commands/commands.component.ts
+25
-32
common/utils/websrv/frontend/src/app/controls/cmds.control.ts
...on/utils/websrv/frontend/src/app/controls/cmds.control.ts
+34
-0
common/utils/websrv/frontend/src/app/controls/infos.control.ts
...n/utils/websrv/frontend/src/app/controls/infos.control.ts
+20
-20
common/utils/websrv/frontend/src/app/controls/options.control.ts
...utils/websrv/frontend/src/app/controls/options.control.ts
+13
-0
common/utils/websrv/frontend/src/app/controls/variable.control.ts
...tils/websrv/frontend/src/app/controls/variable.control.ts
+59
-0
common/utils/websrv/frontend/src/environments/environment.ts
common/utils/websrv/frontend/src/environments/environment.ts
+1
-1
No files found.
common/utils/websrv/frontend/package-lock.json
View file @
9ca2d78f
This diff is collapsed.
Click to expand it.
common/utils/websrv/frontend/src/app/api/commands.api.ts
View file @
9ca2d78f
...
...
@@ -12,6 +12,23 @@ export interface IInfos {
menu_cmds
:
string
[];
}
export
enum
IOptionType
{
subcommand
=
"
subcommand
"
,
variable
=
"
variable
"
}
export
interface
IOption
{
type
:
IOptionType
;
}
export
interface
IVariable
extends
IOption
{
name
:
string
;
value
:
string
;
modifiable
:
boolean
;
}
export
interface
ISubCommands
extends
IOption
{
name
:
string
[];
}
const
route
=
'
/oaisoftmodem
'
;
@
Injectable
({
...
...
@@ -22,41 +39,10 @@ export class CommandsApi {
public
readInfos$
=
()
=>
this
.
httpClient
.
get
<
IInfos
>
(
environment
.
backend
+
route
);
public
runCommand$
=
(
cmdName
:
string
)
=>
this
.
httpClient
.
post
<
string
>
(
environment
.
backend
+
route
,
cmdName
);
}
public
getOptions$
=
(
cmdName
:
string
)
=>
this
.
httpClient
.
get
<
IOption
[]
>
(
environment
.
backend
+
route
+
'
/module/
'
+
cmdName
);
public
runCommand$
=
(
cmdName
:
string
)
=>
this
.
httpClient
.
post
<
string
>
(
environment
.
backend
+
route
+
'
/command/
'
+
cmdName
,
{});
// FRANCOIS_BODY = {
// "main_oai softmodem": [
// {
// "display_status": [
// { "Config file": "../../../ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf" },
// { "Executable function": "gnb" }
// ]
// },
// {
// "menu_cmds": [
// "telnet",
// "softmodem",
// "loader",
// "measur",
// "rfsimu"
// ]
// }
// ]
// }
// YASS_BODY = {
// display_status: {
// config_file: '../../../ ci - scripts / conf_files / gnb.band78.sa.fr1.106PRB.usrpn310.conf',
// executable_function: "gnb"
// },
// menu_cmds: [
// "telnet",
// "softmodem",
// "loader",
// "measur",
// "rfsimu"
// ]
// }
public
setVariable$
=
(
variable
:
IVariable
)
=>
this
.
httpClient
.
post
<
string
>
(
environment
.
backend
+
route
+
'
/variable/
'
+
variable
.
name
,
variable
.
value
);
}
common/utils/websrv/frontend/src/app/app-routing.module.ts
View file @
9ca2d78f
...
...
@@ -3,7 +3,7 @@ import { Routes, RouterModule } from '@angular/router';
import
{
CommandsComponent
}
from
'
./components/commands/commands.component
'
;
const
routes
:
Routes
=
[
{
path
:
''
,
redirectTo
:
'
/
'
,
pathMatch
:
'
full
'
},
{
path
:
''
,
redirectTo
:
'
/
commands
'
,
pathMatch
:
'
full
'
},
{
path
:
'
commands
'
,
component
:
CommandsComponent
},
{
path
:
'
**
'
,
redirectTo
:
''
},
];
...
...
common/utils/websrv/frontend/src/app/components/commands/commands.component.html
View file @
9ca2d78f
...
...
@@ -4,17 +4,35 @@
<p>
config_file: {{ infos.display_status.config_file }}
</p>
<p>
executable_function: {{ infos.display_status.executable_function }}
</p>
<div
*ngIf=
"infos$ | async as infos"
fxLaypout=
"row"
>
<h1
mat-dialog-title
>
Commands
</h1>
<div
fxLaypout=
"row"
>
<mat-form-field>
<mat-label>
Command
</mat-label>
<mat-select
[formControl]=
"selected
"
[value]=
"selected?.value
"
>
<mat-select
[formControl]=
"selected
Cmd"
[value]=
"selectedCmd?.value"
(selectionChange)=
"onSelect(selectedCmd)
"
>
<mat-option
*ngFor=
"let control of infos.cmdsFA.controls"
[value]=
"control.value"
>
{{ control.value }}
</mat-option>
</mat-select>
</mat-form-field>
<button
mat-raised-button
color=
"primary"
[disabled]=
"!selected"
(click)=
"onSubmit()"
>
submit
<div
*ngIf=
"variables$ | async as variables"
fxLaypout=
"column"
>
<h1
mat-dialog-title
>
Variables
</h1>
<div
*ngFor=
"let variable of variables"
>
<mat-form-field>
<mat-label>
{{ variable.nameFC.value }}
</mat-label>
<input
input
matInput
[formControl]=
"variable.valueFC"
/>
</mat-form-field>
<button
mat-raised-button
color=
"primary"
[disabled]=
"!variable.modifiableFC.value"
(click)=
"onVarSubmit(variable)"
>
set
</button>
</div>
</div>
<div
*ngIf=
"subcmds$ | async as subcmds"
fxLaypout=
"column"
fxLayoutGap=
"10px"
>
<h1
mat-dialog-title
>
Sub-commands
</h1>
<button
*ngFor=
"let control of subcmds.namesFA.controls"
mat-raised-button
color=
"primary"
(click)=
"onCmdSubmit(control.value)"
>
{{ control.value }}
</button>
</div>
</div>
\ No newline at end of file
</div>
\ No newline at end of file
common/utils/websrv/frontend/src/app/components/commands/commands.component.ts
View file @
9ca2d78f
import
{
Component
}
from
'
@angular/core
'
;
import
{
FormControl
}
from
'
@angular/forms
'
;
import
{
BehaviorSubject
}
from
'
rxjs
'
;
import
{
Observable
}
from
'
rxjs/internal/Observable
'
;
import
{
map
}
from
'
rxjs/internal/operators/map
'
;
import
{
CommandsApi
}
from
'
src/app/api/commands.api
'
;
import
{
tap
}
from
'
rxjs/internal/operators/tap
'
;
import
{
CommandsApi
,
IOptionType
,
ISubCommands
,
IVariable
}
from
'
src/app/api/commands.api
'
;
import
{
SubCmdCtrl
}
from
'
src/app/controls/cmds.control
'
;
import
{
InfosCtrl
}
from
'
src/app/controls/infos.control
'
;
import
{
VariableCtrl
}
from
'
src/app/controls/variable.control
'
;
import
{
LoadingService
}
from
'
src/app/services/loading.service
'
;
...
...
@@ -14,10 +18,15 @@ import { LoadingService } from 'src/app/services/loading.service';
})
export
class
CommandsComponent
{
IOptionType
=
IOptionType
;
infos$
:
Observable
<
InfosCtrl
>
// infos: InfosCtrl
variables$
=
new
BehaviorSubject
<
VariableCtrl
[]
>
([])
subcmds$
:
BehaviorSubject
<
SubCmdCtrl
>
|
undefined
selected
=
new
FormControl
()
selectedCmd
=
new
FormControl
()
selectedSubCmd
=
new
FormControl
()
selectedVariable
?:
VariableCtrl
constructor
(
public
commandsApi
:
CommandsApi
,
...
...
@@ -26,38 +35,22 @@ export class CommandsComponent {
this
.
infos$
=
this
.
commandsApi
.
readInfos$
().
pipe
(
map
((
doc
)
=>
new
InfosCtrl
(
doc
)),
);
}
onCmdSubmit
(
subCmdName
:
string
)
{
this
.
commandsApi
.
runCommand$
(
subCmdName
).
subscribe
();
}
// this.infos = new InfosCtrl({
// display_status: {
// config_file: '../../../ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf',
// executable_function: "gnb"
// },
// menu_cmds: [
// "telnet",
// "softmodem",
// "loader",
// "measur",
// "rfsimu"
// ]
// })
// const BODY_JSON = {
// "display_status": {
// "config_file": '../../../ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf',
// "executable_function": "gnb"
// },
// "menu_cmds": [
// "telnet",
// "softmodem",
// "loader",
// "measur",
// "rfsimu"
// ]
// }
onVarSubmit
(
varCtrl
:
VariableCtrl
)
{
this
.
commandsApi
.
setVariable$
(
varCtrl
.
api
()).
subscribe
();
}
onSubmit
()
{
this
.
commandsApi
.
runCommand$
(
this
.
selected
.
value
).
subscribe
();
onSelect
(
cmdNameFC
:
FormControl
)
{
this
.
commandsApi
.
getOptions$
(
cmdNameFC
.
value
).
subscribe
(
opts
=>
{
this
.
variables$
.
next
(
opts
.
filter
(
iopt
=>
iopt
.
type
===
IOptionType
.
variable
).
map
(
iopt
=>
new
VariableCtrl
(
iopt
as
IVariable
)))
const
[
subCmds
]
=
opts
.
filter
(
iopt
=>
iopt
.
type
===
IOptionType
.
subcommand
)
this
.
subcmds$
=
new
BehaviorSubject
<
SubCmdCtrl
>
(
new
SubCmdCtrl
(
subCmds
as
ISubCommands
))
})
}
}
common/utils/websrv/frontend/src/app/controls/cmds.control.ts
0 → 100644
View file @
9ca2d78f
import
{
FormArray
,
FormControl
}
from
'
@angular/forms
'
;
import
{
ISubCommands
}
from
'
../api/commands.api
'
;
import
{
OptionsCtrl
}
from
'
./options.control
'
;
const
enum
SubCmdsFCN
{
names
=
'
names
'
,
}
export
class
SubCmdCtrl
extends
OptionsCtrl
{
constructor
(
isubs
:
ISubCommands
)
{
super
(
isubs
);
this
.
addControl
(
SubCmdsFCN
.
names
,
new
FormArray
(
isubs
.
name
.
map
((
name
)
=>
new
FormControl
(
name
))));
}
api
()
{
const
doc
:
ISubCommands
=
{
type
:
this
.
type
,
name
:
this
.
namesFA
.
value
};
return
doc
;
}
get
namesFA
()
{
return
this
.
get
(
SubCmdsFCN
.
names
)
as
FormArray
;
}
set
namesFA
(
fa
:
FormArray
)
{
this
.
setControl
(
SubCmdsFCN
.
names
,
fa
);
}
}
common/utils/websrv/frontend/src/app/controls/infos.control.ts
View file @
9ca2d78f
common/utils/websrv/frontend/src/app/controls/options.control.ts
0 → 100644
View file @
9ca2d78f
import
{
FormGroup
}
from
"
@angular/forms
"
;
import
{
IOption
,
IOptionType
}
from
"
../api/commands.api
"
;
export
class
OptionsCtrl
extends
FormGroup
{
type
:
IOptionType
constructor
(
ioption
:
IOption
)
{
super
({});
this
.
type
=
ioption
.
type
}
}
\ No newline at end of file
common/utils/websrv/frontend/src/app/controls/variable.control.ts
0 → 100644
View file @
9ca2d78f
import
{
FormControl
}
from
'
@angular/forms
'
;
import
{
IOptionType
,
IVariable
}
from
'
../api/commands.api
'
;
import
{
OptionsCtrl
}
from
'
./options.control
'
;
const
enum
VariablesFCN
{
name
=
'
name
'
,
value
=
"
value
"
,
modifiable
=
"
modifiable
"
}
export
class
VariableCtrl
extends
OptionsCtrl
{
constructor
(
ivar
:
IVariable
)
{
super
(
ivar
);
this
.
addControl
(
VariablesFCN
.
name
,
new
FormControl
(
ivar
.
name
));
this
.
addControl
(
VariablesFCN
.
value
,
new
FormControl
(
ivar
.
value
));
this
.
addControl
(
VariablesFCN
.
modifiable
,
new
FormControl
(
ivar
.
modifiable
));
}
api
()
{
const
doc
:
IVariable
=
{
type
:
this
.
type
,
name
:
this
.
nameFC
.
value
,
value
:
this
.
valueFC
.
value
,
modifiable
:
this
.
modifiableFC
.
value
};
return
doc
;
}
get
nameFC
()
{
return
this
.
get
(
VariablesFCN
.
name
)
as
FormControl
;
}
set
nameFC
(
control
:
FormControl
)
{
this
.
setControl
(
VariablesFCN
.
name
,
control
);
}
get
valueFC
()
{
return
this
.
get
(
VariablesFCN
.
value
)
as
FormControl
;
}
set
valueFC
(
control
:
FormControl
)
{
this
.
setControl
(
VariablesFCN
.
value
,
control
);
}
get
modifiableFC
()
{
return
this
.
get
(
VariablesFCN
.
modifiable
)
as
FormControl
;
}
set
modifiableFC
(
control
:
FormControl
)
{
this
.
setControl
(
VariablesFCN
.
modifiable
,
control
);
}
}
common/utils/websrv/frontend/src/environments/environment.ts
View file @
9ca2d78f
...
...
@@ -4,7 +4,7 @@
export
const
environment
=
{
production
:
false
,
backend
:
'
http://
localhost
: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