mirror of https://github.com/jenkinsci/jenkins.git
Squashed commit of the following:
commit847981ebcb
Merge:0ea6dcff0e
23f2b9ef59
Author: Kris Stern <krisstern@outlook.com> Date: Wed Feb 26 09:16:52 2025 +0800 Merge branch 'master' into add-groups-to-command-palette commit0ea6dcff0e
Merge:c0777dbe79
68425e2cd4
Author: Kris Stern <krisstern@outlook.com> Date: Wed Feb 26 01:06:33 2025 +0800 Merge branch 'master' into add-groups-to-command-palette commitc0777dbe79
Merge:1638afe17e
c37293c52d
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Mon Feb 24 13:40:35 2025 +0000 Merge branch 'master' into add-groups-to-command-palette commit1638afe17e
Merge:c987a9e536
b97764d3fd
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Fri Feb 21 11:49:03 2025 +0000 Merge branch 'master' into add-groups-to-command-palette commitc987a9e536
Merge:f909eec0d4
16748f4413
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Thu Feb 20 08:17:19 2025 +0000 Merge branch 'master' into add-groups-to-command-palette commitf909eec0d4
Merge:85eedb7e88
217b0f5742
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Wed Feb 19 16:12:45 2025 +0000 Merge branch 'master' into add-groups-to-command-palette commit85eedb7e88
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Wed Feb 19 16:11:24 2025 +0000 Move to Item commit8f4f117bac
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Wed Feb 19 15:43:50 2025 +0000 Tighten up animations + improve contrast commitd7b7d6388d
Merge:8750f7cb92
4fa61274f9
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Wed Feb 19 08:50:45 2025 +0000 Merge branch 'master' into add-groups-to-command-palette commit8750f7cb92
Merge:7b527340a2
a05c33f797
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Tue Feb 18 21:42:31 2025 +0000 Merge branch 'master' into add-groups-to-command-palette commit7b527340a2
Merge:e2c133d128
3505fb3540
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Mon Feb 17 20:59:02 2025 +0000 Merge branch 'master' into add-groups-to-command-palette commite2c133d128
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Sun Feb 16 18:23:14 2025 +0000 Update require-changelog-label.yml commitd32a61c1ea
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Sun Feb 16 17:11:18 2025 +0000 Update _theme.scss commit42ecfcac5c
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Sun Feb 16 17:10:48 2025 +0000 Rename to Items commitcc3779171a
Merge:0f1cb2187c
2b9d4d62a6
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Sun Feb 16 17:10:25 2025 +0000 Merge branch 'master' into add-groups-to-command-palette commit0f1cb2187c
Merge:04dc6cd222
9474c89bf1
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Wed Feb 12 20:42:01 2025 +0000 Merge branch 'master' into add-groups-to-command-palette commit04dc6cd222
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Tue Feb 11 17:06:31 2025 +0000 Reduce spacing a touch, fix icon spacing commit0ab3665587
Merge:7c9e172b2f
848ac9b66a
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Tue Feb 11 14:44:03 2025 +0000 Merge branch 'master' into add-groups-to-command-palette commit7c9e172b2f
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Tue Feb 11 11:23:27 2025 +0000 Update Messages.properties commitec6a5e5ee0
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Tue Feb 11 08:51:16 2025 +0000 Fix test commit14a64885a2
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Mon Feb 10 16:44:39 2025 +0000 Tidy up commit46a9e5681a
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Mon Feb 10 16:28:15 2025 +0000 Tidy commitd7270b1fa4
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Mon Feb 10 16:06:04 2025 +0000 Tidy commitb2da3f8d39
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Mon Feb 10 16:03:37 2025 +0000 Tidy up commitb746fba008
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Mon Feb 10 15:53:53 2025 +0000 Move to extensionpoint commit7827304ae1
Merge:cac127d119
d03a2e11c9
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Mon Feb 10 15:45:28 2025 +0000 Merge branch 'master' into add-groups-to-command-palette commitcac127d119
Merge:add75bf6a9
e3e3c45270
Author: Tim Jacomb <21194782+timja@users.noreply.github.com> Date: Mon Jan 13 11:03:10 2025 +0000 Merge branch 'jenkinsci:master' into add-groups-to-command-palette commitadd75bf6a9
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Sat Jan 11 19:02:52 2025 +0000 Update _command-palette.scss commiteb4073f4fb
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Sat Jan 11 18:59:37 2025 +0000 Tidy up commit323e48fddf
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Sat Jan 11 18:47:34 2025 +0000 Update Job.java commit3cbdfbc4b5
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Sat Jan 11 18:47:13 2025 +0000 Update _command-palette.scss commit8fecf0d880
Merge:428e826fcd
331c7685ca
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Sat Jan 11 18:45:30 2025 +0000 Merge branch 'master' into add-groups-to-command-palette commit428e826fcd
Merge:5657369d95
f1b6d31272
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Mon Dec 16 20:53:15 2024 +0000 Merge branch 'master' into add-groups-to-command-palette commit5657369d95
Merge:26f17a277f
674d5085c3
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Fri Dec 13 09:46:35 2024 +0000 Merge branch 'add-icons-to-command-palette' into add-groups-to-command-palette commit674d5085c3
Merge:809d2e6120
7020e80af8
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Fri Dec 13 09:42:59 2024 +0000 Merge branch 'master' into add-icons-to-command-palette commit26f17a277f
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Wed Dec 11 22:10:56 2024 +0000 Update _command-palette.scss commit2b6ffc85f3
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Wed Dec 11 22:09:09 2024 +0000 Init commit809d2e6120
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Wed Dec 11 21:37:47 2024 +0000 Make iconXml private, rename to icon commit3d45ca7c39
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Wed Dec 11 21:29:27 2024 +0000 Add group field commit80f24cbfdc
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Wed Dec 11 21:25:23 2024 +0000 Init commit1b9faa8fb0
Merge:d6868c970a
26738449cd
Author: Tim Jacomb <timjacomb1@gmail.com> Date: Wed Dec 11 21:11:56 2024 +0000 Merge branch 'add-icons-to-command-palette' of github.com:janfaracik/jenkins into add-icons-to-command-palette commitd6868c970a
Author: Tim Jacomb <timjacomb1@gmail.com> Date: Wed Dec 11 21:11:41 2024 +0000 Reword javadoc commit26738449cd
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Wed Dec 11 21:03:29 2024 +0000 Implement IconSpec in IComputer commit57910109f3
Merge:661f994783
05ed7560fd
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Wed Dec 11 20:23:58 2024 +0000 Merge branch 'master' into add-icons-to-command-palette commit661f994783
Merge:23570203ea
dad5ef3266
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Wed Dec 11 20:15:22 2024 +0000 Merge branch 'refine-command-palette' into add-icons-to-command-palette commit23570203ea
Merge:436a02b9d3
788ae63c50
Author: Tim Jacomb <timjacomb1@gmail.com> Date: Wed Dec 11 16:35:43 2024 +0000 Merge branch 'add-icons-to-command-palette' of github.com:janfaracik/jenkins into add-icons-to-command-palette commit436a02b9d3
Author: Tim Jacomb <timjacomb1@gmail.com> Date: Wed Dec 11 16:35:24 2024 +0000 Add support for images commita3fdb3e0c7
Merge:ea67d6a554
d22cc2fa3c
Author: Tim Jacomb <timjacomb1@gmail.com> Date: Wed Dec 11 15:27:12 2024 +0000 Merge branch 'master' into add-icons-to-command-palette commit788ae63c50
Merge:ea67d6a554
d22cc2fa3c
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Wed Dec 11 10:00:04 2024 +0000 Merge branch 'jenkinsci:master' into add-icons-to-command-palette commitdad5ef3266
Merge:cc63c9c8e5
d22cc2fa3c
Author: Tim Jacomb <21194782+timja@users.noreply.github.com> Date: Wed Dec 11 09:07:05 2024 +0000 Merge branch 'master' into refine-command-palette commitea67d6a554
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Tue Dec 10 22:26:16 2024 +0000 Update Search.java commita9aadbab30
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Tue Dec 10 22:25:40 2024 +0000 Revert "Update Search.java" This reverts commit24837ea667
. commit24837ea667
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Tue Dec 10 21:59:03 2024 +0000 Update Search.java commitd43a8d3b2f
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Tue Dec 10 21:54:23 2024 +0000 Init commitcc63c9c8e5
Author: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Tue Dec 10 21:37:09 2024 +0000 Refine command palette
This commit is contained in:
parent
7ca2e8f63b
commit
ca0176a53e
|
@ -110,6 +110,7 @@ import jenkins.model.DisplayExecutor;
|
|||
import jenkins.model.IComputer;
|
||||
import jenkins.model.IDisplayExecutor;
|
||||
import jenkins.model.Jenkins;
|
||||
import jenkins.search.SearchGroup;
|
||||
import jenkins.security.ImpersonatingExecutorService;
|
||||
import jenkins.security.MasterToSlaveCallable;
|
||||
import jenkins.security.stapler.StaplerDispatchable;
|
||||
|
@ -1109,6 +1110,11 @@ public /*transient*/ abstract class Computer extends Actionable implements Acces
|
|||
return getUrl();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SearchGroup getSearchGroup() {
|
||||
return SearchGroup.get(SearchGroup.ComputerSearchGroup.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link RetentionStrategy} associated with this computer.
|
||||
*
|
||||
|
|
|
@ -39,6 +39,7 @@ import hudson.util.Secret;
|
|||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import jenkins.model.Jenkins;
|
||||
import jenkins.search.SearchGroup;
|
||||
import jenkins.util.SystemProperties;
|
||||
import jenkins.util.io.OnMaster;
|
||||
import org.kohsuke.stapler.StaplerRequest2;
|
||||
|
@ -249,6 +250,11 @@ public interface Item extends PersistenceRoot, SearchableModelObject, AccessCont
|
|||
*/
|
||||
void delete() throws IOException, InterruptedException;
|
||||
|
||||
@Override
|
||||
default SearchGroup getSearchGroup() {
|
||||
return SearchGroup.get(SearchGroup.ItemSearchGroup.class);
|
||||
}
|
||||
|
||||
PermissionGroup PERMISSIONS = new PermissionGroup(Item.class, Messages._Item_Permissions_Title());
|
||||
Permission CREATE =
|
||||
new Permission(
|
||||
|
|
|
@ -72,6 +72,7 @@ import jenkins.model.Jenkins;
|
|||
import jenkins.model.Loadable;
|
||||
import jenkins.model.ModelObjectWithContextMenu;
|
||||
import jenkins.scm.RunWithSCM;
|
||||
import jenkins.search.SearchGroup;
|
||||
import jenkins.security.ImpersonatingUserDetailsService2;
|
||||
import jenkins.security.LastGrantedAuthoritiesProperty;
|
||||
import jenkins.security.UserDetailsCache;
|
||||
|
@ -284,6 +285,11 @@ public class User extends AbstractModelObject implements AccessControlled, Descr
|
|||
return UserAvatarResolver.resolve(this, "48x48");
|
||||
}
|
||||
|
||||
@Override
|
||||
public SearchGroup getSearchGroup() {
|
||||
return SearchGroup.get(SearchGroup.UserSearchGroup.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* The URL of the user page.
|
||||
*/
|
||||
|
|
|
@ -94,6 +94,7 @@ import jenkins.model.ModelObjectWithContextMenu;
|
|||
import jenkins.model.item_category.Categories;
|
||||
import jenkins.model.item_category.Category;
|
||||
import jenkins.model.item_category.ItemCategory;
|
||||
import jenkins.search.SearchGroup;
|
||||
import jenkins.security.stapler.StaplerNotDispatchable;
|
||||
import jenkins.util.xml.XMLUtils;
|
||||
import jenkins.widgets.HasWidgets;
|
||||
|
@ -565,6 +566,11 @@ public abstract class View extends AbstractModelObject implements AccessControll
|
|||
return "symbol-jobs";
|
||||
}
|
||||
|
||||
@Override
|
||||
public SearchGroup getSearchGroup() {
|
||||
return SearchGroup.get(SearchGroup.ViewSearchGroup.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the transient {@link Action}s associated with the top page.
|
||||
*
|
||||
|
|
|
@ -29,6 +29,8 @@ import static jakarta.servlet.http.HttpServletResponse.SC_NOT_FOUND;
|
|||
|
||||
import edu.umd.cs.findbugs.annotations.CheckForNull;
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
import hudson.ExtensionComponent;
|
||||
import hudson.ExtensionList;
|
||||
import hudson.Util;
|
||||
import hudson.util.EditDistance;
|
||||
import io.jenkins.servlet.ServletExceptionWrapper;
|
||||
|
@ -37,12 +39,16 @@ import java.io.IOException;
|
|||
import java.util.AbstractList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.stream.Collectors;
|
||||
import jenkins.model.Jenkins;
|
||||
import jenkins.search.SearchGroup;
|
||||
import jenkins.security.stapler.StaplerNotDispatchable;
|
||||
import jenkins.util.MemoryReductionUtil;
|
||||
import jenkins.util.SystemProperties;
|
||||
|
@ -171,11 +177,26 @@ public class Search implements StaplerProxy {
|
|||
|
||||
if (iconName.startsWith("symbol")) {
|
||||
r.suggestions.add(new Item(curItem.getPath(), curItem.getUrl(),
|
||||
Symbol.get(new SymbolRequest.Builder().withRaw(iconName).build())));
|
||||
Symbol.get(new SymbolRequest.Builder().withRaw(iconName).build()), "symbol", curItem.item.getSearchGroup().getDisplayName()));
|
||||
} else {
|
||||
r.suggestions.add(new Item(curItem.getPath(), curItem.getUrl(), iconName, "image"));
|
||||
r.suggestions.add(new Item(curItem.getPath(), curItem.getUrl(), iconName, "image", curItem.item.getSearchGroup().getDisplayName()));
|
||||
}
|
||||
}
|
||||
|
||||
// Sort results by group
|
||||
ExtensionList<SearchGroup> groupsExtensionList = ExtensionList.lookup(SearchGroup.class);
|
||||
List<ExtensionComponent<SearchGroup>> components = groupsExtensionList.getComponents();
|
||||
Map<String, Double> searchGroupOrdinal = components.stream()
|
||||
.collect(Collectors.toMap(
|
||||
(k) -> k.getInstance().getDisplayName(),
|
||||
ExtensionComponent::ordinal
|
||||
));
|
||||
r.suggestions.sort(
|
||||
Comparator.comparingDouble((Item item) -> searchGroupOrdinal.getOrDefault(item.getGroup(), Double.MAX_VALUE))
|
||||
.reversed()
|
||||
.thenComparing(item -> item.name)
|
||||
);
|
||||
|
||||
rsp.serveExposedBean(req, r, new ExportConfig());
|
||||
}
|
||||
|
||||
|
@ -279,22 +300,19 @@ public class Search implements StaplerProxy {
|
|||
|
||||
private final String icon;
|
||||
|
||||
private final String group;
|
||||
|
||||
public Item(String name) {
|
||||
this(name, null, null);
|
||||
this(name, null, null, "symbol", null);
|
||||
}
|
||||
|
||||
public Item(String name, String url, String icon) {
|
||||
public Item(String name, String url, String icon, String type, String group) {
|
||||
this.name = name;
|
||||
this.url = url;
|
||||
this.icon = icon;
|
||||
this.type = "symbol";
|
||||
}
|
||||
|
||||
public Item(String name, String url, String icon, String type) {
|
||||
this.name = name;
|
||||
this.url = url;
|
||||
this.icon = icon;
|
||||
this.type = type;
|
||||
this.group = group;
|
||||
}
|
||||
|
||||
@Exported
|
||||
|
@ -311,6 +329,11 @@ public class Search implements StaplerProxy {
|
|||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Exported
|
||||
public String getGroup() {
|
||||
return group;
|
||||
}
|
||||
}
|
||||
|
||||
private enum Mode {
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
package hudson.search;
|
||||
|
||||
import hudson.model.Build;
|
||||
import jenkins.search.SearchGroup;
|
||||
import org.jenkins.ui.icon.IconSpec;
|
||||
|
||||
/**
|
||||
|
@ -63,6 +64,10 @@ public interface SearchItem {
|
|||
return "symbol-search";
|
||||
}
|
||||
|
||||
default SearchGroup getSearchGroup() {
|
||||
return SearchGroup.get(SearchGroup.UnclassifiedSearchGroup.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@link SearchIndex} to further search sub items inside this item.
|
||||
*
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
package jenkins.search;
|
||||
|
||||
import static jenkins.search.Messages.SearchGroup_ComputerSearchGroup_DisplayName;
|
||||
import static jenkins.search.Messages.SearchGroup_ItemSearchGroup_DisplayName;
|
||||
import static jenkins.search.Messages.SearchGroup_UnclassifiedSearchGroup_DisplayName;
|
||||
import static jenkins.search.Messages.SearchGroup_UserSearchGroup_DisplayName;
|
||||
import static jenkins.search.Messages.SearchGroup_ViewSearchGroup_DisplayName;
|
||||
|
||||
import edu.umd.cs.findbugs.annotations.NonNull;
|
||||
import hudson.Extension;
|
||||
import hudson.ExtensionList;
|
||||
import hudson.ExtensionPoint;
|
||||
import hudson.model.ModelObject;
|
||||
|
||||
public interface SearchGroup extends ExtensionPoint, ModelObject {
|
||||
|
||||
static ExtensionList<SearchGroup> all() {
|
||||
return ExtensionList.lookup(SearchGroup.class);
|
||||
}
|
||||
|
||||
static @NonNull <T extends SearchGroup> T get(Class<T> type) {
|
||||
T category = all().get(type);
|
||||
if (category == null) {
|
||||
throw new AssertionError("Group not found. It seems the " + type + " is not annotated with @Extension and so not registered");
|
||||
}
|
||||
return category;
|
||||
}
|
||||
|
||||
@Extension(ordinal = -1)
|
||||
class UnclassifiedSearchGroup implements SearchGroup {
|
||||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return SearchGroup_UnclassifiedSearchGroup_DisplayName();
|
||||
}
|
||||
}
|
||||
|
||||
@Extension(ordinal = 999)
|
||||
class ItemSearchGroup implements SearchGroup {
|
||||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return SearchGroup_ItemSearchGroup_DisplayName();
|
||||
}
|
||||
}
|
||||
|
||||
@Extension
|
||||
class ComputerSearchGroup implements SearchGroup {
|
||||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return SearchGroup_ComputerSearchGroup_DisplayName();
|
||||
}
|
||||
}
|
||||
|
||||
@Extension
|
||||
class ViewSearchGroup implements SearchGroup {
|
||||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return SearchGroup_ViewSearchGroup_DisplayName();
|
||||
}
|
||||
}
|
||||
|
||||
@Extension
|
||||
class UserSearchGroup implements SearchGroup {
|
||||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return SearchGroup_UserSearchGroup_DisplayName();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
# The MIT License
|
||||
#
|
||||
# Copyright (c) 2025 Jan Faracik
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
SearchGroup.UnclassifiedSearchGroup.DisplayName=Other
|
||||
SearchGroup.ItemSearchGroup.DisplayName=Items
|
||||
SearchGroup.ComputerSearchGroup.DisplayName=Nodes
|
||||
SearchGroup.ViewSearchGroup.DisplayName=Views
|
||||
SearchGroup.UserSearchGroup.DisplayName=Users
|
|
@ -21,6 +21,7 @@ export const JenkinsSearchSource = {
|
|||
type: e.type,
|
||||
label: e.name,
|
||||
url: correctAddress(e.url),
|
||||
group: e.group,
|
||||
}),
|
||||
);
|
||||
}),
|
||||
|
|
|
@ -5,6 +5,7 @@ import * as Symbols from "./symbols";
|
|||
import makeKeyboardNavigable from "@/util/keyboard";
|
||||
import { xmlEscape } from "@/util/security";
|
||||
import { createElementFromHtml } from "@/util/dom";
|
||||
import { groupResultsByCategory } from "@/components/command-palette/utils";
|
||||
|
||||
const datasources = [JenkinsSearchSource];
|
||||
|
||||
|
@ -68,6 +69,7 @@ function init() {
|
|||
label: i18n.dataset.getHelp,
|
||||
url: document.querySelector("body").dataset.searchHelpUrl,
|
||||
isExternal: true,
|
||||
group: null,
|
||||
}),
|
||||
]);
|
||||
} else {
|
||||
|
@ -77,15 +79,26 @@ function init() {
|
|||
}
|
||||
|
||||
results.then((results) => {
|
||||
results = groupResultsByCategory(results);
|
||||
|
||||
// Clear current search results
|
||||
searchResults.innerHTML = "";
|
||||
|
||||
if (query.length === 0 || Object.keys(results).length > 0) {
|
||||
results.forEach(function (obj) {
|
||||
const link = createElementFromHtml(obj.render());
|
||||
link.addEventListener("mouseenter", (e) => itemMouseEnter(e));
|
||||
searchResults.append(link);
|
||||
});
|
||||
for (const [group, items] of Object.entries(results)) {
|
||||
if (group !== "null") {
|
||||
const heading = document.createElement("p");
|
||||
heading.className = "jenkins-command-palette__results__heading";
|
||||
heading.innerText = group;
|
||||
searchResults.append(heading);
|
||||
}
|
||||
|
||||
items.forEach(function (obj) {
|
||||
const link = createElementFromHtml(obj.render());
|
||||
link.addEventListener("mouseenter", (e) => itemMouseEnter(e));
|
||||
searchResults.append(link);
|
||||
});
|
||||
}
|
||||
|
||||
updateSelectedItem(0);
|
||||
} else {
|
||||
|
|
|
@ -7,12 +7,14 @@ import { xmlEscape } from "@/util/security";
|
|||
* @param {string} params.label
|
||||
* @param {'symbol' | 'image'} params.type
|
||||
* @param {string} params.url
|
||||
* @param {string | null} params.group
|
||||
* @param {boolean | undefined} params.isExternal
|
||||
*/
|
||||
export function LinkResult(params) {
|
||||
return {
|
||||
label: params.label,
|
||||
url: params.url,
|
||||
group: params.group,
|
||||
render: () => {
|
||||
return `<a class="jenkins-command-palette__results__item" href="${xmlEscape(
|
||||
params.url,
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
/**
|
||||
* Group results by 'group' field into a map
|
||||
*/
|
||||
export function groupResultsByCategory(array) {
|
||||
return array.reduce((hash, obj) => {
|
||||
if (obj.group === undefined) {
|
||||
return hash;
|
||||
}
|
||||
return Object.assign(hash, {
|
||||
[obj.group]: (hash[obj.group] || []).concat(obj),
|
||||
});
|
||||
}, {});
|
||||
}
|
|
@ -192,17 +192,17 @@ $semantics: (
|
|||
--link-font-weight: var(--font-bold-weight);
|
||||
|
||||
// Command Palette
|
||||
--command-palette-results-backdrop-filter: contrast(0.7) brightness(1.5)
|
||||
saturate(1.4) blur(20px);
|
||||
--command-palette-results-backdrop-filter: saturate(1.5) blur(5px);
|
||||
--command-palette-inset-shadow:
|
||||
inset 0 0 2px 2px rgb(255 255 255 / 0.1),
|
||||
var(--jenkins-border--subtle-shadow);
|
||||
var(--jenkins-border--subtle-shadow),
|
||||
0 5px 10px var(--jenkins-border-color--subtle);
|
||||
|
||||
::backdrop {
|
||||
--command-palette-backdrop-background: radial-gradient(
|
||||
farthest-corner at 50% 30vh,
|
||||
rgb(0 0 0 / 0.3),
|
||||
rgb(0 0 0 / 0.1)
|
||||
--command-palette-backdrop-background: color-mix(
|
||||
in sRGB,
|
||||
var(--black) 17.5%,
|
||||
transparent
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
@use "../abstracts/mixins";
|
||||
@use "../base/breakpoints";
|
||||
|
||||
$command-palette-background: color-mix(
|
||||
in sRGB,
|
||||
var(--card-background) 92.5%,
|
||||
transparent
|
||||
);
|
||||
|
||||
.jenkins-command-palette__dialog {
|
||||
background: none;
|
||||
border: none;
|
||||
|
@ -14,19 +20,19 @@
|
|||
|
||||
&::backdrop {
|
||||
background: var(--command-palette-backdrop-background);
|
||||
backdrop-filter: contrast(0.7) brightness(0.9) saturate(1.25) blur(3px);
|
||||
animation: jenkins-dialog-backdrop-animate-in 0.1s linear;
|
||||
backdrop-filter: blur(1px);
|
||||
animation: jenkins-dialog-backdrop-animate-in 0.075s linear;
|
||||
}
|
||||
|
||||
&[open] {
|
||||
animation: command-palette-animate-in 0.1s cubic-bezier(0, 0.68, 0.5, 1.5);
|
||||
animation: command-palette-animate-in 0.075s cubic-bezier(0, 0.68, 0.5, 1.5);
|
||||
}
|
||||
|
||||
&[closing] {
|
||||
animation: command-palette-animate-out 0.1s linear;
|
||||
animation: command-palette-animate-out 0.05s linear;
|
||||
|
||||
&::backdrop {
|
||||
animation: jenkins-dialog-backdrop-animate-out 0.1s linear;
|
||||
animation: jenkins-dialog-backdrop-animate-out 0.05s linear;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -48,7 +54,7 @@
|
|||
}
|
||||
|
||||
.jenkins-command-palette__wrapper {
|
||||
--inset: 15vh;
|
||||
--inset: 10vh;
|
||||
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
@ -76,7 +82,7 @@
|
|||
&__search {
|
||||
--search-bar-height: 3rem !important;
|
||||
|
||||
background: transparent;
|
||||
background: $command-palette-background;
|
||||
box-shadow: var(--command-palette-inset-shadow);
|
||||
margin-bottom: var(--section-padding);
|
||||
border-radius: 1rem;
|
||||
|
@ -109,12 +115,13 @@
|
|||
display: flex;
|
||||
flex-direction: column;
|
||||
border-radius: 1rem;
|
||||
background: $command-palette-background;
|
||||
backdrop-filter: var(--command-palette-results-backdrop-filter);
|
||||
box-shadow: var(--command-palette-inset-shadow);
|
||||
|
||||
// If set to 0, Safari won't always show the backdrop-filter
|
||||
height: 1px;
|
||||
transition: height var(--standard-transition);
|
||||
transition: height 0.15s ease;
|
||||
overflow: hidden;
|
||||
will-change: height;
|
||||
}
|
||||
|
@ -125,14 +132,13 @@
|
|||
padding: 0.5rem;
|
||||
|
||||
&__heading {
|
||||
font-weight: var(--font-bold-weight);
|
||||
font-size: var(--font-size-sm);
|
||||
margin: 0;
|
||||
padding: 0.75rem 0.75rem 0.625rem;
|
||||
padding: 0.375rem 0.625rem;
|
||||
color: var(--text-color-secondary);
|
||||
|
||||
&:not(:first-of-type) {
|
||||
padding-top: 2rem;
|
||||
padding-top: 1.375rem;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -153,10 +159,9 @@
|
|||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
padding: 0.75rem;
|
||||
padding: 0.625rem;
|
||||
border-radius: 0.5rem;
|
||||
color: var(--text-color) !important;
|
||||
transition: var(--standard-transition);
|
||||
|
||||
&--hover {
|
||||
&::before {
|
||||
|
@ -171,7 +176,7 @@
|
|||
justify-content: center;
|
||||
width: 1.375rem;
|
||||
height: 1.375rem;
|
||||
margin-right: 0.75rem;
|
||||
margin-right: 0.625rem;
|
||||
overflow: hidden;
|
||||
pointer-events: none;
|
||||
color: var(--text-color);
|
||||
|
@ -210,8 +215,8 @@
|
|||
&__info {
|
||||
font-size: var(--font-size-sm);
|
||||
margin: 0;
|
||||
padding: 0 14px;
|
||||
line-height: 46px;
|
||||
padding: 0 0.625rem;
|
||||
line-height: 42px;
|
||||
color: var(--text-color);
|
||||
|
||||
span {
|
||||
|
|
|
@ -666,6 +666,7 @@ public class AbstractProjectTest {
|
|||
o.put("url", JSONObject.fromObject(null));
|
||||
o.put("icon", JSONObject.fromObject(null));
|
||||
o.put("type", "symbol");
|
||||
o.put("group", JSONObject.fromObject(null));
|
||||
expected.add(o);
|
||||
}
|
||||
assertThat(suggestions.containsAll(expected), is(true));
|
||||
|
|
Loading…
Reference in New Issue