aboutsummaryrefslogtreecommitdiffstats
path: root/sdnr/wt/odlux/framework
diff options
context:
space:
mode:
authorAijana Schumann <aijana.schumann@highstreet-technologies.com>2020-08-12 12:28:06 +0200
committerAijana Schumann <aijana.schumann@highstreet-technologies.com>2020-08-12 12:29:48 +0200
commit3d02271058d2e59a71e49afdd866462f7b6ab1c6 (patch)
treebb42b3428055136a4a8f5def9c63e412390d40ef /sdnr/wt/odlux/framework
parentcd29d2dd98b7c40bd4efb6a8705787ca35e99fe9 (diff)
Switch odlux from Biermann-RestConf to RFC8040 interface
Switched rest-calls in odlux to use RFC8040 interface Issue-ID: CCSDK-2565 Signed-off-by: Aijana Schumann <aijana.schumann@highstreet-technologies.com> Change-Id: Ia59dd02bc6456bad648083146c0256f204e134d1
Diffstat (limited to 'sdnr/wt/odlux/framework')
-rw-r--r--sdnr/wt/odlux/framework/pom.xml15
-rw-r--r--sdnr/wt/odlux/framework/src/models/elasticSearch.ts13
-rw-r--r--sdnr/wt/odlux/framework/src/services/restService.ts8
-rw-r--r--sdnr/wt/odlux/framework/src/utilities/elasticSearch.ts10
-rw-r--r--sdnr/wt/odlux/framework/src/views/about.tsx2
-rw-r--r--sdnr/wt/odlux/framework/src2/main/resources/version.json4
-rw-r--r--sdnr/wt/odlux/framework/webpack.config.js12
7 files changed, 43 insertions, 21 deletions
diff --git a/sdnr/wt/odlux/framework/pom.xml b/sdnr/wt/odlux/framework/pom.xml
index c7d9c3295..db42ef1ac 100644
--- a/sdnr/wt/odlux/framework/pom.xml
+++ b/sdnr/wt/odlux/framework/pom.xml
@@ -46,7 +46,7 @@
<properties>
<buildtime>${maven.build.timestamp}</buildtime>
<distversion>ONAP Frankfurt (Neon, mdsal ${odl.mdsal.version})</distversion>
- <buildno>56.139cd6d(20/07/08)</buildno>
+ <buildno>57.3e1d5cf(20/08/11)</buildno>
<odlux.version>ONAP SDN-R | ONF Wireless for ${distversion} - Build: ${buildtime} ${buildno} ${project.version}</odlux.version>
</properties>
@@ -56,6 +56,10 @@
<directory>dist</directory>
<targetPath>odlux</targetPath>
</resource>
+ <resource>
+ <directory>src2/main/resources</directory>
+ <targetPath>odlux</targetPath>
+ </resource>
</resources>
<plugins>
<plugin>
@@ -172,12 +176,21 @@
<basedir>${project.build.directory}/classes/odlux</basedir>
<includes>
<include>app.js</include>
+ <include>version.json</include>
</includes>
<replacements>
<replacement>
<token>##odlux.version##</token>
<value>${odlux.version}</value>
</replacement>
+ <replacement>
+ <token>##buildno##</token>
+ <value>${buildno}</value>
+ </replacement>
+ <replacement>
+ <token>##build-timestamp##</token>
+ <value>${buildtime}</value>
+ </replacement>
</replacements>
</configuration>
</plugin>
diff --git a/sdnr/wt/odlux/framework/src/models/elasticSearch.ts b/sdnr/wt/odlux/framework/src/models/elasticSearch.ts
index 12cfd7d28..b5f25097c 100644
--- a/sdnr/wt/odlux/framework/src/models/elasticSearch.ts
+++ b/sdnr/wt/odlux/framework/src/models/elasticSearch.ts
@@ -16,16 +16,21 @@
* ============LICENSE_END==========================================================================
*/
export type Result<TSource extends {}> = {
- output: {
+ "data-provider:output": {
pagination?: {
- size: number,
- page: number,
- total: number
+ size: number;
+ page: number;
+ total: number;
},
data: TSource[];
}
}
+export type SingeResult<TSource extends {}> = {
+ "data-provider:output": TSource;
+}
+
+
export type HitEntry<TSource extends {}> = {
_index: string;
_type: string;
diff --git a/sdnr/wt/odlux/framework/src/services/restService.ts b/sdnr/wt/odlux/framework/src/services/restService.ts
index b02d7d19f..19ef34f91 100644
--- a/sdnr/wt/odlux/framework/src/services/restService.ts
+++ b/sdnr/wt/odlux/framework/src/services/restService.ts
@@ -33,7 +33,7 @@ export const formEncode = (params: { [key: string]: string | number }) => Object
/** Sends a rest request to the given path.
* @returns The data, or null it there was any error
*/
-export async function requestRest<TData>(path: string = '', init: RequestInit = {}, authenticate: boolean = true, isResource: boolean = false): Promise<TData | null> {
+export async function requestRest<TData>(path: string = '', init: RequestInit = {}, authenticate: boolean = true, isResource: boolean = false): Promise<TData | null | undefined> {
const res = await requestRestExt<TData>(path, init, authenticate, isResource);
if (res && res.status >= 200 && res.status < 300) {
return res.data;
@@ -42,9 +42,9 @@ export async function requestRest<TData>(path: string = '', init: RequestInit =
}
/** Sends a rest request to the given path and reports the server state.
- * @returns An object with the server state, a message and the data.
+ * @returns An object with the server state, a message and the data or undefined in case of a json parse error.
*/
-export async function requestRestExt<TData>(path: string = '', init: RequestInit = {}, authenticate: boolean = true, isResource: boolean = false): Promise<{ status: number, message?: string, data: TData | null }> {
+export async function requestRestExt<TData>(path: string = '', init: RequestInit = {}, authenticate: boolean = true, isResource: boolean = false): Promise<{ status: number, message?: string, data: TData | null | undefined }> {
const result: { status: number, message?: string, data: TData | null } = {
status: -1,
data: null,
@@ -99,7 +99,7 @@ export async function requestRestExt<TData>(path: string = '', init: RequestInit
...result,
status: fetchResult.status,
message: error && error.message || String(error),
- data: null
+ data: undefined
};
}
} \ No newline at end of file
diff --git a/sdnr/wt/odlux/framework/src/utilities/elasticSearch.ts b/sdnr/wt/odlux/framework/src/utilities/elasticSearch.ts
index c18a40b0b..6f4c71ec7 100644
--- a/sdnr/wt/odlux/framework/src/utilities/elasticSearch.ts
+++ b/sdnr/wt/odlux/framework/src/utilities/elasticSearch.ts
@@ -33,14 +33,14 @@ type dataType = { [prop: string]: propType };
*/
export function createSearchDataHandler<TResult>(typeName: (() => string) | string, additionalFilters?: {} | null | undefined): DataCallback<(TResult)> {
const fetchData: DataCallback<(TResult)> = async (pageIndex, rowsPerPage, orderBy, order, filter) => {
- const url = `/restconf/operations/data-provider:read-${typeof typeName === "function" ? typeName(): typeName}-list`;
+ const url = `/rests/operations/data-provider:read-${typeof typeName === "function" ? typeName(): typeName}-list`;
filter = { ...filter, ...additionalFilters };
const filterKeys = filter && Object.keys(filter) || [];
const query = {
- input: {
+ "data-provider:input": {
filter: filterKeys.filter(f => filter![f] != null && filter![f] !== "").map(property => ({ property, filtervalue: filter![property]})),
sortorder: orderBy ? [{ property: orderBy, sortorder: order === "desc" ? "descending" : "ascending" }] : [],
pagination: { size: rowsPerPage, page: (pageIndex != null && pageIndex > 0 && pageIndex || 0) +1 }
@@ -60,12 +60,12 @@ export function createSearchDataHandler<TResult>(typeName: (() => string) | stri
if (result) {
let rows: TResult[] = [];
- if (result && result.output && result.output.data) {
- rows = result.output.data.map(obj => convertPropertyNames(obj, replaceHyphen)) || []
+ if (result && result["data-provider:output"] && result["data-provider:output"].data) {
+ rows = result["data-provider:output"].data.map(obj => convertPropertyNames(obj, replaceHyphen)) || []
}
const data = {
- page: result.output.pagination && result.output.pagination.page != null && result.output.pagination.page - 1 || 0 , total: result.output.pagination && result.output.pagination.total || 0, rows: rows
+ page: +(result["data-provider:output"].pagination && result["data-provider:output"].pagination.page != null && result["data-provider:output"].pagination.page - 1 || 0) , total: +(result["data-provider:output"].pagination && result["data-provider:output"].pagination.total || 0), rows: rows
};
return data;
}
diff --git a/sdnr/wt/odlux/framework/src/views/about.tsx b/sdnr/wt/odlux/framework/src/views/about.tsx
index ca3953af1..c4a5488e0 100644
--- a/sdnr/wt/odlux/framework/src/views/about.tsx
+++ b/sdnr/wt/odlux/framework/src/views/about.tsx
@@ -44,7 +44,7 @@ class AboutComponent extends React.Component<any, AboutState> {
requestRestExt<string>('/about').then((response) => {
const content = response.status == 200 ? response.data : `${response.status} ${response.message}` || "Server error";
const loadedSucessfully = response.status == 200 ? true : false;
- this.setState({ content: content, isContentLoadedSucessfully: loadedSucessfully });
+ this.setState({ content: content || null, isContentLoadedSucessfully: loadedSucessfully });
}).catch((error) => {
this.setState({ content: error })
})
diff --git a/sdnr/wt/odlux/framework/src2/main/resources/version.json b/sdnr/wt/odlux/framework/src2/main/resources/version.json
new file mode 100644
index 000000000..f74d2c966
--- /dev/null
+++ b/sdnr/wt/odlux/framework/src2/main/resources/version.json
@@ -0,0 +1,4 @@
+{
+ "version":"##buildno##",
+ "build":"##build-timestamp##"
+} \ No newline at end of file
diff --git a/sdnr/wt/odlux/framework/webpack.config.js b/sdnr/wt/odlux/framework/webpack.config.js
index 4887a757e..c7ef72e80 100644
--- a/sdnr/wt/odlux/framework/webpack.config.js
+++ b/sdnr/wt/odlux/framework/webpack.config.js
@@ -176,7 +176,7 @@ module.exports = (env) => {
],
devServer: {
- public: "http://localhost:3100",
+ public: "http://10.20.6.29:3100",
contentBase: distPath,
compress: true,
@@ -195,23 +195,23 @@ module.exports = (env) => {
},
proxy: {
"/oauth2/": {
- target: "http://localhost:48181",
+ target: "http://10.20.6.29:48181",
secure: false
},
"/database/": {
- target: "http://localhost:48181",
+ target: "http://10.20.6.29:48181",
secure: false
},
"/restconf/": {
- target: "http://localhost:48181",
+ target: "http://10.20.6.29:48181",
secure: false
},
"/help/": {
- target: "http://localhost:48181",
+ target: "http://10.20.6.29:48181",
secure: false
},
"/websocket": {
- target: "http://localhost:48181",
+ target: "http://10.20.6.29:48181",
ws: true,
changeOrigin: true,
secure: false