mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
* refactor version 1 many todo
* split render from viewer
move alfresco render in content pack
* refactor part 2
* test fixed
* fix doc
* [AAE-10778] Fix lint issues
* [AAE-10778] Fix lint issue: remove duplicated declaration
* [AAE-10778] Fix lint issue: use flex shorthand rule
* [AAE-10778] Fix FormService and WidgetComponent imports
* [AAE-10778] Fix import FormModel, FormService, FormFieldModel from adf-core
* [AAE-10778] Implement missing oninit, onchanges and ondestroy
* [AAE-10778] Replace adf-viewer with adf-alfresco-viewer, update escape command to close the viewer
* [AAE-10778] Fix unit test: fix the class name to match the 'adf-viewer-render.image-viewer-scaling' get from the appConfigService
* [AAE-10778] Fix image-viewer unit tests: replace ContentService with UrlService
* [AAE-10778] Fix unit test 'should if the extension change extension Change event be fired': emit file extension when the filename extension change
* [AAE-10778] Fix unit test: expect for internalFileName value instead of display-name id because the display name logic has been moved to the alfresco-viewer.component
* [AAE-10778] Fix unit test: remove display name it because the unknown display name value is no longer handled after refactoring
* [AAE-10778] Fix e2e: [C260096] Should the Viewer able to accept a customToolbar
* [AAE-10778] Update selector to fix e2e: '[C362265] Should the Viewer be able to download a previous version of a file'
* [AAE-10778] Update selector to fix e2e: '[C260038] Should display first page, toolbar and pagination when opening a .pdf file'
* fix aftrer rebase
* fix unit test
* [AAE-10778] Add adf viewer component that is node agnostic, show adf-alfresco-viewer or adf-viewer into file-view-component if blob or node are set
* [AAE-10778] Update viewer export path
* [AAE-10778] Update selectors since have been updated in the viewer component
* [AAE-10778] Call adf-viewer from alfresco-viewer, project adf-alfresco-viewer content to adf-viewer
* [AAE-10778] Remove full screen unit tests from alfresco-viewer component becase that logic is handled in the viewer.component
* [AAE-10778] Export toolbar custom actions component
* [AAE-10778] Pass mimeType as input to adf-viewer to update mime icon
* [AAE-10778] Remove e2e because the custom name behaviour has been removed from the file-view.component (9f21b6dc69
\#diff-4b438dc59784dce9eb7634cfeca6d8db61362966343bd3d6895a3edafdf4cfd5L129)
* [AAE-10778] Use two-way binding for showViewer change to fix C260100
* [AAE-10778] Update prefix css selectors to adf-viewer because are related to the adf-viewer component
* [AAE-10778] Update prefix css selectors to adf-viewer in the unit tests because are related to the adf-viewer component
* [AAE-10778] Update the output name to showViewerChange to navigate to primary url after closing the viewer
* [AAE-10778] Pass right and left sidebar template context to viewer component (fix C362242)
* [AAE-10778] Add allowFullScreen input to disable/enable full screen behaviour
* [AAE-10778] Handle loading visualization only inside the viewer-render component
* [AAE-10778] PDF viewer: fix mat-progress-bar is not showed during the pdf loading, center progress bar
* [AAE-10778] Remove isLoading from unit tests because no longer exists
* [AAE-10778] Remove viewerType input from adf-viewer, viewerType will be handled by viewer-render
* [AAE-10778] Remove console.log
* [AAE-10778] Remove check full screen button is not displayed on the media file because is not needed anymore, we don't need to check for the fullscreen button in the viewer component
* [AAE-10778] Check for node rendtion before to assign to urlFileContent and mimeType
* [AAE-10778] Process Services Cloud: register file-viewer widget that uses adf-alfresco-viewer component to display content from ACS
* [AAE-10778] Core: rename file-viewer widget into base-viewer, base-viewer no longer accept nodeId, but will accept urlFile and blobFile
* [AAE-10778] Process Services: register file-viewer widget that uses adf-alfresco-viewer component to display content from ACS
* [AAE-10778] Base viewer widget: show viewer only if there's a file input
* [AAE-10778] Viewer component: check for fileName when urlFile is provided as Input
* [AAE-10778] Viewer component documentation
* [AAE-10778] Update upgrade guide with viewer changes
* [AAE-10778] Fix double quote lint issue after rebase
---------
Co-authored-by: Amedeo Lepore <amedeo.lepore@hyland.com>
Co-authored-by: Amedeo Lepore <amedeo.lepore85@gmail.com>
110 lines
4.6 KiB
JavaScript
110 lines
4.6 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
var path = require("path");
|
|
var fs = require("fs");
|
|
var process = require("process");
|
|
var graphql_request_1 = require("graphql-request");
|
|
var remark = require("remark");
|
|
var frontMatter = require("remark-frontmatter");
|
|
var yaml = require("js-yaml");
|
|
var moment = require("moment");
|
|
var rxjs_1 = require("rxjs");
|
|
var libsearch = require("./libsearch");
|
|
var stoplist_1 = require("./stoplist");
|
|
var adf20StartDate = '2017-11-20';
|
|
var commitWeight = 0.1;
|
|
var scoreTimeBase = 60;
|
|
var libFolder = 'lib';
|
|
var stoplistFilePath = path.resolve('tools', 'doc', 'commitStoplist.json');
|
|
var angFilePattern = /(component)|(directive)|(model)|(pipe)|(service)|(widget)/;
|
|
var srcData = {};
|
|
var stoplist = new stoplist_1.Stoplist(stoplistFilePath);
|
|
var docsFolderPath = path.resolve('docs');
|
|
var libFolders = ['core', 'content-services', 'extensions', 'insights', 'process-services', 'process-services-cloud'];
|
|
libsearch(srcData, path.resolve(libFolder));
|
|
var authToken = process.env.graphAuthToken;
|
|
var client = new graphql_request_1.GraphQLClient('https://api.github.com/graphql', {
|
|
headers: {
|
|
Authorization: 'Bearer ' + authToken
|
|
}
|
|
});
|
|
var query = "query commitHistory($path: String) {\n repository(name: \"alfresco-ng2-components\", owner: \"alfresco\") {\n ref(qualifiedName: \"development\") {\n target {\n ... on Commit {\n history(first: 15, path: $path) {\n nodes {\n pushedDate\n message\n }\n }\n }\n }\n }\n }\n}";
|
|
var docFiles = getDocFilePaths(docsFolderPath);
|
|
var docNames = (0, rxjs_1.of)(docFiles);
|
|
console.log("'Name','Review date','Commits since review','Score'");
|
|
docNames.subscribe(function (docs) {
|
|
docs.forEach(function (x) {
|
|
var key = path.basename(x, '.md');
|
|
if (!srcData[key]) {
|
|
return;
|
|
}
|
|
var vars = {
|
|
'path': 'lib/' + srcData[key].path
|
|
};
|
|
client.request(query, vars).then(function (data) {
|
|
var nodes = data['repository'].ref.target.history.nodes;
|
|
var lastReviewDate = getDocReviewDate(x); // (key + ".md");
|
|
var numUsefulCommits = extractCommitInfo(nodes, lastReviewDate, stoplist);
|
|
if (numUsefulCommits > 0) {
|
|
var dateString = lastReviewDate.format('YYYY-MM-DD');
|
|
var score = priorityScore(lastReviewDate, numUsefulCommits).toPrecision(3);
|
|
console.log("'".concat(key, "','").concat(dateString, "','").concat(numUsefulCommits, "','").concat(score, "'"));
|
|
}
|
|
});
|
|
});
|
|
});
|
|
function priorityScore(reviewDate, numCommits) {
|
|
var daysSinceReview = moment().diff(reviewDate, 'days');
|
|
var commitScore = 2 + numCommits * commitWeight;
|
|
return Math.pow(commitScore, daysSinceReview / scoreTimeBase);
|
|
}
|
|
function getDocReviewDate(docFileName) {
|
|
var mdFilePath = path.resolve(docsFolderPath, docFileName);
|
|
var mdText = fs.readFileSync(mdFilePath);
|
|
var tree = remark().use(frontMatter, ['yaml']).parse(mdText);
|
|
var lastReviewDate = moment(adf20StartDate);
|
|
if (tree.children[0].type === 'yaml') {
|
|
var metadata = yaml.load(tree.children[0].value);
|
|
if (metadata['Last reviewed']) {
|
|
lastReviewDate = moment(metadata['Last reviewed']);
|
|
}
|
|
}
|
|
return lastReviewDate;
|
|
}
|
|
function extractCommitInfo(commitNodes, cutOffDate, stoplist) {
|
|
var numUsefulCommits = 0;
|
|
commitNodes.forEach(function (element) {
|
|
if (!stoplist.isRejected(element.message)) {
|
|
// const abbr = element.message.substr(0, 15);
|
|
var commitDate = moment(element.pushedDate);
|
|
if (commitDate.isAfter(cutOffDate)) {
|
|
numUsefulCommits++;
|
|
}
|
|
}
|
|
});
|
|
return numUsefulCommits;
|
|
}
|
|
function getDocFilePaths(folderPath) {
|
|
var result = [];
|
|
libFolders.forEach(function (element) {
|
|
var libPath = path.resolve(folderPath, element);
|
|
addItemsRecursively(libPath, result);
|
|
});
|
|
return result;
|
|
function addItemsRecursively(elementPath, resultList) {
|
|
var items = fs.readdirSync(elementPath);
|
|
items.forEach(function (item) {
|
|
var fullItemPath = path.resolve(elementPath, item);
|
|
var itemInfo = fs.statSync(fullItemPath);
|
|
if (itemInfo.isDirectory()) {
|
|
addItemsRecursively(fullItemPath, resultList);
|
|
}
|
|
else if ((path.extname(fullItemPath) === '.md') &&
|
|
(item !== 'README.md') &&
|
|
(item.match(angFilePattern))) {
|
|
resultList.push(fullItemPath);
|
|
}
|
|
});
|
|
}
|
|
}
|