fix: display composed icon for composed model with attribute (#399)
This commit is contained in:
Родитель
57736d0cb4
Коммит
18fb4d7105
|
@ -1,7 +1,7 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
import React from "react";
|
||||
import React, { ReactElement } from "react";
|
||||
import {connect} from "react-redux";
|
||||
import url from "url";
|
||||
import { RouteComponentProps } from "react-router-dom";
|
||||
|
@ -71,7 +71,9 @@ export interface IModel {
|
|||
createdDateTime: string;
|
||||
lastUpdatedDateTime: string;
|
||||
status: string;
|
||||
iconName?: string;
|
||||
attributes?: {
|
||||
isComposed: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
function mapStateToProps(state: IApplicationState) {
|
||||
|
@ -114,7 +116,7 @@ export default class ModelComposePage extends React.Component<IModelComposePageP
|
|||
minWidth: 20,
|
||||
maxWidth: 20,
|
||||
isResizable: true,
|
||||
onRender: (model: IModel) => <FontIcon iconName={model.iconName} className="model-fontIcon"/>,
|
||||
onRender: this.renderComposedIcon,
|
||||
headerClassName: "list-header",
|
||||
},
|
||||
{
|
||||
|
@ -416,7 +418,6 @@ export default class ModelComposePage extends React.Component<IModelComposePageP
|
|||
private getComposeModelByURl = async (idURL) => {
|
||||
const composedRes = await this.getResponse(idURL);
|
||||
const composedModel: IModel = composedRes.data.modelInfo;
|
||||
composedModel.iconName = "Combine";
|
||||
composedModel.key = composedModel.modelId;
|
||||
return composedModel;
|
||||
}
|
||||
|
@ -713,4 +714,12 @@ export default class ModelComposePage extends React.Component<IModelComposePageP
|
|||
}, 1);
|
||||
}
|
||||
}
|
||||
|
||||
private renderComposedIcon = (model: IModel): ReactElement => {
|
||||
if (model.attributes && model.attributes.isComposed) {
|
||||
return <FontIcon iconName={"Combine"} className="model-fontIcon"/>;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче