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
684997d
commit bdcb9b7
Showing
6 changed files
with
39 additions
and
43 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import {LinkResult} from "./models"; | ||
import Search from "@/api/search"; | ||
|
||
export const JenkinsSearchSource = { | ||
async execute(query) { | ||
const response = await Search.search(query); | ||
return await response.json().then(data => { | ||
return [...data["suggestions"]].map(e => new LinkResult(e.icon, e.name, e.description, e.category, e.url)); | ||
}); | ||
} | ||
} |
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,10 +1,10 @@ | ||
// Group suggestions by 'category' field into map | ||
function groupByKey(array, key) { | ||
// Group results by 'category' field into map | ||
function groupResultsByCategory(array) { | ||
return array | ||
.reduce((hash, obj) => { | ||
if (obj[key] === undefined) return hash | ||
return Object.assign(hash, {[obj[key]]: (hash[obj[key]] || []).concat(obj)}) | ||
if (obj.category === undefined) return hash | ||
return Object.assign(hash, {[obj.category]: (hash[obj.category] || []).concat(obj)}) | ||
}, {}) | ||
} | ||
|
||
export default {groupByKey: groupByKey}; | ||
export default {groupResultsByCategory: groupResultsByCategory}; |
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 was deleted.
Oops, something went wrong.
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