Skip to content

Commit 01c1259

Browse files
authored
Merge pull request #139 from Paul-Blanchaert/configurable-search-index-name
Configurable search index name: solr/elastic/opensearch
2 parents 3668efb + 2ad986b commit 01c1259

File tree

7 files changed

+43
-17
lines changed

7 files changed

+43
-17
lines changed

app/models/FeatureToggleModel.scala

+15-1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ package object FeatureToggleModel extends Logging {
5454
private val FEATURE_TOGGLE_RULE_DEPLOYMENT_CUSTOM_SCRIPT = "toggle.rule-deployment.custom-script"
5555
private val FEATURE_TOGGLE_RULE_DEPLOYMENT_CUSTOM_SCRIPT_SMUI2SOLR_SH_PATH = "toggle.rule-deployment.custom-script-SMUI2SOLR-SH_PATH"
5656
private val FEATURE_TOGGLE_HEADLINE = "toggle.headline"
57+
private val FEATURE_TOGGLE_DEPLOYMENT_LABEL = "toggle.rule-deployment-label"
58+
private val FEATURE_TOGGLE_DEPLOYMENT_PRELIVE_LABEL = "toggle.rule-deployment-prelive-label"
5759
private val ACTIVATE_RULE_TAGGING = "toggle.rule-tagging"
5860
private val PREDEFINED_TAGS_FILE = "toggle.predefined-tags-file"
5961
private val SMUI_VERSION = "smui.version"
@@ -160,7 +162,11 @@ package object FeatureToggleModel extends Logging {
160162
}
161163
}
162164
)
163-
)
165+
),
166+
JsFeatureToggle(FEATURE_TOGGLE_DEPLOYMENT_LABEL, new JsStringFeatureToggleValue(
167+
appConfig.getOptional[String](FEATURE_TOGGLE_DEPLOYMENT_LABEL).getOrElse("LIVE"))),
168+
JsFeatureToggle(FEATURE_TOGGLE_DEPLOYMENT_PRELIVE_LABEL, new JsStringFeatureToggleValue(
169+
appConfig.getOptional[String](FEATURE_TOGGLE_DEPLOYMENT_PRELIVE_LABEL).getOrElse("PRELIVE")))
164170
)
165171
}
166172

@@ -216,6 +222,14 @@ package object FeatureToggleModel extends Logging {
216222
appConfig.getOptional[Boolean](FEATURE_TOGGLE_RULE_DEPLOYMENT_PRE_LIVE_PRESENT).getOrElse(false)
217223
}
218224

225+
def getSmuiRuleDeploymentLabel: String = {
226+
appConfig.getOptional[String](FEATURE_TOGGLE_DEPLOYMENT_LABEL).getOrElse("LIVE")
227+
}
228+
229+
def getSmuiRuleDeploymentPreliveLabel: String = {
230+
appConfig.getOptional[String](FEATURE_TOGGLE_DEPLOYMENT_PRELIVE_LABEL).getOrElse("PRELIVE")
231+
}
232+
219233
}
220234

221235
}

app/models/SearchManagementRepository.scala

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,17 @@ class SearchManagementRepository @Inject()(dbapi: DBApi, toggleService: FeatureT
4848
val solrIndexIdId = SolrIndexId(solrIndexId)
4949
val inputTags = InputTag.loadAll.filter(_.solrIndexId== Option(solrIndexIdId))
5050
if (inputTags.size > 0) {
51-
throw new Exception("Can't delete Solr Index that has " + inputTags.size + "tags existing");
51+
throw new Exception("Can't delete rules collection that has " + inputTags.size + "tags existing");
5252
}
5353

5454
val canonicalSpellings = CanonicalSpelling.loadAllForIndex(solrIndexIdId)
5555
if (canonicalSpellings.size > 0) {
56-
throw new Exception("Can't delete Solr Index that has " + canonicalSpellings.size + " canonical spellings existing");
56+
throw new Exception("Can't delete rules collection that has " + canonicalSpellings.size + " canonical spellings existing");
5757
}
5858

5959
val searchInputs = SearchInput.loadAllForIndex(solrIndexIdId)
6060
if (searchInputs.size > 0) {
61-
throw new Exception("Can't delete Solr Index that has " + searchInputs.size + " inputs existing");
61+
throw new Exception("Can't delete rules collection that has " + searchInputs.size + " inputs existing");
6262
}
6363

6464
// TODO consider reconfirmation and deletion of history entries (if some exist) (see https://github.com/querqy/smui/issues/97)

build.sbt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import com.typesafe.sbt.GitBranchPrompt
22

33
name := "search-management-ui"
4-
version := "4.0.8"
4+
version := "4.0.9"
55
maintainer := "Contact productful.io <hello@productful.io>"
66

77
scalaVersion := "2.12.17"

conf/application.conf

+6
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ toggle.rule-deployment.custom-script-SMUI2SOLR-SH_PATH=${?SMUI_TOGGLE_DEPL_CUSTO
8989
toggle.headline="Search Management UI"
9090
toggle.headline=${?SMUI_HEADLINE}
9191

92+
toggle.rule-deployment-label="LIVE"
93+
toggle.rule-deployment-label=${?SMUI_TOGGLE_DEPL_NAME}
94+
95+
toggle.deploy-prelive-fn-label="PRELIVE"
96+
toggle.deploy-prelive-fn-label=${?SMUI_TOGGLE_PRELIVE_NAME}
97+
9298
toggle.rule-tagging=false
9399
toggle.rule-tagging=${?SMUI_RULE_TAGGING_ACTIVE}
94100

frontend/src/app/components/header-nav/header-nav.component.html

+11-8
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
</ul>
7272

7373
<div *ngIf="hideSolrIndexSelector()">
74-
In order to push the rules, <a routerLink="/admin">please create a Solr collection first</a>.
74+
In order to push the rules, <a routerLink="/admin">please create a rules collection first</a>.
7575
</div>
7676
<div
7777
*ngIf="currentSolrIndexId && currentSolrIndexId !== '-1'"
@@ -80,7 +80,10 @@
8080

8181
<div class="depl-info-container border-left border-right pl-2">
8282
<ng-container *ngFor="let singleDeploymentInfo of deploymentLogInfo; index as idxDeploy">
83-
<span class="depl-info-row-instance"><b>{{ singleDeploymentInfo.targetSystem }}</b> deployment:</span>
83+
<span class="depl-info-row-instance">
84+
<b>{{ (singleDeploymentInfo.targetSystem == 'PRELIVE' ?
85+
featureToggleService.getSync('toggle.rule-deployment-prelive-label') :
86+
featureToggleService.getSync('toggle.rule-deployment-label'))}}</b> deployment:</span>
8487
<span class="depl-info-row-datetime"><b>{{ singleDeploymentInfo.formattedDateTime }}</b></span>
8588
<span class="depl-info-row-result">
8689
<b
@@ -105,6 +108,9 @@
105108
</div>
106109
<div class="btn-group">
107110
<button
111+
*ngIf="
112+
featureToggleService.getSyncToggleRuleDeploymentPreLivePresent()
113+
"
108114
type="button"
109115
class="btn btn-outline-primary"
110116
(click)="publishSolrConfig()"
@@ -117,9 +123,6 @@
117123
{{ publishToPreliveButtonText() }}
118124
</button>
119125
<button
120-
*ngIf="
121-
featureToggleService.getSyncToggleRuleDeploymentPreLivePresent()
122-
"
123126
type="button"
124127
class="btn btn-outline-danger"
125128
(click)="modalService.open('confirm-publish-live')"
@@ -161,9 +164,9 @@
161164
</div>
162165
</app-smui-modal>
163166

164-
<app-smui-modal id="confirm-publish-live" title="Confirm publish to LIVE">
167+
<app-smui-modal id="confirm-publish-live" title="Confirm publish to {{ featureToggleService.getSync('toggle.rule-deployment-label') }}">
165168
<div content>
166-
<p>Are you sure to publish current Search Rules to LIVE?</p>
169+
<p>Are you sure to publish current Search Rules to {{ featureToggleService.getSync('toggle.rule-deployment-label') }}?</p>
167170
</div>
168171
<div footer class="btn-toolbar">
169172
<button
@@ -172,7 +175,7 @@
172175
(click)="requestPublishRulesTxtToSolr('LIVE')"
173176
>
174177
<i class="fa fa-thumbs-up smui-icon"></i>
175-
Yes, publish to LIVE
178+
Yes, publish to {{ featureToggleService.getSync('toggle.rule-deployment-label') }}
176179
</button>
177180
<button
178181
class="btn btn-danger"

frontend/src/app/components/header-nav/header-nav.component.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,14 @@ export class HeaderNavComponent implements OnInit {
103103

104104
public publishToPreliveButtonText(): string {
105105
return this.deploymentRunningForStage === 'PRELIVE'
106-
? 'Pushing to Solr...'
107-
: 'Push Config to Solr';
106+
? 'Publishing to ' + this.featureToggleService.getSync('toggle.rule-deployment-prelive-label') + '...'
107+
: 'Publish to ' + this.featureToggleService.getSync('toggle.rule-deployment-prelive-label') + '';
108108
}
109109

110110
public publishToLiveButtonText(): string {
111111
return this.deploymentRunningForStage === 'LIVE'
112-
? 'Publishing to LIVE...'
113-
: 'Publish to LIVE';
112+
? 'Publishing to ' + this.featureToggleService.getSync('toggle.rule-deployment-label') + '...'
113+
: 'Publish to ' + this.featureToggleService.getSync('toggle.rule-deployment-label') + '';
114114
}
115115

116116
public publishSolrConfig() {

frontend/src/app/services/feature-toggle.service.ts

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ const FEATURE_TOGGLE_UI_LIST_LIMIT_ITEMS_TO = 'toggle.ui-list.limit-items-to';
99
const FEATURE_ACTIVATE_SPELLING = 'toggle.activate-spelling';
1010
const FEATURE_ACTIVATE_EVENTHISTORY = 'toggle.activate-eventhistory';
1111
const FEATURE_CUSTOM_UP_DOWN_MAPPINGS = 'toggle.ui-concept.custom.up-down-dropdown-mappings';
12+
const FEATURE_TOGGLE_DEPLOYMENT_LABEL = "toggle.rule-deployment-label";
13+
const FEATURE_TOGGLE_DEPLOYMENT_PRELIVE_LABEL = "toggle.rule-deployment-prelive-label";
14+
1215

1316
@Injectable({
1417
providedIn: 'root'

0 commit comments

Comments
 (0)