Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v2.10.4 #109

Merged
merged 6 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.10.4] - 2024-08-26
### Changed
- Based on data coming back from LaundryView, uiuc laundry adapter now reutrns unknown as a status when the machine is offline and the out for service flag is 0. [#107]https://github.com/rokwire/gateway-building-block/issues/107

## [2.10.3] - 2024-06-28
### Changed
- Added markers and highlites parameters to floor plans endpoint to allow client to set default state. [#103](https://github.com/rokwire/gateway-building-block/issues/103)

## [2.10.2] - 2024-06-27
### Fixed
- Populate building number in wayfinding building end points [#100](https://github.com/rokwire/gateway-building-block/issues/100)
Expand Down
4 changes: 2 additions & 2 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
Patches for **Gateway Building Block** in this repository will only be applied to the following versions:
| Version | Supported |
| ------- | ------------------ |
| 2.10.2 | :white_check_mark: |
| < 2.10.2 | :x: |
| 2.10.4 | :white_check_mark: |
| < 2.10.4 | :x: |

## Reporting a Bug or Vulnerability

Expand Down
4 changes: 2 additions & 2 deletions core/apis_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,10 @@ func (a appClient) GetSuccessTeam(uin string, unitid string, accesstoken string)

}

func (a appClient) GetFloorPlan(buildingnumber string, floornumber string) (*model.FloorPlan, int, error) {
func (a appClient) GetFloorPlan(buildingnumber string, floornumber string, markers string, highlites string) (*model.FloorPlan, int, error) {
conf, _ := a.app.GetEnvConfigs()

retData, err := a.LocationAdapter.GetFloorPlan(buildingnumber, floornumber, conf)
retData, err := a.LocationAdapter.GetFloorPlan(buildingnumber, floornumber, markers, highlites, conf)
if err != nil {
return nil, 500, err
}
Expand Down
4 changes: 2 additions & 2 deletions core/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ type Client interface {
GetSuccessTeam(uin string, unitid string, accessToken string) (*model.SuccessTeam, int, error)
GetPrimaryCareProvider(uin string, accessToken string) (*[]model.SuccessTeamMember, int, error)
GetAcademicAdvisors(uin string, unitid string, accessToken string) (*[]model.SuccessTeamMember, int, error)
GetFloorPlan(buildingnumber string, floornumber string) (*model.FloorPlan, int, error)
GetFloorPlan(buildingnumber string, floornumber string, markers string, highlites string) (*model.FloorPlan, int, error)
SearchBuildings(bldgName string, returnCompact bool) (*map[string]any, error)
}

Expand Down Expand Up @@ -186,7 +186,7 @@ type WayFinding interface {
GetEntrance(bldgID string, adaAccessibleOnly bool, latitude float64, longitude float64, conf *model.EnvConfigData) (*model.Entrance, error)
GetBuildings(conf *model.EnvConfigData) (*[]model.Building, error)
GetBuilding(bldgID string, adaAccessibleOnly bool, latitude float64, longitude float64, conf *model.EnvConfigData) (*model.Building, error)
GetFloorPlan(bldgNum string, floornumber string, conf *model.EnvConfigData) (*model.FloorPlan, error)
GetFloorPlan(bldgNum string, floornumber string, markers string, highlites string, conf *model.EnvConfigData) (*model.FloorPlan, error)
}

// Appointments represents the adapter needed to interace with various appoinment data providers
Expand Down
2 changes: 1 addition & 1 deletion core/model/uiuc/buildingdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func NewFloorPlan(fp CampusFloorPlan) *model.FloorPlan {
}
for j := 0; j < len(fp.Highlites); j++ {
newfp.Highlites = append(newfp.Highlites, model.FloorPlanHighlite{RenderID: fp.Highlites[j].RenderID, Label: fp.Highlites[j].Label, Color: fp.Highlites[j].Color,
Display: fp.Markers[j].Display})
Display: fp.Highlites[j].Display})
}
return &newfp
}
Expand Down
12 changes: 9 additions & 3 deletions core/model/uiuc/laundryview.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,25 @@ func NewLaundryRoom(id int, name string, status string, location *model.LaundryD
}

// NewAppliance returns an app formatted appliance ojbect from campus data
func NewAppliance(id string, appliancetype string, cycletime int, status string, timeremaining string, label string) *model.Appliance {
func NewAppliance(id string, appliancetype string, cycletime int, status string, timeremaining string, label string, outofserviceflag string) *model.Appliance {

var finalStatus string
switch status {
case "Available":
finalStatus = "available"
case "In Use":
finalStatus = "in_use"
case "Offline":
if outofserviceflag == "1" {
finalStatus = "out_of_service"
} else {
finalStatus = "unknown"
}
default:
finalStatus = "out_of_service"
finalStatus = "unknown"
}

if finalStatus == "available" || finalStatus == "out_of_service" {
if finalStatus == "available" || finalStatus == "out_of_service" || finalStatus == "unknown" {
appl := model.Appliance{ID: id, ApplianceType: appliancetype, AverageCycleTime: cycletime, Status: finalStatus, Label: label}
return &appl
}
Expand Down
2 changes: 1 addition & 1 deletion driven/uiucadapters/laundryadapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func (lv *CSCLaundryView) GetLaundryRoom(roomid string, conf *model.EnvConfigDat

for i, appl := range lr.Appliances {
avgCycle, _ := strconv.Atoi(appl.AvgCycleTime)
rd.Appliances[i] = uiuc.NewAppliance(appl.ApplianceKey, appl.ApplianceType, avgCycle, appl.Status, appl.TimeRemaining, appl.Label)
rd.Appliances[i] = uiuc.NewAppliance(appl.ApplianceKey, appl.ApplianceType, avgCycle, appl.Status, appl.TimeRemaining, appl.Label, appl.OutOfService)
}

if len(lv.laundryAssets) > 0 {
Expand Down
17 changes: 15 additions & 2 deletions driven/uiucadapters/wayfindingadapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,24 @@ func (uwf *UIUCWayFinding) GetBuilding(bldgID string, adaAccessibleOnly bool, la
}

// GetFloorPlan returns the requested floor plan
func (uwf *UIUCWayFinding) GetFloorPlan(bldgNum string, floornumber string, conf *model.EnvConfigData) (*model.FloorPlan, error) {
func (uwf *UIUCWayFinding) GetFloorPlan(bldgNum string, floornumber string, markers string, highlites string, conf *model.EnvConfigData) (*model.FloorPlan, error) {
apiURL := conf.WayFindingURL
apikey := conf.WayFindingKey

reqParams := "?"
url := apiURL + "/floorplans/number/" + bldgNum + "/floor/" + floornumber
if markers != "" {
reqParams += "render_markers=" + markers
if highlites != "" {
reqParams += "&"
}
}

if highlites != "" {
reqParams += "render_highlites=" + highlites
}
if reqParams != "?" {
url += reqParams
}

uiucfp, err := uwf.getFloorPlanData(url, apikey)
if err != nil {
Expand Down
12 changes: 11 additions & 1 deletion driver/web/apis_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,9 @@ func (h ClientAPIsHandler) searchBuildings(l *logs.Log, r *http.Request, claims
func (h ClientAPIsHandler) getFloorPlan(l *logs.Log, r *http.Request, claims *tokenauth.Claims) logs.HTTPResponse {
bldgid := ""
floor := ""
markers := "on"
highlites := "on"

reqParams := utils.ConstructFilter(r)

for _, v := range reqParams.Items {
Expand All @@ -310,6 +313,13 @@ func (h ClientAPIsHandler) getFloorPlan(l *logs.Log, r *http.Request, claims *to
if v.Field == "floor" {
floor = v.Value[0]
}
if v.Field == "markers" {
markers = v.Value[0]
}

if v.Field == "highlites" {
highlites = v.Value[0]
}
}
if bldgid == "" || bldgid == "nil" {
return l.HTTPResponseErrorData(logutils.StatusInvalid, logutils.TypeQueryParam, logutils.StringArgs("bldgid"), nil, http.StatusBadRequest, false)
Expand All @@ -318,7 +328,7 @@ func (h ClientAPIsHandler) getFloorPlan(l *logs.Log, r *http.Request, claims *to
if floor == "" || floor == "nil" {
return l.HTTPResponseErrorData(logutils.StatusInvalid, logutils.TypeQueryParam, logutils.StringArgs("floor"), nil, http.StatusBadRequest, false)
}
fp, _, err := h.app.Client.GetFloorPlan(bldgid, floor)
fp, _, err := h.app.Client.GetFloorPlan(bldgid, floor, markers, highlites)

if err != nil {
return l.HTTPResponseErrorAction(logutils.ActionGet, model.TypeFloorPlan, nil, err, http.StatusInternalServerError, true)
Expand Down
2 changes: 1 addition & 1 deletion driver/web/docs/gen/def.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ openapi: 3.0.3
info:
title: Rokwire Gateway Building Block API
description: Gateway Building Block API Documentation
version: 2.10.2
version: 2.10.4
servers:
- url: 'https://api.rokwire.illinois.edu/gateway'
description: Production server
Expand Down
2 changes: 1 addition & 1 deletion driver/web/docs/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ openapi: 3.0.3
info:
title: Rokwire Gateway Building Block API
description: Gateway Building Block API Documentation
version: 2.10.2
version: 2.10.4
servers:
- url: 'https://api.rokwire.illinois.edu/gateway'
description: Production server
Expand Down
Loading