add: 添加实验列表界面,实验增删完全依赖数据库实现
This commit is contained in:
599
src/APIClient.ts
599
src/APIClient.ts
@@ -2811,17 +2811,22 @@ export class ExamClient {
|
||||
}
|
||||
|
||||
/**
|
||||
* 重新扫描实验文件夹并更新数据库
|
||||
* @return 更新结果
|
||||
* 创建新实验
|
||||
* @param request 创建实验请求
|
||||
* @return 创建结果
|
||||
*/
|
||||
scanExams( cancelToken?: CancelToken): Promise<ScanResult> {
|
||||
let url_ = this.baseUrl + "/api/Exam/scan";
|
||||
createExam(request: CreateExamRequest, cancelToken?: CancelToken): Promise<ExamInfo> {
|
||||
let url_ = this.baseUrl + "/api/Exam";
|
||||
url_ = url_.replace(/[?&]$/, "");
|
||||
|
||||
const content_ = JSON.stringify(request);
|
||||
|
||||
let options_: AxiosRequestConfig = {
|
||||
data: content_,
|
||||
method: "POST",
|
||||
url: url_,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Accept": "application/json"
|
||||
},
|
||||
cancelToken
|
||||
@@ -2834,11 +2839,11 @@ export class ExamClient {
|
||||
throw _error;
|
||||
}
|
||||
}).then((_response: AxiosResponse) => {
|
||||
return this.processScanExams(_response);
|
||||
return this.processCreateExam(_response);
|
||||
});
|
||||
}
|
||||
|
||||
protected processScanExams(response: AxiosResponse): Promise<ScanResult> {
|
||||
protected processCreateExam(response: AxiosResponse): Promise<ExamInfo> {
|
||||
const status = response.status;
|
||||
let _headers: any = {};
|
||||
if (response.headers && typeof response.headers === "object") {
|
||||
@@ -2848,12 +2853,19 @@ export class ExamClient {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (status === 200) {
|
||||
if (status === 201) {
|
||||
const _responseText = response.data;
|
||||
let result200: any = null;
|
||||
let resultData200 = _responseText;
|
||||
result200 = ScanResult.fromJS(resultData200);
|
||||
return Promise.resolve<ScanResult>(result200);
|
||||
let result201: any = null;
|
||||
let resultData201 = _responseText;
|
||||
result201 = ExamInfo.fromJS(resultData201);
|
||||
return Promise.resolve<ExamInfo>(result201);
|
||||
|
||||
} else if (status === 400) {
|
||||
const _responseText = response.data;
|
||||
let result400: any = null;
|
||||
let resultData400 = _responseText;
|
||||
result400 = ProblemDetails.fromJS(resultData400);
|
||||
return throwException("A server side error occurred.", status, _responseText, _headers, result400);
|
||||
|
||||
} else if (status === 401) {
|
||||
const _responseText = response.data;
|
||||
@@ -2869,6 +2881,13 @@ export class ExamClient {
|
||||
result403 = ProblemDetails.fromJS(resultData403);
|
||||
return throwException("A server side error occurred.", status, _responseText, _headers, result403);
|
||||
|
||||
} else if (status === 409) {
|
||||
const _responseText = response.data;
|
||||
let result409: any = null;
|
||||
let resultData409 = _responseText;
|
||||
result409 = ProblemDetails.fromJS(resultData409);
|
||||
return throwException("A server side error occurred.", status, _responseText, _headers, result409);
|
||||
|
||||
} else if (status === 500) {
|
||||
const _responseText = response.data;
|
||||
return throwException("A server side error occurred.", status, _responseText, _headers);
|
||||
@@ -2877,7 +2896,278 @@ export class ExamClient {
|
||||
const _responseText = response.data;
|
||||
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
||||
}
|
||||
return Promise.resolve<ScanResult>(null as any);
|
||||
return Promise.resolve<ExamInfo>(null as any);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加实验资源
|
||||
* @param examId 实验ID
|
||||
* @param resourceType 资源类型
|
||||
* @param file (optional) 资源文件
|
||||
* @return 添加结果
|
||||
*/
|
||||
addExamResource(examId: string, resourceType: string, file: FileParameter | undefined, cancelToken?: CancelToken): Promise<ResourceInfo> {
|
||||
let url_ = this.baseUrl + "/api/Exam/{examId}/resources/{resourceType}";
|
||||
if (examId === undefined || examId === null)
|
||||
throw new Error("The parameter 'examId' must be defined.");
|
||||
url_ = url_.replace("{examId}", encodeURIComponent("" + examId));
|
||||
if (resourceType === undefined || resourceType === null)
|
||||
throw new Error("The parameter 'resourceType' must be defined.");
|
||||
url_ = url_.replace("{resourceType}", encodeURIComponent("" + resourceType));
|
||||
url_ = url_.replace(/[?&]$/, "");
|
||||
|
||||
const content_ = new FormData();
|
||||
if (file === null || file === undefined)
|
||||
throw new Error("The parameter 'file' cannot be null.");
|
||||
else
|
||||
content_.append("file", file.data, file.fileName ? file.fileName : "file");
|
||||
|
||||
let options_: AxiosRequestConfig = {
|
||||
data: content_,
|
||||
method: "POST",
|
||||
url: url_,
|
||||
headers: {
|
||||
"Accept": "application/json"
|
||||
},
|
||||
cancelToken
|
||||
};
|
||||
|
||||
return this.instance.request(options_).catch((_error: any) => {
|
||||
if (isAxiosError(_error) && _error.response) {
|
||||
return _error.response;
|
||||
} else {
|
||||
throw _error;
|
||||
}
|
||||
}).then((_response: AxiosResponse) => {
|
||||
return this.processAddExamResource(_response);
|
||||
});
|
||||
}
|
||||
|
||||
protected processAddExamResource(response: AxiosResponse): Promise<ResourceInfo> {
|
||||
const status = response.status;
|
||||
let _headers: any = {};
|
||||
if (response.headers && typeof response.headers === "object") {
|
||||
for (const k in response.headers) {
|
||||
if (response.headers.hasOwnProperty(k)) {
|
||||
_headers[k] = response.headers[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (status === 201) {
|
||||
const _responseText = response.data;
|
||||
let result201: any = null;
|
||||
let resultData201 = _responseText;
|
||||
result201 = ResourceInfo.fromJS(resultData201);
|
||||
return Promise.resolve<ResourceInfo>(result201);
|
||||
|
||||
} else if (status === 400) {
|
||||
const _responseText = response.data;
|
||||
let result400: any = null;
|
||||
let resultData400 = _responseText;
|
||||
result400 = ProblemDetails.fromJS(resultData400);
|
||||
return throwException("A server side error occurred.", status, _responseText, _headers, result400);
|
||||
|
||||
} else if (status === 401) {
|
||||
const _responseText = response.data;
|
||||
let result401: any = null;
|
||||
let resultData401 = _responseText;
|
||||
result401 = ProblemDetails.fromJS(resultData401);
|
||||
return throwException("A server side error occurred.", status, _responseText, _headers, result401);
|
||||
|
||||
} else if (status === 403) {
|
||||
const _responseText = response.data;
|
||||
let result403: any = null;
|
||||
let resultData403 = _responseText;
|
||||
result403 = ProblemDetails.fromJS(resultData403);
|
||||
return throwException("A server side error occurred.", status, _responseText, _headers, result403);
|
||||
|
||||
} else if (status === 404) {
|
||||
const _responseText = response.data;
|
||||
let result404: any = null;
|
||||
let resultData404 = _responseText;
|
||||
result404 = ProblemDetails.fromJS(resultData404);
|
||||
return throwException("A server side error occurred.", status, _responseText, _headers, result404);
|
||||
|
||||
} else if (status === 409) {
|
||||
const _responseText = response.data;
|
||||
let result409: any = null;
|
||||
let resultData409 = _responseText;
|
||||
result409 = ProblemDetails.fromJS(resultData409);
|
||||
return throwException("A server side error occurred.", status, _responseText, _headers, result409);
|
||||
|
||||
} else if (status === 500) {
|
||||
const _responseText = response.data;
|
||||
return throwException("A server side error occurred.", status, _responseText, _headers);
|
||||
|
||||
} else if (status !== 200 && status !== 204) {
|
||||
const _responseText = response.data;
|
||||
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
||||
}
|
||||
return Promise.resolve<ResourceInfo>(null as any);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定实验ID的指定资源类型的所有资源的ID和名称
|
||||
* @param examId 实验ID
|
||||
* @param resourceType 资源类型
|
||||
* @return 资源列表
|
||||
*/
|
||||
getExamResourceList(examId: string, resourceType: string, cancelToken?: CancelToken): Promise<ResourceInfo[]> {
|
||||
let url_ = this.baseUrl + "/api/Exam/{examId}/resources/{resourceType}";
|
||||
if (examId === undefined || examId === null)
|
||||
throw new Error("The parameter 'examId' must be defined.");
|
||||
url_ = url_.replace("{examId}", encodeURIComponent("" + examId));
|
||||
if (resourceType === undefined || resourceType === null)
|
||||
throw new Error("The parameter 'resourceType' must be defined.");
|
||||
url_ = url_.replace("{resourceType}", encodeURIComponent("" + resourceType));
|
||||
url_ = url_.replace(/[?&]$/, "");
|
||||
|
||||
let options_: AxiosRequestConfig = {
|
||||
method: "GET",
|
||||
url: url_,
|
||||
headers: {
|
||||
"Accept": "application/json"
|
||||
},
|
||||
cancelToken
|
||||
};
|
||||
|
||||
return this.instance.request(options_).catch((_error: any) => {
|
||||
if (isAxiosError(_error) && _error.response) {
|
||||
return _error.response;
|
||||
} else {
|
||||
throw _error;
|
||||
}
|
||||
}).then((_response: AxiosResponse) => {
|
||||
return this.processGetExamResourceList(_response);
|
||||
});
|
||||
}
|
||||
|
||||
protected processGetExamResourceList(response: AxiosResponse): Promise<ResourceInfo[]> {
|
||||
const status = response.status;
|
||||
let _headers: any = {};
|
||||
if (response.headers && typeof response.headers === "object") {
|
||||
for (const k in response.headers) {
|
||||
if (response.headers.hasOwnProperty(k)) {
|
||||
_headers[k] = response.headers[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (status === 200) {
|
||||
const _responseText = response.data;
|
||||
let result200: any = null;
|
||||
let resultData200 = _responseText;
|
||||
if (Array.isArray(resultData200)) {
|
||||
result200 = [] as any;
|
||||
for (let item of resultData200)
|
||||
result200!.push(ResourceInfo.fromJS(item));
|
||||
}
|
||||
else {
|
||||
result200 = <any>null;
|
||||
}
|
||||
return Promise.resolve<ResourceInfo[]>(result200);
|
||||
|
||||
} else if (status === 400) {
|
||||
const _responseText = response.data;
|
||||
let result400: any = null;
|
||||
let resultData400 = _responseText;
|
||||
result400 = ProblemDetails.fromJS(resultData400);
|
||||
return throwException("A server side error occurred.", status, _responseText, _headers, result400);
|
||||
|
||||
} else if (status === 401) {
|
||||
const _responseText = response.data;
|
||||
let result401: any = null;
|
||||
let resultData401 = _responseText;
|
||||
result401 = ProblemDetails.fromJS(resultData401);
|
||||
return throwException("A server side error occurred.", status, _responseText, _headers, result401);
|
||||
|
||||
} else if (status === 500) {
|
||||
const _responseText = response.data;
|
||||
return throwException("A server side error occurred.", status, _responseText, _headers);
|
||||
|
||||
} else if (status !== 200 && status !== 204) {
|
||||
const _responseText = response.data;
|
||||
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
||||
}
|
||||
return Promise.resolve<ResourceInfo[]>(null as any);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据资源ID下载资源
|
||||
* @param resourceId 资源ID
|
||||
* @return 资源文件
|
||||
*/
|
||||
getExamResourceById(resourceId: number, cancelToken?: CancelToken): Promise<FileResponse> {
|
||||
let url_ = this.baseUrl + "/api/Exam/resources/{resourceId}";
|
||||
if (resourceId === undefined || resourceId === null)
|
||||
throw new Error("The parameter 'resourceId' must be defined.");
|
||||
url_ = url_.replace("{resourceId}", encodeURIComponent("" + resourceId));
|
||||
url_ = url_.replace(/[?&]$/, "");
|
||||
|
||||
let options_: AxiosRequestConfig = {
|
||||
responseType: "blob",
|
||||
method: "GET",
|
||||
url: url_,
|
||||
headers: {
|
||||
"Accept": "application/json"
|
||||
},
|
||||
cancelToken
|
||||
};
|
||||
|
||||
return this.instance.request(options_).catch((_error: any) => {
|
||||
if (isAxiosError(_error) && _error.response) {
|
||||
return _error.response;
|
||||
} else {
|
||||
throw _error;
|
||||
}
|
||||
}).then((_response: AxiosResponse) => {
|
||||
return this.processGetExamResourceById(_response);
|
||||
});
|
||||
}
|
||||
|
||||
protected processGetExamResourceById(response: AxiosResponse): Promise<FileResponse> {
|
||||
const status = response.status;
|
||||
let _headers: any = {};
|
||||
if (response.headers && typeof response.headers === "object") {
|
||||
for (const k in response.headers) {
|
||||
if (response.headers.hasOwnProperty(k)) {
|
||||
_headers[k] = response.headers[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (status === 200 || status === 206) {
|
||||
const contentDisposition = response.headers ? response.headers["content-disposition"] : undefined;
|
||||
let fileNameMatch = contentDisposition ? /filename\*=(?:(\\?['"])(.*?)\1|(?:[^\s]+'.*?')?([^;\n]*))/g.exec(contentDisposition) : undefined;
|
||||
let fileName = fileNameMatch && fileNameMatch.length > 1 ? fileNameMatch[3] || fileNameMatch[2] : undefined;
|
||||
if (fileName) {
|
||||
fileName = decodeURIComponent(fileName);
|
||||
} else {
|
||||
fileNameMatch = contentDisposition ? /filename="?([^"]*?)"?(;|$)/g.exec(contentDisposition) : undefined;
|
||||
fileName = fileNameMatch && fileNameMatch.length > 1 ? fileNameMatch[1] : undefined;
|
||||
}
|
||||
return Promise.resolve({ fileName: fileName, status: status, data: new Blob([response.data], { type: response.headers["content-type"] }), headers: _headers });
|
||||
} else if (status === 400) {
|
||||
const _responseText = response.data;
|
||||
let result400: any = null;
|
||||
let resultData400 = _responseText;
|
||||
result400 = ProblemDetails.fromJS(resultData400);
|
||||
return throwException("A server side error occurred.", status, _responseText, _headers, result400);
|
||||
|
||||
} else if (status === 404) {
|
||||
const _responseText = response.data;
|
||||
let result404: any = null;
|
||||
let resultData404 = _responseText;
|
||||
result404 = ProblemDetails.fromJS(resultData404);
|
||||
return throwException("A server side error occurred.", status, _responseText, _headers, result404);
|
||||
|
||||
} else if (status === 500) {
|
||||
const _responseText = response.data;
|
||||
return throwException("A server side error occurred.", status, _responseText, _headers);
|
||||
|
||||
} else if (status !== 200 && status !== 204) {
|
||||
const _responseText = response.data;
|
||||
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
||||
}
|
||||
return Promise.resolve<FileResponse>(null as any);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7239,20 +7529,15 @@ export enum CaptureMode {
|
||||
|
||||
/** 调试器整体配置信息 */
|
||||
export class DebuggerConfig implements IDebuggerConfig {
|
||||
/** 时钟频率
|
||||
*/
|
||||
/** 时钟频率 */
|
||||
clkFreq!: number;
|
||||
/** 总端口数量
|
||||
*/
|
||||
/** 总端口数量 */
|
||||
totalPortNum!: number;
|
||||
/** 捕获深度(采样点数)
|
||||
*/
|
||||
/** 捕获深度(采样点数) */
|
||||
captureDepth!: number;
|
||||
/** 触发器数量
|
||||
*/
|
||||
/** 触发器数量 */
|
||||
triggerNum!: number;
|
||||
/** 所有信号通道的配置信息
|
||||
*/
|
||||
/** 所有信号通道的配置信息 */
|
||||
channelConfigs!: ChannelConfig[];
|
||||
|
||||
constructor(data?: IDebuggerConfig) {
|
||||
@@ -7305,42 +7590,31 @@ export class DebuggerConfig implements IDebuggerConfig {
|
||||
|
||||
/** 调试器整体配置信息 */
|
||||
export interface IDebuggerConfig {
|
||||
/** 时钟频率
|
||||
*/
|
||||
/** 时钟频率 */
|
||||
clkFreq: number;
|
||||
/** 总端口数量
|
||||
*/
|
||||
/** 总端口数量 */
|
||||
totalPortNum: number;
|
||||
/** 捕获深度(采样点数)
|
||||
*/
|
||||
/** 捕获深度(采样点数) */
|
||||
captureDepth: number;
|
||||
/** 触发器数量
|
||||
*/
|
||||
/** 触发器数量 */
|
||||
triggerNum: number;
|
||||
/** 所有信号通道的配置信息
|
||||
*/
|
||||
/** 所有信号通道的配置信息 */
|
||||
channelConfigs: ChannelConfig[];
|
||||
}
|
||||
|
||||
/** 表示单个信号通道的配置信息 */
|
||||
export class ChannelConfig implements IChannelConfig {
|
||||
/** 通道名称
|
||||
*/
|
||||
/** 通道名称 */
|
||||
name!: string;
|
||||
/** 通道显示颜色(如前端波形显示用)
|
||||
*/
|
||||
/** 通道显示颜色(如前端波形显示用) */
|
||||
color!: string;
|
||||
/** 通道信号线宽度(位数)
|
||||
*/
|
||||
/** 通道信号线宽度(位数) */
|
||||
wireWidth!: number;
|
||||
/** 信号线在父端口中的起始索引(bit)
|
||||
*/
|
||||
/** 信号线在父端口中的起始索引(bit) */
|
||||
wireStartIndex!: number;
|
||||
/** 父端口编号
|
||||
*/
|
||||
/** 父端口编号 */
|
||||
parentPort!: number;
|
||||
/** 捕获模式(如上升沿、下降沿等)
|
||||
*/
|
||||
/** 捕获模式(如上升沿、下降沿等) */
|
||||
mode!: CaptureMode;
|
||||
|
||||
constructor(data?: IChannelConfig) {
|
||||
@@ -7384,33 +7658,25 @@ export class ChannelConfig implements IChannelConfig {
|
||||
|
||||
/** 表示单个信号通道的配置信息 */
|
||||
export interface IChannelConfig {
|
||||
/** 通道名称
|
||||
*/
|
||||
/** 通道名称 */
|
||||
name: string;
|
||||
/** 通道显示颜色(如前端波形显示用)
|
||||
*/
|
||||
/** 通道显示颜色(如前端波形显示用) */
|
||||
color: string;
|
||||
/** 通道信号线宽度(位数)
|
||||
*/
|
||||
/** 通道信号线宽度(位数) */
|
||||
wireWidth: number;
|
||||
/** 信号线在父端口中的起始索引(bit)
|
||||
*/
|
||||
/** 信号线在父端口中的起始索引(bit) */
|
||||
wireStartIndex: number;
|
||||
/** 父端口编号
|
||||
*/
|
||||
/** 父端口编号 */
|
||||
parentPort: number;
|
||||
/** 捕获模式(如上升沿、下降沿等)
|
||||
*/
|
||||
/** 捕获模式(如上升沿、下降沿等) */
|
||||
mode: CaptureMode;
|
||||
}
|
||||
|
||||
/** 单个通道的捕获数据 */
|
||||
export class ChannelCaptureData implements IChannelCaptureData {
|
||||
/** 通道名称
|
||||
*/
|
||||
/** 通道名称 */
|
||||
name!: string;
|
||||
/** 通道捕获到的数据(Base64编码的UInt32数组)
|
||||
*/
|
||||
/** 通道捕获到的数据(Base64编码的UInt32数组) */
|
||||
data!: string;
|
||||
|
||||
constructor(data?: IChannelCaptureData) {
|
||||
@@ -7446,11 +7712,9 @@ export class ChannelCaptureData implements IChannelCaptureData {
|
||||
|
||||
/** 单个通道的捕获数据 */
|
||||
export interface IChannelCaptureData {
|
||||
/** 通道名称
|
||||
*/
|
||||
/** 通道名称 */
|
||||
name: string;
|
||||
/** 通道捕获到的数据(Base64编码的UInt32数组)
|
||||
*/
|
||||
/** 通道捕获到的数据(Base64编码的UInt32数组) */
|
||||
data: string;
|
||||
}
|
||||
|
||||
@@ -7458,12 +7722,18 @@ export interface IChannelCaptureData {
|
||||
export class ExamSummary implements IExamSummary {
|
||||
/** 实验的唯一标识符 */
|
||||
id!: string;
|
||||
/** 实验名称 */
|
||||
name!: string;
|
||||
/** 实验创建时间 */
|
||||
createdTime!: Date;
|
||||
/** 实验最后更新时间 */
|
||||
updatedTime!: Date;
|
||||
/** 实验标题(从文档内容中提取) */
|
||||
title!: string;
|
||||
/** 实验标签 */
|
||||
tags!: string[];
|
||||
/** 实验难度(1-5) */
|
||||
difficulty!: number;
|
||||
/** 普通用户是否可见 */
|
||||
isVisibleToUsers!: boolean;
|
||||
|
||||
constructor(data?: IExamSummary) {
|
||||
if (data) {
|
||||
@@ -7472,14 +7742,24 @@ export class ExamSummary implements IExamSummary {
|
||||
(<any>this)[property] = (<any>data)[property];
|
||||
}
|
||||
}
|
||||
if (!data) {
|
||||
this.tags = [];
|
||||
}
|
||||
}
|
||||
|
||||
init(_data?: any) {
|
||||
if (_data) {
|
||||
this.id = _data["id"];
|
||||
this.name = _data["name"];
|
||||
this.createdTime = _data["createdTime"] ? new Date(_data["createdTime"].toString()) : <any>undefined;
|
||||
this.updatedTime = _data["updatedTime"] ? new Date(_data["updatedTime"].toString()) : <any>undefined;
|
||||
this.title = _data["title"];
|
||||
if (Array.isArray(_data["tags"])) {
|
||||
this.tags = [] as any;
|
||||
for (let item of _data["tags"])
|
||||
this.tags!.push(item);
|
||||
}
|
||||
this.difficulty = _data["difficulty"];
|
||||
this.isVisibleToUsers = _data["isVisibleToUsers"];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7493,9 +7773,16 @@ export class ExamSummary implements IExamSummary {
|
||||
toJSON(data?: any) {
|
||||
data = typeof data === 'object' ? data : {};
|
||||
data["id"] = this.id;
|
||||
data["name"] = this.name;
|
||||
data["createdTime"] = this.createdTime ? this.createdTime.toISOString() : <any>undefined;
|
||||
data["updatedTime"] = this.updatedTime ? this.updatedTime.toISOString() : <any>undefined;
|
||||
data["title"] = this.title;
|
||||
if (Array.isArray(this.tags)) {
|
||||
data["tags"] = [];
|
||||
for (let item of this.tags)
|
||||
data["tags"].push(item);
|
||||
}
|
||||
data["difficulty"] = this.difficulty;
|
||||
data["isVisibleToUsers"] = this.isVisibleToUsers;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -7504,24 +7791,38 @@ export class ExamSummary implements IExamSummary {
|
||||
export interface IExamSummary {
|
||||
/** 实验的唯一标识符 */
|
||||
id: string;
|
||||
/** 实验名称 */
|
||||
name: string;
|
||||
/** 实验创建时间 */
|
||||
createdTime: Date;
|
||||
/** 实验最后更新时间 */
|
||||
updatedTime: Date;
|
||||
/** 实验标题(从文档内容中提取) */
|
||||
title: string;
|
||||
/** 实验标签 */
|
||||
tags: string[];
|
||||
/** 实验难度(1-5) */
|
||||
difficulty: number;
|
||||
/** 普通用户是否可见 */
|
||||
isVisibleToUsers: boolean;
|
||||
}
|
||||
|
||||
/** 实验信息类 */
|
||||
export class ExamInfo implements IExamInfo {
|
||||
/** 实验的唯一标识符 */
|
||||
id!: string;
|
||||
/** 实验文档内容(Markdown格式) */
|
||||
docContent!: string;
|
||||
/** 实验名称 */
|
||||
name!: string;
|
||||
/** 实验描述 */
|
||||
description!: string;
|
||||
/** 实验创建时间 */
|
||||
createdTime!: Date;
|
||||
/** 实验最后更新时间 */
|
||||
updatedTime!: Date;
|
||||
/** 实验标签 */
|
||||
tags!: string[];
|
||||
/** 实验难度(1-5) */
|
||||
difficulty!: number;
|
||||
/** 普通用户是否可见 */
|
||||
isVisibleToUsers!: boolean;
|
||||
|
||||
constructor(data?: IExamInfo) {
|
||||
if (data) {
|
||||
@@ -7530,14 +7831,25 @@ export class ExamInfo implements IExamInfo {
|
||||
(<any>this)[property] = (<any>data)[property];
|
||||
}
|
||||
}
|
||||
if (!data) {
|
||||
this.tags = [];
|
||||
}
|
||||
}
|
||||
|
||||
init(_data?: any) {
|
||||
if (_data) {
|
||||
this.id = _data["id"];
|
||||
this.docContent = _data["docContent"];
|
||||
this.name = _data["name"];
|
||||
this.description = _data["description"];
|
||||
this.createdTime = _data["createdTime"] ? new Date(_data["createdTime"].toString()) : <any>undefined;
|
||||
this.updatedTime = _data["updatedTime"] ? new Date(_data["updatedTime"].toString()) : <any>undefined;
|
||||
if (Array.isArray(_data["tags"])) {
|
||||
this.tags = [] as any;
|
||||
for (let item of _data["tags"])
|
||||
this.tags!.push(item);
|
||||
}
|
||||
this.difficulty = _data["difficulty"];
|
||||
this.isVisibleToUsers = _data["isVisibleToUsers"];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7551,9 +7863,17 @@ export class ExamInfo implements IExamInfo {
|
||||
toJSON(data?: any) {
|
||||
data = typeof data === 'object' ? data : {};
|
||||
data["id"] = this.id;
|
||||
data["docContent"] = this.docContent;
|
||||
data["name"] = this.name;
|
||||
data["description"] = this.description;
|
||||
data["createdTime"] = this.createdTime ? this.createdTime.toISOString() : <any>undefined;
|
||||
data["updatedTime"] = this.updatedTime ? this.updatedTime.toISOString() : <any>undefined;
|
||||
if (Array.isArray(this.tags)) {
|
||||
data["tags"] = [];
|
||||
for (let item of this.tags)
|
||||
data["tags"].push(item);
|
||||
}
|
||||
data["difficulty"] = this.difficulty;
|
||||
data["isVisibleToUsers"] = this.isVisibleToUsers;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -7562,22 +7882,111 @@ export class ExamInfo implements IExamInfo {
|
||||
export interface IExamInfo {
|
||||
/** 实验的唯一标识符 */
|
||||
id: string;
|
||||
/** 实验文档内容(Markdown格式) */
|
||||
docContent: string;
|
||||
/** 实验名称 */
|
||||
name: string;
|
||||
/** 实验描述 */
|
||||
description: string;
|
||||
/** 实验创建时间 */
|
||||
createdTime: Date;
|
||||
/** 实验最后更新时间 */
|
||||
updatedTime: Date;
|
||||
/** 实验标签 */
|
||||
tags: string[];
|
||||
/** 实验难度(1-5) */
|
||||
difficulty: number;
|
||||
/** 普通用户是否可见 */
|
||||
isVisibleToUsers: boolean;
|
||||
}
|
||||
|
||||
/** 扫描结果类 */
|
||||
export class ScanResult implements IScanResult {
|
||||
/** 结果消息 */
|
||||
declare message: string;
|
||||
/** 更新的实验数量 */
|
||||
updateCount!: number;
|
||||
/** 创建实验请求类 */
|
||||
export class CreateExamRequest implements ICreateExamRequest {
|
||||
/** 实验ID */
|
||||
id!: string;
|
||||
/** 实验名称 */
|
||||
name!: string;
|
||||
/** 实验描述 */
|
||||
description!: string;
|
||||
/** 实验标签 */
|
||||
tags!: string[];
|
||||
/** 实验难度(1-5) */
|
||||
difficulty!: number;
|
||||
/** 普通用户是否可见 */
|
||||
isVisibleToUsers!: boolean;
|
||||
|
||||
constructor(data?: IScanResult) {
|
||||
constructor(data?: ICreateExamRequest) {
|
||||
if (data) {
|
||||
for (var property in data) {
|
||||
if (data.hasOwnProperty(property))
|
||||
(<any>this)[property] = (<any>data)[property];
|
||||
}
|
||||
}
|
||||
if (!data) {
|
||||
this.tags = [];
|
||||
}
|
||||
}
|
||||
|
||||
init(_data?: any) {
|
||||
if (_data) {
|
||||
this.id = _data["id"];
|
||||
this.name = _data["name"];
|
||||
this.description = _data["description"];
|
||||
if (Array.isArray(_data["tags"])) {
|
||||
this.tags = [] as any;
|
||||
for (let item of _data["tags"])
|
||||
this.tags!.push(item);
|
||||
}
|
||||
this.difficulty = _data["difficulty"];
|
||||
this.isVisibleToUsers = _data["isVisibleToUsers"];
|
||||
}
|
||||
}
|
||||
|
||||
static fromJS(data: any): CreateExamRequest {
|
||||
data = typeof data === 'object' ? data : {};
|
||||
let result = new CreateExamRequest();
|
||||
result.init(data);
|
||||
return result;
|
||||
}
|
||||
|
||||
toJSON(data?: any) {
|
||||
data = typeof data === 'object' ? data : {};
|
||||
data["id"] = this.id;
|
||||
data["name"] = this.name;
|
||||
data["description"] = this.description;
|
||||
if (Array.isArray(this.tags)) {
|
||||
data["tags"] = [];
|
||||
for (let item of this.tags)
|
||||
data["tags"].push(item);
|
||||
}
|
||||
data["difficulty"] = this.difficulty;
|
||||
data["isVisibleToUsers"] = this.isVisibleToUsers;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
/** 创建实验请求类 */
|
||||
export interface ICreateExamRequest {
|
||||
/** 实验ID */
|
||||
id: string;
|
||||
/** 实验名称 */
|
||||
name: string;
|
||||
/** 实验描述 */
|
||||
description: string;
|
||||
/** 实验标签 */
|
||||
tags: string[];
|
||||
/** 实验难度(1-5) */
|
||||
difficulty: number;
|
||||
/** 普通用户是否可见 */
|
||||
isVisibleToUsers: boolean;
|
||||
}
|
||||
|
||||
/** 资源信息类 */
|
||||
export class ResourceInfo implements IResourceInfo {
|
||||
/** 资源ID */
|
||||
id!: number;
|
||||
/** 资源名称 */
|
||||
name!: string;
|
||||
|
||||
constructor(data?: IResourceInfo) {
|
||||
if (data) {
|
||||
for (var property in data) {
|
||||
if (data.hasOwnProperty(property))
|
||||
@@ -7588,32 +7997,32 @@ export class ScanResult implements IScanResult {
|
||||
|
||||
init(_data?: any) {
|
||||
if (_data) {
|
||||
this.message = _data["message"];
|
||||
this.updateCount = _data["updateCount"];
|
||||
this.id = _data["id"];
|
||||
this.name = _data["name"];
|
||||
}
|
||||
}
|
||||
|
||||
static fromJS(data: any): ScanResult {
|
||||
static fromJS(data: any): ResourceInfo {
|
||||
data = typeof data === 'object' ? data : {};
|
||||
let result = new ScanResult();
|
||||
let result = new ResourceInfo();
|
||||
result.init(data);
|
||||
return result;
|
||||
}
|
||||
|
||||
toJSON(data?: any) {
|
||||
data = typeof data === 'object' ? data : {};
|
||||
data["message"] = this.message;
|
||||
data["updateCount"] = this.updateCount;
|
||||
data["id"] = this.id;
|
||||
data["name"] = this.name;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
/** 扫描结果类 */
|
||||
export interface IScanResult {
|
||||
/** 结果消息 */
|
||||
message: string;
|
||||
/** 更新的实验数量 */
|
||||
updateCount: number;
|
||||
/** 资源信息类 */
|
||||
export interface IResourceInfo {
|
||||
/** 资源ID */
|
||||
id: number;
|
||||
/** 资源名称 */
|
||||
name: string;
|
||||
}
|
||||
|
||||
/** 逻辑分析仪运行状态枚举 */
|
||||
|
||||
Reference in New Issue
Block a user