// Show runs the show action.
180201
func (c *StatusController) Show(ctx *app.ShowStatusContext) error {
	res := &app.Status{}
	res.Commit = Commit
	res.BuildTime = BuildTime
	res.StartTime = StartTime

	_, err := c.db.DB().Exec("select 1")
	if err != nil {
		var message string
		message = err.Error()
		res.Error = &message
		return ctx.ServiceUnavailable(res)
	}
	return ctx.OK(res)
}
244044
func (engine *Engine) ShowExecTime(show ...bool) {
	if len(show) == 0 {
		engine.TLogger.ETime.Disabled = false
	} else {
		engine.TLogger.ETime.Disabled = show[0] == false
	}
}
607367
func (v GifmsResource) Show(c buffalo.Context) error {
	// Get the DB connection from the context
	tx, ok := c.Value("tx").(*pop.Connection)
	if !ok {
		return errors.WithStack(errors.New("no transaction found"))
	}

	// Allocate an empty Gifm
	gifm := &models.Gifm{}

	// To find the Gifm the parameter gifm_id is used.
	if err := tx.Find(gifm, c.Param("gifm_id")); err != nil {
		return c.Error(404, err)
	}

	return c.Render(200, r.Auto(c, gifm))
}
684290
func Display(possible ...Cmd) {
	hint := randHint(possible)
	if hint != "" {
		ui.Hint(hint, false, nil)
	}
}
543526
func (c *SpaceTemplateController) Show(ctx *app.ShowSpaceTemplateContext) error {
	res := &app.SpaceTemplateSingle{}
	err := application.Transactional(c.db, func(appl application.Application) error {
		st, err := appl.SpaceTemplates().Load(ctx, ctx.SpaceTemplateID)
		if err != nil {
			log.Error(ctx, map[string]interface{}{
				"err":               err,
				"space_template_id": ctx.SpaceTemplateID,
			}, "failed to load space template")
			return err
		}
		return ctx.ConditionalRequest(*st, c.config.GetCacheControlSpaceTemplates, func() error {
			res.Data = ConvertSpaceTemplate(appl, ctx.Request, *st)
			return nil
		})
	})
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, err)
	}
	return ctx.OK(res)
}
942391
func (w *Window) Show() (err error) {
	if err = w.isActionable(); err != nil {
		return
	}
	_, err = synchronousEvent(w.c, w, w.w, Event{Name: EventNameWindowCmdShow, TargetID: w.id}, EventNameWindowEventShow)
	return
}
5759
func (c *WorkItemBoardController) Show(ctx *app.ShowWorkItemBoardContext) error {
	var board *workitem.Board
	err := application.Transactional(c.db, func(appl application.Application) error {
		b, err := appl.Boards().Load(ctx, ctx.BoardID)
		if err != nil {
			return errs.WithStack(err)
		}
		board = b
		return nil
	})
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, err)
	}
	res := &app.WorkItemBoardSingle{
		Data: ConvertBoardFromModel(ctx.Request, *board),
	}
	for _, column := range board.Columns {
		res.Included = append(res.Included, ConvertColumnsFromModel(ctx.Request, column))
	}
	return ctx.OK(res)
}
402386
func Display(d, xauthPath string) ServiceOption {
	return func(s *Service) error {
		if s.display != "" {
			return fmt.Errorf("service display already set: %v", s.display)
		}
		if s.xauthPath != "" {
			return fmt.Errorf("service xauth path already set: %v", s.xauthPath)
		}
		if !isDisplay(d) {
			return fmt.Errorf("supplied display %q must be of the format 'x' or 'x.y' where x and y are integers", d)
		}
		s.display = d
		s.xauthPath = xauthPath
		return nil
	}
}
303976
func (c *SearchController) Show(ctx *app.ShowSearchContext) error {
	offset, limit := computePagingLimits(ctx.PageOffset, ctx.PageLimit)
	// TODO: Keep URL registeration central somehow.
	hostString := ctx.Request.Host
	if hostString == "" {
		hostString = c.configuration.GetHTTPAddress()
	}
	urlRegexString := fmt.Sprintf("(?P<domain>%s)(?P<path>/work-item/list/detail/)(?P<id>\\d*)", hostString)
	search.RegisterAsKnownURL(search.HostRegistrationKeyForListWI, urlRegexString)
	urlRegexString = fmt.Sprintf("(?P<domain>%s)(?P<path>/work-item/board/detail/)(?P<id>\\d*)", hostString)
	search.RegisterAsKnownURL(search.HostRegistrationKeyForBoardWI, urlRegexString)

	if ctx.FilterExpression != nil {
		var result []workitem.WorkItem
		var count int
		var ancestors link.AncestorList
		var childLinks link.WorkItemLinkList
		err := application.Transactional(c.db, func(appl application.Application) error {
			var err error
			result, count, ancestors, childLinks, err = appl.SearchItems().Filter(ctx.Context, *ctx.FilterExpression, ctx.FilterParentexists, &offset, &limit)
			if err != nil {
				cause := errs.Cause(err)
				switch cause.(type) {
				case errors.BadParameterError:
					return goa.ErrBadRequest(fmt.Sprintf("error listing work items for expression '%s': %s", *ctx.FilterExpression, err))
				default:
					log.Error(ctx, map[string]interface{}{
						"err":               err,
						"filter_expression": *ctx.FilterExpression,
					}, "unable to list the work items")
					return goa.ErrInternal(fmt.Sprintf("unable to list the work items: %s", err))
				}
			}
			return nil

		})
		if err != nil {
			return jsonapi.JSONErrorResponse(ctx, err)
		}
		matchingWorkItemIDs := make(id.Slice, len(result))
		for i, wi := range result {
			matchingWorkItemIDs[i] = wi.ID
		}
		hasChildren := workItemIncludeHasChildren(ctx, c.db, childLinks)
		includeParent := includeParentWorkItem(ctx, ancestors, childLinks)
		// Load all work item types
		wits, err := loadWorkItemTypesFromArr(ctx.Context, c.db, result)
		if err != nil {
			return jsonapi.JSONErrorResponse(ctx, errs.Wrap(err, "failed to load work item types"))
		}

		wis, err := ConvertWorkItems(ctx.Request, wits, result, hasChildren, includeParent)
		if err != nil {
			return jsonapi.JSONErrorResponse(ctx, err)
		}
		response := app.SearchWorkItemList{
			Links: &app.PagingLinks{},
			Meta: &app.WorkItemListResponseMeta{
				TotalCount: count,
			},
			Data: wis,
		}
		err = c.enrichWorkItemList(ctx, ancestors, matchingWorkItemIDs, childLinks, &response, hasChildren) // append parentWI and ancestors (if not empty) in response
		if err != nil {
			return errs.Wrap(err, "failed to enrich work item list")
		}
		setPagingLinks(response.Links, buildAbsoluteURL(ctx.Request), len(result), offset, limit, count, "filter[expression]="+*ctx.FilterExpression)

		// Sort "data" by name or ID if no title given
		var data WorkItemPtrSlice = response.Data
		sort.Sort(data)
		response.Data = data

		// Sort work items in the "included" array by ID or title
		var included WorkItemInterfaceSlice = response.Included
		sort.Sort(included)
		response.Included = included

		// build up list of sorted ancestor IDs from already sorted work items
		ancestorIDs := ancestors.GetDistinctAncestorIDs().ToMap()
		sortedAncestorIDs := make(id.Slice, len(ancestorIDs))
		i := 0
		for _, wi := range response.Data {
			if len(ancestorIDs) <= 0 {
				break
			}
			_, ok := ancestorIDs[*wi.ID]
			if ok {
				sortedAncestorIDs[i] = *wi.ID
				i++
				delete(ancestorIDs, *wi.ID)
			}
		}
		for _, ifObj := range response.Included {
			if len(ancestorIDs) <= 0 {
				break
			}
			var wi *app.WorkItem
			switch v := ifObj.(type) {
			case app.WorkItem:
				wi = &v
			case *app.WorkItem:
				wi = v
			default:
				continue
			}
			_, ok := ancestorIDs[*wi.ID]
			if ok {
				sortedAncestorIDs[i] = *wi.ID
				i++
				delete(ancestorIDs, *wi.ID)
			}
		}
		response.Meta.AncestorIDs = sortedAncestorIDs
		return ctx.OK(&response)
	}
	var result []workitem.WorkItem
	var count int
	err := application.Transactional(c.db, func(appl application.Application) error {
		if ctx.Q == nil || *ctx.Q == "" {
			return goa.ErrBadRequest("empty search query not allowed")
		}
		var err error
		result, count, err = appl.SearchItems().SearchFullText(ctx.Context, *ctx.Q, &offset, &limit, ctx.SpaceID)
		if err != nil {
			log.Error(ctx, map[string]interface{}{
				"err":        err,
				"expression": *ctx.Q,
			}, "unable to list the work items")
			return errs.Wrapf(err, "unable to list the work items for expression: %s", *ctx.Q)
		}
		return nil
	})
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, err)
	}
	wits, err := loadWorkItemTypesFromArr(ctx.Context, c.db, result)
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, err)
	}
	wis, err := ConvertWorkItems(ctx.Request, wits, result)
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, err)
	}
	response := app.SearchWorkItemList{
		Links: &app.PagingLinks{},
		Meta:  &app.WorkItemListResponseMeta{TotalCount: count},
		Data:  wis,
	}
	setPagingLinks(response.Links, buildAbsoluteURL(ctx.Request), len(result), offset, limit, count, "q="+*ctx.Q)
	return ctx.OK(&response)
}
3318
func (c *FeaturesController) Show(ctx *app.ShowFeaturesContext) error {
	return proxy.RouteHTTP(ctx, c.config.GetTogglesServiceURL())
}
954159
func (f *FakeWatcher) Action(action EventType, obj runtime.Object) {
	f.result <- Event{action, obj}
}
296224
func (engine *Engine) ShowSQL(show ...bool) {
	engine.logger.ShowSQL(show...)
	if len(show) == 0 {
		engine.TLogger.SQL.Disabled = false
	} else {
		engine.TLogger.SQL.Disabled = show[0] == false
	}
}
948347
func (c *Client) ShowBottle(ctx context.Context, path string) (*http.Response, error) {
	req, err := c.NewShowBottleRequest(ctx, path)
	if err != nil {
		return nil, err
	}
	return c.Client.Do(ctx, req)
}
1127823
func (c *ResourceController) Show(ctx *app.ShowResourceContext) error {

	if !token.IsServiceAccount(ctx) {
		log.Error(ctx, map[string]interface{}{}, "Unable to read resource. Not a service account")
		return jsonapi.JSONErrorResponse(ctx, errors.NewUnauthorizedError("not a service account"))
	}

	svc := c.app.ResourceService()
	res, err := svc.Read(ctx, ctx.ResourceID)
	if err != nil {
		log.Error(ctx, map[string]interface{}{
			"resource_id": ctx.ResourceID,
		}, "unable to read resource")
		return jsonapi.JSONErrorResponse(ctx, err)
	}

	return ctx.OK(res)
}
1296990
func (topic *RelatedTopic) Show(prefix string) {
	topic.fshow(os.Stdout, prefix)
}
959894
func (s *Action) showHandleRevision(ctx context.Context, c *cli.Context, name, key, revision string) error {
	sec, err := s.Store.GetRevision(ctx, name, revision)
	if err != nil {
		return s.showHandleError(ctx, c, name, false, err)
	}

	return s.showHandleOutput(ctx, name, key, sec)
}
354987
func show(c context.Context, client *prpc.Client, name string) error {
	desc, err := loadDescription(c, client)
	if err != nil {
		return fmt.Errorf("could not load server description: %s", err)
	}

	if name == "" {
		for _, s := range desc.Services {
			fmt.Println(s)
		}
		return nil
	}

	file, obj, path := descutil.Resolve(desc.Description, name)
	if obj == nil {
		return fmt.Errorf("name %q could not resolved", name)
	}

	print := newPrinter(os.Stdout)
	if err := print.SetFile(file); err != nil {
		return err
	}

	switch obj := obj.(type) {

	case *descriptor.ServiceDescriptorProto:
		print.Service(obj, -1)

	case *descriptor.MethodDescriptorProto:
		serviceIndex, methodIndex := path[1], path[3]
		print.Service(file.Service[serviceIndex], methodIndex)

		printMsg := func(name string) error {
			name = strings.TrimPrefix(name, ".")
			file, msg, _ := descutil.Resolve(desc.Description, name)
			if msg == nil {
				print.Printf("// Message %q is not found\n", name)
				return nil
			}
			if err := print.SetFile(file); err != nil {
				return err
			}
			print.Message(msg.(*descriptor.DescriptorProto))
			return nil
		}

		print.Printf("\n")
		if err := printMsg(obj.GetInputType()); err != nil {
			return err
		}
		print.Printf("\n")
		if err := printMsg(obj.GetOutputType()); err != nil {
			return err
		}

	case *descriptor.DescriptorProto:
		print.Message(obj)

	case *descriptor.FieldDescriptorProto:
		print.Field(obj)

	case *descriptor.EnumDescriptorProto:
		print.Enum(obj)

	case *descriptor.EnumValueDescriptorProto:
		print.EnumValue(obj)

	default:
		return fmt.Errorf("object of type %T is not supported", obj)
	}

	return print.Err
}