Skip to content

Commit

Permalink
Merge branch 'main' of github.com:eolinker/eoapi
Browse files Browse the repository at this point in the history
  • Loading branch information
scarqin committed Aug 10, 2022
2 parents 6917d9c + f93c424 commit 98881d3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { NzTreeComponent } from 'ng-zorro-antd/tree';
import { ModalService } from '../../../../shared/services/modal.service';
import { StorageService } from '../../../../shared/services/storage';
import { ElectronService } from '../../../../core/services';
import { IndexedDBStorage } from 'eo/workbench/browser/src/app/shared/services/storage/IndexedDB/lib/';
import { createMockObj, IndexedDBStorage } from 'eo/workbench/browser/src/app/shared/services/storage/IndexedDB/lib/';
import { ApiService } from 'eo/workbench/browser/src/app/pages/api/api.service';
@Component({
selector: 'eo-api-group-tree',
Expand Down Expand Up @@ -166,7 +166,11 @@ export class ApiGroupTreeComponent implements OnInit, OnDestroy {
async createGroup({ name, projectID, content }) {
const groupID = await this.storageInstance.group.add({ name: name.replace(/\.json$/, ''), projectID });
const result = content.apiData.map((it, index) => ({ ...it, groupID, uuid: Date.now() + index }));
await this.storageInstance.apiData.bulkAdd(result);
const apiDataKeys = await this.storageInstance.apiData.bulkAdd(result, { allKeys: true });
const apiData = result.map((n, i) =>
createMockObj(n, { name: $localize`Default Mock`, createWay: 'system', apiDataID: apiDataKeys.at(i) })
);
this.storageInstance.mock.bulkAdd(apiData);
this.buildGroupTreeData();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.tab_text {
max-width: 90px;
font-weight: 500;
}
::ng-deep {
eo-api-tab {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,10 @@ export class EoMonacoEditorComponent implements AfterViewInit, OnInit, OnChanges
};
formatCode() {
return new Promise<string>((resolve) => {
requestAnimationFrame(async () => {
this.codeEdtor.updateOptions({ readOnly: false });
requestIdleCallback(async () => {
this.codeEdtor?.updateOptions({ readOnly: false });
await this.codeEdtor?.getAction('editor.action.formatDocument')?.run();
this.codeEdtor.updateOptions({ readOnly: this.config.readOnly });
this.codeEdtor?.updateOptions({ readOnly: this.config.readOnly });
resolve(this.codeEdtor?.getValue() || '');
});
});
Expand Down

0 comments on commit 98881d3

Please sign in to comment.