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
6e3f09a3
Commit
6e3f09a3
authored
Apr 01, 2022
by
El Mghazli Yacine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
webserv APIv2 (frontend part)
parent
9ca2d78f
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
84 deletions
+47
-84
common/utils/websrv/frontend/src/app/api/commands.api.ts
common/utils/websrv/frontend/src/app/api/commands.api.ts
+3
-10
common/utils/websrv/frontend/src/app/components/commands/commands.component.html
...ntend/src/app/components/commands/commands.component.html
+38
-31
common/utils/websrv/frontend/src/app/components/commands/commands.component.ts
...rontend/src/app/components/commands/commands.component.ts
+6
-6
common/utils/websrv/frontend/src/app/controls/infos.control.ts
...n/utils/websrv/frontend/src/app/controls/infos.control.ts
+0
-37
No files found.
common/utils/websrv/frontend/src/app/api/commands.api.ts
View file @
6e3f09a3
...
...
@@ -2,15 +2,6 @@ import { HttpClient } from '@angular/common/http';
import
{
Injectable
}
from
'
@angular/core
'
;
import
{
environment
}
from
'
src/environments/environment
'
;
export
interface
IStatus
{
config_file
:
string
;
executable_function
:
string
;
}
export
interface
IInfos
{
display_status
:
IStatus
;
menu_cmds
:
string
[];
}
export
enum
IOptionType
{
subcommand
=
"
subcommand
"
,
...
...
@@ -37,7 +28,9 @@ const route = '/oaisoftmodem';
export
class
CommandsApi
{
constructor
(
private
httpClient
:
HttpClient
)
{
}
public
readInfos$
=
()
=>
this
.
httpClient
.
get
<
IInfos
>
(
environment
.
backend
+
route
);
public
readStatus$
=
()
=>
this
.
httpClient
.
get
<
IVariable
[]
>
(
environment
.
backend
+
route
+
'
/status/
'
);
public
readModules$
=
()
=>
this
.
httpClient
.
get
<
string
[]
>
(
environment
.
backend
+
route
+
'
/modules/
'
);
public
getOptions$
=
(
cmdName
:
string
)
=>
this
.
httpClient
.
get
<
IOption
[]
>
(
environment
.
backend
+
route
+
'
/module/
'
+
cmdName
);
...
...
common/utils/websrv/frontend/src/app/components/commands/commands.component.html
View file @
6e3f09a3
<div
*ngIf=
"infos$ | async as infos"
>
<div
*ngIf=
"status$ | async as statusVariables"
>
<h1
mat-dialog-title
>
Status
</h1>
<p>
config_file: {{ infos.display_status.config_file }}
</p>
<p>
executable_function: {{ infos.display_status.executable_function }}
</p>
<div
*ngFor=
"let status of statusVariables"
>
<mat-form-field>
<mat-label>
{{ status.nameFC.value }}
</mat-label>
<input
input
matInput
[formControl]=
"status.valueFC"
/>
</mat-form-field>
<button
mat-raised-button
color=
"primary"
[disabled]=
"!status.modifiableFC.value"
(click)=
"onVarSubmit(status)"
>
set
</button>
</div>
</div>
<div
*ngIf=
"infos$ | async as info
s"
fxLaypout=
"row"
>
<div
*ngIf=
"cmds$ | async as cmd
s"
fxLaypout=
"row"
>
<h1
mat-dialog-title
>
Commands
</h1>
<mat-form-field>
<mat-label>
Command
</mat-label>
<mat-select
[formControl]=
"selectedCmd"
[value]=
"selectedCmd?.value"
(selectionChange)=
"onSelect(selectedCmd)"
>
<mat-option
*ngFor=
"let control of infos.cmdsFA.controls"
[value]=
"control.value"
>
{{ control.value
}}
<mat-option
*ngFor=
"let cmd of cmds"
[value]=
"cmd"
>
{{ cmd
}}
</mat-option>
</mat-select>
</mat-form-field>
...
...
@@ -35,4 +42,4 @@
{{ 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 @
6e3f09a3
...
...
@@ -3,10 +3,8 @@ import { FormControl } from '@angular/forms';
import
{
BehaviorSubject
}
from
'
rxjs
'
;
import
{
Observable
}
from
'
rxjs/internal/Observable
'
;
import
{
map
}
from
'
rxjs/internal/operators/map
'
;
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
'
;
...
...
@@ -20,7 +18,8 @@ export class CommandsComponent {
IOptionType
=
IOptionType
;
infos$
:
Observable
<
InfosCtrl
>
status$
:
Observable
<
VariableCtrl
[]
>
cmds$
:
Observable
<
string
[]
>
variables$
=
new
BehaviorSubject
<
VariableCtrl
[]
>
([])
subcmds$
:
BehaviorSubject
<
SubCmdCtrl
>
|
undefined
...
...
@@ -32,16 +31,17 @@ export class CommandsComponent {
public
commandsApi
:
CommandsApi
,
public
loadingService
:
LoadingService
,
)
{
this
.
infos$
=
this
.
commandsApi
.
readInfo
s$
().
pipe
(
map
((
doc
)
=>
new
InfosCtrl
(
doc
)),
this
.
status$
=
this
.
commandsApi
.
readStatu
s$
().
pipe
(
map
((
ivars
)
=>
ivars
.
map
(
ivar
=>
new
VariableCtrl
(
ivar
)))
);
this
.
cmds$
=
this
.
commandsApi
.
readModules$
();
}
onCmdSubmit
(
subCmdName
:
string
)
{
this
.
commandsApi
.
runCommand$
(
subCmdName
).
subscribe
();
}
onVarSubmit
(
varCtrl
:
VariableCtrl
)
{
this
.
commandsApi
.
setVariable$
(
varCtrl
.
api
()).
subscribe
();
}
...
...
common/utils/websrv/frontend/src/app/controls/infos.control.ts
deleted
100644 → 0
View file @
9ca2d78f
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
);
}
}
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