Skip to content

Commit

Permalink
fix: display composed icon for composed model with attribute (#399)
Browse files Browse the repository at this point in the history
  • Loading branch information
stew-ro authored Jul 10, 2020
1 parent 57736d0 commit 18fb4d7
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/react/components/pages/modelCompose/modelCompose.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -71,7 +71,9 @@ export interface IModel {
createdDateTime: string;
lastUpdatedDateTime: string;
status: string;
iconName?: string;
attributes?: {
isComposed: boolean;
};
}

function mapStateToProps(state: IApplicationState) {
Expand Down Expand Up @@ -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",
},
{
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
}
}

0 comments on commit 18fb4d7

Please sign in to comment.