add checkForObsoleteVersion when creating the css for the dashboards

This commit is contained in:
argirok 2023-06-19 11:24:13 +03:00
parent b20d0f0039
commit 9f88a58a30
1 changed files with 4 additions and 4 deletions

View File

@ -11,7 +11,7 @@ import {existsSync} from 'fs';
import {REQUEST, RESPONSE} from "./src/app/openaireLibrary/utils/tokens";
import {isArray} from "util";
import {properties} from "./src/environments/environment";
import {Layout} from "./src/app/openaireLibrary/connect/community/CustomizationOptions";
import {CustomizationOptions, Layout} from "./src/app/openaireLibrary/connect/community/CustomizationOptions";
import {Response} from "express";
const fs = require('fs');
@ -79,7 +79,7 @@ function buildAll(res: Response = null) {
axios.get(layoutsURL).then(response => {
if (response.data && Array.isArray(response.data) && response.data.length > 0) {
response.data.forEach((layout: Layout) => {
let variables = Layout.getVariables(layout.layoutOptions);
let variables = Layout.getVariables(CustomizationOptions.checkForObsoleteVersion(layout.layoutOptions, layout.portalPid));
buildCss(layout.portalPid, layout.date ? layout.date : null, variables);
});
if (res) {
@ -185,7 +185,7 @@ export function app() {
});
server.post('/build-css/:id/:suffix', jsonParser,(req, res) => {
let variables = Layout.getVariables(req.body);
let variables = Layout.getVariables(CustomizationOptions.checkForObsoleteVersion(req.body, req.params.id));
if (variables) {
buildCss(req.params.id , req.params.suffix, variables);
res.status(200).send({
@ -198,7 +198,7 @@ export function app() {
});
server.post('/build-css/preview/:id/:suffix', jsonParser, (req, res) => {
let variables = Layout.getVariables(req.body);
let variables = Layout.getVariables(CustomizationOptions.checkForObsoleteVersion(req.body, req.params.id));
if (variables) {
buildCss(req.params.id, req.params.suffix, variables);
res.status(200).send({code: 200, message: 'CSS build for ' + req.params.id + ' layout was successful'});