mark defautl_crawler as system job, add backup online help
This commit is contained in:
parent
8d364e7621
commit
582de1010a
7 changed files with 113 additions and 17 deletions
|
@ -46,7 +46,7 @@ public class AdminBackupAction extends FessAdminAction {
|
|||
@Override
|
||||
protected void setupHtmlData(final ActionRuntime runtime) {
|
||||
super.setupHtmlData(runtime);
|
||||
runtime.registerData("helpLink", systemHelper.getHelpLink(fessConfig.getOnlineHelpNameLog()));
|
||||
runtime.registerData("helpLink", systemHelper.getHelpLink(fessConfig.getOnlineHelpNameBackup()));
|
||||
}
|
||||
|
||||
@Execute
|
||||
|
|
|
@ -168,7 +168,7 @@ public class AdminSchedulerAction extends FessAdminAction {
|
|||
if (form.crudMode.intValue() == CrudMode.EDIT) {
|
||||
// back
|
||||
form.crudMode = CrudMode.DETAILS;
|
||||
return asDetailsHtml();
|
||||
return asDetailsHtml(id);
|
||||
} else {
|
||||
form.crudMode = CrudMode.EDIT;
|
||||
return asEditHtml();
|
||||
|
@ -182,7 +182,9 @@ public class AdminSchedulerAction extends FessAdminAction {
|
|||
public HtmlResponse details(final int crudMode, final String id) {
|
||||
verifyCrudMode(crudMode, CrudMode.DETAILS);
|
||||
saveToken();
|
||||
return asHtml(path_AdminScheduler_AdminSchedulerDetailsJsp).useForm(EditForm.class, op -> {
|
||||
return asHtml(path_AdminScheduler_AdminSchedulerDetailsJsp).renderWith(data -> {
|
||||
data.register("systemJobId", fessConfig.isSystemJobId(id));
|
||||
}).useForm(EditForm.class, op -> {
|
||||
op.setup(form -> {
|
||||
scheduledJobService.getScheduledJob(id).ifPresent(entity -> {
|
||||
loadScheduledJob(form, entity);
|
||||
|
@ -231,14 +233,14 @@ public class AdminSchedulerAction extends FessAdminAction {
|
|||
@Execute
|
||||
public HtmlResponse delete(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.DETAILS);
|
||||
validate(form, messages -> {}, () -> asDetailsHtml());
|
||||
verifyToken(() -> asDetailsHtml());
|
||||
final String id = form.id;
|
||||
validate(form, messages -> {}, () -> asDetailsHtml(id));
|
||||
verifyToken(() -> asDetailsHtml(id));
|
||||
scheduledJobService.getScheduledJob(id).ifPresent(entity -> {
|
||||
scheduledJobService.delete(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudDeleteCrudTable(GLOBAL));
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asDetailsHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asDetailsHtml(id));
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -246,9 +248,9 @@ public class AdminSchedulerAction extends FessAdminAction {
|
|||
@Execute
|
||||
public HtmlResponse start(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.DETAILS);
|
||||
validate(form, messages -> {}, () -> asDetailsHtml());
|
||||
verifyToken(() -> asDetailsHtml());
|
||||
final String id = form.id;
|
||||
validate(form, messages -> {}, () -> asDetailsHtml(id));
|
||||
verifyToken(() -> asDetailsHtml(id));
|
||||
scheduledJobService.getScheduledJob(id).ifPresent(entity -> {
|
||||
try {
|
||||
entity.start();
|
||||
|
@ -256,12 +258,12 @@ public class AdminSchedulerAction extends FessAdminAction {
|
|||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> {
|
||||
messages.addErrorsFailedToStartJob(GLOBAL, entity.getName());
|
||||
}, () -> asDetailsHtml());
|
||||
}, () -> asDetailsHtml(id));
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> {
|
||||
messages.addErrorsFailedToStartJob(GLOBAL, id);
|
||||
}, () -> asDetailsHtml());
|
||||
}, () -> asDetailsHtml(id));
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -269,9 +271,9 @@ public class AdminSchedulerAction extends FessAdminAction {
|
|||
@Execute
|
||||
public HtmlResponse stop(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.DETAILS);
|
||||
validate(form, messages -> {}, () -> asDetailsHtml());
|
||||
verifyToken(() -> asDetailsHtml());
|
||||
final String id = form.id;
|
||||
validate(form, messages -> {}, () -> asDetailsHtml(id));
|
||||
verifyToken(() -> asDetailsHtml(id));
|
||||
scheduledJobService.getScheduledJob(id).ifPresent(entity -> {
|
||||
try {
|
||||
final JobExecutor jobExecutoer = jobHelper.getJobExecutoer(entity.getId());
|
||||
|
@ -280,12 +282,12 @@ public class AdminSchedulerAction extends FessAdminAction {
|
|||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> {
|
||||
messages.addErrorsFailedToStopJob(GLOBAL, entity.getName());
|
||||
}, () -> asDetailsHtml());
|
||||
}, () -> asDetailsHtml(id));
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> {
|
||||
messages.addErrorsFailedToStartJob(GLOBAL, id);
|
||||
}, () -> asDetailsHtml());
|
||||
}, () -> asDetailsHtml(id));
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -365,7 +367,9 @@ public class AdminSchedulerAction extends FessAdminAction {
|
|||
return asHtml(path_AdminScheduler_AdminSchedulerEditJsp);
|
||||
}
|
||||
|
||||
private HtmlResponse asDetailsHtml() {
|
||||
return asHtml(path_AdminScheduler_AdminSchedulerDetailsJsp);
|
||||
private HtmlResponse asDetailsHtml(String id) {
|
||||
return asHtml(path_AdminScheduler_AdminSchedulerDetailsJsp).renderWith(data -> {
|
||||
data.register("systemJobId", fessConfig.isSystemJobId(id));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,6 +66,9 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
|
|||
-XX:+DisableExplicitGC */
|
||||
String JVM_SUGGEST_OPTIONS = "jvm.suggest.options";
|
||||
|
||||
/** The key of the configuration. e.g. default_crawler */
|
||||
String JOB_SYSTEM_JOB_IDS = "job.system.job.ids";
|
||||
|
||||
/** The key of the configuration. e.g. 50 */
|
||||
String CRAWLER_DOCUMENT_MAX_SITE_LENGTH = "crawler.document.max.site.length";
|
||||
|
||||
|
@ -438,6 +441,9 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
|
|||
/** The key of the configuration. e.g. crawlinginfo */
|
||||
String ONLINE_HELP_NAME_CRAWLINGINFO = "online.help.name.crawlinginfo";
|
||||
|
||||
/** The key of the configuration. e.g. backup */
|
||||
String ONLINE_HELP_NAME_BACKUP = "online.help.name.backup";
|
||||
|
||||
/** The key of the configuration. e.g. 0 */
|
||||
String SUGGEST_POPULAR_WORD_SEED = "suggest.popular.word.seed";
|
||||
|
||||
|
@ -573,6 +579,14 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
|
|||
*/
|
||||
String getJvmSuggestOptions();
|
||||
|
||||
/**
|
||||
* Get the value for the key 'job.system.job.ids'. <br>
|
||||
* The value is, e.g. default_crawler <br>
|
||||
* comment: job
|
||||
* @return The value of found property. (NotNull: if not found, exception but basically no way)
|
||||
*/
|
||||
String getJobSystemJobIds();
|
||||
|
||||
/**
|
||||
* Get the value for the key 'crawler.document.max.site.length'. <br>
|
||||
* The value is, e.g. 50 <br>
|
||||
|
@ -1828,6 +1842,13 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
|
|||
*/
|
||||
String getOnlineHelpNameCrawlinginfo();
|
||||
|
||||
/**
|
||||
* Get the value for the key 'online.help.name.backup'. <br>
|
||||
* The value is, e.g. backup <br>
|
||||
* @return The value of found property. (NotNull: if not found, exception but basically no way)
|
||||
*/
|
||||
String getOnlineHelpNameBackup();
|
||||
|
||||
/**
|
||||
* Get the value for the key 'suggest.popular.word.seed'. <br>
|
||||
* The value is, e.g. 0 <br>
|
||||
|
@ -2026,6 +2047,10 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
|
|||
return get(FessConfig.JVM_SUGGEST_OPTIONS);
|
||||
}
|
||||
|
||||
public String getJobSystemJobIds() {
|
||||
return get(FessConfig.JOB_SYSTEM_JOB_IDS);
|
||||
}
|
||||
|
||||
public String getCrawlerDocumentMaxSiteLength() {
|
||||
return get(FessConfig.CRAWLER_DOCUMENT_MAX_SITE_LENGTH);
|
||||
}
|
||||
|
@ -2702,6 +2727,10 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
|
|||
return get(FessConfig.ONLINE_HELP_NAME_CRAWLINGINFO);
|
||||
}
|
||||
|
||||
public String getOnlineHelpNameBackup() {
|
||||
return get(FessConfig.ONLINE_HELP_NAME_BACKUP);
|
||||
}
|
||||
|
||||
public String getSuggestPopularWordSeed() {
|
||||
return get(FessConfig.SUGGEST_POPULAR_WORD_SEED);
|
||||
}
|
||||
|
|
|
@ -130,4 +130,12 @@ public interface FessProp {
|
|||
return getIndexBackupTargets().split(",");
|
||||
}
|
||||
|
||||
String getJobSystemJobIds();
|
||||
|
||||
public default boolean isSystemJobId(String id) {
|
||||
if (StringUtil.isBlank(getJobSystemJobIds())) {
|
||||
return false;
|
||||
}
|
||||
return StreamUtil.of(getJobSystemJobIds().split(",")).anyMatch(s -> s.equals(id));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,6 +46,9 @@ jvm.suggest.options=\
|
|||
#-Xdebug\n\
|
||||
#-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=127.0.0.1:8000\n\
|
||||
|
||||
# job
|
||||
job.system.job.ids=default_crawler
|
||||
|
||||
# ========================================================================================
|
||||
# Index
|
||||
# ====
|
||||
|
@ -241,6 +244,7 @@ online.help.name.labeltype=labeltype
|
|||
online.help.name.duplicatehost=duplicatehost
|
||||
online.help.name.scheduler=scheduler
|
||||
online.help.name.crawlinginfo=crawlinginfo
|
||||
online.help.name.backup=backup
|
||||
|
||||
# ----------------------------------------------------------
|
||||
# Suggest
|
||||
|
|
|
@ -106,7 +106,56 @@
|
|||
</div>
|
||||
<!-- /.box-body -->
|
||||
<div class="box-footer">
|
||||
<jsp:include page="/WEB-INF/view/common/admin/crud/buttons.jsp"></jsp:include>
|
||||
<button type="submit" class="btn btn-default" name="list" value="back">
|
||||
<i class="fa fa-arrow-circle-left"></i>
|
||||
<la:message key="labels.crud_button_back" />
|
||||
</button>
|
||||
<button type="submit" class="btn btn-warning" name="edit"
|
||||
value="<la:message key="labels.crud_button_edit" />">
|
||||
<i class="fa fa-pencil"></i>
|
||||
<la:message key="labels.crud_button_edit" />
|
||||
</button>
|
||||
<c:if test="${!running and !systemJobId}">
|
||||
<button type="button" class="btn btn-danger" name="delete"
|
||||
data-toggle="modal" data-target="#confirmToDelete"
|
||||
value="<la:message key="labels.crud_button_delete" />">
|
||||
<i class="fa fa-trash"></i>
|
||||
<la:message key="labels.crud_button_delete" />
|
||||
</button>
|
||||
<div class="modal modal-danger fade" id="confirmToDelete" tabindex="-1"
|
||||
role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal"
|
||||
aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<h4 class="modal-title">
|
||||
<la:message key="labels.crud_title_delete" />
|
||||
</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>
|
||||
<la:message key="labels.crud_delete_confirmation" />
|
||||
</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-outline pull-left"
|
||||
data-dismiss="modal">
|
||||
<la:message key="labels.crud_button_cancel" />
|
||||
</button>
|
||||
<button type="submit" class="btn btn-outline btn-danger"
|
||||
name="delete"
|
||||
value="<la:message key="labels.crud_button_delete" />">
|
||||
<i class="fa fa-trash"></i>
|
||||
<la:message key="labels.crud_button_delete" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</c:if>
|
||||
<c:if test="${running}">
|
||||
<button type="submit" class="btn btn-danger" name="stop"
|
||||
value="<la:message key="labels.scheduledjob_button_stop" />">
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
<!-- Navbar Right Menu -->
|
||||
<div class="navbar-custom-menu">
|
||||
<ul class="nav navbar-nav">
|
||||
<li><a href="${contextPath}/admin/scheduler/details/4/default_crawler"><i
|
||||
class="fa fa-play-circle"></i></a></li>
|
||||
<li><a href="${helpLink}" target="_olh"><i
|
||||
class="fa fa-question-circle"></i></a></li>
|
||||
<li><a href="${contextPath}/logout"><i
|
||||
|
|
Loading…
Add table
Reference in a new issue