[ADF-2557] Updated doc files with new script and fixed script bugs (#3135)

This commit is contained in:
Andy Stark 2018-03-29 17:02:40 +01:00 committed by Eugenio Romano
parent 9401e77e0c
commit 717dbfb388
19 changed files with 306 additions and 164 deletions

View File

@ -1,21 +1,28 @@
---
Added: v2.0.0
Status: Active
Last reviewed: 2018-03-12
Last reviewed: 2018-03-29
---
# Content Node Selector component
Allows a user to select items from a Content Services repository.
![Content Node Selector screenshot](../docassets/images/ContentNodeSelector.png)
## Basic Usage
## Class members
### Events
### Properties
| Name | Description |
| ---- | ----------- |
| select | Emitted when the user has selected an item |
| Name | Type | Default value | Description |
| ---- | ---- | ------------- | ----------- |
| currentFolderId | `string` | null | Deprecated: in 2.1.0 |
| dropdownHideMyFiles | `boolean` | false | Deprecated: in 2.1.0 |
| dropdownSiteList | `SitePaging` | null | Deprecated: in 2.1.0 |
| imageResolver | `ImageResolver` | null | Deprecated: in 2.1.0 |
| pageSize | `number` | | Deprecated: in 2.1.0 |
| rowFilter | `RowFilter` | null | Deprecated: in 2.1.0 |
| title | `string` | null | Deprecated: in 2.1.0 |
## Details

View File

@ -1,23 +1,30 @@
---
Added: v2.0.0
Status: Active
Last reviewed: 2018-03-29
---
# Document Actions service
Implements the document menu actions for the Document List component.
## Methods
## Class members
- `getHandler(key: string): ContentActionHandler`
Gets the handler for an action.
- `key` - Identifier of the action
- `setHandler(key: string, handler: ContentActionHandler): boolean`
Sets a new handler for an action.
- `key` - Identifier of the action
- `handler` - Handler for the action
- `canExecuteAction(obj: any): boolean`
Checks if actions can be executed for an item.
- `obj` - Item to receive an action
### Methods
- `canExecuteAction(obj: any = null): boolean`<br/>
Checks if actions can be executed for an item.
- `obj: any = null` - Item to receive an action
- **Returns** `boolean` - True if the action can be executed on this item, false otherwise
- `getHandler(key: string = null): ContentActionHandler`<br/>
Gets the handler for an action.
- `key: string = null` - Identifier of the action
- **Returns** `ContentActionHandler` - The handler for the action
- `setHandler(key: string = null, handler: ContentActionHandler = null): boolean`<br/>
Sets a new handler for an action.
- `key: string = null` - Identifier of the action
- `handler: ContentActionHandler = null` - Handler for the action
- **Returns** `boolean` - False if the key was an empty/null string, true otherwise
## Details

View File

@ -3,6 +3,7 @@ Added: v2.0.0
Status: Active
Last reviewed: 2018-03-13
---
# Search control component
Displays a input text which shows find-as-you-type suggestions.
@ -19,25 +20,27 @@ Displays a input text which shows find-as-you-type suggestions.
</adf-search-control>
```
## Class members
### Properties
| Name | Type | Default value | Description |
| ---- | ---- | ------------- | ----------- |
| expandable | `boolean` | `true` | Toggles whether to use an expanding search control. If false then a regular input is used. |
| highlight | `boolean` | `false` | Toggles highlighting of the search term in the results. |
| inputType | `string` | `'text'` | Type of the input field to render, e.g. "search" or "text" (default). |
| autocomplete | `boolean` | `false` | Toggles auto-completion of the search input field. |
| liveSearchEnabled | `boolean` | `true` | Toggles "find-as-you-type" suggestions for possible matches. |
| liveSearchMaxResults | `number` | `5` | Maximum number of results to show in the live search. |
| customQueryBody | `QueryBody` | | Deprecated in v2.1.0. |
| autocomplete | `boolean` | false | Toggles auto-completion of the search input field. |
| customQueryBody | `QueryBody` | | **Deprecated:** in 2.1.0 |
| expandable | `boolean` | true | Toggles whether to use an expanding search control. If false then a regular input is used. |
| highlight | `boolean` | false | Toggles highlighting of the search term in the results. |
| inputType | `string` | "text" | Type of the input field to render, e.g. "search" or "text" (default). |
| liveSearchEnabled | `boolean` | true | Toggles "find-as-you-type" suggestions for possible matches. |
| liveSearchMaxResults | `number` | 5 | Maximum number of results to show in the live search. |
### Events
| Name | Type | Description |
| ---- | ---- | ----------- |
| submit | `EventEmitter<any>` | Emitted when the search is submitted pressing ENTER button. The search term is provided as value of the event. |
| searchChange | `EventEmitter<string>` | Emitted when the search term is changed. The search term is provided in the 'value' property of the returned object. If the term is less than three characters in length then the term is truncated to an empty string. |
| optionClicked | `EventEmitter<any>` | Emitted when a file item from the list of "find-as-you-type" results is selected. |
| searchChange | `EventEmitter<string>` | Emitted when the search term is changed. The search term is provided in the 'value' property of the returned object. If the term is less than three characters in length then the term is truncated to an empty string. |
| submit | `EventEmitter<any>` | Emitted when the search is submitted pressing ENTER button. The search term is provided as value of the event. |
## Details
@ -67,4 +70,4 @@ You can show your own custom template when no results are found for the search:
```
Place the `adf-empty-search-result` tag inside the `adf-search-control` and then within it, put
whatever content you want to show for an "empty" result.
whatever content you want to show for an "empty" result.

View File

@ -2,6 +2,7 @@
Added: v2.0.0
Status: Active
---
# Search component
Searches items for supplied search terms.
@ -15,23 +16,24 @@ Searches items for supplied search terms.
</adf-search>
```
## Class members
### Properties
| Name | Type | Default value | Description |
| ---- | ---- | ------------- | ----------- |
| displayWith | `(value: any) => string` | `null` | Function that maps an option's value to its display value in the trigger. |
| maxResults | `number` | `20` | Maximum number of results to show in the search. |
| skipResults | `number` | `0` | Number of results to skip from the results pagination. |
| queryBody | `QueryBody` | | |
| searchTerm | `string` | `''` | Search term to use when executing the search. Updating this value will run a new search and update the results. |
| classList | `string` | | CSS class for display. |
| displayWith | `function | null` | null | Function that maps an option's value to its display value in the trigger. |
| maxResults | `number` | 20 | Maximum number of results to show in the search. |
| queryBody | `QueryBody` | | **Deprecated:** in 2.1.0 |
| searchTerm | `string` | "" | Search term to use when executing the search. Updating this value will run a new search and update the results. |
| skipResults | `number` | 0 | Number of results to skip from the results pagination. |
### Events
| Name | Type | Description |
| ---- | ---- | ----------- |
| resultLoaded | `EventEmitter<NodePaging>` | Emitted when search results have fully loaded. |
| error | `EventEmitter<any>` | Emitted when an error occurs. |
| resultLoaded | `EventEmitter<NodePaging>` | Emitted when search results have fully loaded. |
## Details

View File

@ -1,74 +1,74 @@
---
Added: v2.0.0
Status: Active
Last reviewed: 2018-03-13
Last reviewed: 2018-03-29
---
# Authentication Service
Provides authentication to ACS and APS.
## Methods
## Class members
- `isLoggedIn(): boolean`
Checks if the user logged in.
### Methods
- `login(username: string, password: string, rememberMe: boolean = false): Observable<{ type: string; ticket: any; }>`
Logs the user in.
- `username` - Username for the login
- `password` - Password for the login
- `rememberMe` - Stores the user's login details if true
- `isRememberMeSet(): boolean`
Checks whether the "remember me" cookie was set or not.
- `logout(): any`
Logs the user out.
- `removeTicket()`
Removes the login ticket from Storage.
- `getTicketEcm(): string`
Gets the ECM ticket stored in the Storage.
- `getTicketBpm(): string`
Gets the BPM ticket stored in the Storage.
- `getTicketEcmBase64(): string`
Gets the BPM ticket from the Storage in Base 64 format.
- `saveTickets()`
Saves the ECM and BPM ticket in the Storage.
- `saveTicketEcm()`
Saves the ECM ticket in the Storage.
- `saveTicketBpm()`
Saves the BPM ticket in the Storage.
- `saveTicketAuth()`
Saves the AUTH ticket in the Storage.
- `isEcmLoggedIn(): boolean`
Checks if the user is logged in on an ECM provider.
- `isBpmLoggedIn(): boolean`
Checks if the user is logged in on a BPM provider.
- `getEcmUsername(): string`
Gets the ECM username.
- `getBpmUsername(): string`
Gets the BPM username
- `setRedirectUrl(url: RedirectionModel)`
Sets the URL to redirect to after login.
- `url` - URL to redirect to
- `getRedirectUrl(provider: string): string`
Gets the URL to redirect to after login.
- `provider` - Service provider. Can be "ECM", "BPM" or "ALL".
- `handleError(error: any): Observable<any>`
Prints an error message in the console browser
- `error` - Error message
- `getBpmUsername(): string`<br/>
Gets the BPM username
- **Returns** `string` - The BPM username
- `getEcmUsername(): string`<br/>
Gets the ECM username.
- **Returns** `string` - The ECM username
- `getRedirectUrl(provider: string = null): string`<br/>
Gets the URL to redirect to after login.
- `provider: string = null` - Service provider. Can be "ECM", "BPM" or "ALL".
- **Returns** `string` - The redirect URL
- `getTicketBpm(): string | null`<br/>
Gets the BPM ticket stored in the Storage.
- **Returns** `string | null` - The ticket or `null` if none was found
- `getTicketEcm(): string | null`<br/>
Gets the ECM ticket stored in the Storage.
- **Returns** `string | null` - The ticket or `null` if none was found
- `getTicketEcmBase64(): string | null`<br/>
Gets the BPM ticket from the Storage in Base 64 format.
- **Returns** `string | null` - The ticket or `null` if none was found
- `handleError(error: any = null): Observable<any>`<br/>
Prints an error message in the console browser
- `error: any = null` - Error message
- **Returns** `Observable<any>` - Object representing the error message
- `isBpmLoggedIn(): boolean`<br/>
Checks if the user is logged in on a BPM provider.
- **Returns** `boolean` - True if logged in, false otherwise
- `isEcmLoggedIn(): boolean`<br/>
Checks if the user is logged in on an ECM provider.
- **Returns** `boolean` - True if logged in, false otherwise
- `isLoggedIn(): boolean`<br/>
Checks if the user logged in.
- **Returns** `boolean` - True if logged in, false otherwise
- `isRememberMeSet(): boolean`<br/>
Checks whether the "remember me" cookie was set or not.
- **Returns** `boolean` - True if set, false otherwise
- `login(username: string = null, password: string = null, rememberMe: boolean = false): Observable<object>`<br/>
Logs the user in.
- `username: string = null` - Username for the login
- `password: string = null` - Password for the login
- `rememberMe: boolean = false` - Stores the user's login details if true
- **Returns** `Observable<object>` - Object with auth type ("ECM", "BPM" or "ALL") and auth ticket
- `logout(): any`<br/>
Logs the user out.
- **Returns** `any` - Response event called when logout is complete
- `removeTicket()`<br/>
Removes the login ticket from Storage.
- `saveTicketAuth()`<br/>
Saves the AUTH ticket in the Storage.
- `saveTicketBpm()`<br/>
Saves the BPM ticket in the Storage.
- `saveTicketEcm()`<br/>
Saves the ECM ticket in the Storage.
- `saveTickets()`<br/>
Saves the ECM and BPM ticket in the Storage.
- `setRedirectUrl(url: RedirectionModel = null)`<br/>
Sets the URL to redirect to after login.
- `url: RedirectionModel = null` - URL to redirect to
## Details

View File

@ -1,25 +1,30 @@
---
Added: v2.0.0
Status: Active
Last reviewed: 2018-03-29
---
# Cookie service
Stores key-value data items as browser cookies.
## Methods
## Class members
- `isEnabled(): boolean`
Checks if cookies are enabled.
### Methods
- `getItem(key: string): string`
Retrieves a cookie by its key.
- `key` - Key to identify the cookie
- `setItem(key: string, data: string, expiration: Date | null, path: string | null)`
Set a cookie.
- `key` - Key to identify the cookie
- `data` - Data value to set for the cookie
- `expiration` - Expiration date of the data
- `path` - "Pathname" to store the cookie
- `getItem(key: string = null): string | null`<br/>
Retrieves a cookie by its key.
- `key: string = null` - Key to identify the cookie
- **Returns** `string | null` - The cookie data or null if it is not found
- `isEnabled(): boolean`<br/>
Checks if cookies are enabled.
- **Returns** `boolean` - True if enabled, false otherwise
- `setItem(key: string = null, data: string = null, expiration: Date | null = null, path: string | null = null)`<br/>
Sets a cookie.
- `key: string = null` - Key to identify the cookie
- `data: string = null` - Data value to set for the cookie
- `expiration: Date | null = null` - Expiration date of the data
- `path: string | null = null` - "Pathname" to store the cookie
## Details

View File

@ -1,7 +1,9 @@
---
Added: v2.0.0
Status: Active
Last reviewed: 2018-03-29
---
# Widget component
Base class for standard and custom widget classes.
@ -21,12 +23,20 @@ import { WidgetComponent } from '@alfresco/adf-core';
export class CustomEditorComponent extends WidgetComponent {}
```
## Class members
### Properties
| Name | Type | Default | Description |
| ---- | ---- | ------- | ----------- |
| readOnly | boolean | false | Does the widget show a read-only value? (ie, can't be edited) |
| field | [FormFieldModel](../core/form-field.model.md) | | Data to be displayed in the field |
| Name | Type | Default value | Description |
| ---- | ---- | ------------- | ----------- |
| field | `FormFieldModel` | | Data to be displayed in the field |
| readOnly | `boolean` | false | Does the widget show a read-only value? (ie, can't be edited) |
### Events
| Name | Type | Description |
| ---- | ---- | ----------- |
| fieldChanged | `EventEmitter<FormFieldModel>` | **Deprecated:** Used only to trigger visibility engine; components should do that internally if needed |
## Details

View File

@ -0,0 +1,23 @@
{% if hasInputs %}
### Properties
| Name | Type | Default value | Description |
| -- | -- | -- | -- |
{% each properties as prop %}
{% if prop.isInput %}
| {{prop.name}} | `{{{prop.type}}}` | {{{prop.defaultValue}}} | {{{prop.docText}}} |
{% endif %}
{% endeach %}
{% endif %}
{% if hasOutputs%}
### Events
| Name | Type | Description |
| -- | -- | -- |
{% each properties as prop %}
{% if prop.isOutput %}
| {{prop.name}} | `{{{prop.type}}}` | {{{prop.docText}}} |
{% endif %}
{% endeach %}
{% endif %}

View File

@ -1,17 +0,0 @@
{% if hasInputs -%}
### Properties
| Name | Type | Default value | Description |
| -- | -- | -- | -- |
{% for prop in properties %}{% if prop.isInput %}| {{prop.name}} | `{{prop.type}}` | {{prop.defaultValue}} | {% if prop.isDeprecated %}(Deprecated) {% endif %}{{prop.docText}} |
{% endif %}{% endfor %}
{% endif %}
{% if hasOutputs -%}
### Events
| Name | Type | Description |
| -- | -- | -- |
{% for prop in properties %}{% if prop.isOutput %}| {{prop.name}} | `{{prop.type}}` | {% if prop.isDeprecated %}(Deprecated) {% endif %}{{prop.docText}} |
{% endif %}{% endfor %}
{% endif %}

View File

@ -0,0 +1,14 @@
{% if hasMethods %}
### Methods
{% each methods as meth %}- `{{meth.name}}{{{meth.signature}}{% if meth.returnsSomething %}: {{{meth.returnType}}}{% endif %}`<br/>
{{meth.docText}}
{% each meth.params as param %}
- `{{{param.combined}}}` - {% if param.isOptional %}(Optional){% endif %}{{{param.docText}}}
{% endeach %}
{% if meth.returnsSomething %}
- **Returns** `{{{meth.returnType}}}` - {{{meth.returnDocText}}}
{% endif %}
{% endeach %}
{% endif %}

View File

@ -1,10 +0,0 @@
{% if hasMethods %}
### Methods
{% for meth in methods %}- `{{meth.name}}{{meth.signature}}: {{meth.returnType}}`<br/>
{{meth.docText}}
{% for param in meth.params %} - `{{param.combined}}` - {% if param.isOptional %}(Optional){% endif %}{{param.docText}}
{% endfor %} - **Returns** `{{meth.returnType}}` - {{meth.returnDocText}}
{% endfor %}
{% endif %}

View File

@ -4,8 +4,7 @@ var fs = require("fs");
var path = require("path");
var replaceSection = require("mdast-util-heading-range");
var remark = require("remark");
var frontMatter = require("remark-frontmatter");
var liquid = require("liquidjs");
var combyne = require("combyne");
var typedoc_1 = require("typedoc");
var libFolders = ["core", "content-services", "process-services", "insights"];
var templateFolder = path.resolve(".", "config", "DocProcessor", "templates");
@ -25,21 +24,29 @@ var PropInfo = /** @class */ (function () {
this.defaultValue = rawProp.defaultValue || "";
this.defaultValue = this.defaultValue.replace(/\|/, "\\|");
this.type = rawProp.type ? rawProp.type.toString() : "";
this.isDeprecated = rawProp.comment && rawProp.comment.hasTag("deprecated");
if (this.isDeprecated) {
this.docText = "**Deprecated:** " + rawProp.comment.getTag("deprecated").text.replace(/[\n\r]+/g, " ").trim();
}
if (rawProp.decorators) {
rawProp.decorators.forEach(function (dec) {
if (dec.name === "Input") {
_this.isInput = true;
if (!_this.docText)
if (dec.arguments) {
var bindingName = dec["bindingPropertyName"];
if (bindingName && (bindingName !== ""))
_this.name = bindingName;
}
if (!_this.docText && !_this.isDeprecated)
console.log("Warning: Input \"" + rawProp.getFullName() + "\" has no doc text.");
}
if (dec.name === "Output") {
_this.isOutput = true;
if (!_this.docText)
if (!_this.docText && !_this.isDeprecated)
console.log("Warning: Output \"" + rawProp.getFullName() + "\" has no doc text.");
}
});
}
this.isDeprecated = rawProp.comment && rawProp.comment.hasTag("deprecated");
}
return PropInfo;
}());
@ -66,6 +73,7 @@ var MethodSigInfo = /** @class */ (function () {
var _this = this;
this.name = rawSig.name;
this.returnType = rawSig.type ? rawSig.type.toString() : "";
this.returnsSomething = this.returnType != "void";
if (rawSig.hasComment()) {
this.docText = rawSig.comment.shortText + rawSig.comment.text;
this.docText = this.docText.replace(/[\n\r]+/g, " ").trim();
@ -73,7 +81,9 @@ var MethodSigInfo = /** @class */ (function () {
console.log("Warning: method \"" + rawSig.name + "\" has no doc text.");
this.returnDocText = rawSig.comment.returns;
this.returnDocText = this.returnDocText ? this.returnDocText.replace(/[\n\r]+/g, " ").trim() : "";
if (!this.returnDocText)
if (this.returnDocText.toLowerCase() === "nothing")
this.returnsSomething = false;
if (this.returnsSomething && !this.returnDocText)
console.log("Warning: Return value of method \"" + rawSig.name + "\" has no doc text.");
this.isDeprecated = rawSig.comment.hasTag("deprecated");
}
@ -125,9 +135,11 @@ function initPhase(aggData) {
});
var sources = app.expandInputFiles(libFolders);
aggData.projData = app.convert(sources);
/*
aggData.liq = liquid({
root: templateFolder
});
*/
}
exports.initPhase = initPhase;
function readPhase(tree, pathname, aggData) {
@ -142,22 +154,44 @@ function updatePhase(tree, pathname, aggData) {
var compData = new ComponentInfo(classRef);
var classType = compName.match(/component|directive|service/i);
if (classType) {
var templateName = classType[0] + ".liquid";
var templateName = path.resolve(templateFolder, classType + ".combyne");
var templateSource = fs.readFileSync(templateName, "utf8");
var template = combyne(templateSource);
var mdText = template.render(compData);
var newSection_1 = remark().parse(mdText.trim()).children;
replaceSection(tree, "Class members", function (before, section, after) {
newSection_1.unshift(before);
newSection_1.push(after);
return newSection_1;
});
/*
let templateName = classType[0] + ".liquid";
aggData.liq
.renderFile(templateName, compData)
.then(function (mdText) {
var newSection = remark().parse(mdText).children;
replaceSection(tree, "Class members", function (before, section, after) {
.renderFile(templateName, compData)
.then(mdText => {
let newSection = remark().parse(mdText).children;
replaceSection(tree, "Class members", (before, section, after) => {
newSection.unshift(before);
newSection.push(after);
return newSection;
});
fs.writeFileSync(pathname, remark().use(frontMatter, { type: 'yaml', fence: '---' }).data("settings", { paddedTable: false }).stringify(tree));
fs.writeFileSync(pathname, remark().use(frontMatter, {type: 'yaml', fence: '---'}).data("settings", {paddedTable: false}).stringify(tree));
});
*/
}
return false;
return true;
}
exports.updatePhase = updatePhase;
function renderInputs(comp) {
var result = "";
comp.properties.forEach(function (prop) {
result += "| " + prop.name + " | `" + prop.type + "` | " + prop.defaultValue + " | " + prop.docText + " |\n";
});
return result;
}
function initialCap(str) {
return str[0].toUpperCase() + str.substr(1);
}

View File

@ -5,7 +5,7 @@ import * as replaceSection from "mdast-util-heading-range";
import * as remark from "remark";
import * as frontMatter from "remark-frontmatter";
import * as liquid from "liquidjs";
import * as combyne from "combyne";
import {
Application,
@ -53,25 +53,40 @@ class PropInfo {
this.defaultValue = this.defaultValue.replace(/\|/, "\\|");
this.type = rawProp.type ? rawProp.type.toString() : "";
this.isDeprecated = rawProp.comment && rawProp.comment.hasTag("deprecated");
if (this.isDeprecated) {
this.docText = "**Deprecated:** " + rawProp.comment.getTag("deprecated").text.replace(/[\n\r]+/g, " ").trim();
}
if (rawProp.decorators) {
rawProp.decorators.forEach(dec => {
if (dec.name === "Input") {
this.isInput = true;
if (!this.docText)
/*
if (dec.arguments) {
let bindingName = dec.arguments["bindingPropertyName"];
console.log(JSON.stringify(dec.arguments));
if (bindingName && (bindingName !== ""))
this.name = bindingName;
}
*/
if (!this.docText && !this.isDeprecated)
console.log(`Warning: Input "${rawProp.getFullName()}" has no doc text.`);
}
if (dec.name === "Output") {
this.isOutput = true;
if (!this.docText)
if (!this.docText && !this.isDeprecated)
console.log(`Warning: Output "${rawProp.getFullName()}" has no doc text.`);
}
});
}
this.isDeprecated = rawProp.comment && rawProp.comment.hasTag("deprecated");
}
};
@ -110,6 +125,7 @@ class MethodSigInfo {
docText: string;
returnType: string;
returnDocText: string;
returnsSomething: boolean;
signature: string;
params: ParamInfo[];
isDeprecated: boolean;
@ -117,6 +133,7 @@ class MethodSigInfo {
constructor(rawSig: SignatureReflection) {
this.name = rawSig.name;
this.returnType = rawSig.type ? rawSig.type.toString() : "";
this.returnsSomething = this.returnType != "void";
if (rawSig.hasComment()) {
this.docText = rawSig.comment.shortText + rawSig.comment.text;
@ -128,7 +145,10 @@ class MethodSigInfo {
this.returnDocText = rawSig.comment.returns;
this.returnDocText = this.returnDocText ? this.returnDocText.replace(/[\n\r]+/g, " ").trim() : "";
if (!this.returnDocText)
if (this.returnDocText.toLowerCase() === "nothing")
this.returnsSomething = false;
if (this.returnsSomething && !this.returnDocText)
console.log(`Warning: Return value of method "${rawSig.name}" has no doc text.`);
this.isDeprecated = rawSig.comment.hasTag("deprecated");
@ -199,9 +219,11 @@ export function initPhase(aggData) {
let sources = app.expandInputFiles(libFolders);
aggData.projData = app.convert(sources);
/*
aggData.liq = liquid({
root: templateFolder
});
*/
}
@ -220,6 +242,19 @@ export function updatePhase(tree, pathname, aggData) {
let classType = compName.match(/component|directive|service/i);
if (classType) {
let templateName = path.resolve(templateFolder, classType + ".combyne");
let templateSource = fs.readFileSync(templateName, "utf8");
let template = combyne(templateSource);
let mdText = template.render(compData);
let newSection = remark().parse(mdText.trim()).children;
replaceSection(tree, "Class members", (before, section, after) => {
newSection.unshift(before);
newSection.push(after);
return newSection;
});
/*
let templateName = classType[0] + ".liquid";
aggData.liq
@ -233,13 +268,25 @@ export function updatePhase(tree, pathname, aggData) {
});
fs.writeFileSync(pathname, remark().use(frontMatter, {type: 'yaml', fence: '---'}).data("settings", {paddedTable: false}).stringify(tree));
});
*/
}
return false;
return true;
}
function renderInputs(comp: ComponentInfo): string {
var result = "";
comp.properties.forEach(prop => {
result += `| ${prop.name} | \`${prop.type}\` | ${prop.defaultValue} | ${prop.docText} |\n`;
});
return result;
}
function initialCap(str: string) {
return str[0].toUpperCase() + str.substr(1);
}

View File

@ -44,6 +44,7 @@ export class DocumentActionsService {
/**
* Gets the handler for an action.
* @param key Identifier of the action
* @returns The handler for the action
*/
getHandler(key: string): ContentActionHandler {
if (key) {
@ -57,6 +58,7 @@ export class DocumentActionsService {
* Sets a new handler for an action.
* @param key Identifier of the action
* @param handler Handler for the action
* @returns False if the key was an empty/null string, true otherwise
*/
setHandler(key: string, handler: ContentActionHandler): boolean {
if (key) {
@ -70,6 +72,7 @@ export class DocumentActionsService {
/**
* Checks if actions can be executed for an item.
* @param obj Item to receive an action
* @returns True if the action can be executed on this item, false otherwise
*/
canExecuteAction(obj: any): boolean {
return this.documentListService && obj && obj.entry.isFile === true;

View File

@ -55,7 +55,7 @@ export class WidgetComponent implements AfterViewInit {
@Input()
field: FormFieldModel;
/** @deprecated used only to trigger visibility engine, components should do that internally if needed */
/** @deprecated Used only to trigger visibility engine; components should do that internally if needed */
@Output()
fieldChanged: EventEmitter<FormFieldModel> = new EventEmitter<FormFieldModel>();

View File

@ -48,6 +48,7 @@ export class AuthenticationService {
/**
* Checks if the user logged in.
* @returns True if logged in, false otherwise
*/
isLoggedIn(): boolean {
return !!this.alfrescoApi.getInstance().isLoggedIn();
@ -58,6 +59,7 @@ export class AuthenticationService {
* @param username Username for the login
* @param password Password for the login
* @param rememberMe Stores the user's login details if true
* @returns Object with auth type ("ECM", "BPM" or "ALL") and auth ticket
*/
login(username: string, password: string, rememberMe: boolean = false): Observable<{ type: string, ticket: any }> {
this.removeTicket();
@ -92,6 +94,7 @@ export class AuthenticationService {
/**
* Checks whether the "remember me" cookie was set or not.
* @returns True if set, false otherwise
*/
isRememberMeSet(): boolean {
return (this.cookie.getItem(REMEMBER_ME_COOKIE_KEY) === null) ? false : true;
@ -108,6 +111,7 @@ export class AuthenticationService {
/**
* Logs the user out.
* @returns Response event called when logout is complete
*/
logout() {
return Observable.fromPromise(this.callApiLogout())
@ -139,6 +143,7 @@ export class AuthenticationService {
/**
* Gets the ECM ticket stored in the Storage.
* @returns The ticket or `null` if none was found
*/
getTicketEcm(): string | null {
return this.storage.getItem('ticket-ECM');
@ -146,12 +151,16 @@ export class AuthenticationService {
/**
* Gets the BPM ticket stored in the Storage.
* @returns The ticket or `null` if none was found
*/
getTicketBpm(): string | null {
return this.storage.getItem('ticket-BPM');
}
/** Gets the BPM ticket from the Storage in Base 64 format. */
/**
* Gets the BPM ticket from the Storage in Base 64 format.
* @returns The ticket or `null` if none was found
*/
getTicketEcmBase64(): string | null {
let ticket = this.storage.getItem('ticket-ECM');
if (ticket) {
@ -198,6 +207,7 @@ export class AuthenticationService {
/**
* Checks if the user is logged in on an ECM provider.
* @returns True if logged in, false otherwise
*/
isEcmLoggedIn(): boolean {
if (this.cookie.isEnabled() && !this.isRememberMeSet()) {
@ -208,6 +218,7 @@ export class AuthenticationService {
/**
* Checks if the user is logged in on a BPM provider.
* @returns True if logged in, false otherwise
*/
isBpmLoggedIn(): boolean {
if (this.cookie.isEnabled() && !this.isRememberMeSet()) {
@ -218,7 +229,7 @@ export class AuthenticationService {
/**
* Gets the ECM username.
* @memberof AuthenticationService
* @returns The ECM username
*/
getEcmUsername(): string {
return this.alfrescoApi.getInstance().ecmAuth.username;
@ -226,7 +237,7 @@ export class AuthenticationService {
/**
* Gets the BPM username
* @memberof AuthenticationService
* @returns The BPM username
*/
getBpmUsername(): string {
return this.alfrescoApi.getInstance().bpmAuth.username;
@ -241,6 +252,7 @@ export class AuthenticationService {
/** Gets the URL to redirect to after login.
* @param provider Service provider. Can be "ECM", "BPM" or "ALL".
* @returns The redirect URL
*/
getRedirectUrl(provider: string): string {
return this.hasValidRedirection(provider) ? this.redirectUrl.url : null;
@ -257,6 +269,7 @@ export class AuthenticationService {
/**
* Prints an error message in the console browser
* @param error Error message
* @returns Object representing the error message
*/
handleError(error: any): Observable<any> {
this.logService.error('Error when logging in', error);

View File

@ -22,6 +22,7 @@ export class CookieService {
/**
* Checks if cookies are enabled.
* @returns True if enabled, false otherwise
*/
isEnabled(): boolean {
// for certain scenarios Chrome may say 'true' but have cookies still disabled
@ -36,6 +37,7 @@ export class CookieService {
/**
* Retrieves a cookie by its key.
* @param key Key to identify the cookie
* @returns The cookie data or null if it is not found
*/
getItem(key: string): string | null {
const regexp = new RegExp('(?:' + key + '|;\s*' + key + ')=(.*?)(?:;|$)', 'g');
@ -44,12 +46,11 @@ export class CookieService {
}
/**
* Set a cookie.
* Sets a cookie.
* @param key Key to identify the cookie
* @param data Data value to set for the cookie
* @param expiration Expiration date of the data
* @param path "Pathname" to store the cookie
*
*/
setItem(key: string, data: string, expiration: Date | null, path: string | null): void {
document.cookie = `${key}=${data}` +

View File

@ -97,6 +97,7 @@
"bundlesize": "^0.15.3",
"chalk": "^2.3.2",
"codelyzer": "4.0.0",
"combyne": "^2.0.0",
"copy-webpack-plugin": "4.0.1",
"css-loader": "0.25.0",
"css-to-string-loader": "0.1.2",
@ -122,7 +123,6 @@
"karma-sourcemap-loader": "0.3.7",
"karma-systemjs": "0.16.0",
"karma-webpack": "2.0.9",
"liquidjs": "^3.1.1",
"loader-utils": "1.1.0",
"markdown-toc": "1.1.0",
"markdownlint-cli": "^0.3.1",