diff --git a/api/rates.go b/api/rates.go index 15f3bbf67c..104948a702 100644 --- a/api/rates.go +++ b/api/rates.go @@ -15,20 +15,3 @@ func (r Rates) Current(now time.Time) (Rate, error) { return Rate{}, errors.New("no matching rate") } - -// implement sort.Interface -func (r Rates) Len() int { - return len(r) -} - -func (r Rates) Less(i, j int) bool { - if r[i].Price == r[j].Price { - return r[i].Start.After(r[j].Start) - } - - return r[i].Price < r[j].Price -} - -func (r Rates) Swap(i, j int) { - r[i], r[j] = r[j], r[i] -} diff --git a/api/rates_test.go b/api/rates_test.go deleted file mode 100644 index 82eb176f4c..0000000000 --- a/api/rates_test.go +++ /dev/null @@ -1,29 +0,0 @@ -package api - -import ( - "sort" - "testing" - "time" - - "github.com/benbjohnson/clock" - "github.com/stretchr/testify/assert" -) - -func TestRatesSortLateSlotsFirst(t *testing.T) { - clock := clock.NewMock() - - r := Rates{ - { - Price: 1, - Start: clock.Now(), - }, - { - Price: 1, - Start: clock.Now().Add(time.Hour), - }, - } - - sort.Sort(r) - assert.Equal(t, clock.Now().Add(time.Hour), r[0].Start) - assert.Equal(t, clock.Now(), r[1].Start) -} diff --git a/assets/css/app.css b/assets/css/app.css index 3f5a29c751..031cc49e0a 100644 --- a/assets/css/app.css +++ b/assets/css/app.css @@ -160,6 +160,7 @@ a:hover { color: inherit !important; background-color: inherit !important; border-color: inherit !important; + opacity: 0.2; } .btn-outline-primary, diff --git a/assets/js/components/Loadpoint.vue b/assets/js/components/Loadpoint.vue index a490dbabec..8520041b54 100644 --- a/assets/js/components/Loadpoint.vue +++ b/assets/js/components/Loadpoint.vue @@ -155,9 +155,9 @@ export default { vehicleFeatureOffline: Boolean, vehicles: Array, minSoc: Number, + planActive: Boolean, + planProjectedStart: String, targetTime: String, - targetTimeActive: Boolean, - targetTimeProjectedStart: String, vehicleProviderLoggedIn: Boolean, vehicleProviderLoginPath: String, vehicleProviderLogoutPath: String, @@ -256,10 +256,10 @@ export default { api.post(this.apiPath("mode") + "/" + mode); }, setTargetSoc: function (soc) { - api.post(this.apiPath("targetsoc") + "/" + soc); + api.post(this.apiPath("target/soc") + "/" + soc); }, setTargetEnergy: function (kWh) { - api.post(this.apiPath("targetenergy") + "/" + kWh); + api.post(this.apiPath("target/energy") + "/" + kWh); }, setMaxCurrent: function (maxCurrent) { api.post(this.apiPath("maxcurrent") + "/" + maxCurrent); @@ -274,10 +274,10 @@ export default { api.post(this.apiPath("minsoc") + "/" + soc); }, setTargetTime: function (date) { - api.post(`${this.apiPath("targetcharge")}/${this.targetSoc}/${date.toISOString()}`); + api.post(`${this.apiPath("target/time")}/${date.toISOString()}`); }, removeTargetTime: function () { - api.delete(this.apiPath("targetcharge")); + api.delete(this.apiPath("target/time")); }, changeVehicle(index) { api.post(this.apiPath("vehicle") + `/${index}`); diff --git a/assets/js/components/TargetCharge.vue b/assets/js/components/TargetCharge.vue index d1766014e2..c761b61ed4 100644 --- a/assets/js/components/TargetCharge.vue +++ b/assets/js/components/TargetCharge.vue @@ -43,10 +43,23 @@