Skip to content

Commit

Permalink
feat: add fields federations and networks to Organization(bestchains#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jandiasnow committed Feb 17, 2023
1 parent e4f25d1 commit 6da565a
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 0 deletions.
57 changes: 57 additions & 0 deletions bff-sdk/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ export type Mutation = {
networkDissolve: Scalars['Boolean'];
/** 新增组织 */
organizationCreate: Organization;
/** 删除组织 */
organizationDelete: K8sV1Status;
/** 修改组织 */
organizationUpdate: Organization;
/** 更新投票 */
Expand Down Expand Up @@ -147,6 +149,10 @@ export type MutationOrganizationCreateArgs = {
organization: NewOrganizationInput;
};

export type MutationOrganizationDeleteArgs = {
name: Scalars['String'];
};

export type MutationOrganizationUpdateArgs = {
name: Scalars['String'];
organization: UpdateOrganization;
Expand Down Expand Up @@ -241,12 +247,16 @@ export type Organization = {
description?: Maybe<Scalars['String']>;
/** 名称 */
displayName?: Maybe<Scalars['String']>;
/** 所在联盟 */
federations?: Maybe<Array<Scalars['String']>>;
/** 加入时间(只在联盟中使用) */
joinedAt?: Maybe<Scalars['String']>;
/** 更新时间 */
lastHeartbeatTime?: Maybe<Scalars['String']>;
/** name */
name: Scalars['ID'];
/** 所在网络 */
networks?: Maybe<Array<Scalars['String']>>;
/** 原因(状态为非Deplyed时) */
reason?: Maybe<Scalars['String']>;
/** 状态 */
Expand Down Expand Up @@ -700,6 +710,8 @@ export type GetOrganizationsQuery = {
admin?: string | null;
status?: StatusType | null;
reason?: string | null;
networks?: Array<string> | null;
federations?: Array<string> | null;
}>;
};

Expand All @@ -719,6 +731,8 @@ export type GetOrganizationQuery = {
admin?: string | null;
status?: StatusType | null;
reason?: string | null;
networks?: Array<string> | null;
federations?: Array<string> | null;
users?: Array<{
__typename?: 'User';
name: string;
Expand Down Expand Up @@ -771,6 +785,21 @@ export type UpdateOrganizationMutation = {
};
};

export type DeleteOrganizationMutationVariables = Exact<{
name: Scalars['String'];
}>;

export type DeleteOrganizationMutation = {
__typename?: 'Mutation';
organizationDelete: {
__typename?: 'K8sV1Status';
code?: number | null;
status?: string | null;
reason?: string | null;
message?: string | null;
};
};

export type GetProposalsQueryVariables = Exact<{ [key: string]: never }>;

export type GetProposalsQuery = {
Expand Down Expand Up @@ -1047,6 +1076,8 @@ export const GetOrganizationsDocument = gql`
admin
status
reason
networks
federations
}
}
`;
Expand All @@ -1061,6 +1092,8 @@ export const GetOrganizationDocument = gql`
admin
status
reason
networks
federations
users {
name
isOrganizationAdmin
Expand Down Expand Up @@ -1100,6 +1133,16 @@ export const UpdateOrganizationDocument = gql`
}
}
`;
export const DeleteOrganizationDocument = gql`
mutation deleteOrganization($name: String!) {
organizationDelete(name: $name) {
code
status
reason
message
}
}
`;
export const GetProposalsDocument = gql`
query getProposals {
proposals {
Expand Down Expand Up @@ -1394,6 +1437,20 @@ export function getSdk(client: GraphQLClient, withWrapper: SdkFunctionWrapper =
'mutation'
);
},
deleteOrganization(
variables: DeleteOrganizationMutationVariables,
requestHeaders?: Dom.RequestInit['headers']
): Promise<DeleteOrganizationMutation> {
return withWrapper(
wrappedRequestHeaders =>
client.request<DeleteOrganizationMutation>(DeleteOrganizationDocument, variables, {
...requestHeaders,
...wrappedRequestHeaders,
}),
'deleteOrganization',
'mutation'
);
},
getProposals(
variables?: GetProposalsQueryVariables,
requestHeaders?: Dom.RequestInit['headers']
Expand Down
4 changes: 4 additions & 0 deletions src/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const i18nConfig = {
"i18n-2b4dhrz51wu": "more",
"i18n-2tfq4ggp9cv": "Federation deletion failure",
"i18n-2vzrxdpca5": "FederationActivated",
"i18n-386epq7m": "Local network",
"i18n-3cphsjan5d2": "Choose your own organization",
"i18n-3g6iq8ncfsh": "Version details",
"i18n-3ja6wz9xvoh":
Expand Down Expand Up @@ -106,6 +107,7 @@ const i18nConfig = {
"i18n-e6ttl8tm6f": "detail",
"i18n-eirr55ndhxk": "vote",
"i18n-ej048sy57c": "FederationFailed",
"i18n-ely1ij2y": "affiliate",
"i18n-esf1s7w7tv":
"Tip: If the type of the new user is admin, all administrator rights will be transferred to the new admin user",
"i18n-f83f1t03e": "Please select a proposal type",
Expand Down Expand Up @@ -272,6 +274,7 @@ const i18nConfig = {
"i18n-2b4dhrz51wu": "更多",
"i18n-2tfq4ggp9cv": "删除联盟失败",
"i18n-2vzrxdpca5": "已激活",
"i18n-386epq7m": "所在网络",
"i18n-3cphsjan5d2": "选择自己拥有的组织",
"i18n-3g6iq8ncfsh": "版本详细介绍",
"i18n-3ja6wz9xvoh": "提示:确认后,管理员权限将全部转移给新用户",
Expand Down Expand Up @@ -349,6 +352,7 @@ const i18nConfig = {
"i18n-e6ttl8tm6f": "管理联盟",
"i18n-eirr55ndhxk": "投票",
"i18n-ej048sy57c": "组建失败",
"i18n-ely1ij2y": "所在联盟",
"i18n-esf1s7w7tv":
"提示:如果新增用户类型为 admin, 管理员权限将全部转移给新的 admin 用户",
"i18n-f83f1t03e": "请选择提议类型",
Expand Down
56 changes: 56 additions & 0 deletions src/pages/Organization/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,62 @@ class Organization$$Page extends React.Component {
"zh-CN": "状态",
}),
},
{
dataIndex: "federations",
key: "federations",
render: (text, record, index) =>
((__$$context) => (
<Typography.Text
disabled={false}
ellipsis={true}
strong={false}
style={{ fontSize: "" }}
>
{__$$eval(() =>
text?.length > 0 ? text?.join(",") : "-"
)}
</Typography.Text>
))(
__$$createChildContext(__$$context, {
text,
record,
index,
})
),
title: this._i18nText({
"en-US": "affiliate",
key: "i18n-ely1ij2y",
"zh-CN": "所在联盟",
}),
},
{
dataIndex: "networks",
key: "networks",
render: (text, record, index) =>
((__$$context) => (
<Typography.Text
disabled={false}
ellipsis={true}
strong={false}
style={{ fontSize: "" }}
>
{__$$eval(() =>
text?.length > 0 ? text?.join(",") : "-"
)}
</Typography.Text>
))(
__$$createChildContext(__$$context, {
text,
record,
index,
})
),
title: this._i18nText({
"en-US": "Local network",
key: "i18n-386epq7m",
"zh-CN": "所在网络",
}),
},
{
dataIndex: "op",
key: "op",
Expand Down

0 comments on commit 6da565a

Please sign in to comment.