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

Added dashboard view option. Added vertical view dashboard. #178

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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 @@ -47,14 +47,17 @@ public class EnvDashboardView extends View {
private String compOrder = null;

private String deployHistory = null;

private String viewOption = null;

@DataBoundConstructor
public EnvDashboardView(final String name, final String envOrder, final String compOrder,
final String deployHistory) {
final String deployHistory, final String viewOption) {
super(name, Hudson.getInstance());
this.envOrder = envOrder;
this.compOrder = compOrder;
this.deployHistory = deployHistory;
this.viewOption = viewOption;
}

static {
Expand Down Expand Up @@ -113,12 +116,23 @@ public Item doCreateItem(StaplerRequest req, StaplerResponse rsp) throws IOExcep
return Hudson.getInstance().doCreateItem(req, rsp);
}

/**
* Overridden for better type safety.
* If your plugin doesn't really define any property on Descriptor,
* you don't have to do this.
*/
@Override
public DescriptorImpl getDescriptor() {
return (DescriptorImpl)super.getDescriptor();
}

@Extension
public static final class DescriptorImpl extends ViewDescriptor {

private String envOrder;
private String compOrder;
private String deployHistory;
private String viewOption;

/**
* descriptor impl constructor This empty constructor is required for
Expand Down Expand Up @@ -233,6 +247,7 @@ public boolean configure(StaplerRequest req, JSONObject formData) throws FormExc
envOrder = formData.getString("envOrder");
compOrder = formData.getString("compOrder");
deployHistory = formData.getString("deployHistory");
viewOption = formData.getString("viewOption");
save();
return super.configure(req, formData);
}
Expand Down Expand Up @@ -519,6 +534,14 @@ public void setDeployHistory(final String deployHistory) {
this.deployHistory = deployHistory;
}

public String getViewOption() {
return viewOption;
}

public void setViewOption(final String viewOption) {
this.viewOption = viewOption;
}

@Override
public boolean contains(TopLevelItem topLevelItem) {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@
<f:entry title="Limit deploy history to last X deploys" field="deployHistory">
<f:textbox default="10"/>
</f:entry>

<f:entry name="viewOption" title="View option" field="viewOption">
<select name="viewOption">
<option value="horizontal">Horizontal</option>
<option selected="${it.getViewOption().equals('vertical') ? 'true' : null}" value="vertical">Vertical</option>
</select>
</f:entry>

<j:if test="${h.hasPermission(app.ADMINISTER)}">
<f:advanced>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div>
You can choose dashboard view.
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
<td align="right"><a href="configure">Configure</a><st:nbsp/><st:nbsp/><st:nbsp/><a href="delete">Delete</a></td>
</tr></table>
<br /><br />
<st:include page="main.jelly"/>
<j:choose>
<j:when test="${it.getViewOption().equals('vertical')}"><st:include page="main-vertical.jelly"/></j:when>
<j:otherwise><st:include page="main.jelly"/></j:otherwise>
</j:choose>
<j:if test="${h.hasPermission(app.ADMINISTER)}">
<f:form name="purge" method="post" action="purgeSubmit" tableClass="advancedLink">
<f:advanced title="${%Dangerous Operation}">
Expand Down
Loading