Skip to content

Commit

Permalink
feat: add channel detail api (bestchains#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jandiasnow committed Mar 2, 2023
1 parent 6710e94 commit d34665f
Show file tree
Hide file tree
Showing 4 changed files with 333 additions and 184 deletions.
42 changes: 19 additions & 23 deletions bff-sdk/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ export type Epolicy = {
creationTimestamp?: Maybe<Scalars['String']>;
/** 描述 */
description?: Maybe<Scalars['String']>;
/** 更新时间 */
lastHeartbeatTime?: Maybe<Scalars['String']>;
/** name */
name: Scalars['ID'];
/** 策略内容 */
Expand Down Expand Up @@ -187,7 +189,7 @@ export type Mutation = {
/** 从联盟中驱逐一个组织(返回true:只表示这个操作触发成功,而不是驱逐组织成功) */
federationRemoveOrganization: Scalars['Boolean'];
/** 创建IBPPeer节点 */
ibppeerCreate: Ibppeer;
ibppeerCreate: Array<Ibppeer>;
/** 创建网络 */
networkCreate: Network;
/** 删除网络 */
Expand Down Expand Up @@ -245,6 +247,7 @@ export type MutationFederationRemoveOrganizationArgs = {
};

export type MutationIbppeerCreateArgs = {
count?: InputMaybe<Scalars['Float']>;
organization: Scalars['String'];
};

Expand Down Expand Up @@ -658,6 +661,8 @@ export type User = {
email: Scalars['String'];
/** 是否为组织管理员(组织列表中) */
isOrganizationAdmin?: Maybe<Scalars['Boolean']>;
/** 加入组织时间(组织列表中) */
joinedAt?: Maybe<Scalars['String']>;
/** 用户名 */
name: Scalars['ID'];
/** 密码 */
Expand Down Expand Up @@ -778,6 +783,8 @@ export type GetEpoliciesQuery = {
description?: string | null;
channel: string;
value: string;
creationTimestamp?: string | null;
lastHeartbeatTime?: string | null;
}>;
};

Expand Down Expand Up @@ -993,12 +1000,13 @@ export type GetIbppeersQuery = {
};

export type CreateIbppeerMutationVariables = Exact<{
organization: Scalars['String'];
org: Scalars['String'];
count?: InputMaybe<Scalars['Float']>;
}>;

export type CreateIbppeerMutation = {
__typename?: 'Mutation';
ibppeerCreate: {
ibppeerCreate: Array<{
__typename?: 'Ibppeer';
name: string;
creationTimestamp: string;
Expand All @@ -1008,7 +1016,7 @@ export type CreateIbppeerMutation = {
cpu: string;
memory: string;
} | null;
};
}>;
};

export type GetNetworksQueryVariables = Exact<{ [key: string]: never }>;
Expand Down Expand Up @@ -1202,18 +1210,9 @@ export type GetOrganizationQuery = {
__typename?: 'User';
name: string;
isOrganizationAdmin?: boolean | null;
joinedAt?: string | null;
}> | null;
ibppeers?: Array<{
__typename?: 'Ibppeer';
name: string;
creationTimestamp: string;
status?: IbppeerStatus | null;
limits?: {
__typename?: 'SpecResource';
cpu: string;
memory: string;
} | null;
}> | null;
ibppeers?: Array<{ __typename?: 'Ibppeer'; name: string }> | null;
};
};

Expand Down Expand Up @@ -1438,6 +1437,8 @@ export const GetEpoliciesDocument = gql`
description
channel
value
creationTimestamp
lastHeartbeatTime
}
}
`;
Expand Down Expand Up @@ -1597,8 +1598,8 @@ export const GetIbppeersDocument = gql`
}
`;
export const CreateIbppeerDocument = gql`
mutation createIbppeer($organization: String!) {
ibppeerCreate(organization: $organization) {
mutation createIbppeer($org: String!, $count: Float) {
ibppeerCreate(organization: $org, count: $count) {
name
creationTimestamp
status
Expand Down Expand Up @@ -1760,15 +1761,10 @@ export const GetOrganizationDocument = gql`
users {
name
isOrganizationAdmin
joinedAt
}
ibppeers {
name
creationTimestamp
status
limits {
cpu
memory
}
}
}
}
Expand Down
129 changes: 111 additions & 18 deletions src/pages/NetworkChannelDetail/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,19 +106,58 @@ class NetworkChannelDetail$$Page extends React.Component {
column={1}
items={[
{
children: null,
children: (
<Typography.Text
__component_name="Typography.Text"
disabled={false}
ellipsis={true}
strong={false}
style={{ fontSize: '' }}
>
{__$$eval(
() =>
this.props.useGetChannel?.data?.channel
?.name || '-'
)}
</Typography.Text>
),
key: '9qhq7vaoun',
label: this.i18n('i18n-9e87qfos') /* 名称 */,
span: 1,
},
{
children: null,
children: (
<Typography.Text
__component_name="Typography.Text"
disabled={false}
ellipsis={true}
strong={false}
style={{ fontSize: '' }}
>
{__$$eval(
() =>
this.props.useGetChannel?.data?.channel
?.description || '-'
)}
</Typography.Text>
),
key: 'pvlb9npuf1',
label: this.i18n('i18n-8weq4mfy9lf') /* 描述 */,
span: 1,
},
{
children: null,
children: (
<Typography.Time
__component_name="Typography.Time"
format=""
relativeTime={false}
time={__$$eval(
() =>
this.props.useGetChannel?.data?.channel
?.creationTimestamp || '-'
)}
/>
),
key: '3fvfujee7p7',
label: this.i18n('i18n-9ox4rx1wtwv') /* 创建时间 */,
span: 1,
Expand All @@ -142,7 +181,11 @@ class NetworkChannelDetail$$Page extends React.Component {
strong={false}
style={{ fontSize: '' }}
>
text
{__$$eval(
() =>
this.props.useGetChannel?.data?.channel
?.name || '-'
)}
</Typography.Text>
}
</Descriptions.Item>
Expand All @@ -159,7 +202,11 @@ class NetworkChannelDetail$$Page extends React.Component {
strong={false}
style={{ fontSize: '' }}
>
text
{__$$eval(
() =>
this.props.useGetChannel?.data?.channel
?.description || '-'
)}
</Typography.Text>
}
</Descriptions.Item>
Expand All @@ -173,7 +220,11 @@ class NetworkChannelDetail$$Page extends React.Component {
__component_name="Typography.Time"
format=""
relativeTime={false}
time=""
time={__$$eval(
() =>
this.props.useGetChannel?.data?.channel
?.creationTimestamp || '-'
)}
/>
}
</Descriptions.Item>
Expand Down Expand Up @@ -221,6 +272,9 @@ class NetworkChannelDetail$$Page extends React.Component {
},
]}
dataSource={__$$eval(() => [{}])}
loading={__$$eval(
() => this.props.useGetChannel?.loading
)}
pagination={false}
rowKey="id"
scroll={{ scrollToFirstRowOnChange: true, y: 130 }}
Expand Down Expand Up @@ -269,12 +323,19 @@ class NetworkChannelDetail$$Page extends React.Component {
},
{
_unsafe_MixedSetter_title_select: 'StringSetter',
dataIndex: 'version',
key: 'age',
dataIndex: 'name',
key: 'name',
title: 'mspid',
},
]}
dataSource={__$$eval(() => [{}])}
dataSource={__$$eval(
() =>
this.props.useGetChannel?.data?.channel?.members ||
[]
)}
loading={__$$eval(
() => this.props.useGetChannel?.loading
)}
pagination={false}
rowKey="id"
scroll={{ scrollToFirstRowOnChange: true, y: 130 }}
Expand Down Expand Up @@ -322,8 +383,8 @@ class NetworkChannelDetail$$Page extends React.Component {
title: this.i18n('i18n-9e87qfos') /* 名称 */,
},
{
dataIndex: 'version',
key: 'age',
dataIndex: 'namespace',
key: 'namespace',
title: this.i18n('i18n-2uy76ea1') /* 组织 */,
},
{
Expand All @@ -332,7 +393,13 @@ class NetworkChannelDetail$$Page extends React.Component {
title: this.i18n('i18n-db5zj61b') /* 错节点 */,
},
]}
dataSource={__$$eval(() => [{}])}
dataSource={__$$eval(
() =>
this.props.useGetChannel?.data?.channel?.peers || []
)}
loading={__$$eval(
() => this.props.useGetChannel?.loading
)}
pagination={false}
rowKey="id"
scroll={{ scrollToFirstRowOnChange: true, y: 130 }}
Expand Down Expand Up @@ -378,8 +445,8 @@ class NetworkChannelDetail$$Page extends React.Component {
title: this.i18n('i18n-87kp314f') /* 策略名称 */,
},
{
dataIndex: 'version',
key: 'age',
dataIndex: 'description',
key: 'description',
title: this.i18n('i18n-w3qy6omh') /* 策略描述 */,
},
{
Expand All @@ -389,12 +456,31 @@ class NetworkChannelDetail$$Page extends React.Component {
title: this.i18n('i18n-xnyhdqu3') /* 应用合约数 */,
},
{
dataIndex: 'crea',
key: 'crea',
dataIndex: 'creationTimestamp',
key: 'creationTimestamp',
render: (text, record, index) =>
((__$$context) => (
<Typography.Time
__component_name="Typography.Time"
format=""
relativeTime={false}
time={__$$eval(() => record?.creationTimestamp)}
/>
))(
__$$createChildContext(__$$context, {
text,
record,
index,
})
),
title: this.i18n('i18n-9ox4rx1wtwv') /* 创建时间 */,
},
]}
dataSource={__$$eval(() => [{}])}
dataSource={__$$eval(
() =>
this.props.useGetChannel?.data?.channel?.epolicy || []
)}
loading={__$$eval(() => this.props.useGetChannel?.loading)}
pagination={false}
rowKey="id"
scroll={{ scrollToFirstRowOnChange: true, y: 130 }}
Expand Down Expand Up @@ -429,7 +515,14 @@ export default () => {
};
return (
<DataProvider
sdkSwrFuncs={[]}
sdkSwrFuncs={[
{
func: 'useGetChannel',
params: {
name: self.match?.params?.channelId,
},
},
]}
render={(dataProps) => (
<NetworkChannelDetail$$Page
{...dataProps}
Expand Down
23 changes: 20 additions & 3 deletions src/pages/NetworkDetail/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ class NetworkDetail$$Page extends React.Component {
_valueitem$item === void 0
? void 0
: (_valueitem$item$map = _valueitem$item.map((item, i) => {
item = `'${item}'`;
item = `'${item}.member'`;
if (i === 0) {
return 'AND(' + item;
}
Expand Down Expand Up @@ -5349,8 +5349,25 @@ class NetworkDetail$$Page extends React.Component {
this.i18n('i18n-w3qy6omh') /* 策略描述 */,
},
{
dataIndex: 'channels',
key: 'channels',
dataIndex: 'lastHeartbeatTime',
key: 'lastHeartbeatTime',
render: (text, record, index) =>
((__$$context) => (
<Typography.Time
__component_name="Typography.Time"
format=""
relativeTime={false}
time={__$$eval(
() => record?.lastHeartbeatTime
)}
/>
))(
__$$createChildContext(__$$context, {
text,
record,
index,
})
),
title:
this.i18n('i18n-watjije0jk') /* 更新时间 */,
},
Expand Down
Loading

0 comments on commit d34665f

Please sign in to comment.