Skip to content

Commit

Permalink
restore doc metadata check for numbering depth and separator options
Browse files Browse the repository at this point in the history
  • Loading branch information
Doris Lam committed Apr 23, 2024
1 parent 825195c commit 01346ab
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
12 changes: 6 additions & 6 deletions src/ve-app/pane-left/left-pane.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { left_default_buttons } from './left-buttons.config';

import { VeComponentOptions, VePromise, VeQService } from '@ve-types/angular';
import {
DocumentObject,
ElementObject,
ElementsRequest,
ElementsResponse,
Expand Down Expand Up @@ -355,9 +356,8 @@ class LeftPaneController implements angular.IComponentController {
projectId: this.treeApi.projectId,
};
this.elementSvc.getElement<ViewObject>(reqOb).then((root) => {
// TODO this call is taking a long time that keeps the tree from being visible, need
// to see if it can be moved to a resolve or faster
/*if (this.apiSvc.isDocument(root) && this.$state.includes('**.present.**')) {
// TODO this call may take a long time that keeps the tree from being visible?
if (this.apiSvc.isDocument(root) && this.$state.includes('**.present.**')) {
this.viewSvc
.getDocumentMetadata({
elementId: root.id,
Expand All @@ -367,20 +367,20 @@ class LeftPaneController implements angular.IComponentController {
.then((result) => {
this.treeApi.numberingDepth = result.numberingDepth
this.treeApi.numberingSeparator = result.numberingSeparator
this.treeApi.startChapter = (root as DocumentObject)._startChapter
this.treeApi.startChapter = Number.isInteger((root as DocumentObject)._startChapter)
? (root as DocumentObject)._startChapter
: 1

if (!(root as DocumentObject)._childViews)
(root as DocumentObject)._childViews = []
resolve(root)
}, reject)
} else {*/
} else {
this.treeApi.numberingDepth = 0;
this.treeApi.numberingSeparator = '.';
this.treeApi.startChapter = 1;
resolve(root);
//}
}
}, reject);
} else {
resolve(null);
Expand Down
14 changes: 5 additions & 9 deletions src/ve-utils/mms-api-client/View.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {
PresentationReference,
ElementsResponse,
GenericResponse,
BasicResponse,
BasicResponse, TaggedValueObject,
} from '@ve-types/mms';
import { TreeBranch, View2NodeMap } from '@ve-types/tree';

Expand Down Expand Up @@ -1427,7 +1427,7 @@ export class ViewService extends BaseApiService {
return res;
}
values.forEach((value) => {
if (value.type !== 'LiteralString' || !value.value) return;
if (!value.value) return;
res.push(value.value as string);
});
return res;
Expand Down Expand Up @@ -1469,26 +1469,22 @@ export class ViewService extends BaseApiService {
const elementIds = [
`${reqOb.elementId}_asi-slot-${this.schemaSvc.getValue<string>('DOCUMENT_IDS', 'Header', this.schema)}`, //header
`${reqOb.elementId}_asi-slot-${this.schemaSvc.getValue<string>('DOCUMENT_IDS', 'Footer', this.schema)}`, //footer
`${reqOb.elementId}_asi-slot-${this.schemaSvc.getValue<string>(
'DOCUMENT_IDS',
'NumDepth',
this.schema
)}`, //numbering depth
`${reqOb.elementId}_asi-slot-${this.schemaSvc.getValue<string>('DOCUMENT_IDS', 'NumDepth', this.schema)}`, //numbering depth
`${reqOb.elementId}_asi-slot-${this.schemaSvc.getValue<string>('DOCUMENT_IDS', 'NumSep', this.schema)}`, //numbering separator
];
const metaReqOb: ElementsRequest<string[]> = Object.assign(reqOb, {
elementId: elementIds,
});
this.elementSvc
.getElements<SlotObject>(metaReqOb, weight)
.getElements<TaggedValueObject>(metaReqOb, weight)
.then(
(data) => {
if (data.length === 0) {
return;
}
for (let i = 0; i < data.length; i++) {
const prop = data[i];
const feature: string = prop.definingFeatureId ? prop.definingFeatureId : null;
const feature: string = prop.tagDefinitionId ? prop.tagDefinitionId : null;
const value: LiteralObject<unknown>[] = prop.value ? prop.value : null;
if (!feature || !value || !Array.isArray(value)) {
continue;
Expand Down

0 comments on commit 01346ab

Please sign in to comment.