diff --git a/Makefile b/Makefile index a1bfaf261..b1493d078 100755 --- a/Makefile +++ b/Makefile @@ -184,7 +184,7 @@ check: ##@Code Check code format find ./docs -type f -name "*.md" -exec egrep -l " +$$" {} \; cd src/api-engine && tox && cd ${ROOT_PATH} make docker - API_ENGINE_SSO_AUTH_URL=http://keycloak:8080/auth/ NEXT_VERSION=True SERVER_PUBLIC_IP=127.0.0.1 MODE=dev make start + NEXT_VERSION=True MODE=dev make start sleep 10 make test-api NEXT_VERSION=True MODE=dev make stop diff --git a/build_image/docker/baseimage/Dockerfile.in b/build_image/docker/baseimage/Dockerfile.in deleted file mode 100644 index 0b6fa605b..000000000 --- a/build_image/docker/baseimage/Dockerfile.in +++ /dev/null @@ -1,10 +0,0 @@ -FROM _DOCKER_BASE_ -COPY build_image/docker/baseimage /tmp/baseimage -RUN cd /tmp/baseimage && \ - bash install.sh && \ -rm -rf /tmp/baseimage -COPY src/operator-dashboard /app -RUN cd /app/ && \ - pip install -r requirements.txt && \ - rm -rf /tmp/cello -WORKDIR /app diff --git a/build_image/docker/baseimage/install.sh b/build_image/docker/baseimage/install.sh deleted file mode 100644 index c83313932..000000000 --- a/build_image/docker/baseimage/install.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -set -x -# -# Copyright IBM Corp. All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# -# Based thie file on https://github.com/docker-library/mongo/blob/master/3.4/Dockerfile & -# https://docs.mongodb.com/manual/tutorial/install-mongodb-enterprise-on-ubuntu/#install-mongodb-enterprise - -set -x \ - && apt-get update && apt-get install -y supervisor gettext-base && rm -rf /var/lib/apt/lists/* diff --git a/build_image/docker/engine/Dockerfile.in b/build_image/docker/engine/Dockerfile.in deleted file mode 100644 index 144b03c30..000000000 --- a/build_image/docker/engine/Dockerfile.in +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright IBM Corp, All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# -FROM _NS_/cello-baseimage:_TAG_ - -# use this in development -CMD ["python", "restserver.py"] - -# use this in product -#CMD ["gunicorn", "-w", "128", "-b", "0.0.0.0:80", "restserver:app"] - diff --git a/build_image/docker/mongo/Dockerfile.in b/build_image/docker/mongo/Dockerfile.in deleted file mode 100644 index eb35db9f7..000000000 --- a/build_image/docker/mongo/Dockerfile.in +++ /dev/null @@ -1,11 +0,0 @@ -FROM _NS_/cello-baseimage:_TAG_ - -COPY mongo/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh - -VOLUME /data/db /data/configdb - -RUN ln -s usr/local/bin/docker-entrypoint.sh /entrypoint.sh # backwards compat -ENTRYPOINT ["docker-entrypoint.sh"] - -EXPOSE 27017 -CMD ["mongod"] diff --git a/build_image/docker/operator-dashboard/Dockerfile.in b/build_image/docker/operator-dashboard/Dockerfile.in deleted file mode 100644 index c270f22da..000000000 --- a/build_image/docker/operator-dashboard/Dockerfile.in +++ /dev/null @@ -1,9 +0,0 @@ -FROM hyperledger/cello-baseimage:latest - -COPY src/operator-dashboard /app -COPY src/operator-dashboard/celery.conf /etc/supervisor/conf.d/ -RUN cd /app/ && \ - pip install -r requirements.txt && \ - rm -rf /tmp/cello - -CMD /etc/init.d/supervisor start && bash /app/init_client_secrets.sh && if [ "$DEBUG" = "True" ]; then python dashboard.py ; else gunicorn -w 1 --worker-class eventlet -b 0.0.0.0:8080 dashboard:app ;fi diff --git a/build_image/docker/parse-server/Dockerfile.in b/build_image/docker/parse-server/Dockerfile.in deleted file mode 100644 index d172795b3..000000000 --- a/build_image/docker/parse-server/Dockerfile.in +++ /dev/null @@ -1,5 +0,0 @@ -FROM parseplatform/parse-server:3.1.2 - -COPY src/parse-server/cloud /parse-server/cloud - -RUN cd cloud && npm install diff --git a/build_image/docker/user-dashboard/Dockerfile.in b/build_image/docker/user-dashboard/Dockerfile.in deleted file mode 100644 index 34f34b9d5..000000000 --- a/build_image/docker/user-dashboard/Dockerfile.in +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright IBM Corp, All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# -FROM busybox as builder -ENV FABRIC_VERSION_1_0 1.0.5 -RUN cd /tmp && ARCH=$(echo "$(uname -s|tr '[:upper:]' '[:lower:]'|sed 's/mingw64_nt.*/windows/')-$(uname -m | sed 's/x86_64/amd64/g')" | awk '{print tolower($0)}') && \ - echo $ARCH &&wget -c https://nexus.hyperledger.org/content/repositories/releases/org/hyperledger/fabric/hyperledger-fabric/${ARCH}-${FABRIC_VERSION_1_0}/hyperledger-fabric-${ARCH}-${FABRIC_VERSION_1_0}.tar.gz && \ - mkdir fabric-1.0 && tar -zxvf hyperledger-fabric-${ARCH}-${FABRIC_VERSION_1_0}.tar.gz -C fabric-1.0 -ENV FABRIC_VERSION_1_2 1.2.0 -RUN cd /tmp && ARCH=$(echo "$(uname -s|tr '[:upper:]' '[:lower:]'|sed 's/mingw64_nt.*/windows/')-$(uname -m | sed 's/x86_64/amd64/g')" | awk '{print tolower($0)}') && \ - echo $ARCH &&wget -c https://nexus.hyperledger.org/content/repositories/releases/org/hyperledger/fabric/hyperledger-fabric/${ARCH}-${FABRIC_VERSION_1_2}/hyperledger-fabric-${ARCH}-${FABRIC_VERSION_1_2}.tar.gz && \ - mkdir fabric-1.2 && tar -zxvf hyperledger-fabric-${ARCH}-${FABRIC_VERSION_1_2}.tar.gz -C fabric-1.2 - -FROM node:8.9 -MAINTAINER haitao yue "hightall@me.com" -COPY src/user-dashboard/src/package.json / -COPY src/user-dashboard/src/yarn.lock / -RUN cd / && yarn install -g --verbose -ENV PATH ${PATH}:/node_modules/.bin -COPY src/user-dashboard/src/packages /packages -RUN cd /packages/fabric-1.0 && yarn install -RUN cd /packages/fabric-1.2 && yarn install -COPY src/user-dashboard/src /var/www -RUN cd /var/www && ln -sf /node_modules . && npm run build -WORKDIR /var/www -EXPOSE 8081 - -COPY --from=builder /tmp/fabric-1.0/bin/configtxgen /usr/local/bin/fabric-1.0/configtxgen -COPY --from=builder /tmp/fabric-1.2/bin/configtxgen /usr/local/bin/fabric-1.2/configtxgen -COPY src/user-dashboard/fabric/fabric-1.0 /etc/hyperledger/fabric-1.0 -ENV FABRIC_CFG_PATH /etc/hyperledger/fabric-1.0 -COPY src/user-dashboard/fabric/fabric-1.2 /etc/hyperledger/fabric-1.2 -COPY src/user-dashboard/src/app/lib/fabric/fixtures/channel/v1.2/crypto-config /etc/hyperledger/fabric-1.2/crypto-config -ENV MONGO_PORT 27017 - -RUN sed -i 's/.\/ecdsa\/key.js/fabric-client\/lib\/impl\/ecdsa\/key.js/g' /packages/fabric-1.2/node_modules/fabric-ca-client/lib/impl/CryptoSuite_ECDSA_AES.js - -CMD ln -sf /node_modules . && npm run start diff --git a/build_image/docker/watchdog/Dockerfile.in b/build_image/docker/watchdog/Dockerfile.in deleted file mode 100644 index 2b83b7b98..000000000 --- a/build_image/docker/watchdog/Dockerfile.in +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright IBM Corp, All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# -FROM _NS_/cello-baseimage:_TAG_ - -# use this in development -CMD ["python", "watchdog.py"] diff --git a/src/keycloak/__init__.py b/src/keycloak/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/keycloak/initial.py b/src/keycloak/initial.py deleted file mode 100644 index a03fccfb1..000000000 --- a/src/keycloak/initial.py +++ /dev/null @@ -1,136 +0,0 @@ -import os -import subprocess -import sys - -sys.path.append(os.path.join(os.path.dirname(__file__))) - -from keycloak_client import KeyCloakClient - -KEYCLOAK_REALM = os.environ.get("KEYCLOAK_REALM") -SERVER_PUBLIC_IP = os.environ.get("SERVER_PUBLIC_IP") -API_ENGINE_DOCKER_KEY = os.environ.get("API_ENGINE_DOCKER_KEY") -API_ENGINE_K8S_SSO_KEY = os.environ.get("API_ENGINE_K8S_SSO_KEY") -API_ENGINE_WEBROOT = os.environ.get("API_ENGINE_WEBROOT") -DEFAULT_ADMIN_NAME = os.environ.get("DEFAULT_ADMIN_NAME") -DEFAULT_ADMIN_PASSWORD = os.environ.get("DEFAULT_ADMIN_PASSWORD") - -keycloak_client = KeyCloakClient() - -keycloak_client.create_realm( - { - "realm": KEYCLOAK_REALM, - "sslRequired": "none", - "enabled": True, - "displayNameHtml": '
Cello
', - "displayName": "Cello", - "accessTokenLifespan": 86400, - "accessTokenLifespanForImplicitFlow": 86400, - "internationalizationEnabled": True, - "supportedLocales": [ - "de", - "no", - "ru", - "sv", - "pt-BR", - "lt", - "en", - "it", - "fr", - "zh-CN", - "es", - "ja", - "sk", - "ca", - "nl", - ], - } -) -realm = keycloak_client.get_realm(KEYCLOAK_REALM) - -# Create new client scopes -client_scope_body = { - "name": "cello-scopes", - "description": "Cello scopes", - "protocol": "openid-connect", - "protocolMappers": [ - { - "name": "role", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-attribute-mapper", - "config": { - "claim.name": "role", - "jsonType.label": "String", - "user.attribute": "role", - "id.token.claim": True, - "userinfo.token.claim": True, - "access.token.claim": True, - }, - }, - { - "name": "tenant", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-attribute-mapper", - "config": { - "claim.name": "tenant", - "jsonType.label": "String", - "user.attribute": "tenant", - "id.token.claim": True, - "userinfo.token.claim": True, - "access.token.claim": True, - }, - }, - ], -} -keycloak_client.create_new_client_scopes(body=client_scope_body) - -# Create new clients -clients = [ - { - "name": API_ENGINE_K8S_SSO_KEY, - "redirectUrl": "http://%s%s/*" - % (SERVER_PUBLIC_IP, API_ENGINE_WEBROOT), - }, - { - "name": API_ENGINE_DOCKER_KEY, - "redirectUrl": "http://%s:8085%s/*" - % (SERVER_PUBLIC_IP, API_ENGINE_WEBROOT), - }, -] - -secrets = [] -for client in clients: - secret = keycloak_client.create_new_client( - client.get("name", ""), - client.get("redirectUrl"), - ["cello-scopes", "email", "profile"], - ) - secrets.append(secret) - -api_engine_k8s_secret = secrets[0] -api_engine_docker_secret = secrets[1] - -command = ( - 'sed -i "s/API_ENGINE_K8S_SSO_SECRET?=' - '.*/API_ENGINE_K8S_SSO_SECRET?=%s/g" ' - "/makerc/api-engine" % api_engine_k8s_secret -) -subprocess.call([command], shell=True) -command = ( - 'sed -i "s/API_ENGINE_DOCKER_SECRET?=' - '.*/API_ENGINE_DOCKER_SECRET?=%s/g" ' - "/makerc/api-engine" % api_engine_docker_secret -) -subprocess.call([command], shell=True) - -create_user_body = { - "username": DEFAULT_ADMIN_NAME, - "requiredActions": [], - "enabled": True, -} - -keycloak_client.create_user(create_user_body) - -user_id = keycloak_client.get_user_id(username=DEFAULT_ADMIN_NAME) -keycloak_client.reset_user_password(user_id, DEFAULT_ADMIN_PASSWORD) - -keycloak_client.update_user(user_id, body={"attributes": {"role": "operator"}}) diff --git a/src/keycloak/keycloak_client.py b/src/keycloak/keycloak_client.py deleted file mode 100644 index 99365ac11..000000000 --- a/src/keycloak/keycloak_client.py +++ /dev/null @@ -1,243 +0,0 @@ -import requests -import json -import os - -KEYCLOAK_SERVER = os.environ.get("KEYCLOAK_SERVER", "keycloak") -KEYCLOAK_ADMIN_NAME = os.environ.get("KEYCLOAK_ADMIN_NAME", "admin") -KEYCLOAK_ADMIN_PASSWORD = os.environ.get("KEYCLOAK_ADMIN_PASSWORD", "pass") -KEYCLOAK_REALM = os.environ.get("KEYCLOAK_REALM", "cello-realm") - - -class KeyCloakClient(object): - def __init__( - self, - admin_name=KEYCLOAK_ADMIN_NAME, - admin_password=KEYCLOAK_ADMIN_PASSWORD, - realm=KEYCLOAK_REALM, - ): - self._admin_name = admin_name - self._admin_password = admin_password - self._realm = realm - self._base_url = "http://%s:8080" % KEYCLOAK_SERVER - self._token_url = ( - "%s/auth/realms/master/protocol/openid-connect/token" - % self._base_url - ) - self._clients_url = "%s/auth/admin/realms/%s/clients" % ( - self._base_url, - self._realm, - ) - self._user_count_url = "%s/auth/admin/realms/%s/users/count" % ( - self._base_url, - self._realm, - ) - self._users_url = "%s/auth/admin/realms/%s/users" % ( - self._base_url, - self._realm, - ) - self._client_scopes_url = "%s/auth/admin/realms/%s/client-scopes" % ( - self._base_url, - self._realm, - ) - self._get_token() - - def _get_token(self): - body = { - "client_id": "admin-cli", - "username": self._admin_name, - "password": self._admin_password, - "grant_type": "password", - } - ret = requests.post(self._token_url, data=body) - - token = ret.json().get("access_token", "") - - self._headers = { - "Authorization": "bearer %s" % token, - "Content-Type": "application/json", - } - - def get_user_count(self): - ret = requests.get(self._user_count_url, headers=self._headers) - return ret.json() - - def list_users(self): - ret = requests.get(self._users_url, headers=self._headers) - - return ret.json() - - def get_user(self, username=""): - params = {"username": username} - ret = requests.get( - self._users_url, headers=self._headers, params=params - ) - user = None - users = ret.json() - if len(users): - user = users[0] if users[0].get("username") == username else None - - return user - - def get_user_id(self, username=""): - params = {"username": username} - ret = requests.get( - self._users_url, headers=self._headers, params=params - ) - users = ret.json() - if len(users): - return users[0].get("id", "") - - return None - - def update_user(self, user_id="", body=None): - if body is None: - body = {} - - ret = requests.put( - "%s/%s" % (self._users_url, user_id), - data=json.dumps(body), - headers=self._headers, - ) - print(ret.text, ret.status_code) - - def reset_user_password(self, user_id="", password=""): - body = {"type": "password", "temporary": False, "value": password} - ret = requests.put( - "%s/%s/reset-password" % (self._users_url, user_id), - data=json.dumps(body), - headers=self._headers, - ) - print(ret.text, ret.status_code) - - def _get_client_id(self, name): - params = {"clientId": name} - ret = requests.get( - self._clients_url, params=params, headers=self._headers - ) - client = ret.json()[0] - return client.get("id", "") - - def get_client(self, name=""): - client_id = self._get_client_id(name) - ret = requests.get( - "%s/%s" % (self._clients_url, client_id), headers=self._headers - ) - client_json = ret.json() - protocol_mappers = client_json.get("protocolMappers", []) - for item in protocol_mappers: - print(item) - - return client_json - - def update_client(self, name="", body=None): - if body is None: - body = {} - client_id = self._get_client_id(name) - update_url = "%s/%s" % (self._clients_url, client_id) - print("will update client %s %s %s" % (update_url, client_id, body)) - - ret = requests.put( - "%s/%s" % (self._clients_url, client_id), - data=json.dumps(body), - headers=self._headers, - ) - print(ret.text, ret.status_code) - - def create_new_client_scopes(self, body=None): - if body is None: - body = {} - - ret = requests.post( - self._client_scopes_url, - data=json.dumps(body), - headers=self._headers, - ) - print(ret.text, ret.status_code) - - def create_user(self, body=None): - if body is None: - body = {} - - ret = requests.post( - self._users_url, data=json.dumps(body), headers=self._headers - ) - print(ret.text, ret.status_code) - - def delete_user(self, user_id=None): - if user_id is None: - return False - - ret = requests.delete( - "%s/%s" % (self._users_url, user_id), headers=self._headers - ) - print(ret.text, ret.status_code) - - def get_client_scopes(self): - ret = requests.get(self._client_scopes_url, headers=self._headers) - - return ret.json() - - def create_new_client(self, name="", url="", default_client_scopes=None): - if default_client_scopes is None: - default_client_scopes = [] - - body = { - "clientId": name, - "name": name, - "authorizationServicesEnabled": True, - "enabled": True, - "redirectUris": [url], - "serviceAccountsEnabled": True, - "directAccessGrantsEnabled": True, - "defaultClientScopes": default_client_scopes, - } - ret = requests.post( - self._clients_url, data=json.dumps(body), headers=self._headers - ) - print("create client %s result %s" % (name, ret.status_code)) - query_params = {"clientId": name} - ret = requests.get( - self._clients_url, params=query_params, headers=self._headers - ) - client_cello = ret.json()[0] - - client_id = client_cello.get("id", "") - - ret = requests.get( - "%s/%s/client-secret" % (self._clients_url, client_id), - headers=self._headers, - ) - data = ret.json() - secret = data.get("value", "") - print("client %s secret is %s" % (name, secret)) - return secret - - def get_realm(self, name=""): - ret = requests.get( - "%s/auth/admin/realms/%s" % (self._base_url, name), - headers=self._headers, - ) - return ret.json() - - def update_realm(self, name="", body=None): - if body is None: - body = {} - - ret = requests.put( - "%s/auth/admin/realms/%s" % (self._base_url, name), - data=json.dumps(body), - headers=self._headers, - ) - print(ret.text, ret.status_code) - - def create_realm(self, body=None): - if body is None: - return False - - ret = requests.post( - "%s/auth/admin/realms/" % self._base_url, - headers=self._headers, - data=json.dumps(body), - ) - - print(ret.text, ret.status_code) diff --git a/src/parse-server/cloud/functions/chain.js b/src/parse-server/cloud/functions/chain.js deleted file mode 100644 index b996a1b8c..000000000 --- a/src/parse-server/cloud/functions/chain.js +++ /dev/null @@ -1,219 +0,0 @@ -/* - SPDX-License-Identifier: Apache-2.0 -*/ -'use strict'; - -const Parse = require('parse/node'); - -async function generateNetworkFabricV1_0(chain, networkConfig) { - const orgConfigQuery = new Parse.Query('OrgConfig'); - orgConfigQuery.equalTo('networkConfig', networkConfig); - orgConfigQuery.ascending('sequence'); - const orgConfigs = await orgConfigQuery.find(); - - const ordererConfigQuery = new Parse.Query('OrdererConfig'); - ordererConfigQuery.equalTo('networkConfig', networkConfig); - const ordererConfig = await ordererConfigQuery.first(); - - const network = { - orderer: { - url: `grpcs://${ordererConfig.get('url')}`, - 'server-hostname': ordererConfig.get('serverHostName'), - tls_cacerts: '/var/www/app/lib/fabric/fixtures/channel/v1.0/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/ca.crt', - }, - }; - - for (const index in orgConfigs) { - const orgConfig = orgConfigs[index]; - const caConfigQuery = new Parse.Query('CaConfig'); - caConfigQuery.equalTo('networkConfig', networkConfig); - caConfigQuery.equalTo('sequence', orgConfig.get('sequence')); - const caConfig = await caConfigQuery.first(); - - const peerConfigQuery = new Parse.Query('PeerConfig'); - peerConfigQuery.equalTo('networkConfig', networkConfig); - peerConfigQuery.equalTo('orgConfig', orgConfig); - peerConfigQuery.ascending('sequence'); - const peerConfigs = await peerConfigQuery.find(); - const peers = {}; - for (const peerIndex in peerConfigs) { - const peerConfig = peerConfigs[peerIndex]; - peers[`peer${peerConfig.get('sequence') + 1}`] = { - requests: `grpcs://${peerConfig.get('grpc')}`, - events: `grpcs://${peerConfig.get('event')}`, - 'server-hostname': `peer${peerConfig.get('sequence')}.org${orgConfig.get('sequence')}.example.com`, - tls_cacerts: `/var/www/app/lib/fabric/fixtures/channel/v1.0/crypto-config/peerOrganizations/org${orgConfig.get('sequence')}.example.com/peers/peer${peerConfig.get('sequence')}.org${orgConfig.get('sequence')}.example.com/tls/ca.crt`, - }; - } - network[`org${orgConfig.get('sequence')}`] = { - name: orgConfig.get('name'), - mspid: orgConfig.get('mspid'), - ca: `https://${caConfig.get('address')}`, - peers, - admin: { - key: `/var/www/app/lib/fabric/fixtures/channel/v1.0/crypto-config/peerOrganizations/org${orgConfig.get('sequence')}.example.com/users/Admin@org${orgConfig.get('sequence')}.example.com/msp/keystore`, - cert: `/var/www/app/lib/fabric/fixtures/channel/v1.0/crypto-config/peerOrganizations/org${orgConfig.get('sequence')}.example.com/users/Admin@org${orgConfig.get('sequence')}.example.com/msp/signcerts`, - }, - }; - } - - return network; -} - -async function generateNetworkFabricV1_2(chain, networkConfig, config) { - const { dataDir, defaultChannelName } = config; - const orgConfigQuery = new Parse.Query('OrgConfig'); - orgConfigQuery.equalTo('networkConfig', networkConfig); - orgConfigQuery.ascending('sequence'); - const orgConfigs = await orgConfigQuery.find(); - const orgConfigCount = await orgConfigQuery.count(); - - const ordererConfigQuery = new Parse.Query('OrdererConfig'); - ordererConfigQuery.equalTo('networkConfig', networkConfig); - const ordererConfig = await ordererConfigQuery.first(); - - const chainRootDir = `${dataDir}/${chain.get('user')}/chains/${chain.id}`; - const keyValueStorePath = `${chainRootDir}/client-kvs`; - const orderers = {}; - const certificateAuthorities = {}; - const channels = { - orderers: [ - 'orderer.example.com', - ], - }; - const peers = {}; - const organizations = {}; - orderers[ordererConfig.get('serverHostName')] = { - grpcOptions: { - 'ssl-target-name-override': ordererConfig.get('serverHostName'), - }, - tlsCACerts: { - path: '/var/www/app/lib/fabric/fixtures/channel/v1.2/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/ca.crt', - }, - url: `grpcs://${ordererConfig.get('url')}`, - }; - const channelsPeers = {}; - let network = {}; - for (let index = 0; index < orgConfigCount; index++) { - const orgConfig = orgConfigs[index]; - - const caConfigQuery = new Parse.Query('CaConfig'); - caConfigQuery.equalTo('networkConfig', networkConfig); - caConfigQuery.equalTo('sequence', orgConfig.get('sequence')); - const caConfig = await caConfigQuery.first(); - - const peerConfigQuery = new Parse.Query('PeerConfig'); - peerConfigQuery.equalTo('networkConfig', networkConfig); - peerConfigQuery.equalTo('orgConfig', orgConfig); - peerConfigQuery.ascending('sequence'); - const peerConfigs = await peerConfigQuery.find(); - const peerConfigCount = await peerConfigQuery.count(); - - const peerNames = []; - for (let peerIndex = 0; peerIndex < peerConfigCount; peerIndex++) { - peerNames.push(`peer${peerIndex}.org${index + 1}.example.com`); - peers[`peer${peerIndex}.org${index + 1}.example.com`] = { - eventUrl: `grpcs://${peerConfigs[peerIndex].get('event')}`, - grpcOptions: { - 'ssl-target-name-override': `peer${peerIndex}.org${index + 1}.example.com`, - }, - tlsCACerts: { - path: `/var/www/app/lib/fabric/fixtures/channel/v1.2/crypto-config/peerOrganizations/org${index + 1}.example.com/peers/peer${peerIndex}.org${index + 1}.example.com/tls/ca.crt`, - }, - url: `grpcs://${peerConfigs[peerIndex].get('grpc')}`, - }; - channelsPeers[`peer${peerIndex}.org${index + 1}.example.com`] = { - chaincodeQuery: true, - endorsingPeer: peerIndex === 0, - eventSource: peerIndex === 0, - ledgerQuery: true, - }; - } - organizations[`org${index + 1}`] = { - adminPrivateKey: { - path: `/var/www/app/lib/fabric/fixtures/channel/v1.2/crypto-config/peerOrganizations/org${index + 1}.example.com/users/Admin@org${index + 1}.example.com/msp/keystore/admin_sk`, - }, - certificateAuthorities: [`ca-org${index + 1}`], - mspid: `Org${index + 1}MSP`, - peers: peerNames, - signedCert: { - path: `/var/www/app/lib/fabric/fixtures/channel/v1.2/crypto-config/peerOrganizations/org${index + 1}.example.com/users/Admin@org${index + 1}.example.com/msp/signcerts/Admin@org${index + 1}.example.com-cert.pem`, - }, - }; - certificateAuthorities[`ca-org${index + 1}`] = { - caName: `ca-org${index + 1}`, - httpOptions: { - verify: false, - }, - registrar: [ - { - enrollId: 'admin', - enrollSecret: 'adminpw', - }, - ], - tlsCACerts: { - path: `/var/www/app/lib/fabric/fixtures/channel/v1.2/crypto-config/peerOrganizations/org${index + 1}.example.com/ca/ca.org${index + 1}.example.com-cert.pem`, - }, - url: `https://${caConfig.get('address')}`, - }; - network[`org${index + 1}`] = { - 'x-type': 'hlfv1', - name: `${chain.get('name')}-org${index + 1}`, - description: `org${index + 1}`, - version: '1.0', - client: { - organization: `org${index + 1}`, - credentialStore: { - path: keyValueStorePath, - cryptoStore: { - path: `${keyValueStorePath}/tmp`, - }, - wallet: 'wallet', - }, - }, - }; - } - channels.peers = channelsPeers; - const channelsConfig = {}; - channelsConfig[`${defaultChannelName}`] = channels; - network = Object.assign(network, { - config: { - version: '1.0', - 'x-type': 'hlfv1', - name: `${chain.get('name')}`, - description: `${chain.get('name')}`, - orderers, - certificateAuthorities, - organizations, - peers, - channels: channelsConfig, - }, - }); - return network; -} - -Parse.Cloud.define("generateNetwork", async function (request) { - const { id, config } = request.params; - let network = {}; - try { - const chainQuery = new Parse.Query('Chain'); - const chain = await chainQuery.get(id); - const networkNetworkQuery = new Parse.Query('NetworkConfig'); - networkNetworkQuery.equalTo('chain', chain); - const networkConfig = await networkNetworkQuery.first(); - switch (chain.get('type')) { - case 'fabric-1.0': - network = await generateNetworkFabricV1_0(chain, networkConfig); - break; - case 'fabric-1.2': - network = await generateNetworkFabricV1_2(chain, networkConfig, config); - break; - default: - break; - } - } catch (e) { - console.log('generate network failed ', e.message); - } - - return network; -}); diff --git a/src/parse-server/cloud/functions/index.js b/src/parse-server/cloud/functions/index.js deleted file mode 100644 index 3603e9684..000000000 --- a/src/parse-server/cloud/functions/index.js +++ /dev/null @@ -1,7 +0,0 @@ -/* - SPDX-License-Identifier: Apache-2.0 -*/ -'use strict'; - -require('./service-url'); -require('./chain'); diff --git a/src/parse-server/cloud/functions/service-url.js b/src/parse-server/cloud/functions/service-url.js deleted file mode 100644 index b1a1b16bc..000000000 --- a/src/parse-server/cloud/functions/service-url.js +++ /dev/null @@ -1,116 +0,0 @@ -/* - SPDX-License-Identifier: Apache-2.0 -*/ -'use strict'; - -const Parse = require('parse/node'); - -const CaConfig = Parse.Object.extend("CaConfig"); -const OrgConfig = Parse.Object.extend("OrgConfig"); -const PeerConfig = Parse.Object.extend("PeerConfig"); -const OrdererConfig = Parse.Object.extend("OrdererConfig"); - -async function findRegex(regex, value) { - const matches = []; - await value.replace(regex, async match => { - matches.push(match); - }); - return matches; -} - -async function storeUrl(chain, networkConfig, key, value) { - const number_regex = /[+-]?\d+(\.\d+)?/g; - let matches = []; - if (key.startsWith('ca_org')) { - matches = await findRegex(number_regex, key); - const caIndex = parseInt(matches[0]); - const caConfig = new CaConfig(); - await caConfig.save({ - address: value, - sequence: caIndex, - networkConfig: networkConfig, - }); - } else if (key.startsWith('peer')) { - const peerType = key.split('_').slice(-1)[0]; - matches = await findRegex(number_regex, key); - const orgIndex = parseInt(matches[1]); - const peerIndex = parseInt(matches[0]); - - const orgConfigQuery = new Parse.Query("OrgConfig"); - orgConfigQuery.equalTo("networkConfig", networkConfig); - orgConfigQuery.equalTo("sequence", orgIndex); - orgConfigQuery.equalTo("name", `peerOrg${orgIndex}`); - orgConfigQuery.equalTo("mspid", `Org${orgIndex}MSP`); - - let org = await orgConfigQuery.first(); - if (org) { - org.set("name", `peerOrg${orgIndex}`); - org.set("mspid", `Org${orgIndex}MSP`); - await org.save(); - } else { - org = new OrgConfig(); - await org.save({ - networkConfig: networkConfig, - sequence: orgIndex, - name: `peerOrg${orgIndex}`, - mspid: `Org${orgIndex}MSP`, - }) - } - - const updateData = {}; - updateData[`${peerType}`] = value; - - const peerConfigQuery = new Parse.Query("PeerConfig"); - peerConfigQuery.equalTo("orgConfig", org); - peerConfigQuery.equalTo("networkConfig", networkConfig); - peerConfigQuery.equalTo("sequence", peerIndex); - - let peer = await peerConfigQuery.first(); - if (peer) { - for (const updateKey in updateData) { - peer.set(updateKey, updateData[updateKey]); - } - await peer.save(); - } else { - peer = new PeerConfig(); - await peer.save({ - networkConfig: networkConfig, - sequence: peerIndex, - orgConfig: org, - ...updateData, - }) - } - } else if (key === 'orderer') { - const ordererConfig = new OrdererConfig(); - await ordererConfig.save({ - networkConfig: networkConfig, - serverHostName: 'orderer.example.com', - url: value, - }); - } -} - -Parse.Cloud.define("storeServiceUrl", async function (request) { - const { chainId, networkConfigId } = request.params; - let config = request.params.config || {}; - let result = { - success: true, - error: '', - }; - - try { - const chainQuery = new Parse.Query("Chain"); - const networkConfigQuery = new Parse.Query("NetworkConfig"); - const chain = await chainQuery.get(chainId); - const networkConfig = await networkConfigQuery.get(networkConfigId); - - for (const key in config) { - await storeUrl(chain, networkConfig, key, config[key]); - } - } catch (e) { - result.success = false; - result.error = e.message; - } - - return result; -}); diff --git a/src/parse-server/cloud/main.js b/src/parse-server/cloud/main.js deleted file mode 100644 index 2de5424b5..000000000 --- a/src/parse-server/cloud/main.js +++ /dev/null @@ -1,7 +0,0 @@ -/* - SPDX-License-Identifier: Apache-2.0 -*/ -'use strict'; - -require("./functions"); -require("./model"); diff --git a/src/parse-server/cloud/model/chain.js b/src/parse-server/cloud/model/chain.js deleted file mode 100644 index d58ee7ff0..000000000 --- a/src/parse-server/cloud/model/chain.js +++ /dev/null @@ -1,63 +0,0 @@ -/* - SPDX-License-Identifier: Apache-2.0 -*/ -'use strict'; - -const Parse = require('parse/node'); - -Parse.Cloud.afterDelete('Chain', async (request) => { - const queryNetworkConfig = new Parse.Query('NetworkConfig'); - queryNetworkConfig.equalTo('chain', request.object); - const networkConfig = await queryNetworkConfig.first(); - - // remove related ca config - const caConfigQuery = new Parse.Query('CaConfig'); - caConfigQuery.equalTo("networkConfig", networkConfig); - caConfigQuery.find().then(Parse.Object.destroyAll) - .catch((error) => { - console.error("Error delete related ca config" + error.code + ": " + error.message); - }); - - // remove related orderer config - const ordererConfigQuery = new Parse.Query('OrdererConfig'); - ordererConfigQuery.equalTo("networkConfig", networkConfig); - ordererConfigQuery.find().then(Parse.Object.destroyAll) - .catch((error) => { - console.error("Error delete related orderer config" + error.code + ": " + error.message); - }); - - // remove related peer config - const peerConfigQuery = new Parse.Query('PeerConfig'); - peerConfigQuery.equalTo("networkConfig", networkConfig); - peerConfigQuery.find().then(Parse.Object.destroyAll) - .catch((error) => { - console.error("Error delete related peer config" + error.code + ": " + error.message); - }); - - // remove related org config - const orgConfigQuery = new Parse.Query('OrgConfig'); - orgConfigQuery.equalTo("networkConfig", networkConfig); - orgConfigQuery.find().then(Parse.Object.destroyAll) - .catch((error) => { - console.error("Error delete related org config" + error.code + ": " + error.message); - }); - - // remove related network config - await networkConfig.destroy(); - - // remove related operations - const operationQuery = new Parse.Query('Operation'); - operationQuery.equalTo('chain', request.object); - operationQuery.find().then(Parse.Object.destroyAll) - .catch((error) => { - console.error("Error delete related operation" + error.code + ": " + error.message); - }); - - // remove related deployment - const deployQuery = new Parse.Query('SmartContractDeploy'); - deployQuery.equalTo('chain', request.object); - deployQuery.find().then(Parse.Object.destroyAll) - .catch((error) => { - console.error("Error delete related deploy " + error.code + ": " + error.message); - }); -}); diff --git a/src/parse-server/cloud/model/cluster.js b/src/parse-server/cloud/model/cluster.js deleted file mode 100644 index 05ea9ad91..000000000 --- a/src/parse-server/cloud/model/cluster.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - SPDX-License-Identifier: Apache-2.0 -*/ -'use strict'; - -const Parse = require('parse/node'); - -Parse.Cloud.afterDelete("Cluster", (request) => { - // remove related service port - const queryServicePort = new Parse.Query("ServicePort"); - queryServicePort.equalTo("cluster", request.object); - queryServicePort.find() - .then(Parse.Object.destroyAll) - .catch((error) => { - console.error("Error finding related comments " + error.code + ": " + error.message); - }); - // remove related container - const queryContainer = new Parse.Query("Container"); - queryContainer.equalTo("cluster", request.object); - queryContainer.find() - .then(Parse.Object.destroyAll) - .catch((error) => { - console.error("Error finding related comments " + error.code + ": " + error.message); - }); -}); diff --git a/src/parse-server/cloud/model/index.js b/src/parse-server/cloud/model/index.js deleted file mode 100644 index 9f65fecf1..000000000 --- a/src/parse-server/cloud/model/index.js +++ /dev/null @@ -1,9 +0,0 @@ -/* - SPDX-License-Identifier: Apache-2.0 -*/ -'use strict'; - -require('./cluster'); -require('./chain'); -require('./smart-contract'); -require('./smart-contract-code'); diff --git a/src/parse-server/cloud/model/smart-contract-code.js b/src/parse-server/cloud/model/smart-contract-code.js deleted file mode 100644 index e5ba4faa7..000000000 --- a/src/parse-server/cloud/model/smart-contract-code.js +++ /dev/null @@ -1,28 +0,0 @@ -/* - SPDX-License-Identifier: Apache-2.0 -*/ -'use strict'; - -const Parse = require('parse/node'); -const rimraf = require('rimraf'); - -Parse.Cloud.afterDelete("SmartContractCode", async (request) => { - // remove related smart contract code - const smartContractCodeQuery = new Parse.Query("SmartContractCode"); - const smartContract = request.object.get('smartContract'); - if (smartContract) { - smartContractCodeQuery.equalTo("smartContract", smartContract); - const smartContractCodeCount = await smartContractCodeQuery.count(); - if (smartContractCodeCount === 0) { - try { - await smartContract.destroy(); - } catch (e) { - console.error('smart contract have been deleted ', e.code + ': ' + e.message); - } - } - } - - rimraf(request.object.get('path'), function() { - console.log(`delete smart contract path ${request.object.get('path')}`); - }); -}); diff --git a/src/parse-server/cloud/model/smart-contract.js b/src/parse-server/cloud/model/smart-contract.js deleted file mode 100644 index 6c9f5b30d..000000000 --- a/src/parse-server/cloud/model/smart-contract.js +++ /dev/null @@ -1,31 +0,0 @@ -/* - SPDX-License-Identifier: Apache-2.0 -*/ -'use strict'; - -const Parse = require('parse/node'); -const rimraf = require('rimraf'); - -Parse.Cloud.afterDelete("SmartContract", (request) => { - // remove related smart contract code - const smartContractCodeQuery = new Parse.Query("SmartContractCode"); - smartContractCodeQuery.equalTo("smartContract", request.object); - smartContractCodeQuery.find() - .then(Parse.Object.destroyAll) - .catch((error) => { - console.error("Error finding related smart contract code " + error.code + ": " + error.message); - }); - - // remove related smart contract operate history - const smartContractOperateHistoryQuery = new Parse.Query("SmartContractOperateHistory"); - smartContractOperateHistoryQuery.equalTo("smartContract", request.object); - smartContractOperateHistoryQuery.find() - .then(Parse.Object.destroyAll) - .catch((error) => { - console.error("Error finding related smart contract operate history " + error.code + ": " + error.message); - }); - - rimraf(request.object.get('path'), function() { - console.log(`delete smart contract path ${request.object.get('path')}`); - }); -}); diff --git a/src/parse-server/cloud/package.json b/src/parse-server/cloud/package.json deleted file mode 100644 index 6d462ffc2..000000000 --- a/src/parse-server/cloud/package.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "parse-server", - "description": "Cello Parse Server", - "private": true, - "dependencies": { - "rimraf": "^2.6.2" - }, - "author": "hightall", - "license": "MIT" -} diff --git a/src/user-dashboard/Dockerfile b/src/user-dashboard/Dockerfile deleted file mode 100644 index 368d4773e..000000000 --- a/src/user-dashboard/Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ - -# Copyright IBM Corp, All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# -FROM node:8.9 -MAINTAINER haitao yue "hightall@me.com" -COPY src/package.json / -RUN cd / && yarn install -g -ENV PATH ${PATH}:/node_modules/.bin -COPY src /var/www -WORKDIR /var/www -EXPOSE 7001 - -ENV FABRIC_VERSION 1.0.5 -RUN cd /tmp && ARCH=$(echo "$(uname -s|tr '[:upper:]' '[:lower:]'|sed 's/mingw64_nt.*/windows/')-$(uname -m | sed 's/x86_64/amd64/g')" | awk '{print tolower($0)}') && echo $ARCH &&wget -c https://nexus.hyperledger.org/content/repositories/releases/org/hyperledger/fabric/hyperledger-fabric/${ARCH}-${FABRIC_VERSION}/hyperledger-fabric-${ARCH}-${FABRIC_VERSION}.tar.gz && tar -zxvf hyperledger-fabric-${ARCH}-${FABRIC_VERSION}.tar.gz && mv bin/configtxgen /usr/local/bin/configtxgen -COPY fabric/fabric /etc/hyperledger/fabric -ENV FABRIC_CFG_PATH /etc/hyperledger/fabric - -CMD ["npm", "start"] diff --git a/src/user-dashboard/Dockerfile-check-js b/src/user-dashboard/Dockerfile-check-js deleted file mode 100644 index 90db16c76..000000000 --- a/src/user-dashboard/Dockerfile-check-js +++ /dev/null @@ -1,11 +0,0 @@ - -# Copyright IBM Corp, All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# -FROM node:8.11 -MAINTAINER haitao yue "hightall@me.com" -COPY src/package.json / -RUN cd / && sed -i '/dependencies/,/devDependencies/{//!d}' package.json && \ - sed -i '/dependencies/d' package.json && yarn install -CMD bash -c "ln -sf /node_modules /var/www/node_modules && cd /var/www && npm run lint && npm run lint:ui" diff --git a/src/user-dashboard/Makefile b/src/user-dashboard/Makefile deleted file mode 100644 index a3760aa64..000000000 --- a/src/user-dashboard/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -build-js: - docker-compose -f docker-compose-files/docker-compose-build-js.yaml up --force-recreate - -npm-install: - docker-compose -f docker-compose-files/docker-compose-npm-install.yaml up diff --git a/src/user-dashboard/docker-compose-files/docker-compose-build-js.yaml b/src/user-dashboard/docker-compose-files/docker-compose-build-js.yaml deleted file mode 100644 index 37d117150..000000000 --- a/src/user-dashboard/docker-compose-files/docker-compose-build-js.yaml +++ /dev/null @@ -1,20 +0,0 @@ -# This compose file will deploy the services, and bootup a mongo server. - -# Copyright IBM Corp., All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# -# Local `/opt/cello/mongo` will be used for the db storage. -# dashboard: dashboard service of cello, listen on 8080 -# app: app service of cello, listen on 80 -# mongo: mongo db - -version: '2' -services: - build-dashboard-js: - image: hyperledger/cello-user-dashboard - volumes: - - $ROOT_PATH/src/user-dashboard/src:/var/www - environment: - - DEV=True - command: bash -c "ln -sf /node_modules . && npm run build" diff --git a/src/user-dashboard/docker-compose-files/docker-compose-dev.yml b/src/user-dashboard/docker-compose-files/docker-compose-dev.yml deleted file mode 100644 index 9be5ede48..000000000 --- a/src/user-dashboard/docker-compose-files/docker-compose-dev.yml +++ /dev/null @@ -1,25 +0,0 @@ -version: "2" - -# Copyright IBM Corp., All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# -services: - dashboard: - image: node - container_name: user-dashboard - external_links: - - mongodb:dashboard_mongo - ports: - - "8081:8080" - volumes: - - ./:/usr/app/src - environment: - - DEBUG=node:* - - SV_BaseURL=http://9.186.50.245:8080/api/auth/ - command: bash -c "cd /usr/app/src && ./node_modules/.bin/nodemon index.js" -# mongodb: -# image: mongo -# container_name: mongo -# ports: -# - "27017:27017" \ No newline at end of file diff --git a/src/user-dashboard/docker-compose-files/docker-compose-npm-install.yaml b/src/user-dashboard/docker-compose-files/docker-compose-npm-install.yaml deleted file mode 100644 index 0add359c6..000000000 --- a/src/user-dashboard/docker-compose-files/docker-compose-npm-install.yaml +++ /dev/null @@ -1,17 +0,0 @@ -version: "2" - -# Copyright IBM Corp., All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# -services: - install-npm: - image: node - volumes: - - $ROOT_PATH/user-dashboard/js:/reactjs - environment: - - NPM_REGISTRY=$NPM_REGISTRY - command: bash -c "npm config set registry '$NPM_REGISTRY' && - cd /reactjs && npm install && - cd /reactjs/home && npm install && - cd /reactjs/dashboard && npm install" diff --git a/src/user-dashboard/docker-compose-files/docker-compose.yml b/src/user-dashboard/docker-compose-files/docker-compose.yml deleted file mode 100644 index 3421ee383..000000000 --- a/src/user-dashboard/docker-compose-files/docker-compose.yml +++ /dev/null @@ -1,20 +0,0 @@ -version: "2" - -# Copyright IBM Corp., All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# -services: - dashboard: - build: ./ - image: cello-user-dashboard - container_name: user-dashboard - links: - - mongodb:dashboard_mongo - ports: - - "8080:8080" - mongodb: - image: mongo - container_name: mongo - ports: - - "27017:27017" \ No newline at end of file diff --git a/src/user-dashboard/docs/README.md b/src/user-dashboard/docs/README.md deleted file mode 100644 index 381c9ccfc..000000000 --- a/src/user-dashboard/docs/README.md +++ /dev/null @@ -1,44 +0,0 @@ -# User Dashboard for Blockchain - -This dashboard is a web based application for blockchain developers. It is especially useful for blockchain apps incubation. You can upload your smart contract, apply one or more chains that deploy your smart contract, and invoke / query your smart contract functions on the dashboard. It include blockchain topology overview, network latency monitor and log tracking, blocks' transactions reveal and etc. Also support chaincode, fabric and infrastructure analytics. - -![Dashboard home page](images/dashboard-home.png) - -## Installation - -1. Goto directory of user dashboard - - ``` - $ cd my-local-cello-dir/user-dashboard - ``` - -2. Build dashboard image - - ``` - $ docker-compose build - ``` - -3. Start dashboard - - ``` - $ docker-compose up -d - ``` - -4. Access url: [http://localhost:8080](http://localhost:8080) - -## Functions - -| Name | URL | Description | -| --- | --- | --- | -| Home | `/dashboard` | The dashboard overview | -| Chain Management | `/dashboard/chain` | Include functions of apply / edit / release / start / stop / restart chains | -| Chain Detail | `/dashboard/chain/{id}` | Include functions of topology overview, log tracking, blocks view, APIs exposure and chaincode list / invoke / query | -| Smart Contract Management | `/dashboard/contract` | Include functions of smart contract upload, edit, delete and deploy | -| Analytics Overview | `/dashboard/analytics` | The high-level overview of chain status | -| Chaincode Analytics | `/dashboard/analytics/chaincode` | Chaincode invoke functions and response time statistic analysis | -| Fabric Analytics | `/dashboard/analytics/fabric` | Blocks amount and block time statistic analysis | -| Infrastructure Analytics | `/dashboard/analytics/infrastructure` | Cluster's CPU, memory, disk and network statistic analysis | - -## License . -The Hyperledger Cello project uses the [Apache License Version 2.0](LICENSE) software license. - diff --git a/src/user-dashboard/docs/images/dashboard-home.png b/src/user-dashboard/docs/images/dashboard-home.png deleted file mode 100644 index 8cf964c2b..000000000 Binary files a/src/user-dashboard/docs/images/dashboard-home.png and /dev/null differ diff --git a/src/user-dashboard/fabric/fabric-1.0/configtx.yaml b/src/user-dashboard/fabric/fabric-1.0/configtx.yaml deleted file mode 100644 index e60d789e8..000000000 --- a/src/user-dashboard/fabric/fabric-1.0/configtx.yaml +++ /dev/null @@ -1,149 +0,0 @@ -# Copyright IBM Corp. All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# - ---- -################################################################################ -# -# Profile -# -# - Different configuration profiles may be encoded here to be specified -# as parameters to the configtxgen tool -# -################################################################################ -Profiles: - - TwoOrgsOrdererGenesis: - Orderer: - <<: *OrdererDefaults - Organizations: - - *OrdererOrg - Consortiums: - SampleConsortium: - Organizations: - - *Org1 - - *Org2 - TwoOrgsChannel: - Consortium: SampleConsortium - Application: - <<: *ApplicationDefaults - Organizations: - - *Org1 - - *Org2 - -################################################################################ -# -# Section: Organizations -# -# - This section defines the different organizational identities which will -# be referenced later in the configuration. -# -################################################################################ -Organizations: - - # SampleOrg defines an MSP using the sampleconfig. It should never be used - # in production but may be used as a template for other definitions - - &OrdererOrg - # DefaultOrg defines the organization which is used in the sampleconfig - # of the fabric.git development environment - Name: OrdererOrg - - # ID to load the MSP definition as - ID: OrdererMSP - - # MSPDir is the filesystem path which contains the MSP configuration - MSPDir: crypto-config/ordererOrganizations/example.com/msp - - - &Org1 - # DefaultOrg defines the organization which is used in the sampleconfig - # of the fabric.git development environment - Name: Org1MSP - - # ID to load the MSP definition as - ID: Org1MSP - - MSPDir: crypto-config/peerOrganizations/org1.example.com/msp - - AnchorPeers: - # AnchorPeers defines the location of peers which can be used - # for cross org gossip communication. Note, this value is only - # encoded in the genesis block in the Application section context - - Host: peer0.org1.example.com - Port: 7051 - - - &Org2 - # DefaultOrg defines the organization which is used in the sampleconfig - # of the fabric.git development environment - Name: Org2MSP - - # ID to load the MSP definition as - ID: Org2MSP - - MSPDir: crypto-config/peerOrganizations/org2.example.com/msp - - AnchorPeers: - # AnchorPeers defines the location of peers which can be used - # for cross org gossip communication. Note, this value is only - # encoded in the genesis block in the Application section context - - Host: peer0.org2.example.com - Port: 7051 - -################################################################################ -# -# SECTION: Orderer -# -# - This section defines the values to encode into a config transaction or -# genesis block for orderer related parameters -# -################################################################################ -Orderer: &OrdererDefaults - - # Orderer Type: The orderer implementation to start - # Available types are "solo" and "kafka" - OrdererType: solo - - Addresses: - - orderer.example.com:7050 - - # Batch Timeout: The amount of time to wait before creating a batch - BatchTimeout: 2s - - # Batch Size: Controls the number of messages batched into a block - BatchSize: - - # Max Message Count: The maximum number of messages to permit in a batch - MaxMessageCount: 10 - - # Absolute Max Bytes: The absolute maximum number of bytes allowed for - # the serialized messages in a batch. - AbsoluteMaxBytes: 99 MB - - # Preferred Max Bytes: The preferred maximum number of bytes allowed for - # the serialized messages in a batch. A message larger than the preferred - # max bytes will result in a batch larger than preferred max bytes. - PreferredMaxBytes: 512 KB - - Kafka: - # Brokers: A list of Kafka brokers to which the orderer connects - # NOTE: Use IP:port notation - Brokers: - - 127.0.0.1:9092 - - # Organizations is the list of orgs which are defined as participants on - # the orderer side of the network - Organizations: - -################################################################################ -# -# SECTION: Application -# -# - This section defines the values to encode into a config transaction or -# genesis block for application related parameters -# -################################################################################ -Application: &ApplicationDefaults - - # Organizations is the list of orgs which are defined as participants on - # the application side of the network - Organizations: diff --git a/src/user-dashboard/fabric/fabric-1.0/core.yaml b/src/user-dashboard/fabric/fabric-1.0/core.yaml deleted file mode 100644 index b1eddbb31..000000000 --- a/src/user-dashboard/fabric/fabric-1.0/core.yaml +++ /dev/null @@ -1,436 +0,0 @@ -# Copyright IBM Corp. All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# - -############################################################################### -# -# LOGGING section -# -############################################################################### -logging: - - # Default logging levels are specified here. - - # Valid logging levels are case-insensitive strings chosen from - - # CRITICAL | ERROR | WARNING | NOTICE | INFO | DEBUG - - # The overall default logging level can be specified in various ways, - # listed below from strongest to weakest: - # - # 1. The --logging-level= command line option overrides all other - # default specifications. - # - # 2. The environment variable CORE_LOGGING_LEVEL otherwise applies to - # all peer commands if defined as a non-empty string. - # - # 3. The value of peer that directly follows in this file. It can also - # be set via the environment variable CORE_LOGGING_PEER. - # - # If no overall default level is provided via any of the above methods, - # the peer will default to INFO (the value of defaultLevel in - # common/flogging/logging.go) - - # Default for all modules running within the scope of a peer. - # Note: this value is only used when --logging-level or CORE_LOGGING_LEVEL - # are not set - peer: info - - # The overall default values mentioned above can be overridden for the - # specific components listed in the override section below. - - # Override levels for various peer modules. These levels will be - # applied once the peer has completely started. They are applied at this - # time in order to be sure every logger has been registered with the - # logging package. - # Note: the modules listed below are the only acceptable modules at this - # time. - cauthdsl: warning - gossip: warning - ledger: info - msp: warning - policies: warning - grpc: error - - # Message format for the peer logs - format: '%{color}%{time:2006-01-02 15:04:05.000 MST} [%{module}] %{shortfunc} -> %{level:.4s} %{id:03x}%{color:reset} %{message}' - -############################################################################### -# -# Peer section -# -############################################################################### -peer: - - # The Peer id is used for identifying this Peer instance. - id: jdoe - - # The networkId allows for logical seperation of networks - networkId: dev - - # The Address at local network interface this Peer will listen on. - # By default, it will listen on all network interfaces - listenAddress: 0.0.0.0:7051 - - # The endpoint this peer uses to listen for inbound chaincode connections. - # - # The chaincode connection does not support TLS-mutual auth. Having a - # separate listener for the chaincode helps isolate the chaincode - # environment for enhanced security, so it is strongly recommended to - # uncomment chaincodeListenAddress and specify a protected endpoint. - # - # If chaincodeListenAddress is not configured or equals to the listenAddress, - # listenAddress will be used for chaincode connections. This is not - # recommended for production. - # - # chaincodeListenAddress: 127.0.0.1:7052 - - # When used as peer config, this represents the endpoint to other peers - # in the same organization for peers in other organization, see - # gossip.externalEndpoint for more info. - # When used as CLI config, this means the peer's endpoint to interact with - address: 0.0.0.0:7051 - - # Whether the Peer should programmatically determine its address - # This case is useful for docker containers. - addressAutoDetect: false - - # Setting for runtime.GOMAXPROCS(n). If n < 1, it does not change the - # current setting - gomaxprocs: -1 - - # Gossip related configuration - gossip: - # Bootstrap set to initialize gossip with. - # This is a list of other peers that this peer reaches out to at startup. - # Important: The endpoints here have to be endpoints of peers in the same - # organization, because the peer would refuse connecting to these endpoints - # unless they are in the same organization as the peer. - bootstrap: 127.0.0.1:7051 - - # NOTE: orgLeader and useLeaderElection parameters are mutual exclusive. - # Setting both to true would result in the termination of the peer - # since this is undefined state. If the peers are configured with - # useLeaderElection=false, make sure there is at least 1 peer in the - # organization that its orgLeader is set to true. - - # Defines whenever peer will initialize dynamic algorithm for - # "leader" selection, where leader is the peer to establish - # connection with ordering service and use delivery protocol - # to pull ledger blocks from ordering service. It is recommended to - # use leader election for large networks of peers. - useLeaderElection: false - # Statically defines peer to be an organization "leader", - # where this means that current peer will maintain connection - # with ordering service and disseminate block across peers in - # its own organization - orgLeader: true - - # Overrides the endpoint that the peer publishes to peers - # in its organization. For peers in foreign organizations - # see 'externalEndpoint' - endpoint: - # Maximum count of blocks stored in memory - maxBlockCountToStore: 100 - # Max time between consecutive message pushes(unit: millisecond) - maxPropagationBurstLatency: 10ms - # Max number of messages stored until a push is triggered to remote peers - maxPropagationBurstSize: 10 - # Number of times a message is pushed to remote peers - propagateIterations: 1 - # Number of peers selected to push messages to - propagatePeerNum: 3 - # Determines frequency of pull phases(unit: second) - pullInterval: 4s - # Number of peers to pull from - pullPeerNum: 3 - # Determines frequency of pulling state info messages from peers(unit: second) - requestStateInfoInterval: 4s - # Determines frequency of pushing state info messages to peers(unit: second) - publishStateInfoInterval: 4s - # Maximum time a stateInfo message is kept until expired - stateInfoRetentionInterval: - # Time from startup certificates are included in Alive messages(unit: second) - publishCertPeriod: 10s - # Should we skip verifying block messages or not (currently not in use) - skipBlockVerification: false - # Dial timeout(unit: second) - dialTimeout: 3s - # Connection timeout(unit: second) - connTimeout: 2s - # Buffer size of received messages - recvBuffSize: 20 - # Buffer size of sending messages - sendBuffSize: 200 - # Time to wait before pull engine processes incoming digests (unit: second) - digestWaitTime: 1s - # Time to wait before pull engine removes incoming nonce (unit: second) - requestWaitTime: 1s - # Time to wait before pull engine ends pull (unit: second) - responseWaitTime: 2s - # Alive check interval(unit: second) - aliveTimeInterval: 5s - # Alive expiration timeout(unit: second) - aliveExpirationTimeout: 25s - # Reconnect interval(unit: second) - reconnectInterval: 25s - # This is an endpoint that is published to peers outside of the organization. - # If this isn't set, the peer will not be known to other organizations. - externalEndpoint: - # Leader election service configuration - election: - # Longest time peer waits for stable membership during leader election startup (unit: second) - startupGracePeriod: 15s - # Interval gossip membership samples to check its stability (unit: second) - membershipSampleInterval: 1s - # Time passes since last declaration message before peer decides to perform leader election (unit: second) - leaderAliveThreshold: 10s - # Time between peer sends propose message and declares itself as a leader (sends declaration message) (unit: second) - leaderElectionDuration: 5s - - # EventHub related configuration - events: - # The address that the Event service will be enabled on the peer - address: 0.0.0.0:7053 - - # total number of events that could be buffered without blocking send - buffersize: 100 - - # timeout duration for producer to send an event. - # if < 0, if buffer full, unblocks immediately and not send - # if 0, if buffer full, will block and guarantee the event will be sent out - # if > 0, if buffer full, blocks till timeout - timeout: 10ms - - # TLS Settings - # Note that peer-chaincode connections through chaincodeListenAddress is - # not mutual TLS auth. See comments on chaincodeListenAddress for more info - tls: - enabled: false - cert: - file: tls/server.crt - key: - file: tls/server.key - rootcert: - file: tls/ca.crt - - # The server name use to verify the hostname returned by TLS handshake - serverhostoverride: - - # Path on the file system where peer will store data (eg ledger). This - # location must be access control protected to prevent unintended - # modification that might corrupt the peer operations. - fileSystemPath: /var/hyperledger/production - - # BCCSP (Blockchain crypto provider): Select which crypto implementation or - # library to use - BCCSP: - Default: SW - SW: - # TODO: The default Hash and Security level needs refactoring to be - # fully configurable. Changing these defaults requires coordination - # SHA2 is hardcoded in several places, not only BCCSP - Hash: SHA2 - Security: 256 - # Location of Key Store - FileKeyStore: - # If "", defaults to 'mspConfigPath'/keystore - # TODO: Ensure this is read with fabric/core/config.GetPath() once ready - KeyStore: - - # Path on the file system where peer will find MSP local configurations - mspConfigPath: msp - - # Identifier of the local MSP - # ----!!!!IMPORTANT!!!-!!!IMPORTANT!!!-!!!IMPORTANT!!!!---- - # Deployers need to change the value of the localMspId string. - # In particular, the name of the local MSP ID of a peer needs - # to match the name of one of the MSPs in each of the channel - # that this peer is a member of. Otherwise this peer's messages - # will not be identified as valid by other nodes. - localMspId: DEFAULT - - # Used with Go profiling tools only in none production environment. In - # production, it should be disabled (eg enabled: false) - profile: - enabled: false - listenAddress: 0.0.0.0:6060 - -############################################################################### -# -# VM section -# -############################################################################### -vm: - - # Endpoint of the vm management system. For docker can be one of the following in general - # unix:///var/run/docker.sock - # http://localhost:2375 - # https://localhost:2376 - endpoint: unix:///var/run/docker.sock - - # settings for docker vms - docker: - tls: - enabled: false - ca: - file: docker/ca.crt - cert: - file: docker/tls.crt - key: - file: docker/tls.key - - # Enables/disables the standard out/err from chaincode containers for - # debugging purposes - attachStdout: false - - # Parameters on creating docker container. - # Container may be efficiently created using ipam & dns-server for cluster - # NetworkMode - sets the networking mode for the container. Supported - # standard values are: `host`(default),`bridge`,`ipvlan`,`none`. - # Dns - a list of DNS servers for the container to use. - # Note: `Privileged` `Binds` `Links` and `PortBindings` properties of - # Docker Host Config are not supported and will not be used if set. - # LogConfig - sets the logging driver (Type) and related options - # (Config) for Docker. For more info, - # https://docs.docker.com/engine/admin/logging/overview/ - # Note: Set LogConfig using Environment Variables is not supported. - hostConfig: - NetworkMode: host - Dns: - # - 192.168.0.1 - LogConfig: - Type: json-file - Config: - max-size: "50m" - max-file: "5" - Memory: 2147483648 - -############################################################################### -# -# Chaincode section -# -############################################################################### -chaincode: - # This is used if chaincode endpoint resolution fails with the - # chaincodeListenAddress property - peerAddress: - - # The id is used by the Chaincode stub to register the executing Chaincode - # ID with the Peer and is generally supplied through ENV variables - # the `path` form of ID is provided when installing the chaincode. - # The `name` is used for all other requests and can be any string. - id: - path: - name: - - # Generic builder environment, suitable for most chaincode types - builder: $(DOCKER_NS)/fabric-ccenv:$(ARCH)-$(PROJECT_VERSION) - - golang: - # golang will never need more than baseos - runtime: $(BASE_DOCKER_NS)/fabric-baseos:$(ARCH)-$(BASE_VERSION) - - car: - # car may need more facilities (JVM, etc) in the future as the catalog - # of platforms are expanded. For now, we can just use baseos - runtime: $(BASE_DOCKER_NS)/fabric-baseos:$(ARCH)-$(BASE_VERSION) - - java: - # This is an image based on java:openjdk-8 with addition compiler - # tools added for java shim layer packaging. - # This image is packed with shim layer libraries that are necessary - # for Java chaincode runtime. - Dockerfile: | - from $(DOCKER_NS)/fabric-javaenv:$(ARCH)-$(PROJECT_VERSION) - - # Timeout duration for starting up a container and waiting for Register - # to come through. 1sec should be plenty for chaincode unit tests - startuptimeout: 300s - - # Timeout duration for Invoke and Init calls to prevent runaway. - # This timeout is used by all chaincodes in all the channels, including - # system chaincodes. - # Note that during Invoke, if the image is not available (e.g. being - # cleaned up when in development environment), the peer will automatically - # build the image, which might take more time. In production environment, - # the chaincode image is unlikely to be deleted, so the timeout could be - # reduced accordingly. - executetimeout: 30s - - # There are 2 modes: "dev" and "net". - # In dev mode, user runs the chaincode after starting peer from - # command line on local machine. - # In net mode, peer will run chaincode in a docker container. - mode: net - - # keepalive in seconds. In situations where the communiction goes through a - # proxy that does not support keep-alive, this parameter will maintain connection - # between peer and chaincode. - # A value <= 0 turns keepalive off - keepalive: 0 - - # system chaincodes whitelist. To add system chaincode "myscc" to the - # whitelist, add "myscc: enable" to the list below, and register in - # chaincode/importsysccs.go - system: - cscc: enable - lscc: enable - escc: enable - vscc: enable - qscc: enable - - # Logging section for the chaincode container - logging: - # Default level for all loggers within the chaincode container - level: info - # Override default level for the 'shim' module - shim: warning - # Format for the chaincode container logs - format: '%{color}%{time:2006-01-02 15:04:05.000 MST} [%{module}] %{shortfunc} -> %{level:.4s} %{id:03x}%{color:reset} %{message}' - -############################################################################### -# -# Ledger section - ledger configuration encompases both the blockchain -# and the state -# -############################################################################### -ledger: - - blockchain: - - state: - # stateDatabase - options are "goleveldb", "CouchDB" - # goleveldb - default state database stored in goleveldb. - # CouchDB - store state database in CouchDB - stateDatabase: goleveldb - couchDBConfig: - # It is recommended to run CouchDB on the same server as the peer, and - # not map the CouchDB container port to a server port in docker-compose. - # Otherwise proper security must be provided on the connection between - # CouchDB client (on the peer) and server. - couchDBAddress: 127.0.0.1:5984 - # This username must have read and write authority on CouchDB - username: - # The password is recommended to pass as an environment variable - # during start up (eg LEDGER_COUCHDBCONFIG_PASSWORD). - # If it is stored here, the file must be access control protected - # to prevent unintended users from discovering the password. - password: - # Number of retries for CouchDB errors - maxRetries: 3 - # Number of retries for CouchDB errors during peer startup - maxRetriesOnStartup: 10 - # CouchDB request timeout (unit: duration, e.g. 20s) - requestTimeout: 35s - # Limit on the number of records to return per query - queryLimit: 10000 - - - history: - # enableHistoryDatabase - options are true or false - # Indicates if the history of key updates should be stored. - # All history 'index' will be stored in goleveldb, regardless if using - # CouchDB or alternate database for the state. - enableHistoryDatabase: true diff --git a/src/user-dashboard/fabric/fabric-1.0/msp/admincerts/admincert.pem b/src/user-dashboard/fabric/fabric-1.0/msp/admincerts/admincert.pem deleted file mode 100644 index 5f6293ac3..000000000 --- a/src/user-dashboard/fabric/fabric-1.0/msp/admincerts/admincert.pem +++ /dev/null @@ -1,16 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICjDCCAjKgAwIBAgIUBEVwsSx0TmqdbzNwleNBBzoIT0wwCgYIKoZIzj0EAwIw -fzELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNh -biBGcmFuY2lzY28xHzAdBgNVBAoTFkludGVybmV0IFdpZGdldHMsIEluYy4xDDAK -BgNVBAsTA1dXVzEUMBIGA1UEAxMLZXhhbXBsZS5jb20wHhcNMTYxMTExMTcwNzAw -WhcNMTcxMTExMTcwNzAwWjBjMQswCQYDVQQGEwJVUzEXMBUGA1UECBMOTm9ydGgg -Q2Fyb2xpbmExEDAOBgNVBAcTB1JhbGVpZ2gxGzAZBgNVBAoTEkh5cGVybGVkZ2Vy -IEZhYnJpYzEMMAoGA1UECxMDQ09QMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE -HBuKsAO43hs4JGpFfiGMkB/xsILTsOvmN2WmwpsPHZNL6w8HWe3xCPQtdG/XJJvZ -+C756KEsUBM3yw5PTfku8qOBpzCBpDAOBgNVHQ8BAf8EBAMCBaAwHQYDVR0lBBYw -FAYIKwYBBQUHAwEGCCsGAQUFBwMCMAwGA1UdEwEB/wQCMAAwHQYDVR0OBBYEFOFC -dcUZ4es3ltiCgAVDoyLfVpPIMB8GA1UdIwQYMBaAFBdnQj2qnoI/xMUdn1vDmdG1 -nEgQMCUGA1UdEQQeMByCCm15aG9zdC5jb22CDnd3dy5teWhvc3QuY29tMAoGCCqG -SM49BAMCA0gAMEUCIDf9Hbl4xn3z4EwNKmilM9lX2Fq4jWpAaRVB97OmVEeyAiEA -25aDPQHGGq2AvhKT0wvt08cX1GTGCIbfmuLpMwKQj38= ------END CERTIFICATE----- diff --git a/src/user-dashboard/fabric/fabric-1.0/msp/cacerts/cacert.pem b/src/user-dashboard/fabric/fabric-1.0/msp/cacerts/cacert.pem deleted file mode 100644 index 8d98dfa59..000000000 --- a/src/user-dashboard/fabric/fabric-1.0/msp/cacerts/cacert.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICYjCCAgmgAwIBAgIUB3CTDOU47sUC5K4kn/Caqnh114YwCgYIKoZIzj0EAwIw -fzELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNh -biBGcmFuY2lzY28xHzAdBgNVBAoTFkludGVybmV0IFdpZGdldHMsIEluYy4xDDAK -BgNVBAsTA1dXVzEUMBIGA1UEAxMLZXhhbXBsZS5jb20wHhcNMTYxMDEyMTkzMTAw -WhcNMjExMDExMTkzMTAwWjB/MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZv -cm5pYTEWMBQGA1UEBxMNU2FuIEZyYW5jaXNjbzEfMB0GA1UEChMWSW50ZXJuZXQg -V2lkZ2V0cywgSW5jLjEMMAoGA1UECxMDV1dXMRQwEgYDVQQDEwtleGFtcGxlLmNv -bTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABKIH5b2JaSmqiQXHyqC+cmknICcF -i5AddVjsQizDV6uZ4v6s+PWiJyzfA/rTtMvYAPq/yeEHpBUB1j053mxnpMujYzBh -MA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBQXZ0I9 -qp6CP8TFHZ9bw5nRtZxIEDAfBgNVHSMEGDAWgBQXZ0I9qp6CP8TFHZ9bw5nRtZxI -EDAKBggqhkjOPQQDAgNHADBEAiAHp5Rbp9Em1G/UmKn8WsCbqDfWecVbZPQj3RK4 -oG5kQQIgQAe4OOKYhJdh3f7URaKfGTf492/nmRmtK+ySKjpHSrU= ------END CERTIFICATE----- diff --git a/src/user-dashboard/fabric/fabric-1.0/msp/config.yaml b/src/user-dashboard/fabric/fabric-1.0/msp/config.yaml deleted file mode 100644 index 63bec1e0d..000000000 --- a/src/user-dashboard/fabric/fabric-1.0/msp/config.yaml +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright IBM Corp. All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# - -OrganizationalUnitIdentifiers: - - Certificate: "cacerts/cacert.pem" - OrganizationalUnitIdentifier: "COP" diff --git a/src/user-dashboard/fabric/fabric-1.0/msp/keystore/key.pem b/src/user-dashboard/fabric/fabric-1.0/msp/keystore/key.pem deleted file mode 100644 index ba48df918..000000000 --- a/src/user-dashboard/fabric/fabric-1.0/msp/keystore/key.pem +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN EC PRIVATE KEY----- -MHcCAQEEIAsWwFunEzqz1Rh6nvD4MiPkKCtmoxzh3jTquG5MSbeLoAoGCCqGSM49 -AwEHoUQDQgAEHBuKsAO43hs4JGpFfiGMkB/xsILTsOvmN2WmwpsPHZNL6w8HWe3x -CPQtdG/XJJvZ+C756KEsUBM3yw5PTfku8g== ------END EC PRIVATE KEY----- diff --git a/src/user-dashboard/fabric/fabric-1.0/msp/signcerts/peer.pem b/src/user-dashboard/fabric/fabric-1.0/msp/signcerts/peer.pem deleted file mode 100644 index 5f6293ac3..000000000 --- a/src/user-dashboard/fabric/fabric-1.0/msp/signcerts/peer.pem +++ /dev/null @@ -1,16 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICjDCCAjKgAwIBAgIUBEVwsSx0TmqdbzNwleNBBzoIT0wwCgYIKoZIzj0EAwIw -fzELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNh -biBGcmFuY2lzY28xHzAdBgNVBAoTFkludGVybmV0IFdpZGdldHMsIEluYy4xDDAK -BgNVBAsTA1dXVzEUMBIGA1UEAxMLZXhhbXBsZS5jb20wHhcNMTYxMTExMTcwNzAw -WhcNMTcxMTExMTcwNzAwWjBjMQswCQYDVQQGEwJVUzEXMBUGA1UECBMOTm9ydGgg -Q2Fyb2xpbmExEDAOBgNVBAcTB1JhbGVpZ2gxGzAZBgNVBAoTEkh5cGVybGVkZ2Vy -IEZhYnJpYzEMMAoGA1UECxMDQ09QMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE -HBuKsAO43hs4JGpFfiGMkB/xsILTsOvmN2WmwpsPHZNL6w8HWe3xCPQtdG/XJJvZ -+C756KEsUBM3yw5PTfku8qOBpzCBpDAOBgNVHQ8BAf8EBAMCBaAwHQYDVR0lBBYw -FAYIKwYBBQUHAwEGCCsGAQUFBwMCMAwGA1UdEwEB/wQCMAAwHQYDVR0OBBYEFOFC -dcUZ4es3ltiCgAVDoyLfVpPIMB8GA1UdIwQYMBaAFBdnQj2qnoI/xMUdn1vDmdG1 -nEgQMCUGA1UdEQQeMByCCm15aG9zdC5jb22CDnd3dy5teWhvc3QuY29tMAoGCCqG -SM49BAMCA0gAMEUCIDf9Hbl4xn3z4EwNKmilM9lX2Fq4jWpAaRVB97OmVEeyAiEA -25aDPQHGGq2AvhKT0wvt08cX1GTGCIbfmuLpMwKQj38= ------END CERTIFICATE----- diff --git a/src/user-dashboard/fabric/fabric-1.0/msp/tlscacerts/cert.pem b/src/user-dashboard/fabric/fabric-1.0/msp/tlscacerts/cert.pem deleted file mode 100644 index 8d98dfa59..000000000 --- a/src/user-dashboard/fabric/fabric-1.0/msp/tlscacerts/cert.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICYjCCAgmgAwIBAgIUB3CTDOU47sUC5K4kn/Caqnh114YwCgYIKoZIzj0EAwIw -fzELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNh -biBGcmFuY2lzY28xHzAdBgNVBAoTFkludGVybmV0IFdpZGdldHMsIEluYy4xDDAK -BgNVBAsTA1dXVzEUMBIGA1UEAxMLZXhhbXBsZS5jb20wHhcNMTYxMDEyMTkzMTAw -WhcNMjExMDExMTkzMTAwWjB/MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZv -cm5pYTEWMBQGA1UEBxMNU2FuIEZyYW5jaXNjbzEfMB0GA1UEChMWSW50ZXJuZXQg -V2lkZ2V0cywgSW5jLjEMMAoGA1UECxMDV1dXMRQwEgYDVQQDEwtleGFtcGxlLmNv -bTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABKIH5b2JaSmqiQXHyqC+cmknICcF -i5AddVjsQizDV6uZ4v6s+PWiJyzfA/rTtMvYAPq/yeEHpBUB1j053mxnpMujYzBh -MA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBQXZ0I9 -qp6CP8TFHZ9bw5nRtZxIEDAfBgNVHSMEGDAWgBQXZ0I9qp6CP8TFHZ9bw5nRtZxI -EDAKBggqhkjOPQQDAgNHADBEAiAHp5Rbp9Em1G/UmKn8WsCbqDfWecVbZPQj3RK4 -oG5kQQIgQAe4OOKYhJdh3f7URaKfGTf492/nmRmtK+ySKjpHSrU= ------END CERTIFICATE----- diff --git a/src/user-dashboard/fabric/fabric-1.0/orderer.yaml b/src/user-dashboard/fabric/fabric-1.0/orderer.yaml deleted file mode 100644 index a149c89f4..000000000 --- a/src/user-dashboard/fabric/fabric-1.0/orderer.yaml +++ /dev/null @@ -1,226 +0,0 @@ -# Copyright IBM Corp. All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# - ---- -################################################################################ -# -# Orderer Configuration -# -# - This controls the type and configuration of the orderer. -# -################################################################################ -General: - - # Ledger Type: The ledger type to provide to the orderer. - # Two non-production ledger types are provided for test purposes only: - # - ram: An in-memory ledger whose contents are lost on restart. - # - json: A simple file ledger that writes blocks to disk in JSON format. - # Only one production ledger type is provided: - # - file: A production file-based ledger. - LedgerType: file - - # Listen address: The IP on which to bind to listen. - ListenAddress: 127.0.0.1 - - # Listen port: The port on which to bind to listen. - ListenPort: 7050 - - # TLS: TLS settings for the GRPC server. - TLS: - Enabled: false - PrivateKey: tls/server.key - Certificate: tls/server.crt - RootCAs: - - tls/ca.crt - ClientAuthEnabled: false - ClientRootCAs: - - # Log Level: The level at which to log. This accepts logging specifications - # per: fabric/docs/Setup/logging-control.md - LogLevel: info - - # Genesis method: The method by which the genesis block for the orderer - # system channel is specified. Available options are "provisional", "file": - # - provisional: Utilizes a genesis profile, specified by GenesisProfile, - # to dynamically generate a new genesis block. - # - file: Uses the file provided by GenesisFile as the genesis block. - GenesisMethod: provisional - - # Genesis profile: The profile to use to dynamically generate the genesis - # block to use when initializing the orderer system channel and - # GenesisMethod is set to "provisional". See the configtx.yaml file for the - # descriptions of the available profiles. Ignored if GenesisMethod is set to - # "file". - GenesisProfile: SampleInsecureSolo - - # Genesis file: The file containing the genesis block to use when - # initializing the orderer system channel and GenesisMethod is set to - # "file". Ignored if GenesisMethod is set to "provisional". - GenesisFile: genesisblock - - # LocalMSPDir is where to find the private crypto material needed by the - # orderer. It is set relative here as a default for dev environments but - # should be changed to the real location in production. - LocalMSPDir: msp - - # LocalMSPID is the identity to register the local MSP material with the MSP - # manager. IMPORTANT: The local MSP ID of an orderer needs to match the MSP - # ID of one of the organizations defined in the orderer system channel's - # /Channel/Orderer configuration. The sample organization defined in the - # sample configuration provided has an MSP ID of "DEFAULT". - LocalMSPID: DEFAULT - - # Enable an HTTP service for Go "pprof" profiling as documented at: - # https://golang.org/pkg/net/http/pprof - Profile: - Enabled: false - Address: 0.0.0.0:6060 - - # BCCSP configures the blockchain crypto service providers. - BCCSP: - # Default specifies the preferred blockchain crypto service provider - # to use. If the preferred provider is not available, the software - # based provider ("SW") will be used. - # Valid providers are: - # - SW: a software based crypto provider - # - PKCS11: a CA hardware security module crypto provider. - Default: SW - - # SW configures the software based blockchain crypto provider. - SW: - # TODO: The default Hash and Security level needs refactoring to be - # fully configurable. Changing these defaults requires coordination - # SHA2 is hardcoded in several places, not only BCCSP - Hash: SHA2 - Security: 256 - # Location of key store. If this is unset, a location will be - # chosen using: 'LocalMSPDir'/keystore - FileKeyStore: - KeyStore: - -################################################################################ -# -# SECTION: File Ledger -# -# - This section applies to the configuration of the file or json ledgers. -# -################################################################################ -FileLedger: - - # Location: The directory to store the blocks in. - # NOTE: If this is unset, a new temporary location will be chosen every time - # the orderer is restarted, using the prefix specified by Prefix. - Location: /var/hyperledger/production/orderer - - # The prefix to use when generating a ledger directory in temporary space. - # Otherwise, this value is ignored. - Prefix: hyperledger-fabric-ordererledger - -################################################################################ -# -# SECTION: RAM Ledger -# -# - This section applies to the configuration of the RAM ledger. -# -################################################################################ -RAMLedger: - - # History Size: The number of blocks that the RAM ledger is set to retain. - # WARNING: Appending a block to the ledger might cause the oldest block in - # the ledger to be dropped in order to limit the number total number blocks - # to HistorySize. For example, if history size is 10, when appending block - # 10, block 0 (the genesis block!) will be dropped to make room for block 10. - HistorySize: 1000 - -################################################################################ -# -# SECTION: Kafka -# -# - This section applies to the configuration of the Kafka-based orderer, and -# its interaction with the Kafka cluster. -# -################################################################################ -Kafka: - - # Retry: What do if a connection to the Kafka cluster cannot be established, - # or if a metadata request to the Kafka cluster needs to be repeated. - Retry: - # When a new channel is created, or when an existing channel is reloaded - # (in case of a just-restarted orderer), the orderer interacts with the - # Kafka cluster in the following ways: - # 1. It creates a Kafka producer (writer) for the Kafka partition that - # corresponds to the channel. - # 2. It uses that producer to post a no-op CONNECT message to that - # partition - # 3. It creates a Kafka consumer (reader) for that partition. - # If any of these steps fail, they will be re-attempted every - # for a total of , and then every - # for a total of until they succeed. - # Note that the orderer will be unable to write to or read from a - # channel until all of the steps above have been completed successfully. - ShortInterval: 5s - ShortTotal: 10m - LongInterval: 5m - LongTotal: 12h - # Affects the socket timeouts when waiting for an initial connection, a - # response, or a transmission. See Config.Net for more info: - # https://godoc.org/github.com/Shopify/sarama#Config - NetworkTimeouts: - DialTimeout: 10s - ReadTimeout: 10s - WriteTimeout: 10s - # Affects the metadata requests when the Kafka cluster is in the middle - # of a leader election.See Config.Metadata for more info: - # https://godoc.org/github.com/Shopify/sarama#Config - Metadata: - RetryBackoff: 250ms - RetryMax: 3 - # What to do if posting a message to the Kafka cluster fails. See - # Config.Producer for more info: - # https://godoc.org/github.com/Shopify/sarama#Config - Producer: - RetryBackoff: 100ms - RetryMax: 3 - # What to do if reading from the Kafka cluster fails. See - # Config.Consumer for more info: - # https://godoc.org/github.com/Shopify/sarama#Config - Consumer: - RetryBackoff: 2s - - # Verbose: Enable logging for interactions with the Kafka cluster. - Verbose: false - - # TLS: TLS settings for the orderer's connection to the Kafka cluster. - TLS: - - # Enabled: Use TLS when connecting to the Kafka cluster. - Enabled: false - - # PrivateKey: PEM-encoded private key the orderer will use for - # authentication. - PrivateKey: - # As an alternative to specifying the PrivateKey here, uncomment the - # following "File" key and specify the file name from which to load the - # value of PrivateKey. - #File: path/to/PrivateKey - - # Certificate: PEM-encoded signed public key certificate the orderer will - # use for authentication. - Certificate: - # As an alternative to specifying the Certificate here, uncomment the - # following "File" key and specify the file name from which to load the - # value of Certificate. - #File: path/to/Certificate - - # RootCAs: PEM-encoded trusted root certificates used to validate - # certificates from the Kafka cluster. - RootCAs: - # As an alternative to specifying the RootCAs here, uncomment the - # following "File" key and specify the file name from which to load the - # value of RootCAs. - #File: path/to/RootCAs - - # Kafka version of the Kafka cluster brokers (defaults to 0.9.0.1) - Version: diff --git a/src/user-dashboard/fabric/fabric-1.2/configtx.yaml b/src/user-dashboard/fabric/fabric-1.2/configtx.yaml deleted file mode 100644 index e55efb05a..000000000 --- a/src/user-dashboard/fabric/fabric-1.2/configtx.yaml +++ /dev/null @@ -1,204 +0,0 @@ -# Copyright IBM Corp. All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# - ---- -################################################################################ -# -# Section: Organizations -# -# - This section defines the different organizational identities which will -# be referenced later in the configuration. -# -################################################################################ -Organizations: - - # SampleOrg defines an MSP using the sampleconfig. It should never be used - # in production but may be used as a template for other definitions - - &OrdererOrg - # DefaultOrg defines the organization which is used in the sampleconfig - # of the fabric.git development environment - Name: OrdererOrg - - # ID to load the MSP definition as - ID: OrdererMSP - - # MSPDir is the filesystem path which contains the MSP configuration - MSPDir: crypto-config/ordererOrganizations/example.com/msp - - - &Org1 - # DefaultOrg defines the organization which is used in the sampleconfig - # of the fabric.git development environment - Name: Org1MSP - - # ID to load the MSP definition as - ID: Org1MSP - - MSPDir: crypto-config/peerOrganizations/org1.example.com/msp - - AnchorPeers: - # AnchorPeers defines the location of peers which can be used - # for cross org gossip communication. Note, this value is only - # encoded in the genesis block in the Application section context - - Host: peer0.org1.example.com - Port: 7051 - - - &Org2 - # DefaultOrg defines the organization which is used in the sampleconfig - # of the fabric.git development environment - Name: Org2MSP - - # ID to load the MSP definition as - ID: Org2MSP - - MSPDir: crypto-config/peerOrganizations/org2.example.com/msp - - AnchorPeers: - # AnchorPeers defines the location of peers which can be used - # for cross org gossip communication. Note, this value is only - # encoded in the genesis block in the Application section context - - Host: peer0.org2.example.com - Port: 7051 - -################################################################################ -# -# SECTION: Capabilities -# -# - This section defines the capabilities of fabric network. This is a new -# concept as of v1.1.0 and should not be utilized in mixed networks with -# v1.0.x peers and orderers. Capabilities define features which must be -# present in a fabric binary for that binary to safely participate in the -# fabric network. For instance, if a new MSP type is added, newer binaries -# might recognize and validate the signatures from this type, while older -# binaries without this support would be unable to validate those -# transactions. This could lead to different versions of the fabric binaries -# having different world states. Instead, defining a capability for a channel -# informs those binaries without this capability that they must cease -# processing transactions until they have been upgraded. For v1.0.x if any -# capabilities are defined (including a map with all capabilities turned off) -# then the v1.0.x peer will deliberately crash. -# -################################################################################ -Capabilities: - # Channel capabilities apply to both the orderers and the peers and must be - # supported by both. Set the value of the capability to true to require it. - Global: &ChannelCapabilities - # V1.1 for Global is a catchall flag for behavior which has been - # determined to be desired for all orderers and peers running v1.0.x, - # but the modification of which would cause incompatibilities. Users - # should leave this flag set to true. - V1_1: true - - # Orderer capabilities apply only to the orderers, and may be safely - # manipulated without concern for upgrading peers. Set the value of the - # capability to true to require it. - Orderer: &OrdererCapabilities - # V1.1 for Order is a catchall flag for behavior which has been - # determined to be desired for all orderers running v1.0.x, but the - # modification of which would cause incompatibilities. Users should - # leave this flag set to true. - V1_1: true - - # Application capabilities apply only to the peer network, and may be safely - # manipulated without concern for upgrading orderers. Set the value of the - # capability to true to require it. - Application: &ApplicationCapabilities - # V1.2 for Application is a catchall flag for behavior which has been - # determined to be desired for all peers running v1.0.x, but the - # modification of which would cause incompatibilities. Users should - # leave this flag set to true. - V1_2: true - -################################################################################ -# -# SECTION: Application -# -# - This section defines the values to encode into a config transaction or -# genesis block for application related parameters -# -################################################################################ -Application: &ApplicationDefaults - - # Organizations is the list of orgs which are defined as participants on - # the application side of the network - Organizations: - -################################################################################ -# -# SECTION: Orderer -# -# - This section defines the values to encode into a config transaction or -# genesis block for orderer related parameters -# -################################################################################ -Orderer: &OrdererDefaults - - # Orderer Type: The orderer implementation to start - # Available types are "solo" and "kafka" - OrdererType: solo - - Addresses: - - orderer.example.com:7050 - - # Batch Timeout: The amount of time to wait before creating a batch - BatchTimeout: 2s - - # Batch Size: Controls the number of messages batched into a block - BatchSize: - - # Max Message Count: The maximum number of messages to permit in a batch - MaxMessageCount: 10 - - # Absolute Max Bytes: The absolute maximum number of bytes allowed for - # the serialized messages in a batch. - AbsoluteMaxBytes: 99 MB - - # Preferred Max Bytes: The preferred maximum number of bytes allowed for - # the serialized messages in a batch. A message larger than the preferred - # max bytes will result in a batch larger than preferred max bytes. - PreferredMaxBytes: 512 KB - - Kafka: - # Brokers: A list of Kafka brokers to which the orderer connects - # NOTE: Use IP:port notation - Brokers: - - 127.0.0.1:9092 - - # Organizations is the list of orgs which are defined as participants on - # the orderer side of the network - Organizations: - -################################################################################ -# -# Profile -# -# - Different configuration profiles may be encoded here to be specified -# as parameters to the configtxgen tool -# -################################################################################ -Profiles: - - TwoOrgsOrdererGenesis: - Capabilities: - <<: *ChannelCapabilities - Orderer: - <<: *OrdererDefaults - Organizations: - - *OrdererOrg - Capabilities: - <<: *OrdererCapabilities - Consortiums: - SampleConsortium: - Organizations: - - *Org1 - - *Org2 - TwoOrgsChannel: - Consortium: SampleConsortium - Application: - <<: *ApplicationDefaults - Organizations: - - *Org1 - - *Org2 - Capabilities: - <<: *ApplicationCapabilities diff --git a/src/user-dashboard/fabric/fabric-1.2/crypto-config.yaml b/src/user-dashboard/fabric/fabric-1.2/crypto-config.yaml deleted file mode 100644 index 73b444d8c..000000000 --- a/src/user-dashboard/fabric/fabric-1.2/crypto-config.yaml +++ /dev/null @@ -1,83 +0,0 @@ -# Copyright IBM Corp. All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# - -# --------------------------------------------------------------------------- -# "OrdererOrgs" - Definition of organizations managing orderer nodes -# --------------------------------------------------------------------------- -OrdererOrgs: - # --------------------------------------------------------------------------- - # Orderer - # --------------------------------------------------------------------------- - - Name: Orderer - Domain: example.com - # --------------------------------------------------------------------------- - # "Specs" - See PeerOrgs below for complete description - # --------------------------------------------------------------------------- - Specs: - - Hostname: orderer -# --------------------------------------------------------------------------- -# "PeerOrgs" - Definition of organizations managing peer nodes -# --------------------------------------------------------------------------- -PeerOrgs: - # --------------------------------------------------------------------------- - # Org1 - # --------------------------------------------------------------------------- - - Name: Org1 - Domain: org1.example.com - EnableNodeOUs: true - # --------------------------------------------------------------------------- - # "Specs" - # --------------------------------------------------------------------------- - # Uncomment this section to enable the explicit definition of hosts in your - # configuration. Most users will want to use Template, below - # - # Specs is an array of Spec entries. Each Spec entry consists of two fields: - # - Hostname: (Required) The desired hostname, sans the domain. - # - CommonName: (Optional) Specifies the template or explicit override for - # the CN. By default, this is the template: - # - # "{{.Hostname}}.{{.Domain}}" - # - # which obtains its values from the Spec.Hostname and - # Org.Domain, respectively. - # --------------------------------------------------------------------------- - # Specs: - # - Hostname: foo # implicitly "foo.org1.example.com" - # CommonName: foo27.org5.example.com # overrides Hostname-based FQDN set above - # - Hostname: bar - # - Hostname: baz - # --------------------------------------------------------------------------- - # "Template" - # --------------------------------------------------------------------------- - # Allows for the definition of 1 or more hosts that are created sequentially - # from a template. By default, this looks like "peer%d" from 0 to Count-1. - # You may override the number of nodes (Count), the starting index (Start) - # or the template used to construct the name (Hostname). - # - # Note: Template and Specs are not mutually exclusive. You may define both - # sections and the aggregate nodes will be created for you. Take care with - # name collisions - # --------------------------------------------------------------------------- - Template: - Count: 2 - # Start: 5 - # Hostname: {{.Prefix}}{{.Index}} # default - # --------------------------------------------------------------------------- - # "Users" - # --------------------------------------------------------------------------- - # Count: The number of user accounts _in addition_ to Admin - # --------------------------------------------------------------------------- - Users: - Count: 1 - # --------------------------------------------------------------------------- - # Org2: See "Org1" for full specification - # --------------------------------------------------------------------------- - - Name: Org2 - Domain: org2.example.com - EnableNodeOUs: true - Template: - Count: 2 - Users: - Count: 1 diff --git a/src/user-dashboard/fabric/fabric-1.2/cryptogen.yaml b/src/user-dashboard/fabric/fabric-1.2/cryptogen.yaml deleted file mode 100644 index be2a9f860..000000000 --- a/src/user-dashboard/fabric/fabric-1.2/cryptogen.yaml +++ /dev/null @@ -1,113 +0,0 @@ -# -# Copyright IBM Corp. All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# -# --------------------------------------------------------------------------- -# "OrdererOrgs" - Definition of organizations managing orderer nodes -# --------------------------------------------------------------------------- -OrdererOrgs: - # --------------------------------------------------------------------------- - # Orderer - # --------------------------------------------------------------------------- - - Name: Orderer - Domain: example.com - - # --------------------------------------------------------------------------- - # "Specs" - See PeerOrgs below for complete description - # --------------------------------------------------------------------------- - Specs: - - Hostname: orderer - -# --------------------------------------------------------------------------- -# "PeerOrgs" - Definition of organizations managing peer nodes -# --------------------------------------------------------------------------- -PeerOrgs: - # --------------------------------------------------------------------------- - # Org1 - # --------------------------------------------------------------------------- - - Name: Org1 - Domain: org1.example.com - - # --------------------------------------------------------------------------- - # "CA" - # --------------------------------------------------------------------------- - # Uncomment this section to enable the explicit definition of the CA for this - # organization. This entry is a Spec. See "Specs" section below for details. - # --------------------------------------------------------------------------- - CA: - Hostname: ca # implicitly ca.org1.example.com - - # --------------------------------------------------------------------------- - # "Specs" - # --------------------------------------------------------------------------- - # Uncomment this section to enable the explicit definition of hosts in your - # configuration. Most users will want to use Template, below - # - # Specs is an array of Spec entries. Each Spec entry consists of two fields: - # - Hostname: (Required) The desired hostname, sans the domain. - # - CommonName: (Optional) Specifies the template or explicit override for - # the CN. By default, this is the template: - # - # "{{.Hostname}}.{{.Domain}}" - # - # which obtains its values from the Spec.Hostname and - # Org.Domain, respectively. - # - SANS: (Optional) Specifies one or more Subject Alternative Names - # the be set in the resulting x509. Accepts template - # variables {{.Hostname}}, {{.Domain}}, {{.CommonName}} - # NOTE: Two implicit entries are created for you: - # - {{ .CommonName }} - # - {{ .Hostname }} - # --------------------------------------------------------------------------- - # Specs: - # - Hostname: foo # implicitly "foo.org1.example.com" - # CommonName: foo27.org5.example.com # overrides Hostname-based FQDN set above - # SANS: - # - "bar.{{.Domain}}" - # - "altfoo.{{.Domain}}" - # - "{{.Hostname}}.org6.net" - # - Hostname: bar - # - Hostname: baz - - # --------------------------------------------------------------------------- - # "Template" - # --------------------------------------------------------------------------- - # Allows for the definition of 1 or more hosts that are created sequentially - # from a template. By default, this looks like "peer%d" from 0 to Count-1. - # You may override the number of nodes (Count), the starting index (Start) - # or the template used to construct the name (Hostname). - # - # Note: Template and Specs are not mutually exclusive. You may define both - # sections and the aggregate nodes will be created for you. Take care with - # name collisions - # --------------------------------------------------------------------------- - Template: - Count: 2 - # Start: 5 - # Hostname: {{.Prefix}}{{.Index}} # default - SANS: - - "localhost" - - # --------------------------------------------------------------------------- - # "Users" - # --------------------------------------------------------------------------- - # Count: The number of user accounts _in addition_ to Admin - # --------------------------------------------------------------------------- - Users: - Count: 1 - - # --------------------------------------------------------------------------- - # Org2: See "Org1" for full specification - # --------------------------------------------------------------------------- - - Name: Org2 - Domain: org2.example.com - CA: - Hostname: ca # implicitly ca.org1.example.com - - Template: - Count: 2 - SANS: - - "localhost" - Users: - Count: 1 diff --git a/src/user-dashboard/fabric/fabric-1.2/genesis.block b/src/user-dashboard/fabric/fabric-1.2/genesis.block deleted file mode 100644 index 50f689585..000000000 Binary files a/src/user-dashboard/fabric/fabric-1.2/genesis.block and /dev/null differ diff --git a/src/user-dashboard/src/.babelrc.js b/src/user-dashboard/src/.babelrc.js deleted file mode 100644 index c11878030..000000000 --- a/src/user-dashboard/src/.babelrc.js +++ /dev/null @@ -1,12 +0,0 @@ -module.exports = { - plugins: [ - [ - 'babel-plugin-module-resolver', - { - alias: { - components: './app/assets/src/components', - }, - }, - ], - ], -}; diff --git a/src/user-dashboard/src/.eslintignore b/src/user-dashboard/src/.eslintignore deleted file mode 100644 index 0c6f6a77b..000000000 --- a/src/user-dashboard/src/.eslintignore +++ /dev/null @@ -1,4 +0,0 @@ -app/assets/src/index.js -app/assets/src/utils/notification.js -app/assets/src/themes/carbon.js -coverage/** diff --git a/src/user-dashboard/src/.eslintrc b/src/user-dashboard/src/.eslintrc deleted file mode 100644 index 4de5b3da0..000000000 --- a/src/user-dashboard/src/.eslintrc +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "eslint-config-egg", - "rules": { - "array-bracket-spacing": [0], - "no-extend-native": [0], - "no-bitwise": [0] - }, - "parser": "babel-eslint" -} diff --git a/src/user-dashboard/src/.travis.yml b/src/user-dashboard/src/.travis.yml deleted file mode 100644 index b735efcbf..000000000 --- a/src/user-dashboard/src/.travis.yml +++ /dev/null @@ -1,10 +0,0 @@ -sudo: false -language: node_js -node_js: - - '8' -install: - - npm i npminstall && npminstall -script: - - npm run ci -after_script: - - npminstall codecov && codecov diff --git a/src/user-dashboard/src/.ui-eslintrc b/src/user-dashboard/src/.ui-eslintrc deleted file mode 100644 index 3879a4fdb..000000000 --- a/src/user-dashboard/src/.ui-eslintrc +++ /dev/null @@ -1,76 +0,0 @@ -{ - "parser": "babel-eslint", - "extends": ["airbnb", "prettier"], - "env": { - "browser": true, - "node": true, - "es6": true, - "mocha": true, - "jest": true, - "jasmine": true - }, - "rules": { - "generator-star-spacing": [0], - "consistent-return": [0], - "react/forbid-prop-types": [0], - "react/jsx-filename-extension": [1, { "extensions": [".js"] }], - "global-require": [1], - "import/prefer-default-export": [0], - "react/jsx-no-bind": [0], - "react/prop-types": [0], - "react/prefer-stateless-function": [0], - "react/no-did-mount-set-state": [0], - "react/jsx-wrap-multilines": [ - "error", - { - "declaration": "parens-new-line", - "assignment": "parens-new-line", - "return": "parens-new-line", - "arrow": "parens-new-line", - "condition": "parens-new-line", - "logical": "parens-new-line", - "prop": "ignore" - } - ], - "no-else-return": [0], - "no-new": [0], - "no-underscore-dangle": [0], - "array-callback-return": [0], - "no-restricted-syntax": [0], - "import/no-extraneous-dependencies": [0], - "no-use-before-define": [0], - "jsx-a11y/no-static-element-interactions": [0], - "jsx-a11y/no-noninteractive-element-interactions": [0], - "jsx-a11y/click-events-have-key-events": [0], - "jsx-a11y/anchor-is-valid": [0], - "no-nested-ternary": [0], - "no-param-reassign": [0], - "arrow-body-style": [0], - "import/extensions": [0], - "no-bitwise": [0], - "no-cond-assign": [0], - "import/no-unresolved": [0], - "comma-dangle": [ - "error", - { - "arrays": "always-multiline", - "objects": "always-multiline", - "imports": "always-multiline", - "exports": "always-multiline", - "functions": "ignore" - } - ], - "object-curly-newline": [0], - "function-paren-newline": [0], - "no-restricted-globals": [0], - "require-yield": [1] - }, - "parserOptions": { - "ecmaFeatures": { - "experimentalObjectRestSpread": true - } - }, - "settings": { - "polyfills": ["fetch", "promises"] - } -} diff --git a/src/user-dashboard/src/.webpackrc.js b/src/user-dashboard/src/.webpackrc.js deleted file mode 100755 index 27ebdba29..000000000 --- a/src/user-dashboard/src/.webpackrc.js +++ /dev/null @@ -1,19 +0,0 @@ -const path = require('path'); - -export default { - entry: 'app/assets/src/index.js', - extraBabelPlugins: [ - ['import', { libraryName: 'antd', libraryDirectory: 'es', style: true }], - ], - env: { - development: { - extraBabelPlugins: ['dva-hmr'], - }, - }, - alias: { - components: path.resolve(__dirname, 'app/assets/src/components/'), - }, - ignoreMomentLocale: true, - outputPath: 'app/assets/public', - hash: false, -}; diff --git a/src/user-dashboard/src/app.js b/src/user-dashboard/src/app.js deleted file mode 100644 index 8a8bfd0e6..000000000 --- a/src/user-dashboard/src/app.js +++ /dev/null @@ -1,11 +0,0 @@ -/* - SPDX-License-Identifier: Apache-2.0 -*/ -'use strict'; - -module.exports = app => { - require('./app/lib/fabric/v1_0')(app); - require('./app/lib/fabric/v1_2')(app); - require('./app/lib/fabric')(app); - if (app.config.parse) require('./app/lib/parse')(app); -}; diff --git a/src/user-dashboard/src/app/assets/public/favicon.png b/src/user-dashboard/src/app/assets/public/favicon.png deleted file mode 100644 index cc2776830..000000000 Binary files a/src/user-dashboard/src/app/assets/public/favicon.png and /dev/null differ diff --git a/src/user-dashboard/src/app/assets/src/assets/chain.png b/src/user-dashboard/src/app/assets/src/assets/chain.png deleted file mode 100644 index 5cc5e1850..000000000 Binary files a/src/user-dashboard/src/app/assets/src/assets/chain.png and /dev/null differ diff --git a/src/user-dashboard/src/app/assets/src/assets/logo.ico b/src/user-dashboard/src/app/assets/src/assets/logo.ico deleted file mode 100644 index 26ab4cad8..000000000 Binary files a/src/user-dashboard/src/app/assets/src/assets/logo.ico and /dev/null differ diff --git a/src/user-dashboard/src/app/assets/src/assets/logo.svg b/src/user-dashboard/src/app/assets/src/assets/logo.svg deleted file mode 100644 index eb59096c7..000000000 --- a/src/user-dashboard/src/app/assets/src/assets/logo.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/user-dashboard/src/app/assets/src/common/menu.js b/src/user-dashboard/src/app/assets/src/common/menu.js deleted file mode 100644 index d41aeba0d..000000000 --- a/src/user-dashboard/src/app/assets/src/common/menu.js +++ /dev/null @@ -1,93 +0,0 @@ -/* - SPDX-License-Identifier: Apache-2.0 -*/ -import { isUrl } from "../utils/utils"; - -const menuData = [ - { - name: "Chain", - icon: "link", - path: "chain", - children: [ - { - name: "List", - path: "index", - }, - { - name: "Info", - path: "info/:id", - hideInMenu: true, - hideInBreadcrumb: false, - }, - ], - }, - { - name: "Apply Chain", - path: "apply-chain", - hideInMenu: true, - hideInBreadcrumb: false, - }, - { - name: "Smart Contract", - path: "smart-contract", - icon: "code-o", - children: [ - { - name: "Templates", - path: "index", - }, - { - name: "Running", - path: "running", - }, - { - name: "Invoke/Query", - path: "invoke-query/:id", - hideInMenu: true, - hideInBreadcrumb: false, - }, - { - name: "Info", - path: "info/:id", - hideInMenu: true, - hideInBreadcrumb: false, - }, - { - name: "Create", - path: "new", - hideInMenu: true, - hideInBreadcrumb: false, - }, - { - name: "New Code", - path: "new-code", - hideInMenu: true, - hideInBreadcrumb: false, - }, - ], - }, -]; - -function formatter(data, parentPath = "/", parentAuthority) { - return data.map(item => { - let { path } = item; - if (!isUrl(path)) { - path = parentPath + item.path; - } - const result = { - ...item, - path, - authority: item.authority || parentAuthority, - }; - if (item.children) { - result.children = formatter( - item.children, - `${parentPath}${item.path}/`, - item.authority - ); - } - return result; - }); -} - -export const getMenuData = () => formatter(menuData); diff --git a/src/user-dashboard/src/app/assets/src/common/router.js b/src/user-dashboard/src/app/assets/src/common/router.js deleted file mode 100644 index 6481d9c7e..000000000 --- a/src/user-dashboard/src/app/assets/src/common/router.js +++ /dev/null @@ -1,181 +0,0 @@ -/* - SPDX-License-Identifier: Apache-2.0 -*/ -import { createElement } from "react"; -import dynamic from "dva/dynamic"; -import pathToRegexp from "path-to-regexp"; -import { getMenuData } from "./menu"; - -let routerDataCache; - -const modelNotExisted = (app, model) => - // eslint-disable-next-line - !app._models.some(({ namespace }) => { - return namespace === model.substring(model.lastIndexOf("/") + 1); - }); - -// wrapper of dynamic -const dynamicWrapper = (app, models, component) => { - // () => require('module') - // transformed by babel-plugin-dynamic-import-node-sync - if (component.toString().indexOf(".then(") < 0) { - models.forEach(model => { - if (modelNotExisted(app, model)) { - // eslint-disable-next-line - app.model(require(`../models/${model}`).default); - } - }); - return props => { - if (!routerDataCache) { - routerDataCache = getRouterData(app); - } - return createElement(component().default, { - ...props, - routerData: routerDataCache, - }); - }; - } - // () => import('module') - return dynamic({ - app, - models: () => - models - .filter(model => modelNotExisted(app, model)) - .map(m => import(`../models/${m}.js`)), - // add routerData prop - component: () => { - if (!routerDataCache) { - routerDataCache = getRouterData(app); - } - return component().then(raw => { - const Component = raw.default || raw; - return props => - createElement(Component, { - ...props, - routerData: routerDataCache, - }); - }); - }, - }); -}; - -function getFlatMenuData(menus) { - let keys = {}; - menus.forEach(item => { - if (item.children) { - keys[item.path] = { ...item }; - keys = { ...keys, ...getFlatMenuData(item.children) }; - } else { - keys[item.path] = { ...item }; - } - }); - return keys; -} - -export const getRouterData = app => { - const routerConfig = { - "/": { - component: dynamicWrapper(app, ["user", "login"], () => - import("../layouts/BasicLayout") - ), - }, - "/chain/index": { - component: dynamicWrapper(app, ["chain"], () => import("../routes/Chain")), - }, - "/chain/info/:id": { - component: dynamicWrapper(app, ["chain"], () => - import("../routes/Chain/Info") - ), - }, - "/apply-chain": { - component: dynamicWrapper(app, ["chain"], () => - import("../routes/Chain/Apply") - ), - }, - "/exception/403": { - component: dynamicWrapper(app, [], () => - import("../routes/Exception/403") - ), - }, - "/exception/404": { - component: dynamicWrapper(app, [], () => - import("../routes/Exception/404") - ), - }, - "/exception/500": { - component: dynamicWrapper(app, [], () => - import("../routes/Exception/500") - ), - }, - "/user": { - component: dynamicWrapper(app, [], () => import("../layouts/UserLayout")), - }, - "/user/login": { - component: dynamicWrapper(app, ["login"], () => - import("../routes/User/Login") - ), - }, - "/smart-contract/index": { - component: dynamicWrapper(app, ["smartContract"], () => - import("../routes/SmartContract") - ), - }, - "/smart-contract/info/:id": { - component: dynamicWrapper(app, ["smartContract", "chain"], () => - import("../routes/SmartContract/Info") - ), - }, - "/smart-contract/new": { - component: dynamicWrapper(app, ["smartContract"], () => - import("../routes/SmartContract/New") - ), - }, - "/smart-contract/new-code/:id": { - component: dynamicWrapper(app, ["smartContract"], () => - import("../routes/SmartContract/New/code") - ), - }, - "/smart-contract/running": { - component: dynamicWrapper(app, ["deploy"], () => - import("../routes/SmartContract/Running") - ), - }, - "/smart-contract/invoke-query/:id": { - component: dynamicWrapper(app, ["deploy"], () => - import("../routes/SmartContract/InvokeQuery") - ), - }, - }; - // Get name from ./menu.js or just set it in the router data. - const menuData = getFlatMenuData(getMenuData()); - - // Route configuration data - // eg. {name,authority ...routerConfig } - const routerData = {}; - // The route matches the menu - Object.keys(routerConfig).forEach(path => { - // Regular match item name - // eg. router /user/:id === /user/chen - const pathRegexp = pathToRegexp(path); - const menuKey = Object.keys(menuData).find(key => - pathRegexp.test(`${key}`) - ); - let menuItem = {}; - // If menuKey is not empty - if (menuKey) { - menuItem = menuData[menuKey]; - } - let router = routerConfig[path]; - // If you need to configure complex parameter routing, - // https://github.com/ant-design/ant-design-pro-site/blob/master/docs/router-and-nav.md#%E5%B8%A6%E5%8F%82%E6%95%B0%E7%9A%84%E8%B7%AF%E7%94%B1%E8%8F%9C%E5%8D%95 - // eg . /list/:type/user/info/:id - router = { - ...router, - name: router.name || menuItem.name, - authority: router.authority || menuItem.authority, - hideInBreadcrumb: router.hideInBreadcrumb || menuItem.hideInBreadcrumb, - }; - routerData[path] = router; - }); - return routerData; -}; diff --git a/src/user-dashboard/src/app/assets/src/components/Authorized/Authorized.js b/src/user-dashboard/src/app/assets/src/components/Authorized/Authorized.js deleted file mode 100644 index d2867b08a..000000000 --- a/src/user-dashboard/src/app/assets/src/components/Authorized/Authorized.js +++ /dev/null @@ -1,15 +0,0 @@ -/* - SPDX-License-Identifier: Apache-2.0 -*/ -import React from 'react'; -import CheckPermissions from './CheckPermissions'; - -class Authorized extends React.Component { - render() { - const { children, authority, noMatch = null } = this.props; - const childrenRender = typeof children === 'undefined' ? null : children; - return CheckPermissions(authority, childrenRender, noMatch); - } -} - -export default Authorized; diff --git a/src/user-dashboard/src/app/assets/src/components/Authorized/AuthorizedRoute.js b/src/user-dashboard/src/app/assets/src/components/Authorized/AuthorizedRoute.js deleted file mode 100644 index 0e6e55236..000000000 --- a/src/user-dashboard/src/app/assets/src/components/Authorized/AuthorizedRoute.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - SPDX-License-Identifier: Apache-2.0 -*/ -import React from 'react'; -import { Route, Redirect } from 'react-router-dom'; -import Authorized from './Authorized'; - -class AuthorizedRoute extends React.Component { - render() { - const { component: Component, render, authority, redirectPath, ...rest } = this.props; - return ( - } />} - > - (Component ? : render(props))} /> - - ); - } -} - -export default AuthorizedRoute; diff --git a/src/user-dashboard/src/app/assets/src/components/Authorized/CheckPermissions.js b/src/user-dashboard/src/app/assets/src/components/Authorized/CheckPermissions.js deleted file mode 100644 index 89e0ad9f7..000000000 --- a/src/user-dashboard/src/app/assets/src/components/Authorized/CheckPermissions.js +++ /dev/null @@ -1,59 +0,0 @@ -/* - SPDX-License-Identifier: Apache-2.0 -*/ -import React from 'react'; -import PromiseRender from './PromiseRender'; -import { CURRENT } from './index'; - -function isPromise(obj) { - return ( - !!obj && - (typeof obj === 'object' || typeof obj === 'function') && - typeof obj.then === 'function' - ); -} - -const checkPermissions = (authority, currentAuthority, target, Exception) => { - // Retirement authority, return target; - if (!authority) { - return target; - } - if (Array.isArray(authority)) { - if (authority.indexOf(currentAuthority) >= 0) { - return target; - } - return Exception; - } - - if (typeof authority === 'string') { - if (authority === currentAuthority) { - return target; - } - return Exception; - } - - if (isPromise(authority)) { - return ; - } - - if (typeof authority === 'function') { - try { - const bool = authority(currentAuthority); - if (bool) { - return target; - } - return Exception; - } catch (error) { - throw error; - } - } - throw new Error('unsupported parameters'); -}; - -export { checkPermissions }; - -const check = (authority, target, Exception) => { - return checkPermissions(authority, CURRENT, target, Exception); -}; - -export default check; diff --git a/src/user-dashboard/src/app/assets/src/components/Authorized/CheckPermissions.test.js b/src/user-dashboard/src/app/assets/src/components/Authorized/CheckPermissions.test.js deleted file mode 100644 index d6bfa87ff..000000000 --- a/src/user-dashboard/src/app/assets/src/components/Authorized/CheckPermissions.test.js +++ /dev/null @@ -1,40 +0,0 @@ -/* - SPDX-License-Identifier: Apache-2.0 -*/ -import { checkPermissions } from './CheckPermissions.js'; - -const target = 'ok'; -const error = 'error'; - -describe('test CheckPermissions', () => { - it('Correct string permission authentication', () => { - expect(checkPermissions('user', 'user', target, error)).toEqual('ok'); - }); - it('Correct string permission authentication', () => { - expect(checkPermissions('user', 'NULL', target, error)).toEqual('error'); - }); - it('authority is undefined , return ok', () => { - expect(checkPermissions(null, 'NULL', target, error)).toEqual('ok'); - }); - it('currentAuthority is undefined , return error', () => { - expect(checkPermissions('admin', null, target, error)).toEqual('error'); - }); - it('Wrong string permission authentication', () => { - expect(checkPermissions('admin', 'user', target, error)).toEqual('error'); - }); - it('Correct Array permission authentication', () => { - expect(checkPermissions(['user', 'admin'], 'user', target, error)).toEqual('ok'); - }); - it('Wrong Array permission authentication,currentAuthority error', () => { - expect(checkPermissions(['user', 'admin'], 'user,admin', target, error)).toEqual('error'); - }); - it('Wrong Array permission authentication', () => { - expect(checkPermissions(['user', 'admin'], 'guest', target, error)).toEqual('error'); - }); - it('Wrong Function permission authentication', () => { - expect(checkPermissions(() => false, 'guest', target, error)).toEqual('error'); - }); - it('Correct Function permission authentication', () => { - expect(checkPermissions(() => true, 'guest', target, error)).toEqual('ok'); - }); -}); diff --git a/src/user-dashboard/src/app/assets/src/components/Authorized/PromiseRender.js b/src/user-dashboard/src/app/assets/src/components/Authorized/PromiseRender.js deleted file mode 100644 index 611bf61e3..000000000 --- a/src/user-dashboard/src/app/assets/src/components/Authorized/PromiseRender.js +++ /dev/null @@ -1,62 +0,0 @@ -/* - SPDX-License-Identifier: Apache-2.0 -*/ -import React from 'react'; -import { Spin } from 'antd'; - -export default class PromiseRender extends React.PureComponent { - state = { - component: null, - }; - componentDidMount() { - this.setRenderComponent(this.props); - } - componentWillReceiveProps(nextProps) { - // new Props enter - this.setRenderComponent(nextProps); - } - // set render Component : ok or error - setRenderComponent(props) { - const ok = this.checkIsInstantiation(props.ok); - const error = this.checkIsInstantiation(props.error); - props.promise - .then(() => { - this.setState({ - component: ok, - }); - }) - .catch(() => { - this.setState({ - component: error, - }); - }); - } - // Determine whether the incoming component has been instantiated - // AuthorizedRoute is already instantiated - // Authorized render is already instantiated, children is no instantiated - // Secured is not instantiated - checkIsInstantiation = target => { - if (!React.isValidElement(target)) { - return target; - } - return () => target; - }; - render() { - const Component = this.state.component; - return Component ? ( - - ) : ( -
- -
- ); - } -} diff --git a/src/user-dashboard/src/app/assets/src/components/Authorized/Secured.js b/src/user-dashboard/src/app/assets/src/components/Authorized/Secured.js deleted file mode 100644 index ef47425ad..000000000 --- a/src/user-dashboard/src/app/assets/src/components/Authorized/Secured.js +++ /dev/null @@ -1,35 +0,0 @@ -/* - SPDX-License-Identifier: Apache-2.0 -*/ -import React from 'react'; -import Exception from '../Exception/index'; -import CheckPermissions from './CheckPermissions'; - -const Exception403 = () => ; - -// Determine whether the incoming component has been instantiated -// AuthorizedRoute is already instantiated -// Authorized render is already instantiated, children is no instantiated -// Secured is not instantiated -const checkIsInstantiation = target => { - if (!React.isValidElement(target)) { - return target; - } - return () => target; -}; - -const authorize = (authority, error) => { - let classError = false; - if (error) { - classError = () => error; - } - if (!authority) { - throw new Error('authority is required'); - } - return function decideAuthority(targer) { - const component = CheckPermissions(authority, targer, classError || Exception403); - return checkIsInstantiation(component); - }; -}; - -export default authorize; diff --git a/src/user-dashboard/src/app/assets/src/components/Authorized/index.js b/src/user-dashboard/src/app/assets/src/components/Authorized/index.js deleted file mode 100644 index f6e68da85..000000000 --- a/src/user-dashboard/src/app/assets/src/components/Authorized/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/* - SPDX-License-Identifier: Apache-2.0 -*/ -import Authorized from './Authorized'; -import AuthorizedRoute from './AuthorizedRoute'; -import Secured from './Secured'; -import check from './CheckPermissions.js'; - -/* eslint-disable import/no-mutable-exports */ -let CURRENT = 'NULL'; - -Authorized.Secured = Secured; -Authorized.AuthorizedRoute = AuthorizedRoute; -Authorized.check = check; - -/** - * use authority or getAuthority - * @param {string|()=>String} currentAuthority - */ -const renderAuthorize = currentAuthority => { - if (currentAuthority) { - if (currentAuthority.constructor.name === 'Function') { - CURRENT = currentAuthority(); - } - if (currentAuthority.constructor.name === 'String') { - CURRENT = currentAuthority; - } - } else { - CURRENT = 'NULL'; - } - return Authorized; -}; - -export { CURRENT }; -export default renderAuthorize; diff --git a/src/user-dashboard/src/app/assets/src/components/Charts/Pie/index.js b/src/user-dashboard/src/app/assets/src/components/Charts/Pie/index.js deleted file mode 100644 index bcff5306f..000000000 --- a/src/user-dashboard/src/app/assets/src/components/Charts/Pie/index.js +++ /dev/null @@ -1,258 +0,0 @@ -/* - SPDX-License-Identifier: Apache-2.0 -*/ -import React, { Component } from 'react'; -import { Chart, Tooltip, Geom, Coord } from 'bizcharts'; -import { DataView } from '@antv/data-set'; -import { Divider } from 'antd'; -import classNames from 'classnames'; -import ReactFitText from 'react-fittext'; -import Debounce from 'lodash-decorators/debounce'; -import Bind from 'lodash-decorators/bind'; -import autoHeight from '../autoHeight'; - -import styles from './index.less'; - -/* eslint react/no-danger:0 */ -@autoHeight() -export default class Pie extends Component { - state = { - legendData: [], - legendBlock: false, - }; - - componentDidMount() { - this.getLengendData(); - this.resize(); - window.addEventListener('resize', this.resize); - } - - componentWillReceiveProps(nextProps) { - if (this.props.data !== nextProps.data) { - // because of charts data create when rendered - // so there is a trick for get rendered time - this.setState( - { - legendData: [...this.state.legendData], - }, - () => { - this.getLengendData(); - } - ); - } - } - - componentWillUnmount() { - window.removeEventListener('resize', this.resize); - this.resize.cancel(); - } - - getG2Instance = chart => { - this.chart = chart; - }; - - // for custom lengend view - getLengendData = () => { - if (!this.chart) return; - const geom = this.chart.getAllGeoms()[0]; // 获取所有的图形 - const items = geom.get('dataArray') || []; // 获取图形对应的 - - const legendData = items.map(item => { - /* eslint no-underscore-dangle:0 */ - const origin = item[0]._origin; - origin.color = item[0].color; - origin.checked = true; - return origin; - }); - - this.setState({ - legendData, - }); - }; - - // for window resize auto responsive legend - @Bind() - @Debounce(300) - resize() { - const { hasLegend } = this.props; - if (!hasLegend || !this.root) { - window.removeEventListener('resize', this.resize); - return; - } - if (this.root.parentNode.clientWidth <= 380) { - if (!this.state.legendBlock) { - this.setState({ - legendBlock: true, - }); - } - } else if (this.state.legendBlock) { - this.setState({ - legendBlock: false, - }); - } - } - - handleRoot = n => { - this.root = n; - }; - - handleLegendClick = (item, i) => { - const newItem = item; - newItem.checked = !newItem.checked; - - const { legendData } = this.state; - legendData[i] = newItem; - - const filteredLegendData = legendData.filter(l => l.checked).map(l => l.x); - - if (this.chart) { - this.chart.filter('x', val => filteredLegendData.indexOf(val) > -1); - } - - this.setState({ - legendData, - }); - }; - - render() { - const { - valueFormat, - subTitle, - total, - hasLegend = false, - className, - style, - height, - forceFit = true, - percent = 0, - color, - inner = 0.75, - animate = true, - colors, - lineWidth = 1, - } = this.props; - - const { legendData, legendBlock } = this.state; - const pieClassName = classNames(styles.pie, className, { - [styles.hasLegend]: !!hasLegend, - [styles.legendBlock]: legendBlock, - }); - - const defaultColors = colors; - let data = this.props.data || []; - let selected = this.props.selected || true; - let tooltip = this.props.tooltip || true; - let formatColor; - - const scale = { - x: { - type: 'cat', - range: [0, 1], - }, - y: { - min: 0, - }, - }; - - if (percent) { - selected = false; - tooltip = false; - formatColor = value => { - if (value === '占比') { - return color || 'rgba(24, 144, 255, 0.85)'; - } else { - return '#F0F2F5'; - } - }; - - data = [ - { - x: '占比', - y: parseFloat(percent), - }, - { - x: '反比', - y: 100 - parseFloat(percent), - }, - ]; - } - - const tooltipFormat = [ - 'x*percent', - (x, p) => ({ - name: x, - value: `${(p * 100).toFixed(2)}%`, - }), - ]; - - const padding = [12, 0, 12, 0]; - - const dv = new DataView(); - dv.source(data).transform({ - type: 'percent', - field: 'y', - dimension: 'x', - as: 'percent', - }); - - return ( -
- -
- - {!!tooltip && } - - - - - {(subTitle || total) && ( -
- {subTitle &&

{subTitle}

} - {/* eslint-disable-next-line */} - {total && ( -
{typeof total === 'function' ? total() : total}
- )} -
- )} -
-
- - {hasLegend && ( -
    - {legendData.map((item, i) => ( -
  • this.handleLegendClick(item, i)}> - - {item.x} - - - {`${(isNaN(item.percent) ? 0 : item.percent * 100).toFixed(2)}%`} - - {valueFormat ? valueFormat(item.y) : item.y} -
  • - ))} -
- )} -
- ); - } -} diff --git a/src/user-dashboard/src/app/assets/src/components/Charts/Pie/index.less b/src/user-dashboard/src/app/assets/src/components/Charts/Pie/index.less deleted file mode 100644 index 277274cdb..000000000 --- a/src/user-dashboard/src/app/assets/src/components/Charts/Pie/index.less +++ /dev/null @@ -1,94 +0,0 @@ -@import '~antd/lib/style/themes/default.less'; - -.pie { - position: relative; - .chart { - position: relative; - } - &.hasLegend .chart { - width: ~'calc(100% - 240px)'; - } - .legend { - position: absolute; - right: 0; - min-width: 200px; - top: 50%; - transform: translateY(-50%); - margin: 0 20px; - list-style: none; - padding: 0; - li { - cursor: pointer; - margin-bottom: 16px; - height: 22px; - line-height: 22px; - &:last-child { - margin-bottom: 0; - } - } - } - .dot { - border-radius: 8px; - display: inline-block; - margin-right: 8px; - position: relative; - top: -1px; - height: 8px; - width: 8px; - } - .line { - background-color: @border-color-split; - display: inline-block; - margin-right: 8px; - width: 1px; - height: 16px; - } - .legendTitle { - color: @text-color; - } - .percent { - color: @text-color-secondary; - } - .value { - position: absolute; - right: 0; - } - .title { - margin-bottom: 8px; - } - .total { - position: absolute; - left: 50%; - top: 50%; - text-align: center; - height: 62px; - transform: translate(-50%, -50%); - & > h4 { - color: @text-color-secondary; - font-size: 14px; - line-height: 22px; - height: 22px; - margin-bottom: 8px; - font-weight: normal; - } - & > p { - color: @heading-color; - display: block; - font-size: 1.2em; - height: 32px; - line-height: 32px; - white-space: nowrap; - } - } -} - -.legendBlock { - &.hasLegend .chart { - width: 100%; - margin: 0 0 32px 0; - } - .legend { - position: relative; - transform: none; - } -} diff --git a/src/user-dashboard/src/app/assets/src/components/Charts/autoHeight.js b/src/user-dashboard/src/app/assets/src/components/Charts/autoHeight.js deleted file mode 100644 index 5fc97b459..000000000 --- a/src/user-dashboard/src/app/assets/src/components/Charts/autoHeight.js +++ /dev/null @@ -1,65 +0,0 @@ -/* - SPDX-License-Identifier: Apache-2.0 -*/ -import React from 'react'; - -function computeHeight(node) { - const totalHeight = parseInt(getComputedStyle(node).height, 10); - const padding = - parseInt(getComputedStyle(node).paddingTop, 10) + - parseInt(getComputedStyle(node).paddingBottom, 10); - return totalHeight - padding; -} - -function getAutoHeight(n) { - if (!n) { - return 0; - } - - let node = n; - - let height = computeHeight(node); - - while (!height) { - node = node.parentNode; - if (node) { - height = computeHeight(node); - } else { - break; - } - } - - return height; -} - -const autoHeight = () => WrappedComponent => { - return class extends React.Component { - state = { - computedHeight: 0, - }; - - componentDidMount() { - const { height } = this.props; - if (!height) { - const h = getAutoHeight(this.root); - // eslint-disable-next-line - this.setState({ computedHeight: h }); - } - } - - handleRoot = node => { - this.root = node; - }; - - render() { - const { height } = this.props; - const { computedHeight } = this.state; - const h = height || computedHeight; - return ( -
{h > 0 && }
- ); - } - }; -}; - -export default autoHeight; diff --git a/src/user-dashboard/src/app/assets/src/components/Charts/g2.js b/src/user-dashboard/src/app/assets/src/components/Charts/g2.js deleted file mode 100644 index 0695fae86..000000000 --- a/src/user-dashboard/src/app/assets/src/components/Charts/g2.js +++ /dev/null @@ -1,17 +0,0 @@ -/* - SPDX-License-Identifier: Apache-2.0 -*/ -import { track, setTheme } from 'bizcharts'; - -track(false); - -const config = { - defaultColor: '#1089ff', - shape: { - interval: { - fillOpacity: 1, - }, - }, -}; - -setTheme(config); diff --git a/src/user-dashboard/src/app/assets/src/components/Charts/index.js b/src/user-dashboard/src/app/assets/src/components/Charts/index.js deleted file mode 100644 index 81a312621..000000000 --- a/src/user-dashboard/src/app/assets/src/components/Charts/index.js +++ /dev/null @@ -1,7 +0,0 @@ -/* - SPDX-License-Identifier: Apache-2.0 -*/ -import './g2'; -import Pie from './Pie'; - -export { Pie }; diff --git a/src/user-dashboard/src/app/assets/src/components/Charts/index.less b/src/user-dashboard/src/app/assets/src/components/Charts/index.less deleted file mode 100644 index 190428bc8..000000000 --- a/src/user-dashboard/src/app/assets/src/components/Charts/index.less +++ /dev/null @@ -1,19 +0,0 @@ -.miniChart { - position: relative; - width: 100%; - .chartContent { - position: absolute; - bottom: -28px; - width: 100%; - > div { - margin: 0 -5px; - overflow: hidden; - } - } - .chartLoading { - position: absolute; - top: 16px; - left: 50%; - margin-left: -7px; - } -} diff --git a/src/user-dashboard/src/app/assets/src/components/DescriptionList/Description.js b/src/user-dashboard/src/app/assets/src/components/DescriptionList/Description.js deleted file mode 100644 index 3e41c0717..000000000 --- a/src/user-dashboard/src/app/assets/src/components/DescriptionList/Description.js +++ /dev/null @@ -1,27 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import classNames from 'classnames'; -import { Col } from 'antd'; -import styles from './index.less'; -import responsive from './responsive'; - -const Description = ({ term, column, className, children, ...restProps }) => { - const clsString = classNames(styles.description, className); - return ( - - {term &&
{term}
} - {children !== null && children !== undefined && -
{children}
} - - ); -}; - -Description.defaultProps = { - term: '', -}; - -Description.propTypes = { - term: PropTypes.node, -}; - -export default Description; diff --git a/src/user-dashboard/src/app/assets/src/components/DescriptionList/DescriptionList.js b/src/user-dashboard/src/app/assets/src/components/DescriptionList/DescriptionList.js deleted file mode 100644 index 382d7e85f..000000000 --- a/src/user-dashboard/src/app/assets/src/components/DescriptionList/DescriptionList.js +++ /dev/null @@ -1,31 +0,0 @@ -import React from 'react'; -import classNames from 'classnames'; -import { Row } from 'antd'; -import styles from './index.less'; - -const DescriptionList = ({ - className, - title, - col = 3, - layout = 'horizontal', - gutter = 32, - children, - size, - ...restProps -}) => { - const clsString = classNames(styles.descriptionList, styles[layout], className, { - [styles.small]: size === 'small', - [styles.large]: size === 'large', - }); - const column = col > 4 ? 4 : col; - return ( -
- {title ?
{title}
: null} - - {React.Children.map(children, child => child ? React.cloneElement(child, { column }) : child)} - -
- ); -}; - -export default DescriptionList; diff --git a/src/user-dashboard/src/app/assets/src/components/DescriptionList/index.js b/src/user-dashboard/src/app/assets/src/components/DescriptionList/index.js deleted file mode 100644 index 357f479fd..000000000 --- a/src/user-dashboard/src/app/assets/src/components/DescriptionList/index.js +++ /dev/null @@ -1,5 +0,0 @@ -import DescriptionList from './DescriptionList'; -import Description from './Description'; - -DescriptionList.Description = Description; -export default DescriptionList; diff --git a/src/user-dashboard/src/app/assets/src/components/DescriptionList/index.less b/src/user-dashboard/src/app/assets/src/components/DescriptionList/index.less deleted file mode 100644 index bcb6fd1da..000000000 --- a/src/user-dashboard/src/app/assets/src/components/DescriptionList/index.less +++ /dev/null @@ -1,77 +0,0 @@ -@import '~antd/lib/style/themes/default.less'; - -.descriptionList { - // offset the padding-bottom of last row - :global { - .ant-row { - margin-bottom: -16px; - overflow: hidden; - } - } - - .title { - font-size: 14px; - color: @heading-color; - font-weight: 500; - margin-bottom: 16px; - } - - .term { - // Line-height is 22px IE dom height will calculate error - line-height: 20px; - padding-bottom: 16px; - margin-right: 8px; - color: @heading-color; - white-space: nowrap; - display: table-cell; - - &:after { - content: ':'; - margin: 0 8px 0 2px; - position: relative; - top: -0.5px; - } - } - - .detail { - line-height: 22px; - width: 100%; - padding-bottom: 16px; - color: @text-color; - display: table-cell; - } - - &.small { - // offset the padding-bottom of last row - :global { - .ant-row { - margin-bottom: -8px; - } - } - .title { - margin-bottom: 12px; - color: @text-color; - } - .term, - .detail { - padding-bottom: 8px; - } - } - - &.large { - .title { - font-size: 16px; - } - } - - &.vertical { - .term { - padding-bottom: 8px; - display: block; - } - - .detail { - display: block; - } - } -} diff --git a/src/user-dashboard/src/app/assets/src/components/DescriptionList/responsive.js b/src/user-dashboard/src/app/assets/src/components/DescriptionList/responsive.js deleted file mode 100644 index a5aa73f78..000000000 --- a/src/user-dashboard/src/app/assets/src/components/DescriptionList/responsive.js +++ /dev/null @@ -1,6 +0,0 @@ -export default { - 1: { xs: 24 }, - 2: { xs: 24, sm: 12 }, - 3: { xs: 24, sm: 12, md: 8 }, - 4: { xs: 24, sm: 12, md: 6 }, -}; diff --git a/src/user-dashboard/src/app/assets/src/components/EditableLinkGroup/index.js b/src/user-dashboard/src/app/assets/src/components/EditableLinkGroup/index.js deleted file mode 100644 index 2d0b4aa83..000000000 --- a/src/user-dashboard/src/app/assets/src/components/EditableLinkGroup/index.js +++ /dev/null @@ -1,45 +0,0 @@ -import React, { PureComponent, createElement } from 'react'; -import PropTypes from 'prop-types'; -import { Button } from 'antd'; -import styles from './index.less'; - -// TODO: 添加逻辑 - -class EditableLinkGroup extends PureComponent { - static propTypes = { - links: PropTypes.array, - onAdd: PropTypes.func, - linkElement: PropTypes.oneOfType([PropTypes.func, PropTypes.string]), - }; - - static defaultProps = { - links: [], - onAdd: () => {}, - linkElement: 'a', - }; - render() { - const { links, linkElement, onAdd } = this.props; - return ( -
- {links.map(link => - createElement( - linkElement, - { - key: `linkGroup-item-${link.id || link.title}`, - to: link.href, - href: link.href, - }, - link.title - ) - )} - { - - } -
- ); - } -} - -export default EditableLinkGroup; diff --git a/src/user-dashboard/src/app/assets/src/components/EditableLinkGroup/index.less b/src/user-dashboard/src/app/assets/src/components/EditableLinkGroup/index.less deleted file mode 100644 index a421df6fe..000000000 --- a/src/user-dashboard/src/app/assets/src/components/EditableLinkGroup/index.less +++ /dev/null @@ -1,16 +0,0 @@ -@import '~antd/lib/style/themes/default.less'; - -.linkGroup { - padding: 20px 0 8px 24px; - font-size: 0; - & > a { - color: @text-color; - display: inline-block; - font-size: @font-size-base; - margin-bottom: 13px; - width: 25%; - &:hover { - color: @primary-color; - } - } -} diff --git a/src/user-dashboard/src/app/assets/src/components/Ellipsis/index.js b/src/user-dashboard/src/app/assets/src/components/Ellipsis/index.js deleted file mode 100644 index 80d0ee938..000000000 --- a/src/user-dashboard/src/app/assets/src/components/Ellipsis/index.js +++ /dev/null @@ -1,227 +0,0 @@ -/* - SPDX-License-Identifier: Apache-2.0 -*/ -import React, { Component } from 'react'; -import { Tooltip } from 'antd'; -import classNames from 'classnames'; -import styles from './index.less'; - -/* eslint react/no-did-mount-set-state: 0 */ -/* eslint no-param-reassign: 0 */ - -const isSupportLineClamp = document.body.style.webkitLineClamp !== undefined; - -const EllipsisText = ({ text, length, tooltip, ...other }) => { - if (typeof text !== 'string') { - throw new Error('Ellipsis children must be string.'); - } - if (text.length <= length || length < 0) { - return {text}; - } - const tail = '...'; - let displayText; - if (length - tail.length <= 0) { - displayText = ''; - } else { - displayText = text.slice(0, length - tail.length); - } - - if (tooltip) { - return ( - - - {displayText} - {tail} - - - ); - } - - return ( - - {displayText} - {tail} - - ); -}; - -export default class Ellipsis extends Component { - state = { - text: '', - targetCount: 0, - }; - - componentDidMount() { - if (this.node) { - this.computeLine(); - } - } - - componentWillReceiveProps(nextProps) { - if (this.props.lines !== nextProps.lines) { - this.computeLine(); - } - } - - computeLine = () => { - const { lines } = this.props; - if (lines && !isSupportLineClamp) { - const text = this.shadowChildren.innerText; - const lineHeight = parseInt(getComputedStyle(this.root).lineHeight, 10); - const targetHeight = lines * lineHeight; - this.content.style.height = `${targetHeight}px`; - const totalHeight = this.shadowChildren.offsetHeight; - const shadowNode = this.shadow.firstChild; - - if (totalHeight <= targetHeight) { - this.setState({ - text, - targetCount: text.length, - }); - return; - } - - // bisection - const len = text.length; - const mid = Math.floor(len / 2); - - const count = this.bisection(targetHeight, mid, 0, len, text, shadowNode); - - this.setState({ - text, - targetCount: count, - }); - } - }; - - bisection = (th, m, b, e, text, shadowNode) => { - const suffix = '...'; - let mid = m; - let end = e; - let begin = b; - shadowNode.innerHTML = text.substring(0, mid) + suffix; - let sh = shadowNode.offsetHeight; - - if (sh <= th) { - shadowNode.innerHTML = text.substring(0, mid + 1) + suffix; - sh = shadowNode.offsetHeight; - if (sh > th) { - return mid; - } else { - begin = mid; - mid = Math.floor((end - begin) / 2) + begin; - return this.bisection(th, mid, begin, end, text, shadowNode); - } - } else { - if (mid - 1 < 0) { - return mid; - } - shadowNode.innerHTML = text.substring(0, mid - 1) + suffix; - sh = shadowNode.offsetHeight; - if (sh <= th) { - return mid - 1; - } else { - end = mid; - mid = Math.floor((end - begin) / 2) + begin; - return this.bisection(th, mid, begin, end, text, shadowNode); - } - } - }; - - handleRoot = n => { - this.root = n; - }; - - handleContent = n => { - this.content = n; - }; - - handleNode = n => { - this.node = n; - }; - - handleShadow = n => { - this.shadow = n; - }; - - handleShadowChildren = n => { - this.shadowChildren = n; - }; - - render() { - const { text, targetCount } = this.state; - const { children, lines, length, className, tooltip, ...restProps } = this.props; - - const cls = classNames(styles.ellipsis, className, { - [styles.lines]: lines && !isSupportLineClamp, - [styles.lineClamp]: lines && isSupportLineClamp, - }); - - if (!lines && !length) { - return ( - - {children} - - ); - } - - // length - if (!lines) { - return ( - - ); - } - - const id = `antd-pro-ellipsis-${`${new Date().getTime()}${Math.floor(Math.random() * 100)}`}`; - - // support document.body.style.webkitLineClamp - if (isSupportLineClamp) { - const style = `#${id}{-webkit-line-clamp:${lines};-webkit-box-orient: vertical;}`; - return ( -
- - {tooltip ? ( - - {children} - - ) : ( - children - )} -
- ); - } - - const childNode = ( - - {targetCount > 0 && text.substring(0, targetCount)} - {targetCount > 0 && targetCount < text.length && '...'} - - ); - - return ( -
-
- {tooltip ? ( - - {childNode} - - ) : ( - childNode - )} -
- {children} -
-
- {text} -
-
-
- ); - } -} diff --git a/src/user-dashboard/src/app/assets/src/components/Ellipsis/index.less b/src/user-dashboard/src/app/assets/src/components/Ellipsis/index.less deleted file mode 100644 index dd59e3fac..000000000 --- a/src/user-dashboard/src/app/assets/src/components/Ellipsis/index.less +++ /dev/null @@ -1,24 +0,0 @@ -.ellipsis { - overflow: hidden; - display: inline-block; - word-break: break-all; - width: 100%; -} - -.lines { - position: relative; - .shadow { - display: block; - position: relative; - color: transparent; - opacity: 0; - z-index: -999; - } -} - -.lineClamp { - position: relative; - overflow: hidden; - text-overflow: ellipsis; - display: -webkit-box; -} diff --git a/src/user-dashboard/src/app/assets/src/components/Exception/index.js b/src/user-dashboard/src/app/assets/src/components/Exception/index.js deleted file mode 100644 index 7a09243b7..000000000 --- a/src/user-dashboard/src/app/assets/src/components/Exception/index.js +++ /dev/null @@ -1,38 +0,0 @@ -/* - SPDX-License-Identifier: Apache-2.0 -*/ -import React, { createElement } from 'react'; -import classNames from 'classnames'; -import { Button } from 'antd'; -import config from './typeConfig'; -import styles from './index.less'; - -export default ({ className, linkElement = 'a', type, title, desc, img, actions, ...rest }) => { - const pageType = type in config ? type : '404'; - const clsString = classNames(styles.exception, className); - return ( -
-
-
-
-
-

{title || config[pageType].title}

-
{desc || config[pageType].desc}
-
- {actions || - createElement( - linkElement, - { - to: '/', - href: '/', - }, - - )} -
-
-
- ); -}; diff --git a/src/user-dashboard/src/app/assets/src/components/Exception/index.less b/src/user-dashboard/src/app/assets/src/components/Exception/index.less deleted file mode 100644 index 5ef378be6..000000000 --- a/src/user-dashboard/src/app/assets/src/components/Exception/index.less +++ /dev/null @@ -1,88 +0,0 @@ -@import '~antd/lib/style/themes/default.less'; - -.exception { - display: flex; - align-items: center; - height: 100%; - - .imgBlock { - flex: 0 0 62.5%; - width: 62.5%; - padding-right: 152px; - zoom: 1; - &:before, - &:after { - content: ' '; - display: table; - } - &:after { - clear: both; - visibility: hidden; - font-size: 0; - height: 0; - } - } - - .imgEle { - height: 360px; - width: 100%; - max-width: 430px; - float: right; - background-repeat: no-repeat; - background-position: 50% 50%; - background-size: contain; - } - - .content { - flex: auto; - - h1 { - color: #434e59; - font-size: 72px; - font-weight: 600; - line-height: 72px; - margin-bottom: 24px; - } - - .desc { - color: @text-color-secondary; - font-size: 20px; - line-height: 28px; - margin-bottom: 16px; - } - - .actions { - button:not(:last-child) { - margin-right: 8px; - } - } - } -} - -@media screen and (max-width: @screen-xl) { - .exception { - .imgBlock { - padding-right: 88px; - } - } -} - -@media screen and (max-width: @screen-sm) { - .exception { - display: block; - text-align: center; - .imgBlock { - padding-right: 0; - margin: 0 auto 24px; - } - } -} - -@media screen and (max-width: @screen-xs) { - .exception { - .imgBlock { - margin-bottom: -24px; - overflow: hidden; - } - } -} diff --git a/src/user-dashboard/src/app/assets/src/components/Exception/typeConfig.js b/src/user-dashboard/src/app/assets/src/components/Exception/typeConfig.js deleted file mode 100644 index e37055ee1..000000000 --- a/src/user-dashboard/src/app/assets/src/components/Exception/typeConfig.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - SPDX-License-Identifier: Apache-2.0 -*/ -const config = { - 403: { - img: 'https://gw.alipayobjects.com/zos/rmsportal/wZcnGqRDyhPOEYFcZDnb.svg', - title: '403', - desc: 'Sorry,You have no permission to visit this page.', - }, - 404: { - img: 'https://gw.alipayobjects.com/zos/rmsportal/KpnpchXsobRgLElEozzI.svg', - title: '404', - desc: 'Sorry, page not found.', - }, - 500: { - img: 'https://gw.alipayobjects.com/zos/rmsportal/RVRUAYdCGeYNBWoKiIwB.svg', - title: '500', - desc: 'Sorry, something wrong.', - }, -}; - -export default config; diff --git a/src/user-dashboard/src/app/assets/src/components/FooterToolbar/index.js b/src/user-dashboard/src/app/assets/src/components/FooterToolbar/index.js deleted file mode 100644 index 4970bea56..000000000 --- a/src/user-dashboard/src/app/assets/src/components/FooterToolbar/index.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - SPDX-License-Identifier: Apache-2.0 -*/ -import React, { Component } from 'react'; -import classNames from 'classnames'; -import styles from './index.less'; - -export default class FooterToolbar extends Component { - render() { - const { children, className, extra, ...restProps } = this.props; - return ( -
-
{extra}
-
{children}
-
- ); - } -} diff --git a/src/user-dashboard/src/app/assets/src/components/FooterToolbar/index.less b/src/user-dashboard/src/app/assets/src/components/FooterToolbar/index.less deleted file mode 100644 index de6606bd4..000000000 --- a/src/user-dashboard/src/app/assets/src/components/FooterToolbar/index.less +++ /dev/null @@ -1,33 +0,0 @@ -@import '~antd/lib/style/themes/default.less'; - -.toolbar { - position: fixed; - width: 100%; - bottom: 0; - right: 0; - height: 56px; - line-height: 56px; - box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.03); - background: #fff; - border-top: 1px solid @border-color-split; - padding: 0 24px; - z-index: 9; - - &:after { - content: ''; - display: block; - clear: both; - } - - .left { - float: left; - } - - .right { - float: right; - } - - button + button { - margin-left: 8px; - } -} diff --git a/src/user-dashboard/src/app/assets/src/components/GlobalFooter/index.js b/src/user-dashboard/src/app/assets/src/components/GlobalFooter/index.js deleted file mode 100644 index 03d90ff85..000000000 --- a/src/user-dashboard/src/app/assets/src/components/GlobalFooter/index.js +++ /dev/null @@ -1,24 +0,0 @@ -/* - SPDX-License-Identifier: Apache-2.0 -*/ -import React from 'react'; -import classNames from 'classnames'; -import styles from './index.less'; - -export default ({ className, links, copyright }) => { - const clsString = classNames(styles.globalFooter, className); - return ( -
- {links && ( -
- {links.map(link => ( - - {link.title} - - ))} -
- )} - {copyright &&
{copyright}
} -
- ); -}; diff --git a/src/user-dashboard/src/app/assets/src/components/GlobalFooter/index.less b/src/user-dashboard/src/app/assets/src/components/GlobalFooter/index.less deleted file mode 100644 index 101dcf045..000000000 --- a/src/user-dashboard/src/app/assets/src/components/GlobalFooter/index.less +++ /dev/null @@ -1,29 +0,0 @@ -@import '~antd/lib/style/themes/default.less'; - -.globalFooter { - padding: 0 16px; - margin: 48px 0 24px 0; - text-align: center; - - .links { - margin-bottom: 8px; - - a { - color: @text-color-secondary; - transition: all 0.3s; - - &:not(:last-child) { - margin-right: 40px; - } - - &:hover { - color: @text-color; - } - } - } - - .copyright { - color: @text-color-secondary; - font-size: @font-size-base; - } -} diff --git a/src/user-dashboard/src/app/assets/src/components/GlobalHeader/index.js b/src/user-dashboard/src/app/assets/src/components/GlobalHeader/index.js deleted file mode 100644 index 7909cc2ec..000000000 --- a/src/user-dashboard/src/app/assets/src/components/GlobalHeader/index.js +++ /dev/null @@ -1,72 +0,0 @@ -/* - SPDX-License-Identifier: Apache-2.0 -*/ -import React, { PureComponent } from 'react'; -import { Menu, Icon, Spin, Dropdown, Avatar, Divider, Button } from 'antd'; -import Debounce from 'lodash-decorators/debounce'; -import { Link } from 'dva/router'; -import styles from './index.less'; -import { getLang } from '../../utils/utils'; - -const language = getLang(); -export default class GlobalHeader extends PureComponent { - componentWillUnmount() { - this.triggerResizeEvent.cancel(); - } - toggle = () => { - const { collapsed, onCollapse } = this.props; - onCollapse(!collapsed); - this.triggerResizeEvent(); - }; - /* eslint-disable*/ - @Debounce(600) - triggerResizeEvent() { - const event = document.createEvent('HTMLEvents'); - event.initEvent('resize', true, false); - window.dispatchEvent(event); - } - changeLanguage = () => { - localStorage.setItem('language', language === 'en' ? 'zh-CN' : 'en'); - window.location.reload(); - }; - render() { - const { collapsed, isMobile, logo, onMenuClick } = this.props; - const menu = ( - - - Logout - - - ); - return ( -
- {isMobile && [ - - logo - , - , - ]} - -
- - {window.username ? ( - - - - {window.username} - - - ) : ( - - )} -
-
- ); - } -} diff --git a/src/user-dashboard/src/app/assets/src/components/GlobalHeader/index.less b/src/user-dashboard/src/app/assets/src/components/GlobalHeader/index.less deleted file mode 100644 index 8508930ae..000000000 --- a/src/user-dashboard/src/app/assets/src/components/GlobalHeader/index.less +++ /dev/null @@ -1,115 +0,0 @@ -@import '~antd/lib/style/themes/default.less'; - -.header { - height: 64px; - padding: 0 12px 0 0; - background: #fff; - box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08); - position: relative; -} - -:global { - .ant-layout { - min-height: 100vh; - overflow-x: hidden; - } -} - -.logo { - height: 64px; - line-height: 58px; - vertical-align: top; - display: inline-block; - padding: 0 0 0 24px; - cursor: pointer; - font-size: 20px; - img { - display: inline-block; - vertical-align: middle; - } -} - -.menu { - :global(.anticon) { - margin-right: 8px; - } - :global(.ant-dropdown-menu-item) { - width: 160px; - } -} - -i.trigger { - font-size: 20px; - line-height: 64px; - cursor: pointer; - transition: all 0.3s, padding 0s; - padding: 0 24px; - &:hover { - background: @primary-1; - } -} - -.right { - float: right; - height: 100%; - .action { - cursor: pointer; - padding: 0 12px; - display: inline-block; - transition: all 0.3s; - height: 100%; - > i { - font-size: 16px; - vertical-align: middle; - color: @text-color; - } - &:hover, - &:global(.ant-popover-open) { - background: @primary-1; - } - } - .search { - padding: 0; - margin: 0 12px; - &:hover { - background: transparent; - } - } - .account { - .avatar { - margin: 20px 8px 20px 0; - color: @primary-color; - background: rgba(255, 255, 255, 0.85); - vertical-align: middle; - } - } -} - -@media only screen and (max-width: @screen-md) { - .header { - :global(.ant-divider-vertical) { - vertical-align: unset; - } - .name { - display: none; - } - i.trigger { - padding: 0 12px; - } - .logo { - padding-right: 12px; - position: relative; - } - .right { - position: absolute; - right: 12px; - top: 0; - background: #fff; - .account { - .avatar { - margin-right: 0; - } - } - } - } -} diff --git a/src/user-dashboard/src/app/assets/src/components/Login/LoginItem.js b/src/user-dashboard/src/app/assets/src/components/Login/LoginItem.js deleted file mode 100644 index 98efb3337..000000000 --- a/src/user-dashboard/src/app/assets/src/components/Login/LoginItem.js +++ /dev/null @@ -1,104 +0,0 @@ -import React, { Component } from 'react'; -import PropTypes from 'prop-types'; -import { Form, Button, Row, Col } from 'antd'; -import omit from 'omit.js'; -import styles from './index.less'; -import map from './map'; - -const FormItem = Form.Item; - -function generator({ defaultProps, defaultRules, type }) { - return WrappedComponent => { - return class BasicComponent extends Component { - static contextTypes = { - form: PropTypes.object, - updateActive: PropTypes.func, - }; - constructor(props) { - super(props); - this.state = { - count: 0, - }; - } - componentDidMount() { - if (this.context.updateActive) { - this.context.updateActive(this.props.name); - } - } - componentWillUnmount() { - clearInterval(this.interval); - } - onGetCaptcha = () => { - let count = 59; - this.setState({ count }); - if (this.props.onGetCaptcha) { - this.props.onGetCaptcha(); - } - this.interval = setInterval(() => { - count -= 1; - this.setState({ count }); - if (count === 0) { - clearInterval(this.interval); - } - }, 1000); - }; - render() { - const { getFieldDecorator } = this.context.form; - const options = {}; - let otherProps = {}; - const { onChange, defaultValue, rules, name, ...restProps } = this.props; - const { count } = this.state; - options.rules = rules || defaultRules; - if (onChange) { - options.onChange = onChange; - } - if (defaultValue) { - options.initialValue = defaultValue; - } - otherProps = restProps || otherProps; - if (type === 'Captcha') { - const inputProps = omit(otherProps, ['onGetCaptcha']); - return ( - - - - {getFieldDecorator(name, options)( - - )} - - - - - - - ); - } - return ( - - {getFieldDecorator(name, options)( - - )} - - ); - } - }; - }; -} - -const LoginItem = {}; -Object.keys(map).forEach(item => { - LoginItem[item] = generator({ - defaultProps: map[item].props, - defaultRules: map[item].rules, - type: item, - })(map[item].component); -}); - -export default LoginItem; diff --git a/src/user-dashboard/src/app/assets/src/components/Login/LoginSubmit.js b/src/user-dashboard/src/app/assets/src/components/Login/LoginSubmit.js deleted file mode 100644 index 4aebabf89..000000000 --- a/src/user-dashboard/src/app/assets/src/components/Login/LoginSubmit.js +++ /dev/null @@ -1,17 +0,0 @@ -import React from 'react'; -import classNames from 'classnames'; -import { Button, Form } from 'antd'; -import styles from './index.less'; - -const FormItem = Form.Item; - -const LoginSubmit = ({ className, ...rest }) => { - const clsString = classNames(styles.submit, className); - return ( - -