Differentiate between installed and activated states for plugins (#7706)

Этот коммит содержится в:
Joram Wilander
2017-10-25 08:17:17 -04:00
коммит произвёл GitHub
родитель 9c0575ce6e
Коммит 16b845c0d7
11 изменённых файлов: 406 добавлений и 49 удалений

31
model/plugins_response.go Обычный файл
Просмотреть файл

@@ -0,0 +1,31 @@
package model
import (
"encoding/json"
"io"
)
type PluginsResponse struct {
Active []*Manifest `json:"active"`
Inactive []*Manifest `json:"inactive"`
}
func (m *PluginsResponse) ToJson() string {
b, err := json.Marshal(m)
if err != nil {
return ""
} else {
return string(b)
}
}
func PluginsResponseFromJson(data io.Reader) *PluginsResponse {
decoder := json.NewDecoder(data)
var m PluginsResponse
err := decoder.Decode(&m)
if err == nil {
return &m
} else {
return nil
}
}