forked from jenkinsci/jenkins
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
00c4f53
commit da1622c
Showing
11 changed files
with
248 additions
and
388 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
core/src/main/java/hudson/model/testtest/BaseViewThing.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package hudson.model.testtest; | ||
|
||
import hudson.model.TopLevelItem; | ||
import org.kohsuke.stapler.StaplerRequest; | ||
import org.kohsuke.stapler.StaplerResponse; | ||
|
||
import javax.servlet.ServletException; | ||
|
||
public abstract class BaseViewThing { | ||
|
||
public abstract String getDisplayName(); | ||
|
||
public abstract String getIcon(); | ||
|
||
public abstract TopLevelItem doCreateItem(StaplerRequest req, StaplerResponse rsp) throws ServletException; | ||
} |
31 changes: 31 additions & 0 deletions
31
core/src/main/java/hudson/model/testtest/DuplicateProjectThing.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package hudson.model.testtest; | ||
|
||
import hudson.Extension; | ||
import hudson.model.TopLevelItem; | ||
import java.util.Map; | ||
import jenkins.model.Jenkins; | ||
import org.kohsuke.stapler.StaplerRequest; | ||
import org.kohsuke.stapler.StaplerResponse; | ||
|
||
@Extension | ||
public class DuplicateProjectThing extends BaseViewThing { | ||
|
||
@Override | ||
public String getDisplayName() { | ||
return "Duplicate an existing project"; | ||
} | ||
|
||
@Override | ||
public String getIcon() { | ||
return "symbol-duplicate"; | ||
} | ||
|
||
public Map<String, TopLevelItem> getItemMap() { | ||
return Jenkins.get().getItemMap(); | ||
} | ||
|
||
@Override | ||
public TopLevelItem doCreateItem(StaplerRequest req, StaplerResponse rsp) { | ||
return null; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
core/src/main/java/hudson/model/testtest/GithubProjectThing.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package hudson.model.testtest; | ||
|
||
import hudson.Extension; | ||
import hudson.model.TopLevelItem; | ||
import org.kohsuke.stapler.StaplerRequest; | ||
import org.kohsuke.stapler.StaplerResponse; | ||
|
||
@Extension | ||
public class GithubProjectThing extends BaseViewThing { | ||
|
||
@Override | ||
public String getDisplayName() { | ||
return "Add a GitHub repository"; | ||
} | ||
|
||
@Override | ||
public String getIcon() { | ||
return "symbol-github"; | ||
} | ||
|
||
@Override | ||
public TopLevelItem doCreateItem(StaplerRequest req, StaplerResponse rsp) { | ||
return null; | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
core/src/main/java/hudson/model/testtest/ProjectTypesThing.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package hudson.model.testtest; | ||
|
||
import hudson.Extension; | ||
import hudson.model.*; | ||
import jenkins.model.Jenkins; | ||
import net.sf.json.JSONObject; | ||
import org.kohsuke.stapler.StaplerRequest; | ||
import org.kohsuke.stapler.StaplerResponse; | ||
|
||
import javax.servlet.ServletException; | ||
|
||
@Extension | ||
public class ProjectTypesThing extends BaseViewThing { | ||
|
||
@Override | ||
public String getDisplayName() { | ||
return "Project types"; | ||
} | ||
|
||
@Override | ||
public String getIcon() { | ||
return "symbol-types"; | ||
} | ||
|
||
@Override | ||
public TopLevelItem doCreateItem(StaplerRequest req, StaplerResponse rsp) throws ServletException { | ||
JSONObject something = req.getSubmittedForm(); | ||
String name = something.getString("name"); | ||
String type = something.getString("type"); | ||
|
||
TopLevelItemDescriptor descriptor = Items.all().findByName(type); | ||
if (descriptor == null) { | ||
throw new Failure("No item type ‘" + type + "’ is known"); | ||
} | ||
|
||
ItemGroupMixIn itemGroupMixIn = Jenkins.get().doCreateItem(req, rsp); | ||
|
||
// descriptor.checkApplicableIn(parent); | ||
// acl.getACL().checkCreatePermission(parent, descriptor); | ||
|
||
// create empty job and redirect to the project config screen | ||
// result = createProject(descriptor, name, true); | ||
|
||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.