Commit 59c5153f authored by BojanSovticEngIT's avatar BojanSovticEngIT
Browse files

Merge https://github.com/KnowageLabs/Knowage-Server into sprint-15-bugfix

parents 3a2d42d2 6f6b6a75
......@@ -14,26 +14,25 @@
<dependencies>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-1.2-api</artifactId>
<version>2.17.1</version>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-1.2-api</artifactId>
<version>2.17.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<!-- Could not find the original Oracle JDBC driver on Maven Central, using this one with BSD license -->
<groupId>com.github.noraui</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9.3</version>
<scope>compile</scope>
</dependency>
</dependency>
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
......
......@@ -88,6 +88,7 @@
<quartz-oracle.version>2.1.7</quartz-oracle.version>
<logstash-gelf.version>1.15.0</logstash-gelf.version>
<log4j.version>2.17.1</log4j.version>
<ojdbc.version>12.2.0.1</ojdbc.version>
</properties>
<modules>
......@@ -151,7 +152,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<version>3.3.1</version>
<configuration>
<warName>${project.name}</warName>
......@@ -411,6 +412,12 @@
<artifactId>logstash-gelf</artifactId>
<version>${logstash-gelf.version}</version>
</dependency>
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<version>${ojdbc.version}</version>
</dependency>
</dependencies>
......
......@@ -29,6 +29,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.nio.file.Paths;
import java.text.Format;
import java.text.ParseException;
import java.text.SimpleDateFormat;
......@@ -1224,15 +1225,15 @@ public class DocumentExecutionResource extends AbstractSpagoBIResource {
if (input != null) {
String saveDirectoryPath = SpagoBIUtilities.getResourcePath() + "/" + METADATA_DIR + "/" + getUserProfile().getUserName().toString();
java.nio.file.Path saveDirectoryPath = Paths.get(SpagoBIUtilities.getResourcePath(), METADATA_DIR, getUserProfile().getUserId().toString());
final FormFile file = input.getFormFileParameterValues("file")[0];
bytes = file.getContent();
File saveDirectory = new File(saveDirectoryPath);
File saveDirectory = saveDirectoryPath.toFile();
if (!(saveDirectory.exists() && saveDirectory.isDirectory())) {
saveDirectory.mkdirs();
}
String tempFile = saveDirectoryPath + "/" + file.getFileName();
String tempFile = Paths.get(saveDirectoryPath.toString(), file.getFileName()).toString();
File tempFileToSave = new File(tempFile);
tempFileToSave.createNewFile();
DataOutputStream os = new DataOutputStream(new FileOutputStream(tempFileToSave));
......
......@@ -1428,18 +1428,47 @@ public class ManageDataSetsForREST {
MetaData toReturn = new MetaData();
List<IFieldMetaData> fieldsMeta = new ArrayList<IFieldMetaData>();
for (int i = 0; i < dsMeta.length() - 1; i = i + 3) {
Map<String, IFieldMetaData> m = new HashMap<String, IFieldMetaData>();
for (int i = 0; i < dsMeta.length() - 1; i++) {
JSONObject currMetaType = dsMeta.getJSONObject(i);
JSONObject currMetaFieldType = dsMeta.getJSONObject(i + 1);
IFieldMetaData m = new FieldMetadata();
m.setName(currMetaType.getString("column"));
m.setAlias(null);
m.setType(getClassTypeFromColumn(currMetaType.getString("pvalue")));
m.setProperties(new HashMap<>());
m.setFieldType(getFieldTypeFromColumn(currMetaFieldType.getString("pvalue")));
m.setMultiValue(false);
fieldsMeta.add(m);
}
String column = currMetaType.getString("column");
IFieldMetaData columnMap = m.get(column);
if (columnMap == null) {
m.put(column, new FieldMetadata());
m.get(column).setName(currMetaType.getString("column"));
m.get(column).setProperties(new HashMap<>());
m.get(column).setMultiValue(false);
}
switch (currMetaType.getString("pname")) {
case "Type":
m.get(column).setType(getClassTypeFromColumn(currMetaType.getString("pvalue")));
break;
case "fieldType":
m.get(column).setFieldType(getFieldTypeFromColumn(currMetaType.getString("pvalue")));
break;
case "fieldAlias":
m.get(column).setAlias(currMetaType.getString("pvalue"));
break;
case "personal":
m.get(column).setPersonal(currMetaType.getBoolean("pvalue"));
break;
case "decript":
m.get(column).setDecript(currMetaType.getBoolean("pvalue"));
break;
case "subjectId":
m.get(column).setSubjectId(currMetaType.getBoolean("pvalue"));
break;
default:
break;
}
}
m.keySet().forEach(x -> fieldsMeta.add(m.get(x)));
toReturn.setFieldsMeta(fieldsMeta);
return toReturn;
......
import md5 from 'crypto-js/md5'
export function getGravatar(email: string, size?: number): string {
let MD5 = md5(email.toLowerCase())
const picSize = size || 80
return 'http://www.gravatar.com/avatar/' + MD5 + '?d=retro&s=' + picSize
}
......@@ -381,6 +381,7 @@
"engine": "Engine",
"engineHint": "Select a type to unlock the available engines",
"imageError": "Error deleting image",
"imageInfo": "Image successfully uploaded",
"imageUploadError": "Error uploading image",
"infoTitle": "Informations",
"parametersPanelPosition": "Parameters panel position",
......@@ -392,8 +393,7 @@
"restrictionValueHint": "Enter Value",
"restrictionsTitle": "Visibility Restrictions",
"uploadTemplate": "Upload template",
"visibilityLocationTitle": "Select the functionalities where the document will be visible",
"imageInfo": "Image successfully uploaded"
"visibilityLocationTitle": "Select the functionalities where the document will be visible"
},
"outputParams": {
"customValue": "Custom Value",
......@@ -1195,9 +1195,10 @@
"ckanSkipRows": "Start From Row Number",
"ckanUrl": "CKAN Url",
"ckanXslSheetNumber": "Sheet Number",
"confirmMsg": "You will lose all unsaved changes, are you sure you want to open Data Preparation?",
"creationUser": "Creation User",
"dataframeName": "Dataframe variable name",
"decript": "Decript value",
"decript": "Decript",
"deleteAllParams": "Clear all dataset parameters",
"deleteAllParamsMsg": "Are you sure you want to delete all dataset parameters?",
"deleteAllRequestHeaderMsg": "Are you sure you want to delete all REST request headers",
......@@ -1229,17 +1230,19 @@
"jsonPathAttributes": "JSON Path Attributes",
"jsonPathValue": "JSON Path Value",
"metadataInfo": "You cannot open fields metadata for the dataset that is not saved, please save it first.",
"monitoring": "Monitoring",
"noLinkedTables": "There are no linked tables.",
"noSourceSelectedWarning": "Please select a Source",
"noSourceTables": "There are no source tables for selected dataset.",
"noTablesToLink": "There are no tables to link in this source.",
"noVersions": "There are no previous versions of this dataset, save it with changes to create an older version.",
"oldVersions": "Dataset Versions",
"openDP": "Open data preparation",
"openQbeButton": "Open Qbe",
"params": "Parameters",
"peristenceWarning": "Dataset with parameters cannot be persisted!",
"persistTableName": "Persist Table Name",
"personal": "Sensitive data",
"personal": "Personal",
"pivotColName": "Category Column to be Pivoted",
"pivotColValue": "Value Column to be Pivoted",
"pivotIsNumRows": "Automatic Columns numeration?",
......@@ -1279,17 +1282,14 @@
"sparqlDefaultGraphIri": "Default Graph IRI",
"sparqlEndpoint": "Sparql Endpoint",
"sparqlExecutionTimeout": "Execution timeout(s)",
"subjectId": "Subject key",
"subjectId": "Subject id",
"tableEmpty": "Click on the + icon to insert data.",
"timestampFormat": "Timestamp Format",
"title": "Dataset Management",
"typeOrJsonPathValue": "Type or JSON Path Type",
"viewQbeButton": "View Qbe Query",
"viewQbeMsg": "The dataset should be saved before viewing the QBE query",
"viewQbeWarning": "Cannot open QBE query",
"openDP": "Open data preparation",
"confirmMsg": "You will lose all unsaved changes, are you sure you want to open Data Preparation?",
"monitoring": "Monitoring"
"viewQbeWarning": "Cannot open QBE query"
},
"domainsManagement": {
"domainCode": "Domain code",
......
......@@ -24,7 +24,7 @@
"interaction": {
"type": "event"
},
"textField": "priority",
"textField": "parameterUrlName",
"titleField": "label"
},
"style": {
......
......@@ -47,11 +47,11 @@
{{ $t('documentExecution.dossier.launchedActivities') }}
</template>
</Toolbar>
<ProgressBar mode="indeterminate" class="kn-progress-bar" v-if="loading" data-test="progress-bar" />
</template>
<template #content>
<ProgressBar mode="indeterminate" class="kn-progress-bar" v-if="loading" data-test="progress-bar" />
<KnHint v-if="showHint" :title="'documentExecution.dossier.title'" :hint="'documentExecution.dossier.hint'" data-test="hint"></KnHint>
<DataTable v-else :value="dossierActivities" :loading="loading" v-model:filters="filters" :scrollable="true" scrollHeight="40vh" :rows="20" class="p-datatable-sm kn-table" dataKey="id" responsiveLayout="stack" breakpoint="960px" data-test="activities-table">
<DataTable v-else :value="dossierActivities" v-model:filters="filters" :scrollable="true" scrollHeight="40vh" :rows="20" class="p-datatable-sm kn-table" dataKey="id" responsiveLayout="stack" breakpoint="960px" data-test="activities-table">
<template #header>
<div class="table-header">
<span class="p-input-icon-left">
......@@ -102,7 +102,7 @@
export default defineComponent({
name: 'dossier',
components: { Card, Column, DataTable, KnHint, KnValidationMessages },
props: { id: { type: String, required: false }, reloadTrigger: { type: Boolean } },
props: { id: { type: String, required: false }, reloadTrigger: { type: Boolean }, filterData: Object },
computed: {
showHint() {
if (this.dossierActivities.length != 0) {
......@@ -171,8 +171,15 @@
async getDossierTemplate() {
this.loading = true
let url = `/knowagedossierengine/api/start/dossierTemplate?documentId=${this.id}`
let filters = this.filterData ? this.filterData : {}
let config = {
headers: { Accept: 'application/json, text/plain, */*' },
params: {
filterData : encodeURIComponent(JSON.stringify(filters))
},
}
await this.$http
.get(url, { headers: { Accept: 'application/json, text/plain, */*' } })
.get(url, config )
.then((response: AxiosResponse<any>) => {
this.jsonTemplate = { ...response.data }
})
......
......@@ -26,7 +26,7 @@
<template v-if="filtersData && filtersData.isReadyForExecution && !loading && !schedulationsTableVisible">
<Registry v-if="mode === 'registry'" :id="urlData?.sbiExecutionId" :reloadTrigger="reloadTrigger"></Registry>
<Dossier v-else-if="mode === 'dossier'" :id="document.id" :reloadTrigger="reloadTrigger"></Dossier>
<Dossier v-else-if="mode === 'dossier'" :id="document.id" :reloadTrigger="reloadTrigger" :filterData="filtersData"></Dossier>
<Olap
v-else-if="mode === 'olap'"
:id="urlData?.sbiExecutionId"
......
......@@ -74,7 +74,6 @@ import DownloadsDialog from '@/modules/mainMenu/dialogs/DownloadsDialog/Download
import { IMenuItem } from '@/modules/mainMenu/MainMenu'
import TieredMenu from 'primevue/tieredmenu'
import ScrollPanel from 'primevue/scrollpanel'
export default defineComponent({
name: 'Knmenu',
components: {
......@@ -109,7 +108,7 @@ export default defineComponent({
hoverTimer: false as any
}
},
emits: ['update:visibility', 'menuItemSelected'],
emits: ['update:visibility'],
methods: {
info() {
this.display = !this.display
......@@ -156,16 +155,13 @@ export default defineComponent({
this[item.command]()
} else if (item.to && event.navigate) {
event.navigate(event.originalEvent)
this.$emit('menuItemSelected', item)
} else if (item.url && (!item.target || item.target === 'insideKnowage')) this.$router.push({ name: 'externalUrl', params: { url: item.url } })
if (this.adminMenuOpened) this.adminMenuOpened = false
},
getHref(item) {
let to = item.to
if (to) {
to = to.replace(/\\\//g, '/')
if (to.startsWith('/')) to = to.substring(1)
return process.env.VUE_APP_PUBLIC_PATH + to
}
......@@ -218,7 +214,6 @@ export default defineComponent({
}
return toRet
},
toggleMenu(event, item) {
if (item.items) {
clearTimeout(this.hoverTimer)
......
<template>
<li role="menu" :style="[item.style, getVisibilityClass(item)]" :title="item.descr ? $internationalization($t(item.descr)) : $internationalization($t(item.label))">
<li role="menu" :style="[item.style, getVisibilityClass(item)]" :title="getInternationalizedValue()">
<router-link v-if="item.to && !item.disabled" :to="cleanTo" custom v-slot="{ navigate, isActive }" exact>
<a @click="onClick($event, navigate)" role="menuitem" :class="isActive && 'router-link-active'">
<Badge v-if="badge > 0" :value="badge" severity="danger"></Badge>
<span v-if="item.iconCls" :class="['p-menuitem-icon', item.iconCls]"></span>
<img v-if="item.custIcon" :src="item.custIcon" />
<span v-if="!item.iconCls && !item.custIcon" class="p-menuitem-icon fas fa-file"></span>
<span v-if="item.descr" class="p-menuitem-text">{{ $internationalization($t(item.descr)) }}</span>
<span v-else class="p-menuitem-text">{{ $internationalization($t(item.label)) }}</span>
<span class="p-menuitem-text">{{ getInternationalizedValue() }}</span>
<i v-if="item.items" class="pi pi-fw pi-angle-right"></i>
</a>
</router-link>
......@@ -17,8 +16,7 @@
<img v-if="item.custIcon" :src="item.custIcon" />
<img v-if="item.iconCls && item.command === 'languageSelection'" :src="require('@/assets/images/flags/' + locale.toLowerCase().substring(3, 5) + '.svg')" />
<span v-if="!item.iconCls && !item.custIcon" class="p-menuitem-icon fas fa-file"></span>
<span v-if="item.descr" class="p-menuitem-text">{{ $internationalization($t(item.descr)) }}</span>
<span v-else class="p-menuitem-text">{{ $internationalization($t(item.label)) }}</span>
<span class="p-menuitem-text">{{ getInternationalizedValue() }}</span>
<i v-if="item.items" class="pi pi-fw pi-angle-right"></i>
</a>
</li>
......@@ -35,7 +33,8 @@
emits: ['click'],
props: {
item: null,
badge: null
badge: null,
internationalize: { type: Boolean, required: false, default: false }
},
data() {
return {
......@@ -58,6 +57,15 @@
if (!item.conditionedView) return true
return !item.visible ? 'display:none' : ''
},
getInternationalizedValue(): String {
let value = this.item.descr ? this.item.descr : this.item.label
if (this.internationalize) {
// @ts-ignore
return this.$internationalization(value)
} else {
return this.$t(value)
}
}
},
computed: {
......
......@@ -76,6 +76,195 @@
"help": "dataPreparation.substring",
"label": "substring",
"name": "substring"
},
{
"category": "SQL",
"formula": "CASE WHEN expr1 THEN expr2 [WHEN expr3 THEN expr4]* [ELSE expr5] END",
"help": "dataPreparation.case",
"label": "case",
"name": "case"
},
{
"category": "TIME",
"formula": "current_date",
"help": "dataPreparation.current_date",
"label": "CURRENT_DATE",
"name": "CURRENT_DATE"
},
{
"category": "TIME",
"formula": "current_time",
"help": "dataPreparation.current_time",
"label": "CURRENT_TIME",
"name": "CURRENT_TIME"
},
{
"category": "TIME",
"formula": "second(datetime_expression)",
"help": "dataPreparation.second",
"label": "second",
"name": "second"
},
{
"category": "TIME",
"formula": "hour(datetime_expression)",
"help": "dataPreparation.hour",
"label": "hour",
"name": "hour"
},
{
"category": "TIME",
"formula": "year(date_expression)",
"help": "dataPreparation.year",
"label": "year",
"name": "year"
},
{
"category": "TIME",
"formula": "month(date_expression)",
"help": "dataPreparation.month",
"label": "month",
"name": "month"
},
{
"category": "TIME",
"formula": "day(date_expression)",
"help": "dataPreparation.day",
"label": "day",
"name": "day"
},
{
"category": "TIME",
"formula": "get_quarter(date_expression)",
"help": "dataPreparation.get_quarter",
"label": "get_quarter",
"name": "get_quarter"
},
{
"category": "TIME",
"formula": "get_week(date_expression)",
"help": "dataPreparation.get_week",
"label": "get_week",
"name": "get_week"
},
{
"category": "TIME",
"formula": "get_day_of_the_week(date_expression)",
"help": "dataPreparation.get_day_of_the_week",
"label": "get_day_of_the_week",
"name": "get_day_of_the_week"
},
{
"category": "TIME",
"formula": "add_days(${date_expression},${number_of_days})",
"help": "dataPreparation.add_days",
"label": "add_days",
"name": "add_days"
},
{
"category": "TIME",
"formula": "add_hours(${date_expression},${number_of_hours})",
"help": "dataPreparation.add_hours",
"label": "add_hours",
"name": "add_hours"
},
{
"category": "TIME",
"formula": "add_months(${date_expression},${number_of_months})",
"help": "dataPreparation.add_months",
"label": "add_months",
"name": "add_months"
},
{
"category": "TIME",
"formula": "add_years(${date_expression},${number_of_years})",
"help": "dataPreparation.add_years",
"label": "add_years",
"name": "add_years"
},
{
"category": "TIME",
"formula": "subtract_days(${date_expression},${number_of_days})",
"help": "dataPreparation.subtract_days",
"label": "subtract_days",
"name": "subtract_days"
},
{
"category": "TIME",
"formula": "subtract_hours(${date_expression},${number_of_hours})",
"help": "dataPreparation.subtract_hours",
"label": "subtract_hours",
"name": "subtract_hours"
},
{
"category": "TIME",
"formula": "subtract_months(${date_expression},${number_of_months})",
"help": "dataPreparation.subtract_months",
"label": "subtract_months",
"name": "subtract_months"
},
{
"category": "TIME",
"formula": "subtract_years(${date_expression},${number_of_years})",
"help": "dataPreparation.subtract_years",
"label": "subtract_years",
"name": "subtract_years"
},
{
"category": "TIME",
"formula": "datediff_in_days(${starting_date},${ending_date})",
"help": "dataPreparation.datediff_in_days",
"label": "datediff_in_days",
"name": "datediff_in_days"
},
{
"category": "TIME",
"formula": "datediff_in_hours(${starting_date},${ending_date})",
"help": "dataPreparation.datediff_in_hours",
"label": "datediff_in_hours",
"name": "datediff_in_hours"
},
{
"category": "TIME",
"formula": "datediff_in_minutes(${starting_date},${ending_date}) ",
"help": "dataPreparation.datediff_in_minutes",
"label": "datediff_in_minutes",
"name": "datediff_in_minutes"
},
{
"category": "SPATIAL",
"formula": "distance(${geom1}, ${geom2}, ${tol}, ${unit})",
"help": "dataPreparation.distance",
"label": "distance",
"name": "distance"
},
{
"category": "SPATIAL",
"formula": "centroid(${geom1}, ${tol})",
"help": "dataPreparation.centroid",
"label": "Centroid",
"name": "Centroid"
},
{
"category": "SPATIAL",
"formula": "length_spa(${geom}, ${tol}, ${unit})",
"help": "dataPreparation.length_spa",
"label": "length_spa",