package com.liangjian.dataplatform.member.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

/**
 * @Author: 黄子奇
 * @Date: 2019/9/20 15:34
 */
@Controller
@RequestMapping("/superset")
@Api(value = "接入管理superset的控制器", tags="Superset", description = "接入管理superset的控制器")
public class ImportSupersetController {
    @Value("${superseturl}")
    private String supersetUrl;

    @GetMapping("/try")
    public String trysuperset() {
        return "tryimportsuperset";
    }

    @GetMapping("/explore")
    @ApiOperation(value = "重定向获取superset图表",notes = "使用iframe的方式")
    public String expore(HttpServletRequest request){
        String queryString = request.getQueryString();
        String realUrl = supersetUrl+"/superset/explore?"+queryString;
        return "redirect:"+realUrl;
    }
}
