@@ -24,6 +24,7 @@ import (
2424 "github.com/go-chi/render"
2525 "gopkg.in/yaml.v3"
2626
27+ "github.com/TencentBlueKing/bk-bscp/internal/criteria/constant"
2728 "github.com/TencentBlueKing/bk-bscp/pkg/dal/table"
2829 "github.com/TencentBlueKing/bk-bscp/pkg/kit"
2930 "github.com/TencentBlueKing/bk-bscp/pkg/logs"
@@ -69,11 +70,11 @@ func (s *variableService) ExportGlobalVariables(w http.ResponseWriter, r *http.R
6970
7071 outData := variablesToOutData (vs )
7172 switch format {
72- case "yaml" :
73+ case constant . YamlFormat :
7374 exporter = & YAMLVariableExporter {OutData : outData }
7475 w .Header ().Set ("Content-Disposition" , fmt .Sprintf ("attachment; filename=%d_global_variable.yaml" , kt .BizID ))
7576 w .Header ().Set ("Content-Type" , "application/x-yaml" )
76- case "json" :
77+ case constant . JsonFormat :
7778 exporter = & JSONVariableExporter {OutData : outData }
7879 w .Header ().Set ("Content-Type" , "application/json" )
7980 w .Header ().Set ("Content-Disposition" , fmt .Sprintf ("attachment; filename=%d_global_variable.json" , kt .BizID ))
@@ -124,12 +125,12 @@ func (s *variableService) ExportAppVariables(w http.ResponseWriter, r *http.Requ
124125
125126 outData := variablesToOutData (vars .Details )
126127 switch format {
127- case "yaml" :
128+ case constant . YamlFormat :
128129 exporter = & YAMLVariableExporter {OutData : outData }
129130 w .Header ().Set ("Content-Disposition" , fmt .Sprintf ("attachment; filename=%d_%s_variable.yaml" ,
130131 kt .BizID , app .Spec .Name ))
131132 w .Header ().Set ("Content-Type" , "application/x-yaml" )
132- case "json" :
133+ case constant . JsonFormat :
133134 exporter = & JSONVariableExporter {OutData : outData }
134135 w .Header ().Set ("Content-Type" , "application/json" )
135136 w .Header ().Set ("Content-Disposition" , fmt .Sprintf ("attachment; filename=%d_%s_variable.json" ,
@@ -193,12 +194,12 @@ func (s *variableService) ExportReleasedAppVariables(w http.ResponseWriter, r *h
193194
194195 outData := variablesToOutData (vars .Details )
195196 switch format {
196- case "yaml" :
197+ case constant . YamlFormat :
197198 exporter = & YAMLVariableExporter {OutData : outData }
198199 w .Header ().Set ("Content-Disposition" , fmt .Sprintf ("attachment; filename=%d_%s_%s_variable.yaml" ,
199200 kt .BizID , app .Spec .Name , rel .Spec .Name ))
200201 w .Header ().Set ("Content-Type" , "application/x-yaml" )
201- case "json" :
202+ case constant . JsonFormat :
202203 exporter = & JSONVariableExporter {OutData : outData }
203204 w .Header ().Set ("Content-Type" , "application/json" )
204205 w .Header ().Set ("Content-Disposition" , fmt .Sprintf ("attachment; filename=%d_%s_%s_variable.json" ,
0 commit comments