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
8b50d9e
commit 9ef136f
Showing
12 changed files
with
180 additions
and
30 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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 |
---|---|---|
@@ -1,13 +1,30 @@ | ||
package hudson.search; | ||
|
||
public class SearchItemCategory { | ||
public final static String PAGES = "Pages"; | ||
public final static String SETTINGS = "Settings"; | ||
public final static String VIEWS = "Views"; | ||
public final static String JOBS = "Jobs"; | ||
public final static String BUILDS = "Builds"; | ||
public final static String PEOPLE = "People"; | ||
public final static String NODES = "Nodes"; | ||
public final static String IN_PAGE_ACTIONS = "In-page action"; | ||
public final static String OTHER = "Other"; | ||
import org.jenkins.ui.icon.Icon; | ||
|
||
public enum SearchItemCategory { | ||
PAGES("Pages", "symbol-details"), | ||
SETTINGS("Settings", "symbol-settings"), | ||
VIEWS("Views", "symbol-settings"), | ||
JOBS("Jobs", "symbol-reload"), | ||
BUILDS("Builds", "symbol-settings"), | ||
PEOPLE("People", "symbol-person"), | ||
NODES("Nodes", "symbol-computer"), | ||
OTHER("Other", "symbol-cube"); | ||
|
||
private final String name; | ||
private final Icon icon; | ||
|
||
SearchItemCategory(String name, String iconSource) { | ||
this.name = name; | ||
this.icon = new Icon(iconSource, ""); | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public Icon getIcon() { | ||
return icon; | ||
} | ||
} |
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,107 @@ | ||
/* | ||
* The MIT License | ||
* | ||
* Copyright (c) 2015, CloudBees, Inc. | ||
* | ||
* 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. | ||
*/ | ||
|
||
package jenkins; | ||
|
||
import hudson.Extension; | ||
import hudson.model.RootAction; | ||
import hudson.util.HttpResponses; | ||
import net.sf.json.JSONObject; | ||
import org.jenkins.ui.icon.IconSet; | ||
import org.kohsuke.accmod.Restricted; | ||
import org.kohsuke.accmod.restrictions.NoExternalUse; | ||
import org.kohsuke.stapler.HttpResponse; | ||
import org.kohsuke.stapler.StaplerRequest; | ||
|
||
import java.util.Locale; | ||
|
||
import static hudson.Functions.extractPluginNameFromIconSrc; | ||
|
||
/** | ||
* Internationalization REST (ish) API. | ||
* @author <a href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a> | ||
* @since 2.0 | ||
*/ | ||
@Extension | ||
@Restricted(NoExternalUse.class) | ||
public class Symbols implements RootAction { | ||
|
||
@Override | ||
public String getIconFileName() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public String getDisplayName() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public String getUrlName() { | ||
return "symbols"; | ||
} | ||
|
||
/** | ||
* Get a localised resource bundle. | ||
* <p> | ||
* URL: {@code i18n/resourceBundle}. | ||
* <p> | ||
* Parameters: | ||
* <ul> | ||
* <li>{@code baseName}: The resource bundle base name.</li> | ||
* <li>{@code language}: {@link Locale} Language. (optional)</li> | ||
* <li>{@code country}: {@link Locale} Country. (optional)</li> | ||
* <li>{@code variant}: {@link Locale} Language variant. (optional)</li> | ||
* </ul> | ||
* | ||
* @param request The request. | ||
* @return The JSON response. | ||
*/ | ||
public HttpResponse doIndex(StaplerRequest request) { | ||
String symbol = request.getParameter("symbol"); | ||
|
||
if (symbol == null) { | ||
return HttpResponses.errorJSON("Mandatory parameter 'symbol' not specified."); | ||
} | ||
|
||
symbol = symbol.replace("symbol-", ""); | ||
|
||
// String title = request.getParameter("title"); | ||
// String tooltip = request.getParameter("tooltip"); | ||
// String classes = request.getParameter("classes"); | ||
// String pluginName = extractPluginNameFromIconSrc(symbol); | ||
// String id = request.getParameter("id"); | ||
|
||
String title = ""; | ||
String tooltip = ""; | ||
String classes = ""; | ||
String pluginName = extractPluginNameFromIconSrc(symbol); | ||
String id = ""; | ||
|
||
JSONObject jsonObject = new JSONObject(); | ||
jsonObject.put("symbol", IconSet.getSymbol(symbol, title, tooltip, classes, pluginName, id)); | ||
|
||
return HttpResponses.okJSON(jsonObject); | ||
} | ||
} |
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,7 @@ | ||
import jenkins from "@/util/jenkins"; | ||
|
||
export function getSymbol(symbol, handler) { | ||
jenkins.get("/symbols?symbol=" + symbol, function(res) { | ||
handler(res.data["symbol"]) | ||
}, {async: false}); | ||
} |
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.