in ux/src/app/service-list/service-list.component.ts [87:144]
async initData(): Promise<void> {
this.dataSource = [];
this.category = [];
const common = await this.translate.get('common').toPromise();
const columns = await this.translate.get('service.columns').toPromise();
this.category = [
{
field: 'serviceName',
label: columns.serviceName,
type: 'textInput',
},
{
field: 'environment',
label: columns.environment,
type: 'label',
options: cloneDeep(
envOptions.map((item) => {
item.label = item.label || common.empty;
return item;
})
),
},
{
field: 'version',
label: columns.version,
type: 'label',
options: [],
},
{
field: 'appId',
label: columns.app,
type: 'textInput',
},
];
this.service.getServiceByGovern().subscribe(
(data) => {
this.basicDataSource = (data?.allServicesDetail || [])
.map((item: any) => {
if (!item.microService?.environment) {
item.microService.environment = common.empty;
}
return item.microService;
})
.sort((a: any, b: any) => b.modTimestamp - a.modTimestamp);
this.pager.total = this.basicDataSource.length;
this.dataSource = getTabelData(this.basicDataSource, this.pager);
this.category[2].options = uniqBy(
map(this.basicDataSource, (item: any) => ({
label: item.version,
})),
'label'
);
},
(err) => {
// todo 提示
}
);
}