本文整理汇总了Golang中github.com/evergreen-ci/evergreen/plugin.PanelManager.Includes方法的典型用法代码示例。如果您正苦于以下问题:Golang PanelManager.Includes方法的具体用法?Golang PanelManager.Includes怎么用?Golang PanelManager.Includes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/evergreen-ci/evergreen/plugin.PanelManager
的用法示例。
在下文中一共展示了PanelManager.Includes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: getPluginDataAndHTML
// getPluginDataAndHTML returns all data needed to properly render plugins
// for a page. It logs errors but does not return them, as plugin errors
// cannot stop the rendering of the rest of the page
func getPluginDataAndHTML(pluginManager plugin.PanelManager, page plugin.PageScope, ctx plugin.UIContext) pluginData {
includes, err := pluginManager.Includes(page)
if err != nil {
evergreen.Logger.Errorf(
slogger.ERROR, "error getting include html from plugin manager on %v page: %v",
page, err)
}
panels, err := pluginManager.Panels(page)
if err != nil {
evergreen.Logger.Errorf(
slogger.ERROR, "error getting panel html from plugin manager on %v page: %v",
page, err)
}
data, err := pluginManager.UIData(ctx, page)
if err != nil {
evergreen.Logger.Errorf(slogger.ERROR, "error getting plugin data on %v page: %v",
page, err)
}
return pluginData{includes, panels, data}
}
示例2: TestPanelManagerRetrieval
func TestPanelManagerRetrieval(t *testing.T) {
var ppm plugin.PanelManager
Convey("With a simple plugin panel manager", t, func() {
ppm = &plugin.SimplePanelManager{}
Convey("and a registered set of test plugins with panels", func() {
// These 3 plugins exist to check the sort output of the manager.
// For consistency, plugin panels and includes are ordered by plugin name
// and then by the order of their declaration in the Panels array.
// This test asserts that the panels in A come before B which come
// before C, even though they are not in the plugin array in that order.
testPlugins := []plugin.Plugin{
&MockUIPlugin{
NickName: "A_the_first_letter",
Conf: &plugin.PanelConfig{
Panels: []plugin.UIPanel{
{
Page: plugin.TaskPage,
Position: plugin.PageCenter,
Includes: []template.HTML{
"0",
"1",
},
PanelHTML: "0",
DataFunc: func(context plugin.UIContext) (interface{}, error) {
return 1000, nil
},
},
{
Page: plugin.TaskPage,
Position: plugin.PageCenter,
Includes: []template.HTML{
"2",
"3",
},
PanelHTML: "1",
},
{
Page: plugin.TaskPage,
Position: plugin.PageLeft,
Includes: []template.HTML{
"4",
},
PanelHTML: "X",
},
},
},
},
&MockUIPlugin{
NickName: "C_the_third_letter",
Conf: &plugin.PanelConfig{
Panels: []plugin.UIPanel{
{
Page: plugin.TaskPage,
Position: plugin.PageCenter,
Includes: []template.HTML{
"7",
"8",
},
PanelHTML: "3",
DataFunc: func(context plugin.UIContext) (interface{}, error) {
return 2112, nil
},
},
},
},
},
&MockUIPlugin{
NickName: "B_the_middle_letter",
Conf: &plugin.PanelConfig{
Panels: []plugin.UIPanel{
{
Page: plugin.TaskPage,
Position: plugin.PageCenter,
Includes: []template.HTML{
"5",
},
PanelHTML: "2",
DataFunc: func(context plugin.UIContext) (interface{}, error) {
return 1776, nil
},
},
{
Page: plugin.TaskPage,
Position: plugin.PageLeft,
Includes: []template.HTML{
"6",
},
PanelHTML: "Z",
},
},
},
},
}
err := ppm.RegisterPlugins(testPlugins)
So(err, ShouldBeNil)
Convey("retrieved includes for the task page should be in correct "+
//.........这里部分代码省略.........