Skip to content

Commit

Permalink
add error prompt for TIS plugin meata load error for net timeout data…
Browse files Browse the repository at this point in the history
  • Loading branch information
baisui1981 committed Oct 21, 2022
1 parent 884a01a commit 028ea3f
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 20 deletions.
13 changes: 5 additions & 8 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 26 additions & 9 deletions src/base/datax.add.step4.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,22 +154,39 @@ export class SelectedTabsComponent extends BasicFormComponent {
return;
}
}

// console.log([meta, this.subFieldForms.get(meta.id)], this.subFormHetero.descriptorList[0]);
DataxAddStep4Component.processSubFormHeteroList(this, pluginMeta[0], meta, this.subFieldForms.get(meta.id) // , this.subFormHetero.descriptorList[0]
).then((hlist: HeteroList[]) => {
// console.log(hlist[0]);
DataxAddStep4Component.processSubFormHeteroList(this, pluginMeta[0], meta, this.subFieldForms.get(meta.id))
.then((hlist: HeteroList[]) => {
let h = hlist[0];
if (h.items.length < 1) {
// 当给增量流程流程扩展selectTab使用还没有item使用
Descriptor.addNewItemByDescs(h, h.descriptorList, false, (_, propVal) => {

let oitems = h.items;
let items: Array<Item> = [];
h.items = items;
h.descriptorList.forEach((desc) => {
for (let itemIdx = 0; itemIdx < oitems.length; itemIdx++) {
if (oitems[itemIdx].impl === desc.impl) {
items.push(oitems[itemIdx]);
return;
}
}
Descriptor.addNewItemByDescs(h, [desc], false, (_, propVal) => {
if (propVal.pk) {
propVal.primary = meta.id;
propVal.updateModel = true;
}
return propVal;
});
}
});

// if (h.items.length < 1) {
// // 当给增量流程流程扩展selectTab使用还没有item使用
// Descriptor.addNewItemByDescs(h, h.descriptorList, false, (_, propVal) => {
// if (propVal.pk) {
// propVal.primary = meta.id;
// propVal.updateModel = true;
// }
// return propVal;
// });
// }
// console.log(hlist);
this.openSubDetailForm(meta, pluginMeta, hlist);
});
Expand Down
34 changes: 34 additions & 0 deletions src/base/plugin.manage.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ enum PluginTab {
template: `
<tis-page-header *ngIf="!drawerModel" title="插件管理" [showBreadcrumb]="true">
</tis-page-header>
<nz-alert *ngIf="updateSiteLoadErr" nzType="error" nzMessage="错误" [nzDescription]="updateSiteLoadErrTpl" nzShowIcon></nz-alert>
<ng-template #updateSiteLoadErrTpl>
加载远端仓库元数据异常: {{updateSiteLoadErr.action_error_msg}}
<button nz-button nzType="primary" (click)="reloadUpdateSite()" [disabled]="this.formDisabled" nzSize="small"><i nz-icon nzType="redo" nzTheme="outline"></i>重试</button>
</ng-template>
<nz-spin [nzSpinning]="this.formDisabled" [nzSize]="'large'">
<nz-tabset [nzTabBarExtraContent]="extraTemplate" [nzSelectedIndex]="selectedIndex">
<nz-tab nzTitle="可安装" (nzClick)="openAvailable()">
Expand Down Expand Up @@ -159,6 +164,7 @@ enum PluginTab {
font-size: 7px;
color: #989898;
}
.tis-tags {
margin-bottom: 5px;
}
Expand All @@ -183,6 +189,8 @@ export class PluginManageComponent extends BasicFormComponent implements OnInit
installedPlugs: Array<PluginInfo> = [];
selectedIndex = 0;

updateSiteLoadErr: UpdateSiteLoadErr;

/**
* 当前是否在抽屉模式
*/
Expand Down Expand Up @@ -249,10 +257,30 @@ export class PluginManageComponent extends BasicFormComponent implements OnInit
.then((r) => {
this.pager = Pager.create(r);
// this.logs = r.bizresult.rows;
let err = this.pager.payload.find((p) => p.updateSiteLoadErr);

if (err) {
this.updateSiteLoadErr = err;
}
this.avaliablePlugs = r.bizresult.rows;
});
}

reloadUpdateSite() {

this.httpPost('/coredefine/corenodemanage.ajax'
, `action=plugin_action&emethod=reload_update_site_meta${this.buildExtendPointParam()}`)
.then((r) => {
if (r.success) {
// this.installedPlugs = r.bizresult;
this.updateSiteLoadErr = null;
this.pager = Pager.create(r);
this.avaliablePlugs = r.bizresult.rows;
this.selectedIndex = 0;
}
});
}

private fetchInstalledPlugins(query: string) {
this.httpPost('/coredefine/corenodemanage.ajax'
, 'action=plugin_action&emethod=get_installed_plugins' + this.buildExtendPointParam() + (!!query ? '&query=' + query : ''))
Expand Down Expand Up @@ -341,6 +369,8 @@ export class PluginManageComponent extends BasicFormComponent implements OnInit
queryIntalledPlugin(event: { query: string; reset: boolean }) {
this.fetchInstalledPlugins(event.reset ? null : event.query);
}


}

interface PluginInfo {
Expand All @@ -349,3 +379,7 @@ interface PluginInfo {
website: string;
checked: boolean;
}

interface UpdateSiteLoadErr {
action_error_msg: string;
}
13 changes: 10 additions & 3 deletions src/common/pagination.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,23 @@ export class Pager {
public static create(result: TisResponseResult): Pager {
let biz = result.bizresult;
if (biz) {
return new Pager(biz.curPage, biz.totalPage, biz.totalCount, biz.pageSize);
return new Pager(biz.curPage, biz.totalPage, biz.totalCount, biz.pageSize, biz.payload);
} else {
return new Pager();
}
}

constructor(public page = 0, public allPage = 0, public totalCount = 0, public pageSize = 10) {
constructor(public page = 0, public allPage = 0, public totalCount = 0, public pageSize = 10, private _payload = []) {

}

public get payload(): Array<any> {
if (!this._payload) {
return [];
}
return this._payload;
}

get curPage(): number {
if (this.page < 1) {
return 1;
Expand Down Expand Up @@ -192,7 +199,7 @@ export class TdContentDirective implements OnInit {
template: `
<nz-table #tabrows [nzBordered]="bordered" [nzData]="rows" [nzSize]="this.tabSize" [nzShowPagination]="showPagination" [nzLoading]="isSpinning" [(nzPageIndex)]="pager.page"
(nzPageIndexChange)="searchData()"
[nzFrontPagination]="false" [nzTotal]="pager.totalCount" [nzPageSize]="pager.pageSize" >
[nzFrontPagination]="false" [nzTotal]="pager.totalCount" [nzPageSize]="pager.pageSize">
<thead>
<tr>
<th *ngFor="let k of cls" tis-th [key-meta]='k' [nzCustomFilter]="k.searchable">{{k.title}}
Expand Down

0 comments on commit 028ea3f

Please sign in to comment.