Skip to content

Commit 35e7b7b

Browse files
committed
bug fixes for alpha 4
1 parent af26d9c commit 35e7b7b

File tree

14 files changed

+116
-33
lines changed

14 files changed

+116
-33
lines changed

marklogic-data-hub/src/main/resources/ml-modules/root/com.marklogic.hub/lib/hub-entities.xqy

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ declare function hent:database-properties-generate(
207207
let $entity-type-names := map:keys($definitions)
208208
let $range-path-indexes := json:array()
209209
let $word-lexicons := json:array()
210+
let $range-element-indexes := json:array()
210211
let $_ :=
211212
for $entity-type-name in $entity-type-names
212213
let $entity-type := map:get($definitions, $entity-type-name)
@@ -236,6 +237,22 @@ declare function hent:database-properties-generate(
236237
let $_ := map:put($wl-map, "localname", $word-lexicon-property)
237238
let $_ := map:put($wl-map, "namespace-uri", "")
238239
return json:array-push($word-lexicons, $wl-map)
240+
,
241+
let $primary-key-property := map:get($entity-type, "primaryKey")
242+
where $primary-key-property
243+
return
244+
let $pk-map := json:object()
245+
let $property := map:get($properties, $primary-key-property)
246+
let $specified-datatype := esi:resolve-datatype($model, $entity-type-name, $primary-key-property)
247+
let $datatype := esi:indexable-datatype($specified-datatype)
248+
let $collation := head( (map:get($property, "collation"), "http://marklogic.com/collation/en") )
249+
let $_ := map:put($pk-map, "collation", $collation)
250+
let $_ := map:put($pk-map, "localname", $primary-key-property)
251+
let $_ := map:put($pk-map, "namespace-uri", "")
252+
let $_ := map:put($pk-map, "range-value-positions", fn:false())
253+
let $_ := map:put($pk-map, "scalar-type", $datatype)
254+
let $_ := map:put($pk-map, "invalid-values", "reject")
255+
return json:array-push($range-element-indexes, $pk-map)
239256
)
240257
let $path-namespaces := json:array()
241258
let $pn := json:object()
@@ -246,5 +263,6 @@ declare function hent:database-properties-generate(
246263
let $_ := map:put($database-properties, "path-namespace", $path-namespaces)
247264
let $_ := map:put($database-properties, "element-word-lexicon", $word-lexicons)
248265
let $_ := map:put($database-properties, "range-path-index", $range-path-indexes)
266+
let $_ := map:put($database-properties, "range-element-index", $range-element-indexes)
249267
return xdmp:to-json($database-properties)
250268
};

quick-start/src/main/java/com/marklogic/quickstart/service/EntityManagerService.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ public void deleteEntity(String entity) throws IOException {
122122
}
123123
}
124124

125-
public List<JsonNode> getRawEntities() throws IOException {
125+
public List<JsonNode> getRawEntities(EnvironmentConfig environmentConfig) throws IOException {
126126
List<JsonNode> entities = new ArrayList<>();
127-
Path entitiesPath = Paths.get(envConfig().getProjectDir(), PLUGINS_DIR, ENTITIES_DIR);
127+
Path entitiesPath = Paths.get(environmentConfig.getProjectDir(), PLUGINS_DIR, ENTITIES_DIR);
128128
List<String> entityNames = FileUtil.listDirectFolders(entitiesPath.toFile());
129129
ObjectMapper objectMapper = new ObjectMapper();
130130
for (String entityName : entityNames) {
@@ -136,9 +136,9 @@ public List<JsonNode> getRawEntities() throws IOException {
136136
return entities;
137137
}
138138

139-
public void saveSearchOptions() {
139+
public void saveSearchOptions(EnvironmentConfig environmentConfig) {
140140

141-
HubConfig hubConfig = envConfig().getMlSettings();
141+
HubConfig hubConfig = environmentConfig.getMlSettings();
142142
AppConfig config = hubConfig.getAppConfig();
143143
XccAssetLoader xccAssetLoader = config.newXccAssetLoader();
144144

@@ -160,10 +160,10 @@ public void saveSearchOptions() {
160160
modulesLoader.setDatabaseClient(hubConfig.newFinalClient());
161161
modulesLoader.setShutdownTaskExecutorAfterLoadingModules(false);
162162

163-
SearchOptionsGenerator generator = new SearchOptionsGenerator(envConfig().getStagingClient());
163+
SearchOptionsGenerator generator = new SearchOptionsGenerator(environmentConfig.getStagingClient());
164164
try {
165-
String options = generator.generateOptions(getRawEntities());
166-
Path dir = Paths.get(envConfig().getProjectDir(), HubConfig.ENTITY_CONFIG_DIR);
165+
String options = generator.generateOptions(getRawEntities(environmentConfig));
166+
Path dir = Paths.get(environmentConfig.getProjectDir(), HubConfig.ENTITY_CONFIG_DIR);
167167
if (!dir.toFile().exists()) {
168168
dir.toFile().mkdirs();
169169
}
@@ -177,12 +177,12 @@ public void saveSearchOptions() {
177177
}
178178
}
179179

180-
public void saveDbIndexes() {
181-
DbIndexGenerator generator = new DbIndexGenerator(envConfig().getFinalClient());
180+
public void saveDbIndexes(EnvironmentConfig environmentConfig) {
181+
DbIndexGenerator generator = new DbIndexGenerator(environmentConfig.getFinalClient());
182182
try {
183-
String indexes = generator.getIndexes(getRawEntities());
183+
String indexes = generator.getIndexes(getRawEntities(environmentConfig));
184184

185-
Path dir = envConfig().getMlSettings().getEntityDatabaseDir();
185+
Path dir = environmentConfig.getMlSettings().getEntityDatabaseDir();
186186
if (!dir.toFile().exists()) {
187187
dir.toFile().mkdirs();
188188
}

quick-start/src/main/java/com/marklogic/quickstart/web/CurrentProjectController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public String getLastDeployed() throws IOException {
149149
public ResponseEntity<?> reinstallUserModules() throws IOException {
150150
// reinstall the user modules
151151
dataHubService.reinstallUserModules(envConfig().getMlSettings(), this, this);
152-
entityManagerService.saveSearchOptions();
152+
entityManagerService.saveSearchOptions(envConfig());
153153

154154
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
155155
}
@@ -217,7 +217,7 @@ private void startProjectWatcher() throws IOException {
217217

218218
private void installUserModules(HubConfig hubConfig, boolean force) {
219219
dataHubService.installUserModules(hubConfig, force, this, this);
220-
entityManagerService.saveSearchOptions();
220+
entityManagerService.saveSearchOptions(envConfig());
221221
}
222222

223223
@Override

quick-start/src/main/java/com/marklogic/quickstart/web/EntitiesController.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ public ResponseEntity<?> saveEntities(@RequestBody List<EntityModel> entities) t
6262
for (EntityModel entity : entities) {
6363
entityManagerService.saveEntity(entity);
6464
}
65-
entityManagerService.saveSearchOptions();
65+
entityManagerService.saveSearchOptions(envConfig());
6666
entityManagerService.saveAllUiData(entities);
67-
entityManagerService.saveDbIndexes();
67+
entityManagerService.saveDbIndexes(envConfig());
6868

6969
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
7070
}
@@ -81,8 +81,8 @@ public ResponseEntity<?> saveEntitiesUiState(@RequestBody List<EntityModel> enti
8181
public EntityModel saveEntity(@RequestBody EntityModel entity) throws ClassNotFoundException, IOException {
8282
entityManagerService.saveEntityUiData(entity);
8383
EntityModel m = entityManagerService.saveEntity(entity);
84-
entityManagerService.saveSearchOptions();
85-
entityManagerService.saveDbIndexes();
84+
entityManagerService.saveSearchOptions(envConfig());
85+
entityManagerService.saveDbIndexes(envConfig());
8686
return m;
8787
}
8888

quick-start/src/main/ui/app/entity-modeler/entity-modeler.component.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
<button mdl-button mdl-button-type="raised" mdl-ripple mdl-colored="primary" (click)="addEntity()">
1111
<mdl-icon>add</mdl-icon> New Entity
1212
</button>
13-
<button mdl-button mdl-button-type="raised" mdl-ripple mdl-colored="primary" (click)="updateIndexes()">
14-
<mdl-icon>autorenew</mdl-icon> Update Indexes
15-
</button>
1613
</div>
1714
</div>
1815
<div class="entities">

quick-start/src/main/ui/app/entity-modeler/entity-modeler.component.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { EntitiesService } from '../entities/entities.service';
1212

1313
import { InstallService } from '../installer';
1414

15-
import { MdlDialogService } from '@angular-mdl/core';
15+
import { MdlDialogService, MdlSnackbarService } from '@angular-mdl/core';
1616

1717
import { Point, Line, Rect } from './math-helper';
1818

@@ -109,6 +109,7 @@ export class EntityModelerComponent implements AfterViewChecked {
109109

110110
constructor(
111111
private dialogService: MdlDialogService,
112+
private snackbar: MdlSnackbarService,
112113
private entitiesService: EntitiesService,
113114
private installService: InstallService) {
114115
this.getEntities();
@@ -282,7 +283,9 @@ export class EntityModelerComponent implements AfterViewChecked {
282283
let result = this.dialogService.confirm(`Saved. Update Indexes in MarkLogic?`, 'No', 'Yes');
283284
result.subscribe(() => {
284285
this.installService.updateIndexes().subscribe(() => {
285-
this.dialogService.alert(`Indexes updated`);
286+
this.snackbar.showSnackbar({
287+
message: 'Indexes updated.',
288+
});
286289
});
287290
}, () => {});
288291
});
@@ -359,9 +362,4 @@ export class EntityModelerComponent implements AfterViewChecked {
359362
});
360363
}
361364

362-
updateIndexes() {
363-
this.installService.updateIndexes().subscribe(() => {
364-
this.dialogService.alert(`Indexes updated`);
365-
});
366-
}
367365
}

quick-start/src/main/ui/app/flows/flows.component.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import { MlcpUiComponent } from '../mlcp-ui';
1313
import { HarmonizeFlowOptionsComponent } from '../harmonize-flow-options/harmonize-flow-options.component';
1414
import { NewFlowComponent } from '../new-flow/new-flow.component';
1515

16+
import { JobListenerService } from '../jobs/job-listener.service';
17+
1618
import { HasBugsDialogComponent } from '../has-bugs-dialog';
1719

1820
import { DeployService } from '../deploy/deploy.service';
@@ -37,15 +39,25 @@ export class FlowsComponent {
3739
private entitiesService: EntitiesService,
3840
private deployService: DeployService,
3941
private snackbar: MdlSnackbarService,
40-
private dialogService: MdlDialogService
42+
private dialogService: MdlDialogService,
43+
private jobListener: JobListenerService
4144
) {
4245
deployService.onDeploy.subscribe(() => {
4346
this.getEntities();
4447
});
4548
this.getEntities();
4649
this.deployService.validateUserModules();
50+
this.jobListener.jobFinished.subscribe(this.jobFinished);
4751
}
4852

53+
private jobFinished = (jobId) => {
54+
setTimeout(() => {
55+
this.snackbar.showSnackbar({
56+
message: `Job ${jobId} Finished.`,
57+
});
58+
}, 0);
59+
};
60+
4961
getLastDeployed() {
5062
const lastDeployed = this.deployService.getLastDeployed();
5163
if (lastDeployed) {

quick-start/src/main/ui/app/jobs/jobs.component.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,31 @@ input[type="search"] {
5959
}
6060

6161
.mdl-data-table {
62+
width: 100%;
63+
6264
thead {
6365
tr {
6466
background: $bg-color;
6567
th {
68+
padding: 12px 8px 12px 8px;
6669
color: white;
70+
71+
&:last-of-type {
72+
padding-right: 0px;
73+
}
6774
}
6875
}
6976
}
7077

7178
tbody {
7279
tr {
7380
td {
81+
padding: 12px 8px 12px 8px;
7482
max-width: 400px;
83+
84+
&:last-of-type {
85+
padding-right: 0px;
86+
}
7587
}
7688
}
7789
}

quick-start/src/main/ui/app/jobs/jobs.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ export class JobsComponent implements OnChanges, OnDestroy, OnInit {
7171
}
7272

7373
private jobStarted = () => {
74-
this.runQuery();
74+
this.getJobs();
7575
};
7676

7777
private jobFinished = () => {
7878
setTimeout(() => {
79-
this.runQuery();
79+
this.getJobs();
8080
}, 2000);
8181
};
8282

quick-start/src/main/ui/app/mlcp-ui/mlcp-ui.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ <h4>
5454
<button
5555
class="mdl-button mdl-js-button mdl-button--icon"
5656
[appClipboard]="mlcpcmd"
57-
(cbOnSuccess)="cmdCopied()">
57+
(onSuccess)="cmdCopied()">
5858
<i class="fa fa-copy" aria-hidden="true">
5959
</i>
6060
</button>

0 commit comments

Comments
 (0)