Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevents displaying installers with empty names and descriptions #8536

Merged
merged 1 commit into from
Feb 1, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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