Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
ml054 committed Apr 10, 2024
1 parent 6f28ee0 commit a73c5d6
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 4 deletions.
12 changes: 12 additions & 0 deletions src/Raven.Studio/typescript/common/shell/menu/items/databases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ function getDatabasesMenuItem(appUrls: computedAppUrls) {
return new leafMenuItem({
route: "databases",
title: "Databases",
search: {
innerActions: [
{
name: "New Database",
alternativeNames: ["Create Database", "second", "third"] //TODO:
},
{
name: "fruits",
alternativeNames: ["apple", "banana"] //TODO:
}
],
},
moduleId: databasesView,
nav: true,
css: 'icon-resources',
Expand Down
32 changes: 32 additions & 0 deletions src/Raven.Studio/typescript/common/shell/menu/items/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ function getSettingsMenuItem(appUrls: computedAppUrls) {
new leafMenuItem({
route: 'databases/settings/clientConfiguration',
moduleId: bridgeToReact(ClientDatabaseConfiguration, "nonShardedView"),
search: {
innerActions: [
{
name: "Identity parts separator"
},
{
name: "Maximum number of requests per session"
}
],
},
shardingMode: "allShards",
title: 'Client Configuration',
nav: true,
Expand All @@ -65,6 +75,18 @@ function getSettingsMenuItem(appUrls: computedAppUrls) {
}),
new leafMenuItem({
route: 'databases/settings/studioConfiguration',
search: {
alternativeTitles: ["testing"], //TODO:
innerActions: [
{
name: "Database Environment",
alternativeNames: ["baca", "ml054"]// TODO:
},
{
name: "Storage Environment",
}
],
},
moduleId: bridgeToReact(StudioDatabaseConfiguration, "nonShardedView"),
shardingMode: "allShards",
title: 'Studio Configuration',
Expand All @@ -78,6 +100,16 @@ function getSettingsMenuItem(appUrls: computedAppUrls) {
moduleId: bridgeToReact(DocumentRevisions, "nonShardedView"),
shardingMode: "allShards",
title: 'Document Revisions',
search: {
innerActions: [
{
name: "Revert revisions"
},
{
name: "Enforce revisions configuration"
}
],
},
nav: true,
css: 'icon-revisions',
dynamicHash: appUrls.revisions
Expand Down
18 changes: 14 additions & 4 deletions src/Raven.Studio/typescript/common/shell/searchBox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ class searchBox {
this.highlightFirst();
});

/* TODO
this.$searchInput.keydown(e => {
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
this.changeHighlightedItem(e.key === "ArrowDown" ? "down" : "up", [
Expand All @@ -126,7 +127,7 @@ class searchBox {
}
return true;
});
});*/

this.searchQuery.subscribe(() => {
this.highlightedItem(null);
Expand Down Expand Up @@ -161,7 +162,7 @@ class searchBox {
}));
this.results.get("document")(documents);

this.highlightFirst();
//TODO: this.highlightFirst();
})
.always(() => this.spinners.startsWith(false));
} else {
Expand Down Expand Up @@ -240,6 +241,8 @@ class searchBox {

this.omniSearch.register("collection", searchItems);
}

// TODO: call this!
onIndexesUpdated(indexNames: string[]) {
const searchItems: SearchItem[] = indexNames.map(indexName => {
return {
Expand All @@ -251,15 +254,19 @@ class searchBox {
});

this.omniSearch.register("index", searchItems);
}

private highlightFirst() {
/* TODO
if (this.matchedDocumentIds().length) {
this.highlightedItem({ index: 0, listing: "matchedDocument" });
} else if (this.recentDocumentsList().length) {
this.highlightedItem({ index: 0, listing: "recentDocument" });
}
}*/
}

private changeHighlightedItem(direction: "up" | "down", items: Array<{ listName: "matchedDocument" | "recentDocument", list: Array<any>}>) {
/*
const highlight = this.highlightedItem();
items = items.filter(x => x.list.length);
Expand Down Expand Up @@ -321,10 +328,12 @@ class searchBox {
listing: items[previousListingIdx].listName
});
}
}*/
}

private dispatchGoToItem(newTab: boolean) {
const highlight = this.highlightedItem();
/* TODO
if (highlight) {
switch (highlight.listing) {
case "recentDocument":
Expand All @@ -338,7 +347,8 @@ class searchBox {
// user hit enter but values still loading
// try to load document by name
this.goToDocument(this.searchQuery(), newTab);
}
}*/
}

private goToMenuItem(item: leafMenuItem, event: JQueryMouseEventObject) {
const url = item.dynamicHash();
Expand Down

0 comments on commit a73c5d6

Please sign in to comment.