Skip to content

Commit

Permalink
Merge branch 'develop-sdtabilit' into feature/SLTS-59-new-watch-list
Browse files Browse the repository at this point in the history
  • Loading branch information
wisyr authored Nov 25, 2016
2 parents 7d65f48 + d563644 commit feead5c
Show file tree
Hide file tree
Showing 8 changed files with 107 additions and 20 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,9 @@ seroUtils.jar
*client*.png
*client*.css
*.vpp
###########################
# ScadaLTS-UI
###########################
/ScadaLTS-UI/node_modules/
/ScadaLTS-UI/.editorconfig
/ScadaLTS-UI/.editorconfig
/ScadaLTS-UI/dist
31 changes: 30 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,40 @@ before_install:
- sudo apt-get install tomcat7
- sudo apt-get install traceroute
- sudo apt-get install sshpass
#- wget https://nodejs.org/dist/v6.9.1/node-v6.9.1-linux-x64.tar.xz
#- mkdir node
#- mkdir node/etc
#- echo 'prefix=/usr/local' > node/etc/npmrc
#- tar xvf node-v*.tar.?z --strip-components=1 -C ./node
#- sudo mv node /opt/
#- export PATH=/opt/node/bin:$PATH
#- sudo apt-get install -y build-essential
#- curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
#- sudo apt-get install -y nodejs
#- wget -qO- https://deb.nodesource.com/setup_6.x | sudo bash -
#- sudo apt-get install nodejs
#- sudo apt-get install npm
before_script:
#- export PATH=/opt/node:/opt/node/bin:$PATH
- nvm ls
- nvm install node
- nvm use node
- npm -v
- node -v
- env
- npm install -g bower
- npm install -g angular-cli
- chmod +x ./get_seroUtils.sh
- "./get_seroUtils.sh"
- ls -l ./WebContent/WEB-INF/lib/seroUtils.jar
- cd ./WebContent/resources/app; bower update;
- cd ../../..
- cd ./ScadaLTS-UI
- npm install
- ng build
- cd ./war
- ant war
- cd ../..
language: java
jdk:
- openjdk7
Expand All @@ -35,9 +62,11 @@ env:
matrix:
- CATALINA_HOME=/usr/share/tomcat7
global:
secure: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R+WcCvsAJ8Tj7hiV6xwE2LwjiSC56U85k768PCsDLDA7q8VoR1QoMIeZg1rW+rGgMUFOwgyMx0BuXBmyniU5T2trMJvcLZpHX/QPE4UnQ5jvnaEpTXxvJmLBeO1/5ajesCYNyIH9fE00b/vgz5yBVw3S9y0D3Ps7WhIXlhiz57pI6pBi8lUmO0YdtbW9Hc0oDpI7Asg04ftdIJ7Y1+3Ww/rwszQV6QnRiH9iuWq7HJJCmgKeNHS3fo/Zy8N9Xmx3hfFuedpToIN0B+tlzwnDCtvS4Zhx8rSv+9+v/XHYinan8z25Z3CM8A=
- TRAVIS_NODE_VERSION="6"
after_script:
- echo $TRAVIS_BUILD_DIR
- eval "$(ssh-agent -s)"
- traceroute -p 22 149.56.44.225
- sshpass -e scp ./ScadaBR.war [email protected]:/root/ScadaBR.war
- sshpass -e scp ./ScadaLTS-UI/war/ScadaLTS.war [email protected]:/root/ScadaLTS.war
3 changes: 3 additions & 0 deletions ScadaLTS-UI/war/WebContent/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Class-Path:

3 changes: 3 additions & 0 deletions ScadaLTS-UI/war/WebContent/WEB-INF/web.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
19 changes: 19 additions & 0 deletions ScadaLTS-UI/war/build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir="." name="ScadaLTS">

<target name="war" description="Bundles the application as a WAR file" >
<mkdir dir="WebContent/WEB-INF/classes"/>
<copy includeemptydirs="false" todir="WebContent">
<fileset dir="../dist">
<include name="**/*.html"/>
<include name="**/*.js"/>
</fileset>
</copy>

<war destfile="ScadaLTS.war"
basedir="WebContent"
needxmlfile="false">
</war>
</target>

</project>
15 changes: 8 additions & 7 deletions src/com/serotonin/mango/vo/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,11 @@ public void setDisabled(boolean disabled) {

public List<Integer> getDataSourcePermissions() {
if (dataSourcePermissions==null) {
return new LinkedList<Integer>();
} else {
return dataSourcePermissions;
dataSourcePermissions = new LinkedList<Integer>();
}

return dataSourcePermissions;

}

public void setDataSourcePermissions(List<Integer> dataSourcePermissions) {
Expand All @@ -287,10 +288,10 @@ public void setDataSourcePermissions(List<Integer> dataSourcePermissions) {

public List<DataPointAccess> getDataPointPermissions() {
if (dataPointPermissions==null) {
return new LinkedList<DataPointAccess>();
} else {
return dataPointPermissions;
}
dataPointPermissions = new LinkedList<DataPointAccess>();
}
return dataPointPermissions;

}

public void setDataPointPermissions(
Expand Down
48 changes: 38 additions & 10 deletions src/com/serotonin/mango/web/dwr/DataSourceListDwr.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,24 @@
package com.serotonin.mango.web.dwr;

import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.scada_lts.dao.SystemSettingsDAO;

import com.serotonin.db.IntValuePair;
import com.serotonin.mango.Common;
import com.serotonin.mango.db.dao.DataPointDao;
import com.serotonin.mango.db.dao.DataSourceDao;
import org.scada_lts.dao.SystemSettingsDAO;
import com.serotonin.mango.db.dao.UserDao;
import com.serotonin.mango.rt.RuntimeManager;
import com.serotonin.mango.vo.DataPointVO;
import com.serotonin.mango.vo.dataSource.DataSourceVO;
import com.serotonin.mango.vo.dataSource.DataSourceVO.Type;
import com.serotonin.mango.vo.permission.Permissions;
import com.serotonin.web.dwr.DwrResponseI18n;

Expand All @@ -49,16 +51,42 @@ public DwrResponseI18n init() {

if (Common.getUser().isAdmin()) {
List<IntValuePair> translatedTypes = new ArrayList<IntValuePair>();
for (DataSourceVO.Type type : DataSourceVO.Type.values()) {
// Allow customization settings to overwrite the default display
// value.
boolean display = SystemSettingsDAO.getBooleanValue(type.name()
+ SystemSettingsDAO.DATASOURCE_DISPLAY_SUFFIX,
type.isDisplay());
if (display)
translatedTypes.add(new IntValuePair(type.getId(),
getMessage(type.getKey())));
List<DataSourceVO.Type> types = new ArrayList<DataSourceVO.Type>(EnumSet.allOf(DataSourceVO.Type.class));
// because sort not work in openJdk 1.7
for (int i = 0; i < types.size()-1; i++) {
Type temp;
for(int j = 1; j< types.size() -i; j++) {
Type o1 = types.get(j-1);
Type o2 = types.get(j);
if (getMessage(o1.getKey()).toString().compareToIgnoreCase(getMessage(o2.getKey()).toString())>0){
temp = types.get(j-1);
types.set(j-1,types.get(j));
types.set(j,temp);
}
}
}

/*types.sort(new Comparator<DataSourceVO.Type>(){
@Override
public int compare(Type o1, Type o2) {
return getMessage(o1.getKey()).toString().compareToIgnoreCase(getMessage(o2.getKey()).toString());
}
});*/

for (DataSourceVO.Type type : types) {
if (type != DataSourceVO.Type.RADIUINO) {
// Allow customization settings to overwrite the default display
// value.
boolean display = SystemSettingsDAO.getBooleanValue(type.name()
+ SystemSettingsDAO.DATASOURCE_DISPLAY_SUFFIX,
type.isDisplay());
if (display)
translatedTypes.add(new IntValuePair(type.getId(),
getMessage(type.getKey())));
}
}


response.addData("types", translatedTypes);
}

Expand Down
2 changes: 1 addition & 1 deletion src/org/scada_lts/mango/service/WatchListService.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public boolean isXidUnique(String xid, int excludeId) {

@Override
public List<WatchList> getWatchLists(final int userId, int userProfile) {
return watchListDAO.filtered(WatchListDAO.WATCH_LIST_FILTER_BASE_ON_USER_ID_USER_PROFILE_ORDERY_BY_NAME, new Object[]{userId, userProfile}, WatchListDAO.NO_LIMIT);
return watchListDAO.filtered(WatchListDAO.WATCH_LIST_FILTER_BASE_ON_USER_ID_USER_PROFILE_ORDERY_BY_NAME, new Object[]{userId, userProfile, userId}, WatchListDAO.NO_LIMIT);
}

@Override
Expand Down

0 comments on commit feead5c

Please sign in to comment.