Skip to content

Commit

Permalink
Merge pull request #73 from macacajs/feat/tweak-layout-style
Browse files Browse the repository at this point in the history
feat: tweak layout style
  • Loading branch information
paradite authored Aug 6, 2019
2 parents 8ff5ba3 + be84838 commit 928f2b5
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 16 deletions.
6 changes: 4 additions & 2 deletions app/controller/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
const {
Controller,
} = require('egg');
const safeGet = require('lodash/get');

class HomeController extends Controller {
async index() {
const ctx = this.ctx;
const user = ctx.session.user;
const { appid, callbackUrl } = ctx.app.config.authorize.dingtalkAuth;
const { data: configRes } = await this.ctx.model.Config.findOne({ raw: true });
const siteConfig = await this.ctx.model.Config.findOne({ raw: true });
const assetsUrl = safeGet(siteConfig, 'data.site.assetsUrl');
ctx.body = await this.app.render({
dingtalkAuth: {
appid,
Expand All @@ -20,7 +22,7 @@ class HomeController extends Controller {
title: 'Reliable Suites for Macaca',
pageId: 'home',
SERVER_ADDRESS: this.config.reliableView.serverUrl,
assetsUrl: configRes.site && configRes.site.assetsUrl || this.config.reliableView.assetsUrl,
assetsUrl: assetsUrl || this.config.reliableView.assetsUrl,
version: this.app.config.pkg.version,
});
}
Expand Down
30 changes: 20 additions & 10 deletions test/app/controller/home.test.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
'use strict';

const { app, assert } = require('egg-mock/bootstrap');
const { app } = require('egg-mock/bootstrap');

describe('test/app/controller/home.test.js', () => {

it('assert keys', () => {
const pkg = require('../../../package.json');
assert(app.config.keys.startsWith(pkg.name));
});
describe('GET /', () => {
it('should be ok', () => {
return app.httpRequest()
.get('/')
.expect(/Reliable Suites for Macaca/)
.expect(200);
});

it('GET /', () => {
return app.httpRequest()
.get('/')
.expect(/Reliable Suites for Macaca/)
.expect(200);
it('should be ok with site config', async () => {
const ctx = app.mockContext();
await ctx.model.Config.create({
data: {
site: {
assetsUrl: 'https://foo',
},
},
});
return app.httpRequest()
.get('/');
});
});
});
4 changes: 2 additions & 2 deletions view/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "reliable-view",
"version": "1.0.6",
"version": "1.0.8",
"description": "view layer for Reliable",
"files": [
"public/*.js",
Expand Down Expand Up @@ -35,7 +35,7 @@
"@babel/preset-react": "^7.0.0",
"@babel/register": "^7.0.0",
"@babel/runtime": "^7.0.0",
"antd": "^3.6.1",
"antd": "^3.21.1",
"autoprefixer": "^9.1.0",
"awesome-clipboard": "^2.0.2",
"babel-loader": "^8.0.0",
Expand Down
4 changes: 3 additions & 1 deletion view/src/components/ReliableLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ export default class ReliableLayout extends React.Component {

render () {
return (
<Layout>
<Layout
style={{ minHeight: '100%' }}
>
{ !this.props.hideMenu && <SiderBar collapsed={this.state.collapsed} /> }
<Layout>
<Header
Expand Down
1 change: 0 additions & 1 deletion view/src/components/SiderBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export default class SiderBar extends React.Component {
trigger={null}
collapsible
width="200px"
style={{ minHeight: '100%' }}
collapsed={this.props.collapsed}
>
<div className="logo">
Expand Down

0 comments on commit 928f2b5

Please sign in to comment.