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
5b4d587
commit 6bcf863
Showing
3 changed files
with
121 additions
and
13 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
core/src/main/java/jenkins/model/view/ConfigureProjectMenuItem.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,51 @@ | ||
package jenkins.model.view; | ||
|
||
import hudson.Extension; | ||
import hudson.model.Action; | ||
import hudson.model.Job; | ||
import java.util.Collection; | ||
import java.util.Set; | ||
import jenkins.model.TransientActionFactory; | ||
import jenkins.model.menu.Group; | ||
import jenkins.model.menu.event.LinkAction; | ||
|
||
public class ConfigureProjectMenuItem implements Action { | ||
|
||
@Override | ||
public String getDisplayName() { | ||
return "Configure"; | ||
} | ||
|
||
@Override | ||
public String getIconFileName() { | ||
return "symbol-settings"; | ||
} | ||
|
||
@Override | ||
public Group getGroup() { | ||
return Group.IN_APP_BAR; | ||
} | ||
|
||
@Override | ||
public jenkins.model.menu.event.Action getAction() { | ||
return LinkAction.of("configure"); | ||
} | ||
|
||
@Extension | ||
public static class TransientActionFactoryImpl extends TransientActionFactory<Job> { | ||
|
||
@Override | ||
public Class<Job> type() { | ||
return Job.class; | ||
} | ||
|
||
@Override | ||
public Collection<? extends Action> createFor(Job target) { | ||
if (!target.hasPermission(Job.CONFIGURE)) { | ||
return Set.of(); | ||
} | ||
|
||
return Set.of(new ConfigureProjectMenuItem()); | ||
} | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
core/src/main/java/jenkins/model/view/DeleteProjectMenuItem.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,57 @@ | ||
package jenkins.model.view; | ||
|
||
import hudson.Extension; | ||
import hudson.model.Action; | ||
import hudson.model.Job; | ||
import java.util.Collection; | ||
import java.util.Set; | ||
import jenkins.model.TransientActionFactory; | ||
import jenkins.model.menu.Group; | ||
import jenkins.model.menu.Semantic; | ||
import jenkins.model.menu.event.LinkAction; | ||
|
||
public class DeleteProjectMenuItem implements Action { | ||
|
||
@Override | ||
public String getDisplayName() { | ||
return "Delete project"; | ||
} | ||
|
||
@Override | ||
public String getIconFileName() { | ||
return "symbol-trash"; | ||
} | ||
|
||
@Override | ||
public Group getGroup() { | ||
return Group.LAST_IN_MENU; | ||
} | ||
|
||
@Override | ||
public jenkins.model.menu.event.Action getAction() { | ||
return LinkAction.of("delete"); | ||
} | ||
|
||
@Override | ||
public Semantic getSemantic() { | ||
return Semantic.DESTRUCTIVE; | ||
} | ||
|
||
@Extension | ||
public static class TransientActionFactoryImpl extends TransientActionFactory<Job> { | ||
|
||
@Override | ||
public Class<Job> type() { | ||
return Job.class; | ||
} | ||
|
||
@Override | ||
public Collection<? extends Action> createFor(Job target) { | ||
if (!target.hasPermission(Job.DELETE)) { | ||
return Set.of(); | ||
} | ||
|
||
return Set.of(new DeleteProjectMenuItem()); | ||
} | ||
} | ||
} |
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