From 58a7b9be40bc7bb0f93cbe552e844de688519f5c Mon Sep 17 00:00:00 2001 From: mozhenghua Date: Tue, 19 Mar 2024 09:10:21 +0800 Subject: [PATCH] add for cloud native support --- .idea/workspace.xml | 20 ++-- src/base/base.manage-routing.module.ts | 15 ++- src/base/datax.worker.add.step0.component.ts | 10 +- src/base/datax.worker.running.component.ts | 13 ++- src/base/error.detail.component.ts | 22 +++- src/base/error.list.component.ts | 31 ++--- src/base/flink.cluster.list.component.ts | 14 ++- src/common/init.system.component.ts | 2 +- .../launch.waitting.process.component.ts | 2 +- src/common/plugins.component.ts | 5 +- src/common/tis.plugin.ts | 2 + src/common/tis.service.ts | 106 +++++++++++++++--- src/runtime/incr.build.step0.component.ts | 25 ++++- .../incr.build.step4.running.component.ts | 49 +++++--- src/runtime/root-welcome-component.ts | 2 +- 15 files changed, 234 insertions(+), 84 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index ac71866..726b34b 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -6,15 +6,20 @@ - - - - + + + + + + - - + + + + + diff --git a/src/base/base.manage-routing.module.ts b/src/base/base.manage-routing.module.ts index 30a5b15..b115118 100644 --- a/src/base/base.manage-routing.module.ts +++ b/src/base/base.manage-routing.module.ts @@ -30,7 +30,7 @@ import {SnapshotsetComponent} from "../common/snapshotset.component"; import {SchemaEditVisualizingModelComponent, SchemaXmlEditComponent} from "../corecfg/schema-xml-edit.component"; import {DataxAddComponent} from "./datax.add.component"; import {DataxWorkerComponent, PowerjobCptType} from "./datax.worker.component"; -import {DataxWorkerDTO, ProcessMeta} from "../runtime/misc/RCDeployment"; +import {Breadcrumb, DataxWorkerDTO, ProcessMeta} from "../runtime/misc/RCDeployment"; import {PluginManageComponent} from "./plugin.manage.component"; import {StepType} from "../common/steps.component"; import {ErrorListComponent} from "./error.list.component"; @@ -111,7 +111,7 @@ export const dataXWorkerCfg: { processMeta: ProcessMeta } } ] , step0InitDescriptorProcess: (cpt: DataxWorkerAddStep0Component, desc: Array) => { - // console.log(desc); + // console.log(desc); cpt.initPowerJobRelevantProperties(desc); } , step1HeteroGetter: (dto: DataxWorkerDTO) => { @@ -169,7 +169,7 @@ const flinkClusterHeteroPkGetter: (dto: DataxWorkerDTO) => ItemPropVal = (dto: D } return null; } - +const FlinkSessionPageHeader = "添加Kubernetes Session执行器"; // @ts-ignore export const flinkClusterCfg: { processMeta: ProcessMeta } = { @@ -179,6 +179,13 @@ export const flinkClusterCfg: { processMeta: ProcessMeta } require: true, extraParam: "dataxName_" + PowerjobCptType.FlinkCluster }, + breadcrumbGetter: (params) => { + let crumb: Breadcrumb = flinkSessionDetail.processMeta.breadcrumbGetter(params); + return { + breadcrumb: crumb.breadcrumb, + name: FlinkSessionPageHeader + } + }, successCreateNext: (step3: DataxWorkerAddStep3Component) => { // DataxWorkerComponent.getJobWorkerMeta(this, null, step3.dto.processMeta) // .then((dataXWorkerStatus) => { @@ -211,7 +218,7 @@ export const flinkClusterCfg: { processMeta: ProcessMeta } launchClusterMethod: "Launch_flink_cluster", relaunchClusterMethod: "relaunch_flink_cluster", targetName: flinkClusterCfgTargetName - , pageHeader: "Flink Kubernetes Session执行器" + , pageHeader: FlinkSessionPageHeader // , createButtonLabel: "创建Flink Native Cluster执行器" , notCreateTips: "还未创建Flink Kubernetes Session执行器,创建之后可以将Flink Job提交到Kubernetes Session集群,高效并行执行数据实时同步任务" , stepsType: StepType.CreateFlinkCluster diff --git a/src/base/datax.worker.add.step0.component.ts b/src/base/datax.worker.add.step0.component.ts index d17bd07..51af915 100644 --- a/src/base/datax.worker.add.step0.component.ts +++ b/src/base/datax.worker.add.step0.component.ts @@ -36,11 +36,11 @@ import {NzDrawerService} from "ng-zorro-antd/drawer"; @Component({ template: ` - - - 因架构调整,基于K8S执行的分布式DataX任务执行器,和Flink任务执行器需要做新的调整,会将Zookeeper组建依赖去掉,会在4.0.0版本中重新与大家见面 - + + + + + { // console.log("xxxxxxxx"); @@ -566,7 +566,7 @@ export class DataxWorkerRunningComponent extends AppFormComponent implements Aft > - {{this.rcDeployment.pods.length}}/{{this.toPodNum.targetPodNum}}
+ {{this.rcDeployment.pods.length}}/{{this.toPodNum.targetPodNum}} pod
@@ -650,6 +650,13 @@ export class DataxWorkerRunningComponent extends AppFormComponent implements Aft ` + , + styles:[ + `.union-pod { + font-size: 9px; + color: #5d5d5d; + }` + ] }) export class PodsListComponent extends BasicFormComponent implements AfterViewInit, OnInit { @@ -799,6 +806,7 @@ export class PodsListComponent extends BasicFormComponent implements AfterViewIn // console.log(data); // this.collectionOptionList = data; // this.isLoading = false; + this.formDisabled = true; this._progressStat = 'active'; this.rcDeployment.rcScalaLog = undefined; let evtSubject: EventSourceSubject = DataxWorkerAddStep3Component.createLaunchingEventSubject( @@ -845,6 +853,7 @@ export class PodsListComponent extends BasicFormComponent implements AfterViewIn case EventType.SSE_CLOSE: if (this._progressStat === 'active') { this._progressStat = 'success'; + this.formDisabled = false; } case EventType.TASK_EXECUTE_STEPS: break; diff --git a/src/base/error.detail.component.ts b/src/base/error.detail.component.ts index ac7ebf3..83a97b4 100644 --- a/src/base/error.detail.component.ts +++ b/src/base/error.detail.component.ts @@ -20,18 +20,19 @@ import {Component, Input, OnInit} from '@angular/core'; import {NzModalService} from "ng-zorro-antd/modal"; import {BasicFormComponent, BasicSideBar} from "../common/basic.form.component"; -import {TISService} from "../common/tis.service"; +import {SystemError, TISService} from "../common/tis.service"; import {EditorConfiguration} from "codemirror"; import {NzDrawerRef} from "ng-zorro-antd/drawer"; // 查看操作日志 @Component({ template: ` - - - 异常列表 - - + + + 异常列表 + + ` }) export class ErrorDetailComponent extends BasicFormComponent implements OnInit { @@ -55,6 +56,15 @@ export class ErrorDetailComponent extends BasicFormComponent implements OnInit { } ngOnInit(): void { + // if (this.sysErrCode) { + // switch (this.sysErrCode) { + // case SystemError.FLINK_CLUSTER_LOSS_OF_CONTACT: { + // + // break; + // } + // default: + // } + // } this.httpPost('/runtime/operation_detail.ajax' , `action=operation_log_action&event_submit_do_get_error_detail=y&logfilename=${this.logFileName}`) diff --git a/src/base/error.list.component.ts b/src/base/error.list.component.ts index 0914375..bd734bf 100644 --- a/src/base/error.list.component.ts +++ b/src/base/error.list.component.ts @@ -30,21 +30,22 @@ import {NzDrawerService} from "ng-zorro-antd/drawer"; @Component({ template: ` - - - - - {{l.abstractInfo}} - - - {{l.createTime | date : "yyyy/MM/dd HH:mm:ss"}} - - - - - - - + + + + + {{l.abstractInfo}} + + + {{l.createTime | date : "yyyy/MM/dd HH:mm:ss"}} + + + + + + + ` }) export class ErrorListComponent extends BasicFormComponent implements OnInit { diff --git a/src/base/flink.cluster.list.component.ts b/src/base/flink.cluster.list.component.ts index fba27d8..8a2701d 100644 --- a/src/base/flink.cluster.list.component.ts +++ b/src/base/flink.cluster.list.component.ts @@ -39,15 +39,15 @@ import {DataXJobWorkerStatus} from "../runtime/misc/RCDeployment"; -
+
ClusterId
{{l.clusterId}}
Namespace
{{l.k8sNamespace}}
BasePath
{{l.k8sBasePath}}
-
管道
-
{{l.dataXName}}
+ +
@@ -69,11 +69,13 @@ import {DataXJobWorkerStatus} from "../runtime/misc/RCDeployment"; `, styles:[ - `#cluster-desc dt{ + `.cluster-desc dt { float: left; - color: #1f8ffb; + font-weight: bold; + color: #676767; } - #cluster-desc dd{ + + .cluster-desc dd { margin: 0 0 0 80px; } ` diff --git a/src/common/init.system.component.ts b/src/common/init.system.component.ts index 8bebc0a..021fe44 100644 --- a/src/common/init.system.component.ts +++ b/src/common/init.system.component.ts @@ -52,7 +52,7 @@ export class InitSystemComponent extends BasicFormComponent implements OnInit { this._percent += 2; }, 500); let url = '/runtime/applist.ajax?action=sys_initialize_action&emethod=init'; - this.httpPost(url, '').then((r) => { + this.httpPost(url, 'disableTransaction=true').then((r) => { clearInterval(timer); if (r.success) { this.activeModal.close(r); diff --git a/src/common/launch.waitting.process.component.ts b/src/common/launch.waitting.process.component.ts index ac6e282..1a8e42b 100644 --- a/src/common/launch.waitting.process.component.ts +++ b/src/common/launch.waitting.process.component.ts @@ -65,7 +65,7 @@ export function openWaittingProcessComponent(drawerService: NzDrawerService, sub
- +
diff --git a/src/common/plugins.component.ts b/src/common/plugins.component.ts index e629f1f..6fd488e 100644 --- a/src/common/plugins.component.ts +++ b/src/common/plugins.component.ts @@ -874,9 +874,12 @@ export class NotebookwrapperComponent implements OnInit { + - + + {{e.name}} + diff --git a/src/common/tis.plugin.ts b/src/common/tis.plugin.ts index d1c3277..b1f6601 100644 --- a/src/common/tis.plugin.ts +++ b/src/common/tis.plugin.ts @@ -926,6 +926,8 @@ export interface IFieldError { export class ValOption { public impl: string; public name: string; + // 端类型,mysql,docker,sqlserver + public endType:string; } export interface OptionEnum { diff --git a/src/common/tis.service.ts b/src/common/tis.service.ts index 104081a..7612040 100644 --- a/src/common/tis.service.ts +++ b/src/common/tis.service.ts @@ -16,10 +16,10 @@ * limitations under the License. */ -import {Injectable, NgZone} from '@angular/core'; +import {EventEmitter, Injectable, NgZone} from '@angular/core'; import 'rxjs/add/operator/toPromise'; -import {CurrentCollection, WSMessage} from './basic.form.component'; +import {BasicFormComponent, CurrentCollection, WSMessage} from './basic.form.component'; import {Observable, Observer, Subject} from "rxjs"; // @ts-ignore import * as NProgress from 'nprogress/nprogress.js'; @@ -31,6 +31,11 @@ import {ErrorDetailComponent} from "../base/error.detail.component"; import {TISBaseProfile} from "./navigate.bar.component"; import {LocalStorageService} from "angular-2-local-storage"; import {LatestSelectedIndex} from "./LatestSelectedIndex"; +import {NzModalService} from "ng-zorro-antd/modal"; +import {NzModalRef} from "ng-zorro-antd/modal/modal-ref"; +import {OnClickCallback} from "ng-zorro-antd/modal/modal-types"; +import {IncrBuildStep4RunningComponent} from "../runtime/incr.build.step4.running.component"; +import {ActivatedRoute, Router} from "@angular/router"; declare var TIS: any; @@ -40,6 +45,10 @@ export const WS_CLOSE_MSG = 'event_close_ws'; export const KEY_APPNAME = 'appname'; export const KEY_APP_ID = 'appid'; +export enum SystemError { + FLINK_CLUSTER_LOSS_OF_CONTACT = 'FLINK_CLUSTER_LOSS_OF_CONTACT' +} + // @ts-ignore @Injectable() export class TISService { @@ -63,8 +72,8 @@ export class TISService { }); } - constructor(protected http: HttpClient - // , private modalService: NgbModal + constructor(protected http: HttpClient, private router: Router, private route: ActivatedRoute + , private modalService: NzModalService , public notification: NzNotificationService, private drawerService: NzDrawerService, public _zone: NgZone, private _localStorageService: LocalStorageService) { } @@ -294,6 +303,7 @@ export class TISService { return result; } let logFileName: string[]; + let errCode: SystemError = null; let errContent = '
    ' + errs.map((r) => { if (typeof r === 'string') { return `
  • ${r}
  • ` @@ -302,23 +312,76 @@ export class TISService { // "logFileName":"20220504130948886", // "message":"IllegalStateException: xxxxxxxxxxxxxxxxxxxxx" // } + if (r.errCode) { + errCode = SystemError[r.errCode]; + if (!errCode) { + throw new Error("invalid errCode:" + r.errCode); + } + } logFileName = [r.logFileName]; return `
  • 详细 ${r.message}
  • ` } else { throw new Error('illegal type:' + r); } }).join('') + '
'; - // console.log(errContent); - let nref = this.notification.create('error', '错误', errContent, {nzDuration: 6000, nzStyle: {width: "600px"}}) - nref.onClick.subscribe((ee) => { - let pe = ee; - let target: any = pe.target; - if (target.nodeName === 'A') { - // console.log(logFileName); - // this.drawerService.create() - TISService.openSysErrorDetail(this.drawerService, true, logFileName[0]); + + + if (errCode) { + // console.log(errCode); + let sysErrorRestoreStrategy: SysErrorRestoreStrategy = null; + let mref: NzModalRef = null; + switch (errCode) { + case SystemError.FLINK_CLUSTER_LOSS_OF_CONTACT: + let okEventEmitter = new EventEmitter(); + sysErrorRestoreStrategy = { + title: "服务端Flink服务已经失联,是否要重新创建增量通道?", + okText: "重新创建", + cancelText: "等等再说", + onOKExec: okEventEmitter + } + okEventEmitter.subscribe((ist) => { + if (mref) { + let cfg = mref.getConfig(); + cfg.nzOkLoading = true; + TISService.channelDelete(this) + .then((r) => { + // TODO 页面重定向 + this.router.navigate(["/x", this.currApp.appName], {relativeTo: this.route}); + mref.close(); + }).finally(() => { + cfg.nzOkLoading = false; + }); + } + + }) + default: } - }) + // + // + mref = this.modalService.error({ + nzWidth: 500, + nzTitle: sysErrorRestoreStrategy.title, + nzContent: errContent, + nzOkText: sysErrorRestoreStrategy.okText, + nzCancelText: sysErrorRestoreStrategy.cancelText, + nzOnOk: sysErrorRestoreStrategy.onOKExec + }); + + + } else { + // console.log(errContent); + let nref = this.notification.create('error', '错误', errContent, {nzDuration: 6000, nzStyle: {width: "600px"}}) + nref.onClick.subscribe((ee) => { + let pe = ee; + let target: any = pe.target; + if (target.nodeName === 'A') { + // console.log(logFileName); + // this.drawerService.create() + TISService.openSysErrorDetail(this.drawerService, true, logFileName[0]); + } + }) + } + if (result.errorfields && result.errorfields.length > 0) { return result; } @@ -326,6 +389,13 @@ export class TISService { } } + public static channelDelete(tisService: TISService): Promise { + return tisService.httpPost('/coredefine/corenodemanage.ajax', "event_submit_do_incr_delete=y&action=core_action").then((r) => { + if (r.success) { + return r; + } + }); + } protected handleError = (error: any): Promise => { // console.log(error); @@ -421,6 +491,14 @@ export class TISService { } } + +interface SysErrorRestoreStrategy { + title: string; + okText: string; + cancelText: string; + onOKExec: EventEmitter; +}; + export class EventSourceSubject { constructor(public targetResName: string, private eventSource: EventSource, private observable: Observable<[EventType, Array | MessageData | ExecuteStep | Event]>) { diff --git a/src/runtime/incr.build.step0.component.ts b/src/runtime/incr.build.step0.component.ts index 0de6423..3c7dbca 100644 --- a/src/runtime/incr.build.step0.component.ts +++ b/src/runtime/incr.build.step0.component.ts @@ -28,19 +28,34 @@ import {NzNotificationService} from "ng-zorro-antd/notification"; @Component({ template: ` - + + +

+ +

+
+ + MySQL同步Doris作为示例,让初次使用者能够更快熟悉操作 + +
- ` + `, + styles:[ + ` + .container { + margin-top: 30px; + } + ` + ] }) export class IncrBuildStep0Component extends AppFormComponent implements AfterContentInit { @Output() nextStep = new EventEmitter(); diff --git a/src/runtime/incr.build.step4.running.component.ts b/src/runtime/incr.build.step4.running.component.ts index a189cd3..9bb052f 100644 --- a/src/runtime/incr.build.step4.running.component.ts +++ b/src/runtime/incr.build.step4.running.component.ts @@ -18,7 +18,7 @@ import {AfterContentInit, Component, EventEmitter, OnDestroy, OnInit, Output, ViewChild} from "@angular/core"; import {TISService} from "../common/tis.service"; -import {AppFormComponent, CurrentCollection, WSMessage} from "../common/basic.form.component"; +import {AppFormComponent, BasicFormComponent, CurrentCollection, WSMessage} from "../common/basic.form.component"; import {ActivatedRoute, Router} from "@angular/router"; import {NzModalService} from "ng-zorro-antd/modal"; import {NzNotificationService} from "ng-zorro-antd/notification"; @@ -333,11 +333,11 @@ export class IncrBuildStep4RunningComponent extends AppFormComponent implements reload() { IndexIncrStatus.getIncrStatusThenEnter(this, (incrStatus) => { - // if(this.dto.state !== incrStatus.state){ - // console.log(this.dto); - this.dto = incrStatus; - this.successNotify("状态已更新"); - // } + // if(this.dto.state !== incrStatus.state){ + // console.log(this.dto); + this.dto = incrStatus; + this.successNotify("状态已更新"); + // } }, false); } @@ -379,6 +379,14 @@ export class IncrBuildStep4RunningComponent extends AppFormComponent implements // }); } + // public static channelDelete(base: BasicFormComponent): Promise { + // return base.httpPost('/coredefine/corenodemanage.ajax', "event_submit_do_incr_delete=y&action=core_action").then((r) => { + // if (r.success) { + // return r; + // } + // }); + // } + /** * 删除增量通道 */ @@ -389,17 +397,26 @@ export class IncrBuildStep4RunningComponent extends AppFormComponent implements // nzOkText: '执行', // nzCancelText: '取消', // nzOnOk: () => { - this.httpPost('/coredefine/corenodemanage.ajax', "event_submit_do_incr_delete=y&action=core_action").then((r) => { - if (r.success) { - this.successNotify(`已经成功删除增量实例${this.currentApp.appName}`); - // this.router.navigate(["."], {relativeTo: this.route}); - this.nextStep.next(this.dto); - } else { - cpt.restoreInitialState() - } - }, (_) => { - cpt.restoreInitialState() + + TISService.channelDelete(this.tisService).then((r) => { + this.successNotify(`已经成功删除增量实例${this.currentApp.appName}`); + // this.router.navigate(["."], {relativeTo: this.route}); + this.nextStep.next(this.dto); + }, () => { + cpt.restoreInitialState(); }); + + // this.httpPost('/coredefine/corenodemanage.ajax', "event_submit_do_incr_delete=y&action=core_action").then((r) => { + // if (r.success) { + // this.successNotify(`已经成功删除增量实例${this.currentApp.appName}`); + // // this.router.navigate(["."], {relativeTo: this.route}); + // this.nextStep.next(this.dto); + // } else { + // cpt.restoreInitialState() + // } + // }, (_) => { + // cpt.restoreInitialState() + // }); // } // }); } diff --git a/src/runtime/root-welcome-component.ts b/src/runtime/root-welcome-component.ts index 3d1876d..8fd6e33 100644 --- a/src/runtime/root-welcome-component.ts +++ b/src/runtime/root-welcome-component.ts @@ -39,7 +39,7 @@ import {BasicFormComponent} from "../common/basic.form.component";

实例

- dataX + Pipeline