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
77b4022b
Commit
77b4022b
authored
Mar 17, 2022
by
El Mghazli Yacine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rudiments ok
parent
6bcd3006
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
100 additions
and
146 deletions
+100
-146
common/utils/websrv/frontend/src/app/api/commands.api.ts
common/utils/websrv/frontend/src/app/api/commands.api.ts
+42
-19
common/utils/websrv/frontend/src/app/components/commands/commands.component.html
...ntend/src/app/components/commands/commands.component.html
+11
-6
common/utils/websrv/frontend/src/app/components/commands/commands.component.ts
...rontend/src/app/components/commands/commands.component.ts
+6
-12
common/utils/websrv/frontend/src/app/components/nav/nav.component.html
...websrv/frontend/src/app/components/nav/nav.component.html
+2
-6
common/utils/websrv/frontend/src/app/controls/command.control.ts
...utils/websrv/frontend/src/app/controls/command.control.ts
+0
-46
common/utils/websrv/frontend/src/app/controls/infos.control.ts
...n/utils/websrv/frontend/src/app/controls/infos.control.ts
+39
-0
common/utils/websrv/frontend/src/app/controls/option.control.ts
.../utils/websrv/frontend/src/app/controls/option.control.ts
+0
-57
No files found.
common/utils/websrv/frontend/src/app/api/commands.api.ts
View file @
77b4022b
...
...
@@ -2,24 +2,17 @@ import { HttpClient } from '@angular/common/http';
import
{
Injectable
}
from
'
@angular/core
'
;
import
{
environment
}
from
'
src/environments/environment
'
;
export
interface
IOption
{
key
:
string
;
value
:
number
;
}
export
interface
ICommand
{
name
:
string
;
options
:
IOption
[];
}
export
interface
IStatus
{
infos
:
string
;
config_file
:
string
;
executable_function
:
string
;
}
export
interface
ILog
{
text
:
string
;
export
interface
IInfos
{
display_status
:
IStatus
;
menu_cmds
:
string
[];
}
const
route
=
'
/
commands
'
;
const
route
=
'
/
oaisoftmodem
'
;
@
Injectable
({
providedIn
:
'
root
'
,
...
...
@@ -27,11 +20,41 @@ const route = '/commands';
export
class
CommandsApi
{
constructor
(
private
httpClient
:
HttpClient
)
{
}
public
readCommands$
=
()
=>
this
.
httpClient
.
get
<
ICommand
[]
>
(
environment
.
backend
+
route
+
'
/list
'
);
public
readStatus$
=
()
=>
this
.
httpClient
.
get
<
IStatus
>
(
environment
.
backend
+
route
+
'
/status
'
);
public
readInfos$
=
()
=>
this
.
httpClient
.
get
<
IInfos
>
(
environment
.
backend
+
route
);
}
public
runCommand$
=
(
command
:
ICommand
)
=>
this
.
httpClient
.
post
<
ICommand
>
(
environment
.
backend
+
route
,
command
);
public
readLogs$
=
()
=>
this
.
httpClient
.
get
<
IStatus
>
(
environment
.
backend
+
route
+
'
/logs
'
);
}
\ No newline at end of file
// 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"
// ]
// }
common/utils/websrv/frontend/src/app/components/commands/commands.component.html
View file @
77b4022b
<h1
mat-dialog-title
>
Status
</h1>
<mat-form-field
*ngIf=
"commandsCtrls$ | async as commands"
>
<mat-label>
Command
</mat-label>
<mat-select
[formControl]=
"selectedCtrl!.nameFC"
[value]=
"selectedCtrl!.nameFC.value"
>
<mat-option
*ngFor=
"let command of commands"
[value]=
"command"
>
{{ command }}
</mat-option>
</mat-select>
</mat-form-field>
\ No newline at end of file
<div
*ngIf=
"infos$ | async as infos"
>
<p>
config_file: {{ infos.display_status.config_file }}
</p>
<p>
executable_function: {{ infos.display_status.executable_function }}
</p>
<mat-form-field>
<mat-label>
Command
</mat-label>
<mat-select
[formControl]=
"selectedCmd!.value"
[value]=
"selectedCmd!.value"
>
<mat-option
*ngFor=
"let control of infos.cmdsFA.controls"
[value]=
"control.value"
>
{{ control.value }}
</mat-option>
</mat-select>
</mat-form-field>
</div>
\ No newline at end of file
common/utils/websrv/frontend/src/app/components/commands/commands.component.ts
View file @
77b4022b
...
...
@@ -3,10 +3,11 @@
/* eslint-disable eqeqeq */
/* eslint-disable @typescript-eslint/naming-convention */
import
{
Component
}
from
'
@angular/core
'
;
import
{
FormControl
}
from
'
@angular/forms
'
;
import
{
Observable
}
from
'
rxjs
'
;
import
{
map
,
tap
}
from
'
rxjs/operators
'
;
import
{
CommandsApi
}
from
'
src/app/api/commands.api
'
;
import
{
CommandCtrl
}
from
'
src/app/controls/command
.control
'
;
import
{
InfosCtrl
}
from
'
src/app/controls/infos
.control
'
;
import
{
LoadingService
}
from
'
src/app/services/loading.service
'
;
...
...
@@ -17,23 +18,16 @@ import { LoadingService } from 'src/app/services/loading.service';
})
export
class
CommandsComponent
{
commandsCtrls$
:
Observable
<
CommandCtrl
[]
>
selectedC
trl
?:
CommandCtr
l
infos$
:
Observable
<
InfosCtrl
>
selectedC
md
?:
FormContro
l
constructor
(
public
commandsApi
:
CommandsApi
,
public
loadingService
:
LoadingService
,
)
{
this
.
commandsCtrls$
=
this
.
commandsApi
.
readCommand
s$
().
pipe
(
map
((
doc
s
)
=>
docs
.
map
((
doc
)
=>
new
CommandCtrl
(
doc
)
)),
this
.
infos$
=
this
.
commandsApi
.
readInfo
s$
().
pipe
(
map
((
doc
)
=>
new
InfosCtrl
(
doc
)),
);
}
onSubmit
(
control
:
CommandCtrl
)
{
this
.
commandsApi
.
runCommand$
(
control
.
api
()).
pipe
(
// take(1),
tap
(()
=>
control
.
markAsPristine
())
).
subscribe
();
}
}
common/utils/websrv/frontend/src/app/components/nav/nav.component.html
View file @
77b4022b
...
...
@@ -2,11 +2,7 @@
<mat-sidenav
#drawer
class=
"sidenav"
fixedInViewport
[attr.role]=
"(isHandset$ | async) ? 'dialog' : 'navigation'"
[mode]=
"(isHandset$ | async) ? 'over' : 'side'"
[opened]=
"(isHandset$ | async) === false"
>
<mat-nav-list>
<a
mat-list-item
routerLink=
"/bookings"
routerLinkActive=
"active"
>
Month
</a>
<a
mat-list-item
routerLink=
"/year"
routerLinkActive=
"active"
>
Year
</a>
<a
mat-list-item
routerLink=
"/messages"
routerLinkActive=
"active"
>
Autosend
</a>
<a
mat-list-item
routerLink=
"/cleaners"
routerLinkActive=
"active"
>
Cleaners
</a>
<a
mat-list-item
routerLink=
"/user"
routerLinkActive=
"active"
>
Calendars
</a>
<a
mat-list-item
routerLink=
"/commands"
routerLinkActive=
"active"
>
Commands
</a>
</mat-nav-list>
</mat-sidenav>
...
...
@@ -18,7 +14,7 @@
<button
mat-icon-button
(click)=
"drawer.toggle()"
>
<mat-icon>
menu
</mat-icon>
</button>
<h1>
SOFTMODEM
</h1>
<h1>
OAI SoftModem
</h1>
</ng-template>
<ng-template
#loading
>
<mat-progress-spinner
mode=
"indeterminate"
diameter=
"40"
>
...
...
common/utils/websrv/frontend/src/app/controls/command.control.ts
deleted
100644 → 0
View file @
6bcd3006
/* eslint-disable no-shadow */
import
{
FormArray
,
FormControl
,
FormGroup
}
from
'
@angular/forms
'
;
import
{
ICommand
}
from
'
../api/commands.api
'
;
import
{
OptionCtrl
}
from
'
./option.control
'
;
const
enum
CommandFCN
{
name
=
'
name
'
,
options
=
'
options
'
,
}
export
class
CommandCtrl
extends
FormGroup
{
constructor
(
icommand
:
ICommand
)
{
super
({});
this
.
addControl
(
CommandFCN
.
name
,
new
FormControl
(
icommand
.
name
));
this
.
addControl
(
CommandFCN
.
options
,
new
FormArray
(
icommand
.
options
.
map
((
ioption
)
=>
new
OptionCtrl
(
ioption
))));
}
api
()
{
const
doc
:
ICommand
=
{
name
:
this
.
nameFC
.
value
,
options
:
this
.
optionsFA
.
controls
.
map
(
control
=>
(
control
as
OptionCtrl
).
api
()),
};
return
doc
;
}
get
nameFC
()
{
return
this
.
get
(
CommandFCN
.
name
)
as
FormControl
;
}
set
nameFC
(
control
:
FormControl
)
{
this
.
setControl
(
CommandFCN
.
name
,
control
);
}
get
optionsFA
()
{
return
this
.
get
(
CommandFCN
.
options
)
as
FormArray
;
}
set
optionsFA
(
control
:
FormArray
)
{
this
.
setControl
(
CommandFCN
.
options
,
control
);
}
}
common/utils/websrv/frontend/src/app/controls/infos.control.ts
0 → 100644
View file @
77b4022b
/* eslint-disable no-shadow */
import
{
FormArray
,
FormControl
,
FormGroup
}
from
'
@angular/forms
'
;
import
{
IInfos
,
IStatus
}
from
'
../api/commands.api
'
;
const
enum
InfosFCN
{
menu_cmds
=
'
commands
'
,
}
export
class
InfosCtrl
extends
FormGroup
{
display_status
:
IStatus
constructor
(
icommand
:
IInfos
)
{
super
({});
this
.
display_status
=
icommand
.
display_status
this
.
addControl
(
InfosFCN
.
menu_cmds
,
new
FormArray
(
icommand
.
menu_cmds
.
map
((
cmd
)
=>
new
FormControl
(
cmd
))));
}
api
()
{
const
doc
:
IInfos
=
{
display_status
:
this
.
display_status
,
menu_cmds
:
this
.
cmdsFA
.
value
,
};
return
doc
;
}
get
cmdsFA
()
{
return
this
.
get
(
InfosFCN
.
menu_cmds
)
as
FormArray
;
}
set
cmdsFA
(
control
:
FormArray
)
{
this
.
setControl
(
InfosFCN
.
menu_cmds
,
control
);
}
}
common/utils/websrv/frontend/src/app/controls/option.control.ts
deleted
100644 → 0
View file @
6bcd3006
/* eslint-disable no-shadow */
import
{
FormControl
,
FormGroup
}
from
'
@angular/forms
'
;
import
{
IOption
}
from
'
../api/commands.api
'
;
const
enum
OptionFCN
{
key
=
'
key
'
,
value
=
'
value
'
,
}
export
class
Option
{
key
:
string
;
value
:
number
;
constructor
(
ioption
:
IOption
)
{
this
.
key
=
ioption
.
key
;
this
.
value
=
ioption
.
value
;
}
}
export
class
OptionCtrl
extends
FormGroup
{
constructor
(
ioption
:
IOption
)
{
super
({});
const
option
=
new
Option
(
ioption
);
this
.
addControl
(
OptionFCN
.
key
,
new
FormControl
(
option
.
key
));
this
.
addControl
(
OptionFCN
.
value
,
new
FormControl
(
option
.
value
));
}
api
()
{
const
doc
:
IOption
=
{
key
:
this
.
keyFC
.
value
,
value
:
this
.
valueFC
.
value
,
};
return
doc
;
}
get
keyFC
()
{
return
this
.
get
(
OptionFCN
.
key
)
as
FormControl
;
}
set
keyFC
(
control
:
FormControl
)
{
this
.
setControl
(
OptionFCN
.
key
,
control
);
}
get
valueFC
()
{
return
this
.
get
(
OptionFCN
.
value
)
as
FormControl
;
}
setvalueFC
(
control
:
FormControl
)
{
this
.
setControl
(
OptionFCN
.
value
,
control
);
}
}
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