Cron tasks (#817)

* Run task

* Add info popup dialog for details

* List cron tasks

* Add cron to admin screen

Co-authored-by: M M Arif <mmarif@swatian.com>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/817
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-Authored-By: M M Arif <mmarif@noreply.codeberg.org>
Co-Committed-By: M M Arif <mmarif@noreply.codeberg.org>
This commit is contained in:
M M Arif
2021-02-04 04:47:00 +01:00
committed by 6543
parent cb241d80f3
commit d72cd57cd7
15 changed files with 686 additions and 2 deletions

View File

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/primaryBackgroundColor"
android:fitsSystemWindows="true"
android:orientation="vertical">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/Widget.AppCompat.SearchView">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/primaryBackgroundColor">
<ImageView
android:id="@+id/close"
android:layout_width="@dimen/close_button_size"
android:layout_height="@dimen/close_button_size"
android:layout_marginRight="15dp"
android:layout_marginLeft="15dp"
android:gravity="center_vertical"
android:contentDescription="@string/close"
android:src="@drawable/ic_close" />
<TextView
android:id="@+id/toolbarTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="@string/adminCron"
android:textColor="?attr/primaryTextColor"
android:maxLines="1"
android:textSize="20sp" />
</com.google.android.material.appbar.MaterialToolbar>
</com.google.android.material.appbar.AppBarLayout>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/pullToRefresh"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/primaryBackgroundColor"
android:scrollbars="vertical" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<TextView
android:id="@+id/noData"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="16dp"
android:gravity="center"
android:text="@string/noDataFound"
android:textColor="?attr/primaryTextColor"
android:textSize="20sp"
android:visibility="visible" />
</LinearLayout>

View File

@ -26,6 +26,25 @@
android:padding="16dp"
app:drawableStartCompat="@drawable/ic_people" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:id="@+id/divider"
android:background="?attr/dividerColor" />
<TextView
android:id="@+id/adminCron"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="@string/adminCron"
android:drawablePadding="32dp"
android:textColor="?attr/primaryTextColor"
android:textSize="16sp"
android:padding="16dp"
android:visibility="gone"
app:drawableStartCompat="@drawable/ic_tasks" />
</LinearLayout>
</ScrollView>

View File

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="25dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/taskScheduleHeader"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/adminCronScheduleHeader"
android:textColor="?attr/primaryTextColor"
android:textSize="16sp" />
<TextView
android:id="@+id/taskScheduleContent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?attr/primaryTextColor" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="15dp"
android:orientation="vertical">
<TextView
android:id="@+id/nextRunHeader"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/adminCronNextRunHeader"
android:textColor="?attr/primaryTextColor"
android:textSize="16sp" />
<TextView
android:id="@+id/nextRunContent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?attr/primaryTextColor" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="15dp"
android:orientation="vertical">
<TextView
android:id="@+id/lastRunHeader"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/adminCronLastRunHeader"
android:textColor="?attr/primaryTextColor"
android:textSize="16sp" />
<TextView
android:id="@+id/lastRunContent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?attr/primaryTextColor" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="15dp"
android:orientation="vertical">
<TextView
android:id="@+id/execTimeHeader"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/adminCronExecutionHeader"
android:textColor="?attr/primaryTextColor"
android:textSize="16sp" />
<TextView
android:id="@+id/execTimeContent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autoLink="web"
android:textColorLink="@color/lightBlue"
android:textColor="?attr/primaryTextColor" />
</LinearLayout>
</LinearLayout>

View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="15dp"
android:background="?attr/primaryBackgroundColor" >
<LinearLayout
android:id="@+id/cronTasksRun"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginEnd="15dp">
<ImageView
android:id="@+id/runTask"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:scaleType="fitCenter"
android:contentDescription="@string/adminCron"
android:src="@drawable/ic_play" />
</LinearLayout>
<LinearLayout
android:id="@+id/cronTasksInfo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toEndOf="@id/cronTasksRun"
android:orientation="vertical">
<TextView
android:id="@+id/taskName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:text="@string/userName"
android:textColor="?attr/primaryTextColor"
android:textSize="16sp" />
</LinearLayout>
</RelativeLayout>

View File

@ -33,7 +33,7 @@
android:id="@+id/editCommentStatus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:contentDescription="@string/menuDeleteText"
android:src="@drawable/ic_edit" />
@ -41,7 +41,7 @@
android:id="@+id/deleteDraft"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:contentDescription="@string/menuDeleteText"
android:src="@drawable/ic_delete" />