[Trunk | Explore Services]
1. extractUrlsFromSearch.ts: a. [Bug fix] In request for getting communities, resolve and reject appropriately. b. Removed require('express'), require('url'), require('cors'). c. Updated file names (date.getMonth() returns 0-11) | Add .txt in error file name. 2. package.json: Removed dependencies cors and express. 3. tsconfig.json: Added in compilerOptions: "lib": ["es2017", "dom"]. 4. svn:ignore: Ignore node_module, package-lock.json, *.xml, *.txt. git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@61227 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
4d5d3ea0f0
commit
1990ce1eca
|
@ -8,12 +8,7 @@ import {Identifier} from "../../explore/src/app/openaireLibrary/utils/string-uti
|
||||||
import {SearchFields} from "../../explore/src/app/openaireLibrary/utils/properties/searchFields";
|
import {SearchFields} from "../../explore/src/app/openaireLibrary/utils/properties/searchFields";
|
||||||
import {ContextsService} from "../../explore/src/app/openaireLibrary/claims/claim-utils/service/contexts.service";
|
import {ContextsService} from "../../explore/src/app/openaireLibrary/claims/claim-utils/service/contexts.service";
|
||||||
|
|
||||||
let express = require('express');
|
|
||||||
let app = express();
|
|
||||||
const request = require('superagent');
|
const request = require('superagent');
|
||||||
const URL = require('url');
|
|
||||||
let cors = require('cors');
|
|
||||||
app.use(cors());
|
|
||||||
|
|
||||||
function get(resultsPerUrl) {
|
function get(resultsPerUrl) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
@ -208,13 +203,14 @@ function getUrlByType(type: any, pid: any, id: any) {
|
||||||
|
|
||||||
function getCommunities() {
|
function getCommunities() {
|
||||||
communitiesPromise = new Promise((resolve, reject) => {
|
communitiesPromise = new Promise((resolve, reject) => {
|
||||||
resolve();
|
|
||||||
request.get(contextUrl, async function (err: any, communitiesResponse: any) {
|
request.get(contextUrl, async function (err: any, communitiesResponse: any) {
|
||||||
if (!communitiesResponse && err) {
|
if (!communitiesResponse && err) {
|
||||||
console.error("Error getting communities ", err);
|
console.error("Error getting communities ", err);
|
||||||
|
reject();
|
||||||
} else {
|
} else {
|
||||||
const contextsService = new ContextsService();
|
const contextsService = new ContextsService();
|
||||||
publicCommunities = contextsService.parseCommunities(communitiesResponse.body, false).map(value => value.id);
|
publicCommunities = contextsService.parseCommunities(communitiesResponse.body, false).map(value => value.id);
|
||||||
|
resolve();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
@ -224,8 +220,8 @@ function buildSiteMap(resultsPerUrl) {
|
||||||
console.time("total_time");
|
console.time("total_time");
|
||||||
|
|
||||||
let date = new Date();
|
let date = new Date();
|
||||||
fileName = "sitemap_"+date.getFullYear()+"_"+date.getMonth()+"_"+date.getDate()+".xml";//+"_"+date.getTime();
|
fileName = "sitemap_"+date.getFullYear()+"_"+(date.getMonth()+1)+"_"+date.getDate()+".xml";//+"_"+date.getTime();
|
||||||
errorFileName = "error_"+date.getFullYear()+"_"+date.getMonth()+"_"+date.getDate();//+"_"+date.getTime();
|
errorFileName = "error_"+date.getFullYear()+"_"+(date.getMonth()+1)+"_"+date.getDate()+".txt";//+"_"+date.getTime();
|
||||||
console.log("Buiding sitemap in file: "+fileName+"\n");
|
console.log("Buiding sitemap in file: "+fileName+"\n");
|
||||||
|
|
||||||
let sitemap = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
|
let sitemap = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
|
||||||
|
|
|
@ -7,8 +7,6 @@
|
||||||
"start": "PORT=3100 node extractUrlsFromSearch.js"
|
"start": "PORT=3100 node extractUrlsFromSearch.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cors": "^2.8.5",
|
|
||||||
"express": "^4.17.1",
|
|
||||||
"superagent": "^5.0.5"
|
"superagent": "^5.0.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
@ -4,6 +4,10 @@
|
||||||
"node_modules/@types"
|
"node_modules/@types"
|
||||||
],
|
],
|
||||||
"noImplicitAny": false,
|
"noImplicitAny": false,
|
||||||
|
"lib": [
|
||||||
|
"es2017",
|
||||||
|
"dom"
|
||||||
|
],
|
||||||
"emitDecoratorMetadata": true,
|
"emitDecoratorMetadata": true,
|
||||||
"experimentalDecorators": true
|
"experimentalDecorators": true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue