Skip to content

Commit

Permalink
Inspection Panel - icon is not updated, when 'Edit' icon was pressed …
Browse files Browse the repository at this point in the history
…and new image uploaded #4595
  • Loading branch information
ashklianko committed Mar 15, 2017
1 parent 6e978a5 commit 6d1df05
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ export class LiveFormPanel extends api.ui.panel.Panel {
this.pageView.setLocked(true);
this.lockPageAfterProxyLoad = false;
}

this.imageInspectionPanel.refresh();
});

return liveEditPageProxy;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import Option = api.ui.selector.Option;
import SelectedOption = api.ui.selector.combobox.SelectedOption;
import PropertyTree = api.data.PropertyTree;
import SelectedOptionEvent = api.ui.selector.combobox.SelectedOptionEvent;
import ContentSummaryBuilder = api.content.ContentSummaryBuilder;

export class ImageInspectionPanel extends ComponentInspectionPanel<ImageComponent> {

Expand Down Expand Up @@ -159,4 +160,19 @@ export class ImageInspectionPanel extends ComponentInspectionPanel<ImageComponen
return this.imageView;
}

refresh() {
if (this.imageComponent) {
const contentId: ContentId = this.imageComponent.getImage();
if (contentId) {
const image: ContentSummary = this.imageSelector.getContent(contentId);
if (image) {
const newImage: ContentSummary = new ContentSummaryBuilder(image).setIconUrl(image.getIconUrl() + '1').build();
this.imageSelector.clearCombobox();
this.imageSelector.removeAllOptions();
this.setImage(newImage);
}
}
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,10 @@ module api.ui.selector.combobox {
}
}

removeAllOptions() {
this.comboBoxDropdown.removeAllOptions();
}

getSelectedOptions(): Option<OPTION_DISPLAY_VALUE>[] {
if (this.selectedOptionsView) {
return this.selectedOptionsView.getSelectedOptions().map((selectedOption: SelectedOption<OPTION_DISPLAY_VALUE>) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,10 @@ module api.ui.selector.combobox {
this.comboBox.clearSelection(false, true, forceClear);
}

removeAllOptions() {
this.comboBox.removeAllOptions();
}

isSelected(value: OPTION_DISPLAY_VALUE): boolean {
let selectedValues = this.getSelectedValues();
let valueToFind = this.getDisplayValueId(value);
Expand Down

0 comments on commit 6d1df05

Please sign in to comment.