Skip to content

Commit

Permalink
Fix cli api remove sensors (#299)
Browse files Browse the repository at this point in the history
* fix(cli): remove sensors

* fix(api): remove sensor from postman env

* fix(api): remove old enpoint list file
  • Loading branch information
FrancoLiberali authored Nov 23, 2023
1 parent c6cbb99 commit d34682f
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 717 deletions.
639 changes: 0 additions & 639 deletions API/resources/Endpoint_List.md

This file was deleted.

36 changes: 0 additions & 36 deletions API/resources/postman/Local_env.postman_environment.json
Original file line number Diff line number Diff line change
Expand Up @@ -912,26 +912,11 @@
"value": "",
"enabled": true
},
{
"key": "RackSensorID",
"value": "",
"enabled": true
},
{
"key": "DeviceSensorID",
"value": "",
"enabled": true
},
{
"key": "SUNBIRD",
"value": "",
"enabled": true
},
{
"key": "RoomSensorID",
"value": "",
"enabled": true
},
{
"key": "RackGroupID",
"value": "",
Expand Down Expand Up @@ -987,21 +972,6 @@
"value": "",
"enabled": true
},
{
"key": "DeviceSensorUpdateStr",
"value": "",
"enabled": true
},
{
"key": "RoomSensorUpdateStr",
"value": "",
"enabled": true
},
{
"key": "RackSensorUpdateStr",
"value": "",
"enabled": true
},
{
"key": "RoomTemplateUpdateStr",
"value": "",
Expand All @@ -1023,12 +993,6 @@
"type": "any",
"enabled": true
},
{
"key": "StraySensorID",
"value": "",
"type": "default",
"enabled": true
},
{
"key": "DomainID",
"value": "",
Expand Down
6 changes: 0 additions & 6 deletions CLI/completer.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ func GetPrefixCompleter() *readline.PrefixCompleter {
readline.PcItem("lscorridor", false),
readline.PcItem("lsac", false),
readline.PcItem("lspanel", false),
readline.PcItem("lssensor", false),
readline.PcItem("lsenterprise", false),
readline.PcItem("get", false),
readline.PcItem("getu", false),
Expand Down Expand Up @@ -303,8 +302,6 @@ func GetPrefixCompleter() *readline.PrefixCompleter {
readline.PcItemDynamic(SiteOCLICompleter, true)),
readline.PcItem("co:", true,
readline.PcItemDynamic(SiteOCLICompleter, true)),
readline.PcItem("orphan sensor:", true,
readline.PcItemDynamic(SiteOCLICompleter, true)),
readline.PcItem("orphan device:", true,
readline.PcItemDynamic(SiteOCLICompleter, true))),

Expand Down Expand Up @@ -351,9 +348,6 @@ func GetPrefixCompleter() *readline.PrefixCompleter {
readline.PcItem("lspanel", true,
readline.PcItem("-r", false),
readline.PcItemDynamic(ListEntities, false)),
readline.PcItem("lssensor", true,
readline.PcItem("-r", false),
readline.PcItemDynamic(ListEntities, false)),
readline.PcItem("lsog", false),
readline.PcItem("print", false,
readline.PcItemDynamic(ListUserVars("", true), false)),
Expand Down
17 changes: 2 additions & 15 deletions CLI/controllers/commandController.go
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ func Help(entry string) {
path = "./other/man/var.md"

case "lsobj", "lsten", "lssite", "lsbldg", "lsroom", "lsrack",
"lsdev", "lsac", "lscorridor", "lspanel", "lssensor", "lscabinet":
"lsdev", "lsac", "lscorridor", "lspanel", "lscabinet":
path = "./other/man/lsobj.md"

default:
Expand Down Expand Up @@ -502,7 +502,7 @@ func CreateObject(path string, ent int, data map[string]interface{}) error {
data["description"] = []interface{}{}

//Retrieve Parent
if ent != models.SITE && ent != models.STRAY_DEV && ent != models.STRAYSENSOR {
if ent != models.SITE && ent != models.STRAY_DEV {
var err error
parent, err = PollObject(path)
if err != nil {
Expand Down Expand Up @@ -823,19 +823,6 @@ func CreateObject(path string, ent int, data map[string]interface{}) error {
groups := strings.Join(attr["content"].([]string), ",")
attr["content"] = groups

case models.STRAYSENSOR:
attr = data["attributes"].(map[string]interface{})
if _, ok := attr["template"]; ok {
//GetOCLIAtrributesTemplateHelper(attr, data, DEVICE)
tmpl, err := fetchTemplate(attr["template"].(string), models.STRAYSENSOR)
if err != nil {
return err
}
MergeMaps(attr, tmpl, true)
} else {
attr["template"] = ""
}

case models.STRAY_DEV:
attr = data["attributes"].(map[string]interface{})
if _, ok := attr["template"]; ok {
Expand Down
2 changes: 1 addition & 1 deletion CLI/controllers/ogree3d.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func (ogree3D *ogree3DPortImpl) Inform(caller string, entity int, data map[strin
// otherwise does nothing
func (ogree3D *ogree3DPortImpl) InformOptional(caller string, entity int, data map[string]interface{}) error {
if ogree3D.connection.IsConnected() {
if entity > -1 && entity < models.SENSOR+1 {
if entity > -1 && entity <= models.CORRIDOR {
data = GenerateFilteredJson(data)
}
if State.DebugLvl > INFO {
Expand Down
8 changes: 0 additions & 8 deletions CLI/models/entity.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ const (
PWRPNL
CABINET
CORRIDOR
SENSOR
ROOMTMPL
OBJTMPL
BLDGTMPL
GROUP
STRAY_DEV
STRAYSENSOR
DOMAIN
TAG
)
Expand Down Expand Up @@ -53,8 +51,6 @@ func EntityToString(entity int) string {
return "group"
case CORRIDOR:
return "corridor"
case SENSOR:
return "sensor"
case TAG:
return "tag"
default:
Expand Down Expand Up @@ -94,8 +90,6 @@ func EntityStrToInt(entity string) int {
return GROUP
case "corridor", "co":
return CORRIDOR
case "sensor", "sr":
return SENSOR
case "tag":
return TAG
default:
Expand Down Expand Up @@ -131,8 +125,6 @@ func GetParentOfEntity(ent int) int {
return -1
case CORRIDOR:
return ROOM
case SENSOR:
return -2
default:
return -3
}
Expand Down
1 change: 0 additions & 1 deletion CLI/other/man/lsobj.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ ac
cabinet
corridor
panel
sensor

The possible flags that can be supplied at this time are '-r' option for recursive ls, '-s' option for sorting results and '-f' for displaying results with their attributes. By default the ls{obj} commands will not be recursive and does no sorting etc.

Expand Down
8 changes: 0 additions & 8 deletions CLI/other/man/plus.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,6 @@ Where ... is any number of racks (which must be already existing) that you would
Where RACKN is the last rack (which must be already existing) that you would like to add


+ orphan sensor: NAME/OF/SENSOR @ TEMPLATE
User must specify the path, and TEMPLATE

Where TEMPLATE refers to the sensor template name (which must be already existing)


+ orphan device: NAME/OF/DEVICE @ TEMPLATE
User must specify the path, and TEMPLATE

Expand Down Expand Up @@ -204,6 +198,4 @@ EXAMPLES

+gr:BETA.A.R1.GroupG@{A01,A02,A03,A04}

+ orphan sensor: StraySensorDEMO @ SensorTemplateA

+ orphan device: StrayDevDEMO @ DEVICE1T
8 changes: 5 additions & 3 deletions CLI/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ import (

type parseCommandFunc func() node

var lsCommands = []string{"ls", "lssite", "lsbuilding", "lsroom", "lsrack", "lsdev", "lsac",
"lspanel", "lscabinet", "lscorridor", "lssensor"}
var lsCommands = []string{
"ls", "lssite", "lsbuilding", "lsroom",
"lsrack", "lsdev", "lsac",
"lspanel", "lscabinet", "lscorridor"}

var manCommands = []string{
"get", "getu", "getslot",
Expand All @@ -19,7 +21,7 @@ var manCommands = []string{
commands.Connect3D, "ui", "camera",
"link", "unlink",
"lssite", "lsbldg", "lsroom", "lsrack", "lsdev", "lsac",
"lspanel", "lscabinet", "lscorridor", "lssensor", "lsenterprise",
"lspanel", "lscabinet", "lscorridor", "lsenterprise",
"drawable", "draw", "undraw",
"tree", "lsog", "env", "cd", "pwd", "clear", "grep", "ls", "exit", "len", "man", "hc",
"print", "printf", "unset", "selection",
Expand Down

0 comments on commit d34682f

Please sign in to comment.