2011-09-30 Miguel de Dios <miguel.dedios@artica.es>
* AndroidManifest.xml: level up the sdk requirements. * src/pandroid_event_viewer/pandorafms/PandroidEventviewerActivity.java, src/pandroid_event_viewer/pandorafms/Main.java, src/pandroid_event_viewer/pandorafms/EventList.java: wip and fixes. * res/values/strings.xml, res/values-en/strings.xml, res/values-es/strings.xml: added more values. * res/layout/item_list_event_extended.xml: wip and fixes. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5030 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
29baddf275
commit
724f3bc406
|
@ -18,7 +18,7 @@
|
|||
package="pandroid_event_viewer.pandorafms"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
<uses-sdk android:minSdkVersion="7" />
|
||||
<uses-sdk android:minSdkVersion="8" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
||||
<!--
|
||||
|
|
|
@ -1,3 +1,16 @@
|
|||
2011-09-30 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* AndroidManifest.xml: level up the sdk requirements.
|
||||
|
||||
* src/pandroid_event_viewer/pandorafms/PandroidEventviewerActivity.java,
|
||||
src/pandroid_event_viewer/pandorafms/Main.java,
|
||||
src/pandroid_event_viewer/pandorafms/EventList.java: wip and fixes.
|
||||
|
||||
* res/values/strings.xml, res/values-en/strings.xml,
|
||||
res/values-es/strings.xml: added more values.
|
||||
|
||||
* res/layout/item_list_event_extended.xml: wip and fixes.
|
||||
|
||||
2011-09-29 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* AndroidManifest.xml: level down the SDK version requirements, need test in
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:paddingRight="5px"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/severity_text"
|
||||
|
@ -64,6 +65,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:paddingRight="5px"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/type_text"
|
||||
|
@ -106,6 +108,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:paddingRight="5px"
|
||||
/>
|
||||
<TextView
|
||||
android:layout_weight="1"
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
// GNU General Public License for more details.
|
||||
-->
|
||||
<resources>
|
||||
<string name="item_tab_main_text">Main</string>
|
||||
<string name="item_tab_main_text">Filter</string>
|
||||
<string name="item_tab_event_list_text">Event list</string>
|
||||
|
||||
<string name="main_text">main text (value english)</string>
|
||||
|
@ -48,7 +48,7 @@
|
|||
<string name="load_more_events_button_str">Load more events</string>
|
||||
<string name="empty_label_str">Empty list events</string>
|
||||
<string name="refresh_time_label_str">Refresh time watcher</string>
|
||||
<string name="set_as_filter_watcher_button_str">Set as filter for watcher</string>
|
||||
<string name="set_as_filter_watcher_button_str">Filter by default</string>
|
||||
|
||||
<string name="config_update_succesful_str">Update configuration successful.</string>
|
||||
<string name="config_update_fail_str">Update configuration is failed.</string>
|
||||
|
@ -78,4 +78,15 @@
|
|||
|
||||
<string name="licensed_under_gpl_str">Licensed under GPL</string>
|
||||
<string name="develop_team_str">Develop team: Miguel de Dios</string>
|
||||
|
||||
<string name="alert_recovered_str">Alert recovered</string>
|
||||
<string name="alert_manual_validation_str">Alert manually validated</string>
|
||||
<string name="going_up_warning_str">Going from critical to warning</string>
|
||||
<string name="going_down_critical_str">Going down to critical state</string>
|
||||
<string name="going_up_normal_str">Going up to normal state</string>
|
||||
<string name="going_down_warning_str">Going down from normal to warning</string>
|
||||
<string name="alert_fired_str">Alert fired</string>
|
||||
<string name="recon_host_detected_str">Recon server detected a new host</string>
|
||||
<string name="new_agent_str">New agent created</string>
|
||||
<string name="unknown_str">Unknown type:</string>
|
||||
</resources>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
// GNU General Public License for more details.
|
||||
-->
|
||||
<resources>
|
||||
<string name="item_tab_main_text">Principal</string>
|
||||
<string name="item_tab_main_text">Filtro</string>
|
||||
<string name="item_tab_event_list_text">Lista de eventos</string>
|
||||
|
||||
<string name="main_text">main text (value spanish)</string>
|
||||
|
@ -48,7 +48,7 @@
|
|||
<string name="load_more_events_button_str">Cargar mas eventos</string>
|
||||
<string name="empty_label_str">Lista vacia de eventos</string>
|
||||
<string name="refresh_time_label_str">Refresco scanner eventos</string>
|
||||
<string name="set_as_filter_watcher_button_str">Hacerlo filtro para scanner eventos</string>
|
||||
<string name="set_as_filter_watcher_button_str">Filtro por defecto</string>
|
||||
<string name="validate_event_button_str">Validar Evento</string>
|
||||
|
||||
<string name="config_update_succesful_str">Configuración guardada correctamente.</string>
|
||||
|
@ -78,4 +78,15 @@
|
|||
|
||||
<string name="licensed_under_gpl_str">Licenciado bajo GPL</string>
|
||||
<string name="develop_team_str">Equipo de desarrollo: Miguel de Dios</string>
|
||||
|
||||
<string name="alert_recovered_str">Alerta recuperada</string>
|
||||
<string name="alert_manual_validation_str">Alerta validada manualmente</string>
|
||||
<string name="going_up_warning_str">Cayendo de crítico a advertencia</string>
|
||||
<string name="going_down_critical_str">Cayendo a estado crítico</string>
|
||||
<string name="going_up_normal_str">Subiendo a estado normal</string>
|
||||
<string name="going_down_warning_str">Cayendo de normal a advertencia</string>
|
||||
<string name="alert_fired_str">Alerta lanzada</string>
|
||||
<string name="recon_host_detected_str">El servidor Recon detectó un equipo nuevo</string>
|
||||
<string name="new_agent_str">Agente nuevo creado</string>
|
||||
<string name="unknown_str">Tipo desconocido:</string>
|
||||
</resources>
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
<string name="const_string_preferences">PANDROID_EVENT_VIEWER_PREFERENCES</string>
|
||||
|
||||
<string name="item_tab_main_text">Main</string>
|
||||
<string name="item_tab_main_text">Filter</string>
|
||||
<string name="item_tab_event_list_text">Event list</string>
|
||||
|
||||
<string name="main_text">main text (value)</string>
|
||||
|
@ -53,7 +53,7 @@
|
|||
<string name="load_more_events_button_str">Load more events</string>
|
||||
<string name="empty_label_str">Empty list events</string>
|
||||
<string name="refresh_time_label_str">Refresh time watcher</string>
|
||||
<string name="set_as_filter_watcher_button_str">Set as filter for watcher</string>
|
||||
<string name="set_as_filter_watcher_button_str">Filter by default</string>
|
||||
<string name="validate_event_button_str">Validate Event</string>
|
||||
|
||||
<string name="config_update_succesful_str">Update configuration successful.</string>
|
||||
|
@ -83,4 +83,15 @@
|
|||
|
||||
<string name="licensed_under_gpl_str">Licensed under GPL</string>
|
||||
<string name="develop_team_str">Develop team: Miguel de Dios</string>
|
||||
|
||||
<string name="alert_recovered_str">Alert recovered</string>
|
||||
<string name="alert_manual_validation_str">Alert manually validated</string>
|
||||
<string name="going_up_warning_str">Going from critical to warning</string>
|
||||
<string name="going_down_critical_str">Going down to critical state</string>
|
||||
<string name="going_up_normal_str">Going up to normal state</string>
|
||||
<string name="going_down_warning_str">Going down from normal to warning</string>
|
||||
<string name="alert_fired_str">Alert fired</string>
|
||||
<string name="recon_host_detected_str">Recon server detected a new host</string>
|
||||
<string name="new_agent_str">New agent created</string>
|
||||
<string name="unknown_str">Unknown type:</string>
|
||||
</resources>
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.io.InputStream;
|
|||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import android.app.Activity;
|
||||
|
@ -85,6 +86,19 @@ public class EventList extends ListActivity {
|
|||
int load_more = intent.getIntExtra("load_more", 0);
|
||||
Log.e("load_more", "" + load_more);
|
||||
|
||||
Button button = (Button) findViewById(R.id.button_load_more_events);
|
||||
Log.e("object.eventList.size", object.eventList.size() + "");
|
||||
Log.e("object.count_events", object.count_events + "");
|
||||
if (object.eventList.size() == 0) {
|
||||
button.setVisibility(Button.GONE);
|
||||
}
|
||||
else if (((long)object.eventList.size()) >= object.count_events) {
|
||||
button.setVisibility(Button.GONE);
|
||||
}
|
||||
else {
|
||||
button.setVisibility(Button.VISIBLE);
|
||||
}
|
||||
|
||||
if (load_more == 1) {
|
||||
la.showLoadingEvents = false;
|
||||
la.notifyDataSetChanged();
|
||||
|
@ -145,6 +159,7 @@ public class EventList extends ListActivity {
|
|||
Log.e("onOptionsItemSelected","refresh_button_menu_options");
|
||||
this.object.loadInProgress = true;
|
||||
this.object.getNewListEvents = true;
|
||||
this.object.eventList = new ArrayList<EventListItem>();
|
||||
this.toggleLoadingLayout();
|
||||
this.object.executeBackgroundGetEvents();
|
||||
break;
|
||||
|
@ -352,7 +367,16 @@ public class EventList extends ListActivity {
|
|||
}
|
||||
else {
|
||||
Button button = (Button)view.findViewById(R.id.button_load_more_events);
|
||||
button.setVisibility(Button.VISIBLE);
|
||||
|
||||
if (object.eventList.size() == 0) {
|
||||
button.setVisibility(Button.GONE);
|
||||
}
|
||||
else if (((long)object.eventList.size()) >= object.count_events) {
|
||||
button.setVisibility(Button.GONE);
|
||||
}
|
||||
else {
|
||||
button.setVisibility(Button.VISIBLE);
|
||||
}
|
||||
|
||||
button.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -438,20 +462,19 @@ public class EventList extends ListActivity {
|
|||
row.setVisibility(View.VISIBLE);
|
||||
|
||||
text = (TextView)viewEventExtended.findViewById(R.id.agent_text);
|
||||
//http://127.0.0.1/pandora_console/mobile/index.php?page=agent&id=1
|
||||
//Log.e("url", this.object.url);
|
||||
text.setText(Html.fromHtml(
|
||||
"<a href='" + this.object.url +
|
||||
"/index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente="
|
||||
//"/mobile/index.php?page=agent&id="
|
||||
//"/mobile/index.php?page=agent&id=" //The link to Pandora Console Mobile
|
||||
+ item.id_agent
|
||||
+ "'>" + item.agent_name + "</a>"));
|
||||
text.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
//text.setText(item.agent_name);
|
||||
|
||||
setImageType(viewEventExtended, item.description_image, R.id.img_type);
|
||||
}
|
||||
|
||||
setImageType(viewEventExtended, item.description_image, R.id.img_type);
|
||||
text = (TextView)viewEventExtended.findViewById(R.id.type_text);
|
||||
text.setText(eventType2Text(item.event_type));
|
||||
|
||||
if (item.criticity_name.length() != 0) {
|
||||
text = (TextView)viewEventExtended.findViewById(R.id.severity_text);
|
||||
text.setText(item.criticity_name);
|
||||
|
@ -479,6 +502,52 @@ public class EventList extends ListActivity {
|
|||
return view;
|
||||
}
|
||||
|
||||
private String eventType2Text(String type) {
|
||||
String return_var;
|
||||
|
||||
if (type.equals("alert_recovered")) {
|
||||
return_var = getApplicationContext().getString(R.string.alert_recovered_str);
|
||||
}
|
||||
else if (type.equals("alert_manual_validation")) {
|
||||
return_var = getApplicationContext().getString(R.string.alert_manual_validation_str);
|
||||
}
|
||||
else if (type.equals("going_up_warning")) {
|
||||
return_var = getApplicationContext().getString(R.string.going_up_warning_str);
|
||||
}
|
||||
else if (type.equals("going_down_critical")) {
|
||||
return_var = getApplicationContext().getString(R.string.going_down_critical_str);
|
||||
}
|
||||
else if (type.equals("going_up_critical")) {
|
||||
return_var = getApplicationContext().getString(R.string.going_down_critical_str);
|
||||
}
|
||||
else if (type.equals("going_up_normal")) {
|
||||
return_var = getApplicationContext().getString(R.string.going_up_normal_str);
|
||||
}
|
||||
else if (type.equals("going_down_normal")) {
|
||||
return_var = getApplicationContext().getString(R.string.going_up_normal_str);
|
||||
}
|
||||
else if (type.equals("going_down_warning")) {
|
||||
return_var = getApplicationContext().getString(R.string.going_down_warning_str);
|
||||
}
|
||||
else if (type.equals("alert_fired")) {
|
||||
return_var = getApplicationContext().getString(R.string.alert_fired_str);
|
||||
}
|
||||
else if (type.equals("system")) {
|
||||
return_var = getApplicationContext().getString(R.string.system_str);
|
||||
}
|
||||
else if (type.equals("recon_host_detected")) {
|
||||
return_var = getApplicationContext().getString(R.string.system_str);
|
||||
}
|
||||
else if (type.equals("new_agent")) {
|
||||
return_var = getApplicationContext().getString(R.string.new_agent_str);
|
||||
}
|
||||
else {
|
||||
return_var = getApplicationContext().getString(R.string.unknown_str) + " " + type;
|
||||
}
|
||||
|
||||
return return_var;
|
||||
}
|
||||
|
||||
private class OnItemClickListener implements OnClickListener{
|
||||
private int mPosition;
|
||||
private PandroidEventviewerActivity object;
|
||||
|
|
|
@ -165,7 +165,7 @@ public class Main extends Activity {
|
|||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
Log.e("ERROR THE ", e.getMessage());
|
||||
Log.e("ERROR getGroups ", e.getMessage());
|
||||
}
|
||||
|
||||
return array;
|
||||
|
@ -236,6 +236,7 @@ public class Main extends Activity {
|
|||
public void search_form() {
|
||||
//Clean the EventList
|
||||
this.object.eventList = new ArrayList<EventListItem>();
|
||||
Log.e("search_form", "" +this.object.eventList.size());
|
||||
this.object.loadInProgress = true;
|
||||
|
||||
//Get form data
|
||||
|
|
|
@ -87,7 +87,7 @@ public class PandroidEventviewerActivity extends TabActivity implements Serializ
|
|||
this.offset = 0;
|
||||
this.agentNameStr = preferences.getString("filterAgentName", "");
|
||||
this.severity = preferences.getInt("filterSeverity", -1);
|
||||
this.status = preferences.getInt("filterStatus", 4);
|
||||
this.status = preferences.getInt("filterStatus", 3);
|
||||
this.eventSearch = preferences.getString("filterEventSearch", "");
|
||||
this.filterLastTime = preferences.getInt("filterLastTime", 6);
|
||||
|
||||
|
@ -299,6 +299,12 @@ public class PandroidEventviewerActivity extends TabActivity implements Serializ
|
|||
for (int i= 0; i < lines.length; i++) {
|
||||
String[] items = lines[i].split(";", 21);
|
||||
|
||||
if (items.length != 21) {
|
||||
this.count_events --; //Discount invalid.
|
||||
if (this.count_events < 0) this.count_events = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
EventListItem event = new EventListItem();
|
||||
if (items[0].length() == 0) {
|
||||
event.id_event = 0;
|
||||
|
|
Loading…
Reference in New Issue