func (this *TemplatesDetailController) List(serviceId int64) {
	service := entity.Service{}
	service.Id = serviceId
	service.Load()

	template, errs := entity.LoadTemplateList(serviceId)
	this.Data["Template"] = template

	if errs != nil {
		this.Data["MessageErr"] = fmt.Sprintf("Errors: %s", errs)
	}

	component, componenterrors := entity.LoadComponentList(serviceId)

	this.Data["Component"] = component
	if componenterrors != nil {
		this.Data["MessageErr"] = fmt.Sprintf("Errors: %s", componenterrors)
	}

	if service.Where == utils.Deploy_On_Vms {
		operation := entity.Operation{}
		operation.Sid = serviceId
		operationerrors := operation.LoadBySid()

		this.Data["Operation"] = operation
		if operationerrors != nil {
			this.Data["MessageErr"] = fmt.Sprintf("Errors: %s", operationerrors)
		}
	}
	this.TplName = "templates/index_detail.tpl"
}
// parse template 2 file
func (servicedDeploy *ServiceDeployWebSocketController) ParseTemplate(ws *websocket.Conn, service entity.Service) bool {

	writeStringMessage(ws, "Load templateList")

	template, templateLoadErr := entity.LoadTemplateList(service.Id)

	if templateLoadErr != nil {
		writeStringMessage(ws, fmt.Sprintf("Error,%s", templateLoadErr))
		return false
	}
	writeStringMessage(ws, "Load componentList")
	component, componentErr := entity.LoadComponentList(service.Id)

	if componentErr != nil {
		writeStringMessage(ws, fmt.Sprintf("Error,%s", componentErr))
		return false
	}
	writeStringMessage(ws, "Parse template")

	data := make(map[string]string)

	if len(component) > 0 {
		for _, item := range component {
			data[item.Name] = item.Value
		}
	}

	for _, templatefile := range template {
		if templatefile.FileType == utils.FileTypes_Template {
			if templatefile.TargetFile == "" {
				writeStringMessage(ws, fmt.Sprintf("%s TargetFile is null,please set the value", templatefile.Name))
			}
			if templatefile.TemplateFile == "" {
				writeStringMessage(ws, fmt.Sprintf("%s TemplateFile is null,please set the value", templatefile.Name))
			}
			result, err := utils.ParseTemplateFile2File(templatefile.TargetFile, data, templatefile.TemplateFile)
			if !result {
				writeStringMessage(ws, fmt.Sprintf("Error,%s", err))
				return result
			}
		}
	}
	writeStringMessage(ws, "Parse template successful")
	return true
}