@Get detail info of plugins @Description GET /plugininfo @Description RETURN SAMPLE @Tags framework/plugininfo @Success 200 @Failure 400 {string} errcode.Error "Bad Request" @Router /plugininfo [get]
(c *gin.Context)
| 151 | // @Failure 400 {string} errcode.Error "Bad Request" |
| 152 | // @Router /plugininfo [get] |
| 153 | func Get(c *gin.Context) { |
| 154 | info := NewTotalInfo() |
| 155 | |
| 156 | // set the domain layer tables info. |
| 157 | domaininfo := domaininfo.GetDomainTablesInfo() |
| 158 | for _, table := range domaininfo { |
| 159 | tableInfo := NewTableInfos(table) |
| 160 | info.DomainInfos = append(info.DomainInfos, tableInfo) |
| 161 | } |
| 162 | |
| 163 | // plugin info |
| 164 | err := plugin.TraversalPlugin(func(name string, p plugin.PluginMeta) errors.Error { |
| 165 | infoPlugin := NewPluginInfo() |
| 166 | info.PluginInfos = append(info.PluginInfos, infoPlugin) |
| 167 | |
| 168 | // plugin name and description |
| 169 | infoPlugin.Name = name |
| 170 | infoPlugin.Description = p.Description() |
| 171 | |
| 172 | // if this plugin has the plugin task info |
| 173 | if pt, ok := p.(plugin.PluginTask); ok { |
| 174 | infoPlugin.TaskMeta = CreateSubTaskMeta(pt.SubTaskMetas()) |
| 175 | } |
| 176 | |
| 177 | // if this plugin has the plugin model info |
| 178 | if pm, ok := p.(plugin.PluginModel); ok { |
| 179 | tables := pm.GetTablesInfo() |
| 180 | for _, table := range tables { |
| 181 | TableInfos := NewTableInfos(table) |
| 182 | infoPlugin.Tables = append(infoPlugin.Tables, TableInfos) |
| 183 | } |
| 184 | } |
| 185 | |
| 186 | return nil |
| 187 | }) |
| 188 | |
| 189 | if err != nil { |
| 190 | shared.ApiOutputError(c, errors.Default.Wrap(err, "error getting plugin info of plugins")) |
| 191 | } |
| 192 | |
| 193 | shared.ApiOutputSuccess(c, info, http.StatusOK) |
| 194 | } |
| 195 | |
| 196 | // @Get name list of plugins |
| 197 | // @Description GET /plugins |
nothing calls this directly
no test coverage detected