@ant-design/icons#ApiTwoTone JavaScript Examples

The following examples show how to use @ant-design/icons#ApiTwoTone. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: index.js    From quick_redis_blog with MIT License 4 votes vote down vote up
/**
     * 显示右键菜单
     *
     * @returns
     * @memberof ResourceTree
     */
    showTreeRightClickMenu() {
        let keys = resourceTreeSelectKeys;
        // 0:新建连接;1:修改连接;2:删除连接;3:新建目录;4:修改目录;5:删除目录;6:删除;7:打开命令行;8:打开新窗口;9:断开连接;10:新建根目录;11:复制链接
        let showMenuItem = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
        showMenuItem[HOSTS_TREEE_MENU_TYPE.CREATE_FOLDER_ON_ROOT] = 1;
        if (typeof keys === "undefined") {
            showMenuItem[HOSTS_TREEE_MENU_TYPE.CREATE_CONN] = 1;
            showMenuItem[HOSTS_TREEE_MENU_TYPE.CREATE_FOLDER] = 1;
        } else {
            let nodeTypeList = [];
            for (let i = 0; i < keys.length; i++) {
                let node = this.findNodeByNodeKey(this.props.hosts, keys[i]);
                if (node == null || typeof node === "undefined") {
                    continue;
                }
                nodeTypeList.push(node.isLeaf);
                if (nodeTypeList.length >= 2) {
                    break;
                }
            }
            if (nodeTypeList.length === 2) {
                // 选择了多个类型的节点
                showMenuItem[HOSTS_TREEE_MENU_TYPE.DEL_ALL] = 1;
            } else if (nodeTypeList.length === 1) {
                let nodeType = nodeTypeList[0];
                if (nodeType === false) {
                    // 文件夹
                    showMenuItem[HOSTS_TREEE_MENU_TYPE.CREATE_CONN] = 1;
                    showMenuItem[HOSTS_TREEE_MENU_TYPE.CREATE_FOLDER] = 1;
                    showMenuItem[HOSTS_TREEE_MENU_TYPE.UPDATE_FOLDER] = 1;
                    showMenuItem[HOSTS_TREEE_MENU_TYPE.DEL_FOLDER] = 1;
                } else {
                    // 连接
                    showMenuItem[HOSTS_TREEE_MENU_TYPE.CREATE_CONN] = 1;
                    showMenuItem[HOSTS_TREEE_MENU_TYPE.CREATE_FOLDER] = 1;
                    showMenuItem[HOSTS_TREEE_MENU_TYPE.UPDATE_CONN] = 1;
                    showMenuItem[HOSTS_TREEE_MENU_TYPE.DEL_CONN] = 1;
                    showMenuItem[
                        HOSTS_TREEE_MENU_TYPE.CREATE_CONN_TERMINAL
                    ] = 1;
                    showMenuItem[HOSTS_TREEE_MENU_TYPE.CREATE_CONN_MUTI] = 1;
                    showMenuItem[HOSTS_TREEE_MENU_TYPE.DISCONNECT_CONN] = 1;
                    showMenuItem[HOSTS_TREEE_MENU_TYPE.COPY_CONN] = 1;
                }
            } else {
                // 没有选择节点
                showMenuItem[HOSTS_TREEE_MENU_TYPE.CREATE_FOLDER] = 1;
                showMenuItem[HOSTS_TREEE_MENU_TYPE.CREATE_CONN] = 1;
            }
        }

        return (
            <Menu
                onClick={this.clickTreeRightClickMenu.bind(this)}
                style={{ width: 200 }}
            >
                {showMenuItem[0] === 1 ? (
                    <Menu.Item key="0">
                        <FolderAddTwoTone /> {intl.get("Tree.Menu.CREATE_CONN")}
                    </Menu.Item>
                ) : (
                    ""
                )}
                {showMenuItem[1] === 1 ? (
                    <Menu.Item key="1">
                        <EditTwoTone /> {intl.get("Tree.Menu.UPDATE_CONN")}
                    </Menu.Item>
                ) : (
                    ""
                )}
                {showMenuItem[2] === 1 ? (
                    <Menu.Item key="2">
                        <DeleteTwoTone /> {intl.get("Tree.Menu.DEL_CONN")}
                    </Menu.Item>
                ) : (
                    ""
                )}
                {showMenuItem[3] === 1 ? (
                    <Menu.Item key="3">
                        <FolderAddTwoTone />{" "}
                        {intl.get("Tree.Menu.CREATE_FOLDER")}
                    </Menu.Item>
                ) : (
                    ""
                )}
                {showMenuItem[4] === 1 ? (
                    <Menu.Item key="4">
                        <EditTwoTone /> {intl.get("Tree.Menu.UPDATE_FOLDER")}
                    </Menu.Item>
                ) : (
                    ""
                )}
                {showMenuItem[5] === 1 ? (
                    <Menu.Item key="5">
                        <DeleteTwoTone /> {intl.get("Tree.Menu.DEL_FOLDER")}
                    </Menu.Item>
                ) : (
                    ""
                )}
                {showMenuItem[6] === 1 ? (
                    <Menu.Item key="6">
                        <DeleteTwoTone /> {intl.get("Tree.Menu.DEL_ALL")}
                    </Menu.Item>
                ) : (
                    ""
                )}
                {showMenuItem[7] === 1 ? (
                    <Menu.Item key="7">
                        <CodeTwoTone />{" "}
                        {intl.get("Tree.Menu.CREATE_CONN_TERMINAL")}
                    </Menu.Item>
                ) : (
                    ""
                )}
                {showMenuItem[8] === 1 ? (
                    <Menu.Item key="8">
                        <PlusSquareTwoTone />{" "}
                        {intl.get("Tree.Menu.CREATE_CONN_MUTI")}
                    </Menu.Item>
                ) : (
                    ""
                )}
                {showMenuItem[9] === 1 ? (
                    <Menu.Item key="9">
                        <ApiTwoTone /> {intl.get("Tree.Menu.DISCONNECT_CONN")}
                    </Menu.Item>
                ) : (
                    ""
                )}
                {showMenuItem[10] === 1 ? (
                    <Menu.Item key="10">
                        <FolderAddTwoTone />{" "}
                        {intl.get("Tree.Menu.CREATE_FOLDER_ON_ROOT")}
                    </Menu.Item>
                ) : (
                    ""
                )}
                {showMenuItem[11] === 1 ? (
                    <Menu.Item key="11">
                        <CopyTwoTone /> {intl.get("Tree.Menu.COPY_CONN")}
                    </Menu.Item>
                ) : (
                    ""
                )}
            </Menu>
        );
    }