Skip to content

Commit 7adfe8a

Browse files
committed
#237 - Style fixes + Fixed update tree action to retrieve term set data
1 parent 95654ed commit 7adfe8a

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

src/controls/taxonomyPicker/TaxonomyPicker.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,11 @@ export class TaxonomyPicker extends React.Component<ITaxonomyPickerProps, ITaxon
103103
/**
104104
* Force update of the taxonomy tree - required by term action in case the term has been added, deleted or moved.
105105
*/
106-
private updateTaxonomyTree(): void {
106+
private async updateTaxonomyTree(): Promise<void> {
107+
const termSetAndTerms = await this.termsService.getAllTerms(this.props.termsetNameOrID);
108+
107109
this.setState({
108-
termSetAndTerms: this.state.termSetAndTerms
110+
termSetAndTerms
109111
});
110112
}
111113

src/controls/taxonomyPicker/Term.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,10 @@ export default class Term extends React.Component<ITermProps, ITermState> {
7474
}
7575

7676
if (updateAction.updateActionType === UpdateType.updateTermLabel) {
77-
this.props.term.Name = updateAction.value;
7877
this.setState({
7978
termLabel: updateAction.value
8079
});
81-
}
82-
else {
80+
} else {
8381
this.props.updateTaxonomyTree();
8482
}
8583
}

src/controls/taxonomyPicker/termActions/ButtonTermAction.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ export default class ButtonTermAction extends React.Component<IConcreteTermActio
7272
public render(): React.ReactElement<IConcreteTermActionProps> {
7373
const { term, termActions } = this.props;
7474

75+
// Check if there are actions to show
76+
const actionsToShow = termActions.filter(a => !a.hidden);
77+
if (actionsToShow && actionsToShow.length === 0) {
78+
return null;
79+
}
80+
7581
return (
7682
<div style={{ display: 'flex', alignItems: 'stretch', height: '32px' }}>
7783
{

src/webparts/controlsTest/components/ControlsTest.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,8 @@ export default class ControlsTest extends React.Component<IControlsTestProps, IC
465465
},
466466
applyToTerm: () => (true)
467467
},
468-
new TermLabelAction("Get Labels")],
468+
// new TermLabelAction("Get Labels")
469+
],
469470
termActionsDisplayMode: TermActionsDisplayMode.buttons,
470471
termActionsDisplayStyle: TermActionsDisplayStyle.textAndIcon
471472
}}

0 commit comments

Comments
 (0)