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

Add app bar to job page #199

Open
wants to merge 149 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 134 commits
Commits
Show all changes
149 commits
Select commit Hold shift + click to select a range
6f802f2
Init
janfaracik Mar 12, 2023
c01db44
Init
janfaracik Dec 10, 2023
a4c7f4f
Update taglib
janfaracik Dec 10, 2023
4cc43e4
Add docs
janfaracik Dec 10, 2023
163be52
Merge branch 'master' into revamp-dropdowns
janfaracik Jan 3, 2024
1c3961b
Add additional docs
janfaracik Jan 4, 2024
6800c88
Update header.jelly
janfaracik Jan 4, 2024
2dd9e32
Remove translations
janfaracik Jan 4, 2024
0075375
Merge branch 'master' into revamp-dropdowns
janfaracik Jan 4, 2024
44981c2
Merge branch 'master' into revamp-dropdowns
janfaracik Jan 8, 2024
1e22c34
Merge branch 'master' into revamp-dropdowns
janfaracik Jan 14, 2024
9865811
Merge branch 'master' into revamp-dropdowns
MarkEWaite Jan 18, 2024
7270712
Merge branch 'master' into revamp-dropdowns
janfaracik Feb 10, 2024
069fefb
Linting
janfaracik Feb 10, 2024
8b944e9
Update utils.js
janfaracik Feb 10, 2024
1c19e43
Add clazz
janfaracik Feb 10, 2024
9d9e2ab
Update templates.js
janfaracik Feb 10, 2024
702d9d1
Address comments
janfaracik Feb 28, 2024
b1e132e
Merge branch 'master' into revamp-dropdowns
janfaracik Feb 28, 2024
d34465b
Fix failing tests due to JS change
janfaracik Feb 28, 2024
9e2af88
Merge branch 'master' into revamp-dropdowns
janfaracik Feb 29, 2024
ff813be
Update templates.js
janfaracik Feb 29, 2024
7e48e13
Fix properties not being set correctly
janfaracik Feb 29, 2024
7910c8e
Merge branch 'master' into custom-edit-description
janfaracik Feb 29, 2024
7cc8e5f
Merge branch 'revamp-dropdowns' into custom-edit-description
janfaracik Feb 29, 2024
54d459c
More
janfaracik Feb 29, 2024
445d124
Update editable-description.js
janfaracik Feb 29, 2024
6107495
More
janfaracik Mar 1, 2024
fb0ddf1
Update index.jelly
janfaracik Mar 1, 2024
65477d4
Update main.jelly
janfaracik Mar 1, 2024
aadcfda
Revert "Update main.jelly"
janfaracik Mar 1, 2024
2db280f
Init
janfaracik Mar 1, 2024
0191e64
Init
janfaracik Mar 1, 2024
7fe28ad
More
janfaracik Mar 1, 2024
64b3563
More
janfaracik Mar 1, 2024
bc0038c
More
janfaracik Mar 1, 2024
715d362
More
janfaracik Mar 1, 2024
64ebc85
More
janfaracik Mar 1, 2024
b55ad06
More
janfaracik Mar 1, 2024
b752720
More
janfaracik Mar 2, 2024
0f67b99
More
janfaracik Mar 2, 2024
60a7fa1
More
janfaracik Mar 3, 2024
0a45487
Update index.jelly
janfaracik Mar 3, 2024
aa1848d
Update index.jelly
janfaracik Mar 4, 2024
a356f72
Merge branch 'master' into revamp-dropdowns
janfaracik Mar 9, 2024
fd7867a
XML escape clazz, URL and ID
janfaracik Mar 11, 2024
8bc53fe
Merge branch 'revamp-dropdowns' into dashboard-app-bar-revamp
janfaracik Mar 11, 2024
e412d9b
Merge branch 'master' into dashboard-app-bar-revamp
janfaracik Mar 16, 2024
5d85564
more
janfaracik Mar 16, 2024
070dade
More
janfaracik Mar 17, 2024
8552ba3
Init
janfaracik Mar 17, 2024
5b4d587
Update BuildActionFactory.java
janfaracik Mar 17, 2024
6bcf863
More
janfaracik Mar 17, 2024
427ffe9
More
janfaracik Mar 17, 2024
d169ebc
More
janfaracik Mar 17, 2024
749ebaa
Update DeleteBuildMenuItem.java
janfaracik Mar 18, 2024
db3121e
Init
janfaracik Apr 1, 2024
1e4c5b6
Remove br
janfaracik Apr 1, 2024
11f07ac
Remove unused functions
janfaracik Apr 2, 2024
e231913
Merge branch 'master' into tidy-new-item-page
janfaracik Apr 2, 2024
7af4749
Remove div class assertion
janfaracik Apr 2, 2024
0ff2d10
Merge branch 'master' into tidy-new-item-page
janfaracik Apr 2, 2024
6603706
Merge branch 'master' into dashboard-app-bar-revamp
janfaracik Apr 4, 2024
1b2ccea
Merge branch 'dashboard-app-bar-revamp' into projct-app-bar-revamp
janfaracik Apr 4, 2024
7bbf63a
Push
janfaracik Apr 4, 2024
5bffbe0
Reset files
janfaracik Apr 4, 2024
f566874
Lint
janfaracik Apr 4, 2024
cf7ac77
Tidy up
janfaracik Apr 4, 2024
e70dc35
More
janfaracik Apr 4, 2024
da32265
Tidy up
janfaracik Apr 4, 2024
5f4b21f
More
janfaracik Apr 4, 2024
8738507
Increase gap between items
janfaracik Apr 5, 2024
e8c4598
Merge branch 'master' into tidy-new-item-page
janfaracik Apr 5, 2024
d8f4a17
Add dialogs
janfaracik Apr 5, 2024
2a086cd
Merge branch 'tidy-new-item-page' into projct-app-bar-revamp
janfaracik Apr 5, 2024
b84756b
Push
janfaracik Apr 5, 2024
476733a
Update BuildActionFactory.java
janfaracik Apr 5, 2024
83bd609
Fix configure button
janfaracik Apr 5, 2024
80ca65a
Merge branch 'master' into projct-app-bar-revamp
janfaracik Apr 5, 2024
50e172b
Fix missing breadcrumb items
janfaracik Apr 5, 2024
36d1773
Rename stuff, use absolute urls
janfaracik Apr 5, 2024
82c946c
Push
janfaracik Apr 6, 2024
6027f5b
Simplify API
janfaracik Apr 6, 2024
7227f95
Working build
janfaracik Apr 6, 2024
ee35cda
Working build!
janfaracik Apr 6, 2024
198fbc8
Init
janfaracik Apr 6, 2024
b053a80
Localisation
janfaracik Apr 6, 2024
a618c34
Rename and localize
janfaracik Apr 6, 2024
c6d6ef0
Update Security2780Test.java
janfaracik Apr 6, 2024
5fa629a
Add localised string for build scheduled
janfaracik Apr 7, 2024
6876d93
Restore hetero list functionality
janfaracik Apr 7, 2024
143373f
Tidy up
janfaracik Apr 7, 2024
ca9ade7
Reset files
janfaracik Apr 7, 2024
2046f1e
Merge branch 'use-jenkins-button-for-tables' into projct-app-bar-revamp
janfaracik Apr 7, 2024
d2cd9f7
More
janfaracik Apr 7, 2024
a0f375c
Fix icon
janfaracik Apr 7, 2024
b6f0ea0
Temp
janfaracik Apr 7, 2024
830658d
Tidy up
janfaracik Apr 7, 2024
5897bb4
Rename factories
janfaracik Apr 8, 2024
f26a8f0
Merge branch 'master' into projct-app-bar-revamp
janfaracik Apr 27, 2024
b626b16
Rename action to event
janfaracik Apr 27, 2024
157c92b
Reset files
janfaracik Apr 27, 2024
0464a13
Merge branch 'master' into projct-app-bar-revamp
janfaracik May 3, 2024
f094dbf
Update utils.js
janfaracik May 3, 2024
0e8b2f1
Update sidepanel.jelly
janfaracik May 3, 2024
1a7cca8
Merge branch 'master' into projct-app-bar-revamp
janfaracik May 21, 2024
50f36d2
Merge branch 'master' into projct-app-bar-revamp
janfaracik Jun 1, 2024
9a89f7a
Move from job to run
janfaracik Jun 1, 2024
5ca57f6
Push
janfaracik Jun 1, 2024
7a10c7b
Push
janfaracik Jun 2, 2024
1bc2030
Merge branch 'master' into job-app-bar-revamp
janfaracik Jun 24, 2024
bf298b2
Update index.jelly
janfaracik Jun 24, 2024
7679219
Push
janfaracik Jun 24, 2024
2bcd2d7
Update Actionable.java
janfaracik Jun 24, 2024
faba7ea
Push
janfaracik Jun 24, 2024
8b0a920
Reset
janfaracik Jun 24, 2024
961bdf1
Push
janfaracik Jun 24, 2024
3836db3
Merge branch 'master' into job-app-bar-revamp
janfaracik Jul 9, 2024
b6f2434
Merge branch 'master' into job-app-bar-revamp
janfaracik Jul 9, 2024
23848c4
push
janfaracik Jul 9, 2024
77e45bb
Push
janfaracik Jul 9, 2024
5ae9bfc
Update KeepRunAction.java
janfaracik Jul 9, 2024
13f6e34
Push
janfaracik Jul 9, 2024
9199b32
Merge branch 'master' into job-app-bar-revamp
janfaracik Aug 13, 2024
2dd5cc5
Merge branch 'master' into job-app-bar-revamp
janfaracik Dec 23, 2024
fb3e64d
Fixes
janfaracik Dec 23, 2024
6d24605
Update templates.js
janfaracik Dec 23, 2024
f2c7dd1
Update tasks.jelly
janfaracik Dec 23, 2024
69a9814
Merge branch 'master' into job-app-bar-revamp
janfaracik Jan 27, 2025
dc7df24
Update new-build-page.jelly
janfaracik Jan 27, 2025
6562f3e
Delete ConsoleAction.java
janfaracik Jan 27, 2025
0128e1e
Tidy
janfaracik Jan 27, 2025
9db9886
Merge branch 'master' into job-app-bar-revamp
janfaracik Jan 29, 2025
b49a978
Push
janfaracik Jan 29, 2025
7120d3c
Push
janfaracik Jan 29, 2025
8f9f8f1
Update KeepRunAction.java
janfaracik Jan 30, 2025
fc3e175
Push
janfaracik Jan 30, 2025
f4338be
Update templates.js
janfaracik Jan 30, 2025
1922647
Update templates.js
janfaracik Jan 30, 2025
4b08597
Update Semantic.java
janfaracik Jan 30, 2025
88f1be6
Tidy
janfaracik Jan 30, 2025
208739d
Update new-build-page.jelly
janfaracik Jan 30, 2025
da04e3d
Update jumplists.js
janfaracik Jan 30, 2025
cf5e71f
Tidy
janfaracik Jan 30, 2025
d89475f
WB
janfaracik Jan 30, 2025
847034a
Tidy
janfaracik Jan 30, 2025
d243725
Push
janfaracik Jan 30, 2025
ee9c1e8
Tidy
janfaracik Jan 30, 2025
b17f26d
Update RenameAction.java
janfaracik Jan 30, 2025
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
11 changes: 11 additions & 0 deletions core/src/main/java/hudson/Functions.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@
import jenkins.model.ModelObjectWithContextMenu;
import jenkins.model.SimplePageDecorator;
import jenkins.util.SystemProperties;
import net.sf.json.JSONObject;
import org.apache.commons.jelly.JellyContext;
import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.Script;
Expand Down Expand Up @@ -2586,6 +2587,16 @@ public static String generateItemId() {
return String.valueOf(Math.floor(Math.random() * 3000));
}

/**
* Converts the given actions to a JSON object
*/
@Restricted(NoExternalUse.class)
public static String convertActionsToJson(List<Action> actions) {
ModelObjectWithContextMenu.ContextMenu contextMenu = new ModelObjectWithContextMenu.ContextMenu();
contextMenu.addAll(actions);
return JSONObject.fromObject(contextMenu).toString();
}

@Restricted(NoExternalUse.class)
public static ExtensionList<SearchFactory> getSearchFactories() {
return SearchFactory.all();
Expand Down
27 changes: 26 additions & 1 deletion core/src/main/java/hudson/model/Action.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@

import edu.umd.cs.findbugs.annotations.CheckForNull;
import hudson.Functions;
import jenkins.model.menu.Group;
import jenkins.model.menu.Semantic;
import jenkins.model.menu.event.Event;
import jenkins.model.menu.event.LinkEvent;

/**
* Object that contributes additional information, behaviors, and UIs to {@link ModelObject}
Expand Down Expand Up @@ -137,6 +141,27 @@ public interface Action extends ModelObject {
* null if this action object doesn't need to be bound to web
* (when you do that, be sure to also return null from {@link #getIconFileName()}.
* @see Functions#getActionUrl(String, Action)
*
* @deprecated
* Override {@link #getEvent()} instead
*/
@CheckForNull String getUrlName();
@CheckForNull default String getUrlName() {
return null;
}

default Group getGroup() {
return Group.IN_MENU;
}

default Event getEvent() {
return LinkEvent.of(getUrlName());
}

default Semantic getSemantic() {
return null;
}

default boolean isVisibleInContextMenu() {
return true;
}
}
30 changes: 30 additions & 0 deletions core/src/main/java/hudson/model/Actionable.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,19 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;
import jenkins.model.ModelObjectWithContextMenu;
import jenkins.model.TransientActionFactory;
import jenkins.security.stapler.StaplerNotDispatchable;
import org.apache.commons.lang.StringUtils;
import org.jenkins.ui.icon.IconSpec;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerRequest2;
import org.kohsuke.stapler.StaplerResponse;
Expand Down Expand Up @@ -113,6 +118,31 @@ public final List<? extends Action> getAllActions() {
return Collections.unmodifiableList(_actions);
}

/**
* TODO
*/
public List<Action> getMagic() {
// How does this differ from getActions?
// How does this differ from getAllActions?
// TODO - Think of an appropriate name for this and see if we can combine the functions

return getAllActions().stream()
.filter(e -> {
String icon = e.getIconFileName();

if (e instanceof IconSpec) {
if (((IconSpec) e).getIconClassName() != null) {
icon = ((IconSpec) e).getIconClassName();
}
}

return !StringUtils.isBlank(e.getDisplayName()) && !StringUtils.isBlank(icon);
})
.sorted(Comparator.comparingInt((Action e) -> e.getGroup().getOrder())
.thenComparing(e -> Objects.requireNonNullElse(e.getDisplayName(), "")))
.collect(Collectors.toUnmodifiableList());
}

private <T> Collection<? extends Action> createFor(TransientActionFactory<T> taf) {
try {
Collection<? extends Action> result = taf.createFor(taf.type().cast(this));
Expand Down
Loading