Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
JENKINS-47374 revert fancy combobox
  • Loading branch information
jetersen committed Oct 21, 2017
1 parent 635173c commit 5d39b5e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 81 deletions.
50 changes: 0 additions & 50 deletions src/main/java/hudson/plugins/accurev/AccurevSCM.java
Expand Up @@ -61,17 +61,13 @@
import hudson.scm.SCMDescriptor;
import hudson.scm.SCMRevisionState;
import hudson.security.ACL;
import hudson.util.ComboBoxModel;
import hudson.util.FormValidation;
import hudson.util.ListBoxModel;
import hudson.util.Secret;
import jenkins.model.Jenkins;

import jenkins.plugins.accurev.AccurevTool;
import jenkins.plugins.accurev.util.UUIDUtils;
import hudson.plugins.accurev.cmd.Login;
import hudson.plugins.accurev.cmd.ShowDepots;
import hudson.plugins.accurev.cmd.ShowStreams;
import hudson.plugins.accurev.delegates.AbstractModeDelegate;

/**
Expand Down Expand Up @@ -660,52 +656,6 @@ public ListBoxModel doFillServerUUIDItems(@QueryParameter String serverUUID) {
return s;
}

@SuppressWarnings("unused") // Used by stapler
public ListBoxModel doFillDepotItems(@QueryParameter String serverUUID, @QueryParameter String depot) throws IOException, InterruptedException {
if (StringUtils.isBlank(serverUUID) && !getServers().isEmpty()) serverUUID = getServers().get(0).getUuid();
final AccurevServer server = getServer(serverUUID);

if (server == null) {
return new ListBoxModel();
}

List<String> depots = new ArrayList<>();

// Execute the login command first & upon success of that run show depots
// command. If any of the command's exitvalue is 1 proper error message is
// logged
if (Login.accurevLoginFromGlobalConfig(server)) {
depots = ShowDepots.getDepots(server, DESCRIPTORLOGGER);
}

ListBoxModel d = new ListBoxModel();
for (String dname : depots) {
d.add(dname, dname);
}
// Below while loop is for to retain the selected item when you open the
// Job to reconfigure
d.stream().filter(o -> depot.equals(o.name)).forEach(o -> o.selected = true);
return d;
}

// Populating the streams
@SuppressWarnings("unused") // Used by stapler
public ComboBoxModel doFillStreamItems(@QueryParameter String serverUUID, @QueryParameter String depot) throws IOException, InterruptedException {
if (StringUtils.isBlank(serverUUID) && !getServers().isEmpty()) serverUUID = getServers().get(0).getUuid();
final AccurevServer server = getServer(serverUUID);
if (server == null) {
return new ComboBoxModel();
}
ComboBoxModel cbm = new ComboBoxModel();
if (Login.accurevLoginFromGlobalConfig(server)) {
if (StringUtils.isBlank(depot)) {
depot = Util.fixNull(ShowDepots.getDepots(server, DESCRIPTORLOGGER)).get(0);
}
cbm = ShowStreams.getStreamsForGlobalConfig(server, depot, cbm);
}
return cbm;
}

@SuppressWarnings("unused") // Used by stapler
public ListBoxModel doFillAccurevToolItems() {
ListBoxModel r = new ListBoxModel();
Expand Down
28 changes: 0 additions & 28 deletions src/main/java/hudson/plugins/accurev/cmd/ShowStreams.java
@@ -1,13 +1,10 @@
package hudson.plugins.accurev.cmd;

import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.locks.Lock;
import java.util.logging.Logger;
import java.util.stream.Collectors;

import javax.annotation.CheckForNull;

Expand All @@ -18,8 +15,6 @@
import hudson.Launcher;
import hudson.model.TaskListener;
import hudson.util.ArgumentListBuilder;
import hudson.util.ComboBoxModel;
import jenkins.model.Jenkins;

import hudson.plugins.accurev.AccurevLauncher;
import hudson.plugins.accurev.AccurevSCM;
Expand Down Expand Up @@ -131,27 +126,4 @@ private static void setParents(Map<String, AccurevStream> streams) {
.forEach(stream -> stream.setParent(streams.get(stream.getBasisName())));
}

//Populating streams dynamically in the global config page

public static ComboBoxModel getStreamsForGlobalConfig(//
final AccurevServer server,
final String depot,
final ComboBoxModel cbm
) throws IOException {
Jenkins jenkins = Jenkins.getInstance();
TaskListener listener = TaskListener.NULL;
Launcher launcher = jenkins.createLauncher(listener);
EnvVars accurevEnv = new EnvVars();
Map<String, AccurevStream> allStreams = getAllStreams(null, server, depot, null, accurevEnv, jenkins.getRootPath(), listener, launcher);
if (allStreams == null) return cbm;
if (allStreams.isEmpty()) return cbm;
List<String> streamNames = allStreams
.values()
.stream()
.map(AccurevStream::getName)
.collect(Collectors.toList());
cbm.addAll(streamNames);
Collections.sort(cbm);
return cbm;
}
}
Expand Up @@ -6,16 +6,16 @@
<legend>AccuRev Configurations</legend>
<table width="100%">
<f:entry title="Server ${hudson.utils.Util.filter(scms,hudson.plugins.accurev.AccurevSCM.class)}"
field="serverUUID" help="/plugin/accurev/help/project/server.html">
field="serverName" help="/plugin/accurev/help/project/server.html">
<f:select/>
</f:entry>
<f:entry title="Depot ${hudson.utils.Util.filter(scms,hudson.plugins.accurev.AccurevSCM.class)}"
field="depot" help="/plugin/accurev/help/project/depot.html">
<f:select/>
<f:textbox/>
</f:entry>
<f:entry title="Stream/Workspace ${hudson.utils.Util.filter(scms,hudson.plugins.accurev.AccurevSCM.class)}"
field="stream" help="/plugin/accurev/help/project/stream.html">
<f:combobox/>
<f:textbox/>
</f:entry>
<j:if test="${descriptor.showAccurevToolOptions()}">
<f:entry title="${%Accurev executable}" field="accurevTool">
Expand Down

0 comments on commit 5d39b5e

Please sign in to comment.