summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/odlux/framework
diff options
context:
space:
mode:
Diffstat (limited to 'sdnr/wt/odlux/framework')
-rw-r--r--sdnr/wt/odlux/framework/pom.xml314
-rw-r--r--sdnr/wt/odlux/framework/src/app.css10
-rw-r--r--sdnr/wt/odlux/framework/src/components/material-table/index.tsx5
-rw-r--r--sdnr/wt/odlux/framework/src/components/material-table/tableFilter.tsx6
-rw-r--r--sdnr/wt/odlux/framework/src/components/material-table/utilities.ts26
-rw-r--r--sdnr/wt/odlux/framework/src/views/about.tsx77
-rw-r--r--sdnr/wt/odlux/framework/webpack.config.js6
7 files changed, 267 insertions, 177 deletions
diff --git a/sdnr/wt/odlux/framework/pom.xml b/sdnr/wt/odlux/framework/pom.xml
index fc7a532c9..78349e471 100644
--- a/sdnr/wt/odlux/framework/pom.xml
+++ b/sdnr/wt/odlux/framework/pom.xml
@@ -1,165 +1,165 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
+ <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.parent</groupId>
- <artifactId>odlparent</artifactId>
- <version>1.5.2-SNAPSHOT</version>
- <relativePath/>
- </parent>
+ <parent>
+ <groupId>org.onap.ccsdk.parent</groupId>
+ <artifactId>odlparent</artifactId>
+ <version>1.5.2-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
- <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
- <artifactId>sdnr-wt-odlux-framework</artifactId>
- <version>0.7.1-SNAPSHOT</version>
- <packaging>jar</packaging>
+ <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
+ <artifactId>sdnr-wt-odlux-framework</artifactId>
+ <version>0.7.1-SNAPSHOT</version>
+ <packaging>jar</packaging>
- <name>ccsdk-features :: ${project.artifactId}</name>
- <licenses>
- <license>
- <name>Apache License, Version 2.0</name>
- <url>http://www.apache.org/licenses/LICENSE-2.0</url>
- </license>
- </licenses>
+ <name>sdnr-wt-odlux-framework</name>
+ <licenses>
+ <license>
+ <name>Apache License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0</url>
+ </license>
+ </licenses>
- <properties>
- <buildtime>${maven.build.timestamp}</buildtime>
- <distversion>ONAP Frankfurt (Neon, mdsal ${odl.mdsal.version})</distversion>
- <buildno>36.1a30021(19/12/12)</buildno>
- <odlux.version>ONAP SDN-R | ONF Wireless for ${distversion} - Build: ${buildtime} ${buildno} ${project.version}</odlux.version>
- </properties>
+ <properties>
+ <buildtime>${maven.build.timestamp}</buildtime>
+ <distversion>ONAP Frankfurt (Neon, mdsal ${odl.mdsal.version})</distversion>
+ <buildno>39.0e1988b(20/01/12)</buildno>
+ <odlux.version>ONAP SDN-R | ONF Wireless for ${distversion} - Build: ${buildtime} ${buildno} ${project.version}</odlux.version>
+ </properties>
- <build>
- <resources>
- <resource>
- <directory>dist</directory>
- <targetPath>odlux</targetPath>
- </resource>
- </resources>
- <plugins>
- <plugin>
- <artifactId>maven-clean-plugin</artifactId>
- <configuration>
- <filesets>
- <fileset>
- <directory>dist</directory>
- <followSymlinks>false</followSymlinks>
- </fileset>
- <fileset>
- <directory>node</directory>
- <followSymlinks>false</followSymlinks>
- </fileset>
- <fileset>
- <directory>node_modules</directory>
- <followSymlinks>false</followSymlinks>
- </fileset>
- <fileset>
- <directory>../node_modules</directory>
- <followSymlinks>false</followSymlinks>
- </fileset>
- <!-- eclipse bug build bin folder in basedir -->
- <fileset>
- <directory>bin</directory>
- <followSymlinks>false</followSymlinks>
- </fileset>
- </filesets>
- </configuration>
- </plugin>
- <plugin>
- <groupId>de.jacks-it-lab</groupId>
- <artifactId>frontend-maven-plugin</artifactId>
- <version>1.7.2</version>
- <executions>
- <execution>
- <id>install node and yarn</id>
- <goals>
- <goal>install-node-and-yarn</goal>
- </goals>
- <!-- optional: default phase is "generate-resources" -->
- <phase>initialize</phase>
- <configuration>
- <nodeVersion>v10.16.3</nodeVersion>
- <yarnVersion>v1.19.0</yarnVersion>
- </configuration>
- </execution>
- <execution>
- <id>clear cache</id>
- <goals>
- <goal>yarn</goal>
- </goals>
- <phase>initialize</phase>
- <configuration>
- <arguments>cache clean</arguments>
- <installDirectory>${project.basedir}</installDirectory>
- <workingDirectory>${project.basedir}/../</workingDirectory>
- </configuration>
- </execution>
- <execution>
- <id>install lerna</id>
- <goals>
- <goal>yarn</goal>
- </goals>
- <phase>initialize</phase>
- <configuration>
- <arguments>add lerna@3.13.1 -W --exact</arguments>
- <installDirectory>${project.basedir}</installDirectory>
- <workingDirectory>${project.basedir}/../</workingDirectory>
- </configuration>
- </execution>
- <execution>
- <id>exec lerna bootstrap</id>
- <goals>
- <goal>lerna</goal>
- </goals>
- <phase>initialize</phase>
- <configuration>
- <lernaInheritsProxyConfigFromMaven>false</lernaInheritsProxyConfigFromMaven>
- <arguments>bootstrap</arguments>
- <installDirectory>${project.basedir}</installDirectory>
- <workingDirectory>${project.basedir}/../</workingDirectory>
- </configuration>
- </execution>
- <execution>
- <id>yarn build</id>
- <goals>
- <goal>yarn</goal>
- </goals>
- <configuration>
- <arguments>run build</arguments>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>com.google.code.maven-replacer-plugin</groupId>
- <artifactId>replacer</artifactId>
- <version>1.5.2</version>
- <executions>
- <execution>
- <id>replace version</id>
- <phase>prepare-package</phase>
- <goals>
- <goal>replace</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <basedir>${project.build.directory}/classes/odlux</basedir>
- <includes>
- <include>app.js</include>
- </includes>
- <replacements>
- <replacement>
- <token>##odlux.version##</token>
- <value>${odlux.version}</value>
- </replacement>
- </replacements>
- </configuration>
- </plugin>
- </plugins>
- </build>
+ <build>
+ <resources>
+ <resource>
+ <directory>dist</directory>
+ <targetPath>odlux</targetPath>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <artifactId>maven-clean-plugin</artifactId>
+ <configuration>
+ <filesets>
+ <fileset>
+ <directory>dist</directory>
+ <followSymlinks>false</followSymlinks>
+ </fileset>
+ <fileset>
+ <directory>node</directory>
+ <followSymlinks>false</followSymlinks>
+ </fileset>
+ <fileset>
+ <directory>node_modules</directory>
+ <followSymlinks>false</followSymlinks>
+ </fileset>
+ <fileset>
+ <directory>../node_modules</directory>
+ <followSymlinks>false</followSymlinks>
+ </fileset>
+ <!-- eclipse bug build bin folder in basedir -->
+ <fileset>
+ <directory>bin</directory>
+ <followSymlinks>false</followSymlinks>
+ </fileset>
+ </filesets>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>de.jacks-it-lab</groupId>
+ <artifactId>frontend-maven-plugin</artifactId>
+ <version>1.7.2</version>
+ <executions>
+ <execution>
+ <id>install node and yarn</id>
+ <goals>
+ <goal>install-node-and-yarn</goal>
+ </goals>
+ <!-- optional: default phase is "generate-resources" -->
+ <phase>initialize</phase>
+ <configuration>
+ <nodeVersion>v10.16.3</nodeVersion>
+ <yarnVersion>v1.19.0</yarnVersion>
+ </configuration>
+ </execution>
+ <execution>
+ <id>clear cache</id>
+ <goals>
+ <goal>yarn</goal>
+ </goals>
+ <phase>initialize</phase>
+ <configuration>
+ <arguments>cache clean</arguments>
+ <installDirectory>${project.basedir}</installDirectory>
+ <workingDirectory>${project.basedir}/../</workingDirectory>
+ </configuration>
+ </execution>
+ <execution>
+ <id>install lerna</id>
+ <goals>
+ <goal>yarn</goal>
+ </goals>
+ <phase>initialize</phase>
+ <configuration>
+ <arguments>add lerna@3.13.1 -W --exact</arguments>
+ <installDirectory>${project.basedir}</installDirectory>
+ <workingDirectory>${project.basedir}/../</workingDirectory>
+ </configuration>
+ </execution>
+ <execution>
+ <id>exec lerna bootstrap</id>
+ <goals>
+ <goal>lerna</goal>
+ </goals>
+ <phase>initialize</phase>
+ <configuration>
+ <lernaInheritsProxyConfigFromMaven>false</lernaInheritsProxyConfigFromMaven>
+ <arguments>bootstrap</arguments>
+ <installDirectory>${project.basedir}</installDirectory>
+ <workingDirectory>${project.basedir}/../</workingDirectory>
+ </configuration>
+ </execution>
+ <execution>
+ <id>yarn build</id>
+ <goals>
+ <goal>yarn</goal>
+ </goals>
+ <configuration>
+ <arguments>run build</arguments>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>com.google.code.maven-replacer-plugin</groupId>
+ <artifactId>replacer</artifactId>
+ <version>1.5.2</version>
+ <executions>
+ <execution>
+ <id>replace version</id>
+ <phase>prepare-package</phase>
+ <goals>
+ <goal>replace</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <basedir>${project.build.directory}/classes/odlux</basedir>
+ <includes>
+ <include>app.js</include>
+ </includes>
+ <replacements>
+ <replacement>
+ <token>##odlux.version##</token>
+ <value>${odlux.version}</value>
+ </replacement>
+ </replacements>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
diff --git a/sdnr/wt/odlux/framework/src/app.css b/sdnr/wt/odlux/framework/src/app.css
index 356f36dd0..f70fbc0e4 100644
--- a/sdnr/wt/odlux/framework/src/app.css
+++ b/sdnr/wt/odlux/framework/src/app.css
@@ -3,4 +3,14 @@ html, body, #app {
padding: 0px;
margin: 0px;
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
+}
+.about-table td{
+ padding:0.5rem 1rem;
+ border-bottom: 1px solid #DDD;
+}
+.about-table pre {
+ background:#FFF;
+ border:1px solid #CCC;
+ padding:1rem;
+ margin: 1rem 0;
} \ No newline at end of file
diff --git a/sdnr/wt/odlux/framework/src/components/material-table/index.tsx b/sdnr/wt/odlux/framework/src/components/material-table/index.tsx
index 3e31c5e03..520674441 100644
--- a/sdnr/wt/odlux/framework/src/components/material-table/index.tsx
+++ b/sdnr/wt/odlux/framework/src/components/material-table/index.tsx
@@ -179,7 +179,7 @@ class MaterialTableComponent<TData extends {} = {}> extends React.Component<Mate
<TableToolbar tableId={this.props.tableId} numSelected={selected && selected.length} title={this.props.title} customActionButtons={this.props.customActionButtons} onExportToCsv={this.exportToCsv}
onToggleFilter={toggleFilter} />
<div className={classes.tableWrapper}>
- <Table className={classes.table} aria-labelledby="tableTitle">
+ <Table className={classes.table} aria-label={this.props.tableId ? this.props.tableId : 'tableTitle'}>
<EnhancedTableHead
columns={columns}
numSelected={selected && selected.length}
@@ -193,7 +193,7 @@ class MaterialTableComponent<TData extends {} = {}> extends React.Component<Mate
<TableBody>
{showFilter && <EnhancedTableFilter columns={columns} filter={filter} onFilterChanged={this.onFilterChanged} enableSelection={this.props.enableSelection} /> || null}
{rows // may need ordering here
- .map((entry: TData & { [key: string]: any }) => {
+ .map((entry: TData & { [key: string]: any }, index) => {
const entryId = getId(entry);
const isSelected = this.isSelected(entryId);
return (
@@ -202,6 +202,7 @@ class MaterialTableComponent<TData extends {} = {}> extends React.Component<Mate
onClick={event => this.handleClick(event, entry, entryId)}
role="checkbox"
aria-checked={isSelected}
+ aria-label={`${(this.props.tableId ? this.props.tableId : 'table')}-row-${(index + 1)}`}
tabIndex={-1}
key={entryId}
selected={isSelected}
diff --git a/sdnr/wt/odlux/framework/src/components/material-table/tableFilter.tsx b/sdnr/wt/odlux/framework/src/components/material-table/tableFilter.tsx
index 737ea85f9..2075e052c 100644
--- a/sdnr/wt/odlux/framework/src/components/material-table/tableFilter.tsx
+++ b/sdnr/wt/odlux/framework/src/components/material-table/tableFilter.tsx
@@ -69,14 +69,14 @@ class EnhancedTableFilterComponent extends React.Component<IEnhancedTableFilterC
{col.disableFilter || (col.type === ColumnType.custom)
? null
: (col.type === ColumnType.boolean)
- ? <Select className={classes.input} value={filter[col.property] !== undefined ? filter[col.property] : ''} onChange={this.createFilterHandler(col.property)} inputProps={{ name: `${col.property}-bool`, id: `${col.property}-bool` }} >
- <MenuItem value={undefined}>
+ ? <Select className={classes.input} aria-label={(col.title as string).toLowerCase() + ' filter'} value={filter[col.property] !== undefined ? filter[col.property] : ''} onChange={this.createFilterHandler(col.property)} inputProps={{ name: `${col.property}-bool`, id: `${col.property}-bool` }} >
+ <MenuItem value={undefined} >
<em>None</em>
</MenuItem>
<MenuItem value={true as any as string}>{col.labels ? col.labels["true"] : "true"}</MenuItem>
<MenuItem value={false as any as string}>{col.labels ? col.labels["false"] : "false"}</MenuItem>
</Select>
- : <Input className={classes.input} inputProps={{ 'aria-label': 'Filter' }} value={filter[col.property] || ''} onChange={this.createFilterHandler(col.property)} />}
+ : <Input className={classes.input} inputProps={{ 'aria-label': (col.title as string).toLowerCase() + ' filter' }} value={filter[col.property] || ''} onChange={this.createFilterHandler(col.property)} />}
</TableCell>
);
}, this)}
diff --git a/sdnr/wt/odlux/framework/src/components/material-table/utilities.ts b/sdnr/wt/odlux/framework/src/components/material-table/utilities.ts
index 6e8902c07..74682cd95 100644
--- a/sdnr/wt/odlux/framework/src/components/material-table/utilities.ts
+++ b/sdnr/wt/odlux/framework/src/components/material-table/utilities.ts
@@ -196,6 +196,29 @@ export function createExternal<TData>(callback: DataCallback<TData>, selectState
}).catch(error => new AddErrorInfoAction(error));
};
+ const reloadActionAsync = async (dispatch: Dispatch, getAppState: () => IApplicationStoreState) => {
+ dispatch(new RefreshAction());
+ const ownState = selectState(getAppState());
+ const filter = { ...ownState.preFilter, ...(ownState.showFilter && ownState.filter || {}) };
+
+ try {
+ const result = await Promise.resolve(callback(ownState.page, ownState.rowsPerPage, ownState.orderBy, ownState.order, filter));
+
+
+ if (ownState.page > 0 && ownState.rowsPerPage * ownState.page > result.total) { //if result is smaller than the currently shown page, new search and repaginate
+
+ let newPage = Math.floor(result.total / ownState.rowsPerPage);
+
+ const repaginationResult = await Promise.resolve(callback(newPage, ownState.rowsPerPage, ownState.orderBy, ownState.order, filter));
+ dispatch(new SetResultAction(repaginationResult));
+ } else {
+ dispatch(new SetResultAction(result));
+ }
+ } catch (error) {
+ new AddErrorInfoAction(error);
+ }
+ };
+
const createPreActions = (dispatch: Dispatch, skipRefresh: boolean = false) => {
return {
onPreFilterChanged: (preFilter: { [key: string]: string }) => {
@@ -258,6 +281,7 @@ export function createExternal<TData>(callback: DataCallback<TData>, selectState
createActions: createActions,
createProperties: createProperties,
createPreActions: createPreActions,
- actionHandler: externalTableStateActionHandler
+ actionHandler: externalTableStateActionHandler,
+ reloadActionAsync: reloadActionAsync,
}
} \ No newline at end of file
diff --git a/sdnr/wt/odlux/framework/src/views/about.tsx b/sdnr/wt/odlux/framework/src/views/about.tsx
index d47e09c3a..59a71512c 100644
--- a/sdnr/wt/odlux/framework/src/views/about.tsx
+++ b/sdnr/wt/odlux/framework/src/views/about.tsx
@@ -15,17 +15,68 @@
* the License.
* ============LICENSE_END==========================================================================
*/
-import * as React from 'react';
-
-const AboutComponent = () => {
-
- return (
- <div>
- <h2>About</h2>
- <div style={{ margin: "0 auto" }}>##odlux.version##</div>
- </div>
- );
-};
-
-export const About = AboutComponent;
+import * as React from 'react';
+import * as marked from 'marked';
+import * as hljs from 'highlight.js';
+import { requestRestExt } from '../services/restService';
+const defaultRenderer = new marked.Renderer();
+defaultRenderer.link = (href, title, text) => (
+ `<a target="_blank" rel="noopener noreferrer" href="${href}" title="${title}">${text}</a>`
+);
+interface AboutState {
+ content: string | null;
+}
+
+class AboutComponent extends React.Component<any, AboutState> {
+
+
+ constructor(props: any) {
+ super(props);
+ this.state = { content: null }
+ this.loadAboutContent();
+ }
+ private loadAboutContent(): void {
+ requestRestExt<string>('/about').then((response) => {
+ this.setState({ content: response.status == 200 ? response.data : `${response.status} ${response.message}` || "Server error" })
+ }).catch((error) => {
+ this.setState({ content: error })
+ })
+ }
+ render() {
+
+ const markedOptions: marked.MarkedOptions = {
+ gfm: true,
+ breaks: false,
+ pedantic: false,
+ sanitize: true,
+ smartLists: true,
+ smartypants: false,
+ langPrefix: 'hljs ',
+ ...({}),
+ highlight: (code, lang) => {
+ if (!!(lang && hljs.getLanguage(lang))) {
+ return hljs.highlight(lang, code).value;
+ }
+ return code;
+ }
+ };
+
+
+ const className = "about-table"
+ const style: React.CSSProperties = {};
+
+ const html = (marked(this.state.content || 'loading', { renderer: markedOptions && markedOptions.renderer || defaultRenderer }));
+
+ return (
+ <div
+ dangerouslySetInnerHTML={{ __html: html }}
+ className={className}
+ style={style}
+ />
+
+ );
+ }
+};
+
+export const About = AboutComponent;
export default About; \ 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 578a0ae44..93b748d73 100644
--- a/sdnr/wt/odlux/framework/webpack.config.js
+++ b/sdnr/wt/odlux/framework/webpack.config.js
@@ -191,7 +191,11 @@ module.exports = (env) => {
},
proxy: {
"/oauth2/**/*": {
- target: "http://10.20.6.29:48181",
+ target: "http://172.18.0.3:8181",
+ secure: false
+ },
+ "/about": {
+ target: "http://172.18.0.3:8181",
secure: false
}
}