Commit e5f78946f0742f9cd9227edec46faf6205e876fc

Authored by kristinlaahneolsen
1 parent a53f30b4

Endret endpoint til nettadressen Øyvin hadde fikset til oss, må endres tilbake h…

…vis man skal bruke localhost
Risiko/app/src/main/java/activity/Evaluations.java
... ... @@ -117,6 +117,13 @@ public class Evaluations extends AppCompatActivity {
117 117 TextView probabilityLow = promptView.findViewById(R.id.pop_probability_low);
118 118 TextView probabilityMedium = promptView.findViewById(R.id.pop_probability_medium);
119 119 TextView probabilityHigh = promptView.findViewById(R.id.pop_probability_high);
  120 + Button deleteEvaluation = promptView.findViewById(R.id.pop_delete_evaluation);
  121 +
  122 + //TODO: IMPLEMENTERE DET SLIK AT VI FÅR HENTET UT HVILKEN BRUKER SOM HAR SKREVET SAKEN
  123 + TextView addedBy = promptView.findViewById(R.id.tv_added_by);
  124 +
  125 + deleteEvaluation.setOnClickListener(view -> deleteEvaluationDialog());
  126 +
120 127  
121 128  
122 129 if (evaluation.getProbability() == 3) {
... ... @@ -155,4 +162,14 @@ public class Evaluations extends AppCompatActivity {
155 162 alert.show();
156 163 }
157 164  
  165 + private void deleteEvaluationDialog() {
  166 + new AlertDialog.Builder(this)
  167 + .setTitle(R.string.delete)
  168 + .setMessage(R.string.areYouSure)
  169 + .setPositiveButton(R.string.yes, null)
  170 + //TODO IMPLEMENTER SLETTING AV SAK
  171 + .setNegativeButton(R.string.no, null)
  172 + .show();
  173 + }
  174 +
158 175 }
... ...
Risiko/app/src/main/java/activity/Incident.java
... ... @@ -6,6 +6,7 @@ import android.os.Bundle;
6 6 import android.util.Log;
7 7 import android.view.LayoutInflater;
8 8 import android.view.View;
  9 +import android.widget.Button;
9 10 import android.widget.ListView;
10 11 import android.widget.TextView;
11 12  
... ... @@ -80,6 +81,13 @@ public class Incident extends AppCompatActivity {
80 81 TextView tvLocation = promptView.findViewById(R.id.pop_place);
81 82 TextView tvDescription = promptView.findViewById(R.id.pop_description);
82 83 TextView tvAssociatedRisk = promptView.findViewById(R.id.pop_associated_risk);
  84 + Button deleteEvent = promptView.findViewById(R.id.pop_delete_event);
  85 +
  86 + //TODO: IMPLEMENTERE DET SLIK AT VI FÅR HENTET UT HVILKEN BRUKER SOM HAR SKREVET SAKEN
  87 + TextView addedBy = promptView.findViewById(R.id.tv_added_by);
  88 +
  89 + deleteEvent.setOnClickListener(view -> deleteEventDialog());
  90 +
83 91  
84 92 tvDate.setText(chosenItem.getDate());
85 93 tvLocation.setText(chosenItem.getLocation());
... ... @@ -94,6 +102,16 @@ public class Incident extends AppCompatActivity {
94 102 alert.show();
95 103  
96 104 }
  105 +
  106 +
  107 + private void deleteEventDialog() {
  108 + new AlertDialog.Builder(this)
  109 + .setTitle(R.string.delete)
  110 + .setMessage(R.string.areYouSureEvent)
  111 + .setPositiveButton(R.string.yes, null)
  112 + .setNegativeButton(R.string.no, null)
  113 + .show();
  114 + }
97 115 }
98 116  
99 117  
... ...
Risiko/app/src/main/java/api/Endpoints.java
... ... @@ -10,6 +10,7 @@ import dataclasses.Evaluation;
10 10 import dataclasses.Incident;
11 11 import retrofit2.Call;
12 12 import retrofit2.http.Body;
  13 +import retrofit2.http.DELETE;
13 14 import retrofit2.http.Field;
14 15 import retrofit2.http.FormUrlEncoded;
15 16 import retrofit2.http.GET;
... ... @@ -23,7 +24,14 @@ public interface Endpoints {
23 24  
24 25  
25 26 // THE BASEURL HAS TO BE CHANGE TO THE IP-ADDRESS YOU ARE CONNECTED TO AT LOCALHOST
26   - String BASEURL = "http://172.20.10.4:3000/";
  27 + //String BASEURL = "http://172.20.10.4:3000/";
  28 +
  29 + //HOS KRISTIN
  30 + //String BASEURL = "http://192.168.84.58:3000/";
  31 +
  32 + //ØYVIN FIX
  33 + String BASEURL ="http://risikoapi.harm.no/";
  34 +
27 35  
28 36 @GET("evaluation")
29 37 Call<List<Evaluation>> getAllEvaluations();
... ... @@ -51,5 +59,8 @@ public interface Endpoints {
51 59 @Field("consequence") int consequence, @Field("measures") String measures, @Field("outcome") String outcome, @Field("probability") int probability);
52 60  
53 61  
  62 + @DELETE("incident/{id}")
  63 + Call<String> deleteIncident(@Path("uuid") String uuid);
  64 +
54 65  
55 66 }
... ...
Risiko/app/src/main/res/drawable/ic_delete.xml
... ... @@ -4,6 +4,6 @@
4 4 android:viewportWidth="24.0"
5 5 android:viewportHeight="24.0">
6 6 <path
7   - android:fillColor="#f1754d"
  7 + android:fillColor="#ffffff"
8 8 android:pathData="M6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2L18,7L6,7v12zM8.46,11.88l1.41,-1.41L12,12.59l2.12,-2.12 1.41,1.41L13.41,14l2.12,2.12 -1.41,1.41L12,15.41l-2.12,2.12 -1.41,-1.41L10.59,14l-2.13,-2.12zM15.5,4l-1,-1h-5l-1,1L5,4v2h14L19,4z"/>
9 9 </vector>
... ...
Risiko/app/src/main/res/drawable/ic_edit.xml
... ... @@ -4,6 +4,6 @@
4 4 android:viewportWidth="24.0"
5 5 android:viewportHeight="24.0">
6 6 <path
7   - android:fillColor="#f1754d"
  7 + android:fillColor="#ffffff"
8 8 android:pathData="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z"/>
9 9 </vector>
... ...
Risiko/app/src/main/res/layout/evaluationlist.xml
... ... @@ -10,21 +10,6 @@
10 10 android:layout_height="wrap_content"
11 11 android:orientation="horizontal">
12 12  
13   - <ImageView
14   - android:layout_gravity="center_vertical"
15   - android:layout_width="30dp"
16   - android:layout_height="30dp"
17   - android:background="@drawable/ic_edit"
18   - android:layout_marginRight="10dp"/>
19   -
20   - <ImageView
21   - android:layout_gravity="center_vertical"
22   - android:layout_width="30dp"
23   - android:layout_height="30dp"
24   - android:background="@drawable/ic_delete"
25   - android:layout_marginRight="10dp" />
26   -
27   -
28 13  
29 14 <TextView
30 15 android:id="@+id/tv_headline"
... ...
Risiko/app/src/main/res/layout/popup_evaluation.xml
... ... @@ -5,17 +5,59 @@
5 5 android:orientation="vertical"
6 6 android:padding="10dp">
7 7  
  8 +
  9 + <LinearLayout
  10 + android:orientation="horizontal"
  11 + android:layout_width="fill_parent"
  12 + android:layout_height="wrap_content"
  13 + android:background="@color/colorPrimaryDark">
  14 +
  15 + <TextView
  16 + android:id="@+id/pop_headline"
  17 + android:layout_width="wrap_content"
  18 + android:layout_height="wrap_content"
  19 + android:layout_gravity="left"
  20 + android:padding="10dp"
  21 + android:text="@string/evaluation_headline"
  22 + android:textAppearance="?android:attr/textAppearanceMedium"
  23 + android:textStyle="bold" />
  24 +
  25 + <LinearLayout
  26 + android:orientation="horizontal"
  27 + android:layout_width="fill_parent"
  28 + android:layout_height="match_parent"
  29 + android:gravity="right|center"
  30 + android:layout_marginRight="15dp">
  31 +
  32 + <Button
  33 + android:layout_marginRight="15dp"
  34 + android:id="@+id/pop_delete_evaluation"
  35 + android:layout_width="30dp"
  36 + android:layout_height="30dp"
  37 + android:background="@drawable/ic_delete"/>
  38 +
  39 + <Button
  40 + android:id="@+id/pop_edit_evaluation"
  41 + android:layout_width="30dp"
  42 + android:layout_height="30dp"
  43 + android:background="@drawable/ic_edit"/>
  44 + </LinearLayout>
  45 +
  46 + </LinearLayout>
  47 +
8 48 <TextView
9   - android:id="@+id/pop_headline"
  49 + android:id="@+id/tv_added_by"
10 50 android:layout_width="match_parent"
11 51 android:layout_height="wrap_content"
12   - android:padding="10dp"
13   - android:text="@string/evaluation_headline"
14   - android:textAlignment="center"
15   - android:textAppearance="?android:attr/textAppearanceMedium"
16   - android:textStyle="bold"
  52 + android:text="@string/added_by"
  53 + android:paddingBottom="7dp"
  54 + android:paddingLeft="10dp"
  55 + android:textColor="@color/colorWhite"
  56 + android:textStyle="italic"
  57 + android:textSize="15sp"
17 58 android:background="@color/colorPrimaryDark"/>
18 59  
  60 +
19 61 <TextView
20 62 android:layout_width="wrap_content"
21 63 android:layout_height="wrap_content"
... ... @@ -111,4 +153,7 @@
111 153 android:text="@string/high"/>
112 154  
113 155  
  156 +
  157 +
  158 +
114 159 </LinearLayout>
115 160 \ No newline at end of file
... ...
Risiko/app/src/main/res/layout/popup_event.xml
... ... @@ -5,17 +5,61 @@
5 5 android:orientation="vertical"
6 6 android:padding="10dp">
7 7  
  8 +
  9 + <LinearLayout
  10 + android:orientation="horizontal"
  11 + android:layout_width="fill_parent"
  12 + android:layout_height="wrap_content"
  13 + android:background="@color/colorPrimaryDark">
  14 +
  15 + <TextView
  16 + android:id="@+id/pop_headline"
  17 + android:layout_width="wrap_content"
  18 + android:layout_height="wrap_content"
  19 + android:layout_gravity="left"
  20 + android:padding="10dp"
  21 + android:text="@string/event_headline"
  22 + android:textAppearance="?android:attr/textAppearanceMedium"
  23 + android:textStyle="bold" />
  24 +
  25 + <LinearLayout
  26 + android:orientation="horizontal"
  27 + android:layout_width="fill_parent"
  28 + android:layout_height="match_parent"
  29 + android:gravity="right|center"
  30 + android:layout_marginRight="15dp">
  31 +
  32 + <Button
  33 + android:layout_marginRight="15dp"
  34 + android:id="@+id/pop_delete_event"
  35 + android:layout_width="30dp"
  36 + android:layout_height="30dp"
  37 + android:background="@drawable/ic_delete"/>
  38 +
  39 + <Button
  40 + android:id="@+id/pop_edit_event"
  41 + android:layout_width="30dp"
  42 + android:layout_height="30dp"
  43 + android:background="@drawable/ic_edit"/>
  44 + </LinearLayout>
  45 +
  46 + </LinearLayout>
  47 +
8 48 <TextView
9   - android:id="@+id/pop_event_headline"
  49 + android:id="@+id/tv_added_by"
10 50 android:layout_width="match_parent"
11 51 android:layout_height="wrap_content"
12   - android:padding="10dp"
13   - android:text="@string/event_headline"
14   - android:textAlignment="center"
15   - android:textAppearance="?android:attr/textAppearanceMedium"
16   - android:textStyle="bold"
  52 + android:text="@string/added_by"
  53 + android:paddingBottom="7dp"
  54 + android:paddingLeft="10dp"
  55 + android:textColor="@color/colorWhite"
  56 + android:textStyle="italic"
  57 + android:textSize="15sp"
17 58 android:background="@color/colorPrimaryDark"/>
18 59  
  60 +
  61 +
  62 +
19 63 <LinearLayout
20 64 android:layout_width="match_parent"
21 65 android:layout_height="wrap_content"
... ...
Risiko/app/src/main/res/values/strings.xml
... ... @@ -33,5 +33,12 @@
33 33 <string name="username">Brukernavn</string>
34 34 <string name="password">Passord</string>
35 35 <string name="btn_login">Logg inn</string>
  36 + <string name="delete">Slett vurdering</string>
  37 + <string name="areYouSure">Er du sikker på at du vil slette denne vurderingen?</string>
  38 + <string name="yes">Ja</string>
  39 + <string name="no">Nei</string>
  40 + <string name="areYouSureEvent">Er du sikker på at du vil slette denne hendelsen?</string>
  41 + <string name="added_by">Lagt til av:</string>
  42 +
36 43  
37 44 </resources>
... ...
restApi/.idea/workspace.xml
... ... @@ -58,8 +58,8 @@
58 58 <file leaf-file-name="routes.js" pinned="false" current-in-tab="true">
59 59 <entry file="file://$PROJECT_DIR$/api/routes/routes.js">
60 60 <provider selected="true" editor-type-id="text-editor">
61   - <state relative-caret-position="416">
62   - <caret line="161" column="28" lean-forward="false" selection-start-line="161" selection-start-column="28" selection-end-line="161" selection-end-column="28" />
  61 + <state relative-caret-position="282">
  62 + <caret line="68" column="78" lean-forward="true" selection-start-line="68" selection-start-column="78" selection-end-line="68" selection-end-column="78" />
63 63 <folding />
64 64 </state>
65 65 </provider>
... ... @@ -104,7 +104,7 @@
104 104 <path value="$PROJECT_DIR$/package.json" />
105 105 </packageJsonPaths>
106 106 </component>
107   - <component name="ProjectFrameBounds" extendedState="1">
  107 + <component name="ProjectFrameBounds">
108 108 <option name="y" value="23" />
109 109 <option name="width" value="1440" />
110 110 <option name="height" value="873" />
... ... @@ -223,15 +223,15 @@
223 223 <workItem from="1541155443683" duration="1473000" />
224 224 <workItem from="1541596156631" duration="9351000" />
225 225 <workItem from="1541681303243" duration="9060000" />
226   - <workItem from="1542189792461" duration="2464000" />
  226 + <workItem from="1542189792461" duration="2884000" />
227 227 </task>
228 228 <servers />
229 229 </component>
230 230 <component name="TimeTrackingManager">
231   - <option name="totallyTimeSpent" value="24246000" />
  231 + <option name="totallyTimeSpent" value="24666000" />
232 232 </component>
233 233 <component name="ToolWindowManager">
234   - <frame x="0" y="23" width="1440" height="873" extended-state="1" />
  234 + <frame x="0" y="23" width="1440" height="873" extended-state="0" />
235 235 <editor active="true" />
236 236 <layout>
237 237 <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.20014094" sideWeight="0.71465296" order="0" side_tool="false" content_ui="combo" />
... ... @@ -291,8 +291,8 @@
291 291 </entry>
292 292 <entry file="file://$PROJECT_DIR$/api/routes/routes.js">
293 293 <provider selected="true" editor-type-id="text-editor">
294   - <state relative-caret-position="416">
295   - <caret line="161" column="28" lean-forward="false" selection-start-line="161" selection-start-column="28" selection-end-line="161" selection-end-column="28" />
  294 + <state relative-caret-position="282">
  295 + <caret line="68" column="78" lean-forward="true" selection-start-line="68" selection-start-column="78" selection-end-line="68" selection-end-column="78" />
296 296 <folding />
297 297 </state>
298 298 </provider>
... ...