Skip to content

Commit

Permalink
Prevents displaying installers with empty names and descriptions (#8536)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitaliy Guliy authored Feb 1, 2018
1 parent e5a9932 commit 4d96bca
Showing 1 changed file with 34 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ private class Installer {
// Row containing error message
Element errorSection;

/**
* Creates installer section.
*
* @param installerName installer name
* @param installerDescription installer description
*/
public Installer(String installerName, String installerDescription) {
// Clone installerTemplate node
section = installerTemplate.cloneNode(true).cast();
Expand Down Expand Up @@ -121,6 +127,25 @@ public Installer(String installerName, String installerDescription) {
description.setInnerText(installerDescription);
}

/**
* Sets installer name.
*
* @param installerName installer name
*/
void setName(String installerName) {
name.setInnerText(installerName);
}

/**
* Sets installer description.
*
* @param installerDescription installer description
*/
void setDescription(String installerDescription) {
description.setInnerText(installerDescription);
}

/** Changes installer state to STARTING. */
void setStarting() {
state.setAttribute("rel", "starting");
state.setInnerText("Starting");
Expand All @@ -131,6 +156,7 @@ void setStarting() {
animatedElements.add(status);
}

/** Changes installer state to RUNNING. */
void setRunning() {
state.setAttribute("rel", "running");
state.setInnerText("Running");
Expand All @@ -141,6 +167,7 @@ void setRunning() {
animatedElements.remove(status);
}

/** Changes installer state to STOPPED. */
void setStopped() {
state.setAttribute("rel", "stopped");
state.setInnerText("Stopped");
Expand Down Expand Up @@ -186,6 +213,7 @@ void setFailed(String errorMessage) {
tableBody.insertAfter(errorSection, section);
}

/** Resets installer state. */
void reset() {
state.setAttribute("rel", "");
state.setInnerText("");
Expand Down Expand Up @@ -325,12 +353,15 @@ void setState(String newState) {
* @param installerDescription installer description
*/
void addInstaller(String installerId, String installerName, String installerDescription) {
if (installers.containsKey(installerId)) {
Installer installer = installers.get(installerId);

if (installer != null) {
installer.setName(installerName);
installer.setDescription(installerDescription);
return;
}

Installer installer = new Installer(installerName, installerDescription);

installer = new Installer(installerName, installerDescription);
installers.put(installerId, installer);

tableBody.insertBefore(installer.section, machinesDelimiter);
Expand Down

0 comments on commit 4d96bca

Please sign in to comment.