Skip to content

Commit

Permalink
Add the option to scan all items for missing metadata...
Browse files Browse the repository at this point in the history
Not just those that were created manually
  • Loading branch information
mikesname committed Nov 20, 2024
1 parent d4ef371 commit 0cdbd52
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
8 changes: 4 additions & 4 deletions modules/admin/app/actors/datamodel/Auditor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ case class Auditor(searchEngine: SearchEngine, resolver: SearchItemResolver, fie

private def initSearch(task: AuditTask): SearchQuery = {
val paging: PageParams = PageParams(limit = batchSize)
val params: SearchParams = SearchParams(entities = Seq(task.entityType), query = task.idPrefix.map(p => s"$p*"), sort = Some(SearchSort.Id))
val cpFacet = AppliedFacet(SearchConstants.CREATION_PROCESS, Seq(Description.CreationProcess.Manual.toString))
val facets = List(FieldFacetClass(key = SearchConstants.CREATION_PROCESS, name = "Creation Process", param = "creation"))
SearchQuery(params = params, paging = paging, appliedFacets = Seq(cpFacet), user = userOpt, facetClasses = facets)
val params: SearchParams = SearchParams(entities = Seq(task.entityType), query = task.idPrefix.filter(_.nonEmpty).map(p => s"$p*"), sort = Some(SearchSort.Id))
val facets = if(task.manualOnly) List(FieldFacetClass(key = SearchConstants.CREATION_PROCESS, name = "Creation Process", param = "creation")) else Nil
val applied = if(task.manualOnly) Seq(AppliedFacet(SearchConstants.CREATION_PROCESS, Seq(Description.CreationProcess.Manual.toString))) else Nil
SearchQuery(params = params, paging = paging, appliedFacets = applied, user = userOpt, facetClasses = facets)
}
}
2 changes: 1 addition & 1 deletion modules/admin/app/actors/datamodel/AuditorManager.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import scala.concurrent.duration.DurationInt

object AuditorManager {

case class AuditTask(entityType: EntityType.Value, idPrefix: Option[String] = None, mandatoryOnly: Boolean)
case class AuditTask(entityType: EntityType.Value, idPrefix: Option[String] = None, mandatoryOnly: Boolean = true, manualOnly: Boolean = true)
object AuditTask {
implicit val _format: Format[AuditTask] = Json.format[AuditTask]
}
Expand Down
8 changes: 7 additions & 1 deletion modules/admin/app/assets/js/dmeditor/auditor-app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export default {
running: false,
idPrefix: '',
mandatoryOnly: true,
manualOnly: true,
entityType: 'Repository' as EntityType,
filter: {value: '', active: false},
api: new AuditorApi(this.service),
Expand All @@ -42,7 +43,8 @@ export default {
let {url, jobId} = await this.api.runAudit({
idPrefix: this.idPrefix,
entityType: this.entityType,
mandatoryOnly: this.mandatoryOnly
mandatoryOnly: this.mandatoryOnly,
manualOnly: this.manualOnly,
});
console.log("Monitor: ", url, jobId);
self.jobId = jobId;
Expand Down Expand Up @@ -138,6 +140,10 @@ export default {
<input v-model="mandatoryOnly" id="opt_mandatoryOnly" class="form-check-input" type="checkbox"/>
<label for="opt_mandatoryOnly" class="form-check-label">{{ $t(`dataModel.audit.mandatoryOnly`) }}</label>
</div>
<div class="form-group form-check">
<input v-model="manualOnly" id="opt_manualOnly" class="form-check-input" type="checkbox"/>
<label for="opt_manualOnly" class="form-check-label">{{ $t(`dataModel.audit.manualOnly`) }}</label>
</div>
</fieldset>
<button v-if="running" class="btn btn-sm btn-default" v-on:click.prevent="cancelAudit">
<i class="fa fa-fw fa-circle-o-notch fa-spin"></i> Cancel Audit
Expand Down
2 changes: 2 additions & 0 deletions modules/admin/conf/messages
Original file line number Diff line number Diff line change
Expand Up @@ -1587,6 +1587,8 @@ dataModel.audit.entityType=Entity Type
dataModel.audit.entityType.description=The type of entity to audit
dataModel.audit.mandatoryOnly=Check Mandatory Fields Only
dataModel.audit.mandatoryOnly.description=Check only mandatory fields, ignoring desirable fields
dataModel.audit.manualOnly=Skip Imported Items
dataModel.audit.manualOnly.description=Only check items that have a manual creation process
dataModel.audit.idPrefix=ID Prefix
dataModel.audit.idPrefix.description=Narrow the scope of the audit scan by specifying an ID prefix, e.g. 'gb-00' for UK items...
dataModel.audit.runAudit=Run Audit
Expand Down

0 comments on commit 0cdbd52

Please sign in to comment.