Skip to content

Commit

Permalink
make import functions of fabricClient uniformly
Browse files Browse the repository at this point in the history
Signed-off-by: Yi DENG <[email protected]>
  • Loading branch information
dengyi9 committed Mar 20, 2019
1 parent 3b7dfdc commit 246d7fb
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import LoadingLayout from './components/LoadingLayout';

import { getConfigDBSingleton } from './util/createDB';
// import generateYaml from './util/generateYaml';
// import getFabricClientSingleton from './util/fabric';
// import { getFabricClientSingleton } from './util/fabric';


const logger = require('electron-log');
Expand Down
2 changes: 1 addition & 1 deletion src/components/UserLayout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// TODO: 登录页(秘钥导入页面)
import React from 'react';
import { Button, Input, Layout, Icon, message } from 'antd';
import getFabricClientSingleton from '../util/fabric';
import { getFabricClientSingleton } from '../util/fabric';
import { getConfigDBSingleton } from '../util/createDB';


Expand Down
2 changes: 1 addition & 1 deletion src/components/content/ChaincodeInstallContent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import React from 'react';
import { Button, Form, Input, Modal, Menu, Dropdown, Icon, Select, Tag, message } from 'antd';
import getFabricClientSingleton from '../../util/fabric';
import { getFabricClientSingleton } from '../../util/fabric';

const logger = require('electron-log');

Expand Down
2 changes: 1 addition & 1 deletion src/components/content/ChaincodeInvokeContent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import React from 'react';
import { Button, Input, Select, Radio, message, Modal, Icon, Tag, Tooltip } from 'antd';
import getFabricClientSingleton from '../../util/fabric';
import { getFabricClientSingleton } from '../../util/fabric';

const logger = require('electron-log');
const path = require('path');
Expand Down
2 changes: 1 addition & 1 deletion src/components/content/ChannelManangeContent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { Button, message, Input, Icon, Tooltip } from 'antd';
import getFabricClientSingleton from '../../util/fabric';
import { getFabricClientSingleton } from '../../util/fabric';
import { copyDir, copyFile, deleteDir } from '../../util/tools';

const path = require('path');
Expand Down
2 changes: 1 addition & 1 deletion src/components/content/DataContent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import React from 'react';
import { Col, Row, Table, Modal, Select, message } from 'antd';
import { getQueryBlockSingleton, deleteQueryBlockSingleton } from '../../util/queryBlock';
import getFabricClientSingleton from '../../util/fabric';
import { getFabricClientSingleton } from '../../util/fabric';

const logger = require('electron-log');

Expand Down
5 changes: 1 addition & 4 deletions src/util/fabric.js
Original file line number Diff line number Diff line change
Expand Up @@ -835,11 +835,8 @@ export function getFabricClientSingletonHelper(dbConfig) {
return Promise.resolve(__fabricClient);
}

// TODO: 考虑是否去除export default,全部使用export。
// 由此保证import无需再区分 import something from 'lib' 与 import {something} from 'lib'

// FabricClient单例模式。后续考虑优化为多套身份,多个client
export default function getFabricClientSingleton() {
export function getFabricClientSingleton() {
return getFabricClientSingletonHelper(db);
}

Expand Down
2 changes: 1 addition & 1 deletion src/util/queryBlock.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2018 The hyperledger-fabric-desktop Authors. All rights reserved.

import { getBlockDBSingleton } from './createDB';
import getFabricClientSingleton from './fabric';
import { getFabricClientSingleton } from './fabric';

const db = getBlockDBSingleton();

Expand Down
2 changes: 1 addition & 1 deletion test/util/fabric.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright 2019 The hyperledger-fabric-desktop Authors. All rights reserved.
import { getFabricClientSingletonHelper, deleteFabricClientSingleton} from '../../src/util/fabric';
import { getFabricClientSingletonHelper, deleteFabricClientSingleton } from '../../src/util/fabric';

const { execSync } = require('child_process');
const logger = require('electron-log');
Expand Down

0 comments on commit 246d7fb

Please sign in to comment.