import React from 'react'; import { IUser } from '@alife/yunxiao-common'; import { ApiResult } from '@/api/types'; import { FeatureKey } from '@/utils/features'; import { DeployGroup, Host, ChangeableEnvVO, MemberVO, AdeTaskForm } from '@/api'; /** * 复制文本到剪切板 * @param text * @returns */ export declare const copyToClipboard: (text: string, showMessage?: boolean) => void; /** * 将成员组建的type map成后端类型 * @param type string * @returns ResourcePlayerRequest.type */ export declare const mapMemberType: (type: string) => any; /** * * @param text * @returns cell function or ReactNode */ export declare const tableCell: (text: number | string, url?: string) => JSX.Element; export declare const getPlaceholderKeys: (template: string, type: 'appstack' | 'custom') => string[]; /** * * @param repoUrl * @returns */ export declare const getCodeRepoNameFromRepoUrl: (repoUrl: string) => string; /** * * @param repoUrl * @returns */ export declare const getCodeRepoUrl: (repoUrl?: string) => string; /** * * @param values * @param template * @param type * @returns */ export declare const getUndefinedKeys: (values: string[], template: string, type: 'appstack' | 'custom') => string[]; export declare const getUnusedKeys: (values: string[], templates: string[], type: 'appstack' | 'custom') => string[]; /** * * @param time 时间 * @param isShort 是否是短时间 * @returns */ export declare const formatDate: (time?: string | number | undefined, isShort?: boolean, precision?: 's' | 'd' | 'm') => string; /** * * @param start 开始时间 * @param end 结束时间 * @returns 格式化后的时长 最大单位天 */ export declare const dateDiff: (start?: string | number, end?: string | number) => string; /** * * @param count 需要分批的数量 * @param batches 分批数量 * @returns 具体批次 [1,2,3] */ export declare const getBatchDetail: (count: number, batches: number) => number[]; /** * * @returns 当前环境 daily | pre | prod */ export declare const getEnv: () => "pre" | "daily" | "prod"; /** * * @returns Flow环境 PRODUCTION | PREPUB */ export declare const getFlowEnv: () => "PRODUCTION" | "PREPUB"; export declare const noop: () => any; export declare const stopPropagation: React.MouseEventHandler; export declare const increment: (val: string) => string; export declare const getDataSourceFromEnum: (enums: Record) => Array<{ label: string; value: string; }>; /** * * @param message 初始错误信息 * @param params 需要填充到错误信息的参数 */ /** * * @param data response data * */ export declare const showApiError: (data: ApiResult<{}> & { message?: string; traceId?: string; }) => void; /** * * @param values * @returns */ export declare const getStrategies: (values: IDeployComponent) => any; /** * 将adeTask转成部署组件 * @param AdeTaskForm * @returns IDeployComponent * * * */ export declare function getDeployComponentsFromEnvTask(tasks: AdeTaskForm[], envName: string): ({ kind: AdeTaskForm; name: AdeTaskForm; taskName: AdeTaskForm; behavior: AdeTaskForm; envName: string; strategy: Record; values: { targetReplicas: any; fromReplica: any; batchSteps: any; batchMode: any; deployType: any; batches: any; timeout: any; }; } | { behavior: AdeTaskForm; kind: AdeTaskForm; name: AdeTaskForm; taskName: AdeTaskForm; envName: string; strategy?: undefined; values?: undefined; })[]; /** * * @param length 随机字符串的长度 * @returns 指定长度的随机字符串 */ export declare const randomString: (length?: number) => string; /** * * @returns 获取全局labels */ export declare const getLables: () => Promise; /** * * @param promise request promise * @param showError 是否展示api错误 * @param errorExt 需要填充到错误信息的参数 * @returns [error, result] */ export declare function catchAwait>(promise: Promise, showError?: boolean, errorExt?: object, isProjexModule?: boolean): Promise<[U, T] | [null, T]>; export declare const getGitRepoUrl: ({ repoUrl, branchName, commitId, }: { repoUrl?: string; branchName?: string; commitId?: string; }) => string; /** * 成员转用户 * @param member MemberVO * @returns IUser */ export declare function memberToUser(member?: MemberVO): IUser; /** * * @param time 延迟时间 * @returns Promise */ export declare function delay(time: number): Promise; export declare function getFeature(id: FeatureKey): any; export declare function domClick(selector: string, delayTime?: number): void; /** * 判断是否是url * @param url * @returns boolean */ export declare function isUrl(url: string): boolean; /** * * @param param * @returns */ export declare function saveFile({ data, fileName, type, }: { data: object | string; fileName?: string; type?: string; }): void; export declare function fillHostStateByDeployGroup(hosts: Host[], deployGroup: DeployGroup, env?: ChangeableEnvVO): Promise; export declare const initSomething: () => void; /** * 获取研发流程模板 PUT 请求体 */ export declare const getWorkflowTemplateUpdateRequestBody: (template: T) => T; /** * * @param str * @return bool */ export declare const isObjectStr: (str?: string) => boolean; /** * * @param str * @param defaultValue * @returns */ export declare const jsonParse: (str?: string, defaultValue?: object) => any; /** * * @param obj * @returns string */ export declare function jsonStringify(obj?: object): string; export declare const replacePipelineVariable: (stage: any) => any; /** 按条件插入数组元素 小工具 */ export declare function insertIf(condition: boolean, ...elements: any[]): any[]; export declare const isYamlStringWithTemplateMark: (content: string) => boolean; /** * 获取列表的简要显示文本 * 该函数旨在简化长列表的显示,通过仅展示前几个元素后跟"等"字来表示更多未显示的元素 * 如果列表长度不超过指定的数字,则展示所有元素 * * @param list - 待显示的列表,默认为空数组 如果未提供,将使用空数组 * @param number - 最多显示的元素数量,默认为3 包括最后用"等"表示的未显示元素在内 * @returns {string} - 格式化后的字符串,用于显示列表的一部分或全部内容 */ export declare const getListAskText: (list?: string[], number?: number) => string; /** * 富文本描述,如果是json就渲染text * @param showText string|jsonString * @returns string */ export declare const renderRichTextDescription: (showText: string) => any; /** * 判断是否为数字字符串 * @param str */ export declare const isNumeric: (str: string) => boolean; /** * 将对象格式化成展示字符串 * @param obj 对象数据 * @param indentLevel 缩进格数 */ export declare const formatObjectToString: (obj: any, indentLevel?: number) => string; /** * 将Monaco字符串中的换行符标准化为`\n` * @param {string} str - 需要进行换行符标准化的字符串 * @returns {string} 标准化换行符后的字符串,如果输入为空则返回空字符串 */ export declare function replaceMonacoString(str: string | undefined): string; /** * 模板编辑器工具栏 * 用于应用描述编辑器 */ export declare const templateEditorToolbar: { richText: string[][]; md: string[]; };