Skip to content

Commit

Permalink
#645 Add check that Solr service exist
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitryKolinchuk committed Nov 25, 2021
1 parent b2bca99 commit 31b06a3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/SIM.Base/SolrState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ public class SolrState
public enum CurrentState
{
Running,
Stopped
Stopped,
ServiceNotExist
}
}
}
2 changes: 1 addition & 1 deletion src/SIM.Base/SolrStateResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public virtual SolrState.CurrentState GetServiceState(string solrServiceName)

if (service == null)
{
return SolrState.CurrentState.Stopped;
return SolrState.CurrentState.ServiceNotExist;
}

if (service.Status != ServiceControllerStatus.Running)
Expand Down
4 changes: 2 additions & 2 deletions src/SIM.Tool.Windows/Dialogs/GridEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ private List<SolrState> GetSolrStates()
// If Solr service is not running, possibly Solr is started using CMD, in this case Solr Url accesibility can be checked
foreach (SolrState solrState in solrStates)
{
if (solrState.State == SolrState.CurrentState.Stopped && !solrStates.Any(s =>
if (solrState.State != SolrState.CurrentState.Running && !solrStates.Any(s =>
s.State == SolrState.CurrentState.Running && s.Url == solrState.Url))
{
solrState.State = solrStateResolver.GetUrlState(solrState.Url);
Expand Down Expand Up @@ -226,7 +226,7 @@ private void UpdateDataGridRowColor()
{
row.Background = (SolidColorBrush)new BrushConverter().ConvertFrom("#ccffcc");
}
else if (state == SolrState.CurrentState.Stopped)
else if (state == SolrState.CurrentState.Stopped || state == SolrState.CurrentState.ServiceNotExist)
{
row.Background = (SolidColorBrush)new BrushConverter().ConvertFrom("#f2f2f2");
}
Expand Down

0 comments on commit 31b06a3

Please sign in to comment.