frontend/search/ui fixes
This commit is contained in:
parent
6673a24466
commit
1ff7cd7290
|
@ -59,7 +59,7 @@ config :backend, Backend.Repo,
|
||||||
config :backend, :crawler,
|
config :backend, :crawler,
|
||||||
status_age_limit_days: 28,
|
status_age_limit_days: 28,
|
||||||
status_count_limit: 100,
|
status_count_limit: 100,
|
||||||
personal_instance_threshold: 1,
|
personal_instance_threshold: 5,
|
||||||
crawl_interval_mins: 1,
|
crawl_interval_mins: 1,
|
||||||
crawl_workers: 10,
|
crawl_workers: 10,
|
||||||
blacklist: [
|
blacklist: [
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
defmodule BackendWeb.SearchView do
|
defmodule BackendWeb.SearchView do
|
||||||
use BackendWeb, :view
|
use BackendWeb, :view
|
||||||
alias BackendWeb.SearchView
|
alias BackendWeb.SearchView
|
||||||
require Logger
|
import Backend.Util
|
||||||
|
|
||||||
def render("index.json", %{instances: instances, next: next}) do
|
def render("index.json", %{instances: instances, next: next}) do
|
||||||
%{
|
%{
|
||||||
|
@ -11,9 +11,18 @@ defmodule BackendWeb.SearchView do
|
||||||
end
|
end
|
||||||
|
|
||||||
def render("instance.json", %{instance: instance}) do
|
def render("instance.json", %{instance: instance}) do
|
||||||
|
threshold = get_config(:personal_instance_threshold)
|
||||||
|
|
||||||
|
description =
|
||||||
|
if instance.user_count != nil and instance.user_count < threshold do
|
||||||
|
nil
|
||||||
|
else
|
||||||
|
instance.description
|
||||||
|
end
|
||||||
|
|
||||||
%{
|
%{
|
||||||
name: instance.domain,
|
name: instance.domain,
|
||||||
description: instance.description,
|
description: description,
|
||||||
userCount: instance.user_count
|
userCount: instance.user_count
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
|
@ -72,7 +72,6 @@ interface IInstanceScreenProps {
|
||||||
isLoadingInstanceDetails: boolean;
|
isLoadingInstanceDetails: boolean;
|
||||||
navigateToRoot: () => void;
|
navigateToRoot: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IInstanceScreenState {
|
interface IInstanceScreenState {
|
||||||
neighbors?: string[];
|
neighbors?: string[];
|
||||||
isProcessingNeighbors: boolean;
|
isProcessingNeighbors: boolean;
|
||||||
|
@ -119,8 +118,10 @@ class InstanceScreenImpl extends React.PureComponent<IInstanceScreenProps, IInst
|
||||||
this.processEdgesToFindNeighbors();
|
this.processEdgesToFindNeighbors();
|
||||||
}
|
}
|
||||||
|
|
||||||
public componentDidUpdate(prevProps: IInstanceScreenProps, prevState: IInstanceScreenState) {
|
public componentDidUpdate(prevProps: IInstanceScreenProps) {
|
||||||
if (prevProps.instanceName !== this.props.instanceName) {
|
const isNewInstance = prevProps.instanceName !== this.props.instanceName;
|
||||||
|
const receivedNewEdges = !!this.props.graph && !this.state.isProcessingNeighbors && !this.state.neighbors;
|
||||||
|
if (isNewInstance || receivedNewEdges) {
|
||||||
this.processEdgesToFindNeighbors();
|
this.processEdgesToFindNeighbors();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,7 @@ class SearchScreen extends React.PureComponent<ISearchScreenProps, ISearchScreen
|
||||||
};
|
};
|
||||||
|
|
||||||
private handleKeyPress = (event: React.KeyboardEvent<HTMLInputElement>) => {
|
private handleKeyPress = (event: React.KeyboardEvent<HTMLInputElement>) => {
|
||||||
if (event.key === "Enter") {
|
if (event.key === "Enter" && this.state.currentQuery !== this.props.query) {
|
||||||
this.search();
|
this.search();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue