Skip to content

Commit

Permalink
docs: v1.9.6 changelog and harbor api
Browse files Browse the repository at this point in the history
  • Loading branch information
wqcstrong committed Oct 23, 2024
1 parent 665cbfb commit a64068e
Show file tree
Hide file tree
Showing 6 changed files with 210 additions and 15 deletions.
3 changes: 3 additions & 0 deletions src/pages/Docs/md/api.en.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
- [constructor()](./data-harbor#constructor)
- [$harbor.onOfflineLog()](./data-harbor#onOfflineLog)
- [$harbor.pause()](./data-harbor#pause)
- [$harbor.resume()](./data-harbor#resume)
- [$harbor.reharbor()](./data-harbor#reharbor)

#### RRWebPlugin#rrweb

Expand Down
3 changes: 3 additions & 0 deletions src/pages/Docs/md/api.zh.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
- [constructor()](./data-harbor#constructor)
- [$harbor.onOfflineLog()](./data-harbor#onOfflineLog)
- [$harbor.pause()](./data-harbor#pause)
- [$harbor.resume()](./data-harbor#resume)
- [$harbor.reharbor()](./data-harbor#reharbor)

#### RRWebPlugin#rrweb

Expand Down
9 changes: 9 additions & 0 deletions src/pages/Docs/md/changelog.en.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
import offlineLogImg from '@/assets/image/screenshot/v1.9.2-offline-log-size.png';

## v1.9.6

- 🆕 DataHarborPlugin added a new prototype method. See details: https://github.com/HuolalaTech/page-spy/pull/110;
- `$harbor.pause()`: Pause recording;
- `$harbor.resume()`: Resume recording, corresponding to `pause()`;
- `$harbor.reharbor()`: Clear the recorded data and remakes it.
- 🆕 Add new prompt for "Object cannot be expanded" on the replay page;
- 🐛 Fixed the display of `application/x-www-form-urlencoded` payload. See details: https://github.com/HuolalaTech/page-spy-web/issues/267;

## v1.9.5

- 🆕 Add DockerHub image: https://hub.docker.com/r/huolalatech/page-spy-web;
Expand Down
9 changes: 9 additions & 0 deletions src/pages/Docs/md/changelog.zh.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
import offlineLogImg from '@/assets/image/screenshot/v1.9.2-offline-log-size.png';

## v1.9.6

- 🆕 DataHarborPlugin 插件新增原型方法。查看详情:https://github.com/HuolalaTech/page-spy/pull/110
- `$harbor.pause()`:暂停记录;
- `$harbor.resume()`: 恢复记录,和 `pause()` 对应;
- `$harbor.reharbor()`:清空已记录的数据并重新制作。
- 🆕 回放页面对于「对象不可展开」新增提示;
- 🐛 修复 `application/x-www-form-urlencoded` 展示的 Payload。查看详情:https://github.com/HuolalaTech/page-spy-web/issues/267

## v1.9.5

- 🆕 新增 DockerHub 镜像: https://hub.docker.com/r/huolalatech/page-spy-web;
Expand Down
104 changes: 94 additions & 10 deletions src/pages/Docs/md/data-harbor.en.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// Default 10MB.
maximum?: number;

// Specit which types of data to cache
// Specify which types of data to cache
caredData?: Record<DataType, boolean>;

// Specify the offline log filename, with the default being named according to the current time
Expand All @@ -21,39 +21,123 @@
onDownload?: (data: CacheMessageItem[]) => void;
}

delcare class DataHarborPlugin implements PageSpyPlugin {
declare class DataHarborPlugin implements PageSpyPlugin {
constructor(config?: DataHarborConfig);
}
```


#### onOfflineLog()#onOfflineLog

Upload / download log manaually.
Manually download / upload offline logs.

- Type

```ts
declare class DataHarborPlugin {
onOfflineLog(type: 'download' | 'upload'): Promise<string | null | undefined>;
onOfflineLog(type: 'download' | 'upload', clearCache?: boolean): Promise<string | null | undefined>;
}
```

- Details

If you hide the automatically rendered floating or want to automatically trigger offline log operations at certain times, you can achieve through this method.

Each invocation logs the entire current session. Once the upload is complete, a replay URL will be returned.
If you hide the automatically rendered UI controls by `autoRender: false`, or you want to automatically trigger the offline log operation at certain times, you can use this method.

After each call, the recorded log data will be cleared by default and recording will be restarted; on the contrary, if the user upload / download the log multiple times through the buttons on the UI dialog, it will be a complete log from beginning to end of the current session. You can also control it yourself through the second parameter `clearCache: boolean`.

After the upload is completed, the replay URL will be returned and printed to the console.

- Example

```ts
- details
window.$harbor = new DataHarborPlugin();
// upload
// Upload (clear existing data and re-record)
const url = await window.$harbor.onOfflineLog('upload');
// Upload (do not clear data)
const url = await window.$harbor.onOfflineLog('upload', false);
// download
window.$harbor.onOfflineLog('download');
```


#### pause()#pause

Pause recording.

- Type

```ts
declare class DataHarborPlugin {
pause(): void;
}
```

More flexible control of logging behavior.

The data generated by the program after the pause will not be recorded. Call `$harbor.resume()` to resume.

- Example

```ts
window.$harbor = new DataHarborPlugin();
// pause
window.$harbor.pause();
// resume
window.$harbor.resume();
```


#### resume()#resume


Resume records.

- Type

```ts
declare class DataHarborPlugin {
resume(): void;
}
```

More flexible control of logging behavior.

- Details

Data during &lt;Pause - Resume&gt; will not be recorded.

- Example

```ts
window.$harbor = new DataHarborPlugin();
// pause
window.$harbor.pause();
// resume
window.$harbor.resume();
```

#### reharbor()#reharbor

Clear the recorded data and continue recording. In short, remastered.

- Type

```ts
declare class DataHarborPlugin {
reharbor(): void;
}
```

- Example

```ts
window.$harbor = new DataHarborPlugin();
window.$harbor.reharbor();
```
97 changes: 92 additions & 5 deletions src/pages/Docs/md/data-harbor.zh.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@
onDownload?: (data: CacheMessageItem[]) => void;
}

delcare class DataHarborPlugin implements PageSpyPlugin {
declare class DataHarborPlugin implements PageSpyPlugin {
constructor(config?: DataHarborConfig);
}
```



#### onOfflineLog()#onOfflineLog

手动操作离线日志的下载、上传。
Expand All @@ -36,26 +35,114 @@

```ts
declare class DataHarborPlugin {
onOfflineLog(type: 'download' | 'upload'): Promise<string | null | undefined>;
onOfflineLog(type: 'download' | 'upload', clearCache?: boolean): Promise<string | null | undefined>;
}
```

- 详细信息

如果隐藏了自动渲染的 UI 控件,或者希望在某些时候自动触发队离线日志的操作,可以通过该方法实现。

每次调用都是当前会话的完整日志。上传完成后会返回回放的 URL,并打印到控制台。
每次调用后,默认会清除已记录的日志数据、并重新开始记录;与之相反,用户通过 UI 弹窗上的按钮操作日志上传 / 下载多次都是当前会话从头到尾的完整日志。你也可以通过第二个参数 `clearCache: boolean` 自行控制。

上传完成后会返回回放的 URL,并打印到控制台。

- 示例

```ts
window.$harbor = new DataHarborPlugin();
// 上传
// 上传(清除已有数据、并重新记录)
const url = await window.$harbor.onOfflineLog('upload');
// 上传(不清除数据)
const url = await window.$harbor.onOfflineLog('upload', false);
// 下载
window.$harbor.onOfflineLog('download');
```


#### pause()#pause

暂停记录。

- 类型

```ts
declare class DataHarborPlugin {
pause(): void;
}
```

- 详细信息

更加灵活的控制记录日志的行为。

暂停后程序产生的数据不会被记录,执行 `$harbor.resume()` 恢复。

- 示例

```ts
window.$harbor = new DataHarborPlugin();
// 暂停
window.$harbor.pause();
// 恢复
window.$harbor.resume();
```


#### resume()#resume

恢复记录。

- 类型

```ts
declare class DataHarborPlugin {
resume(): void;
}
```

- 详细信息

更加灵活的控制记录日志的行为。

&lt;暂停 - 恢复&gt; 期间的数据不会被记录。

- 示例

```ts
window.$harbor = new DataHarborPlugin();
// 暂停
window.$harbor.pause();
// 恢复
window.$harbor.resume();
```


#### reharbor()#reharbor

清空已记录的数据,并继续记录。简而言之,重新制作。

- 类型

```ts
declare class DataHarborPlugin {
reharbor(): void;
}
```

- 示例

```ts
window.$harbor = new DataHarborPlugin();
window.$harbor.reharbor();
```


0 comments on commit a64068e

Please sign in to comment.