解决airpal的数据预览问题
airpal可以形成一个系列了。airpal默认是可以预览数据的。但加上用户对应的权限表之后,数据预览就不见了。
解决这个问题的环境:
intellij 15
chrmoe
远程debug
解决思路:
1.刚开始怀疑是前端的问题,通过chrome的inspect发现有数据返回与没数据返回所调用类是不一样,于是找到airpal.css.
render() {
if( !_.isEmpty(this.state.table) ) { return this._renderMetaData(); } else { return this._renderEmptyMessage(); } }, /* Internal Helpers ------------------------------------------------------- */ _renderEmptyMessage() { return ( <div className="alert alert-warning"> <p>There is no table selected. Please select a table to view the meta data.</p> </div> ) },
于是把判断条件由&& 改为||,就算没结果集也返回数据库的字段,但这不符合bi的需求,于是排除前端的问题。
2.远程debug
一步一步debug,从用户加载到执行sql,终于发现一个子sql执行出错了。
是这条导致没有数据返回,怎么改?从最容易的下手
由于是配了权限不够导致出错了,那好办,权限配置是采用shiro,给权限配一个并集的组合。编译,测试,数据预览出来了。