From 289e239ad36e771bf5f96ee9dad8b3a71f39beeb Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Wed, 20 Feb 2019 22:52:16 +0100 Subject: [PATCH] Add unmaintained states --- src/js/yunohost/controllers/apps.js | 33 +++++++++++++++++++++++++++++ src/locales/en.json | 3 +++ src/views/app/app_list_install.ms | 4 ++-- 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/src/js/yunohost/controllers/apps.js b/src/js/yunohost/controllers/apps.js index c48436bd..db0f6bc9 100644 --- a/src/js/yunohost/controllers/apps.js +++ b/src/js/yunohost/controllers/apps.js @@ -40,6 +40,21 @@ } } + function stateToMaintained(state) { + if ( state === "request_help" ) { + return 'info'; + } + else if ( state === "request_adoption" ) { + return 'warning'; + } + else if ( state === "orphaned" ) { + return 'danger'; + } + else { + return 'default'; + } + } + function combineColors(stateColor, levelColor, installable) { if (stateColor === "danger" || levelColor === "danger") { return 'danger'; @@ -74,6 +89,24 @@ var isFeatured = ( dataraw[v['id']]['featured'] && dataraw[v['id']]['high_quality']); // Update the status featured with the previous condition dataraw[v['id']]['featured'] = isFeatured; + + if ( dataraw[v['id']]['maintained'] !== true ) + { + // Set the maintained status at Orphaned if the value of 'maintained' is 'false' + if ( dataraw[v['id']]['maintained'] === false ) + { + dataraw[v['id']]['MaintainedStatus'] = "orphaned"; + } + // Otherwise, set 'MaintainedStatus' at the value of 'maintained' and set 'maintained' as 'false' + else + { + dataraw[v['id']]['MaintainedStatus'] = dataraw[v['id']]['maintained']; + dataraw[v['id']]['maintained'] = false; + } + // Set the color for the label + dataraw[v['id']]['MaintainedColor'] = stateToMaintained(dataraw[v['id']]['MaintainedStatus']); + } + // Keep only the first instance of each app and remove community not working apps if (!v['id'].match(/__[0-9]{1,5}$/) && (dataraw[v['id']]['repository'] === 'yunohost' || state !== 'notworking')) { diff --git a/src/locales/en.json b/src/locales/en.json index adddaa72..a5134c50 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -233,6 +233,7 @@ "only_working_apps": "Only working apps", "open": "Open", "operations": "Operations", + "orphaned": "Orphaned", "os": "OS", "password": "Password", "password_confirmation": "Password confirmation", @@ -282,6 +283,8 @@ "reception": "Reception", "refresh_app_list": "Refresh list", "remove_access": "Remove access", + "request_adoption": "Request for adoption", + "request_help": "Request for help", "restore": "Restore", "run": "Run", "running": "Running", diff --git a/src/views/app/app_list_install.ms b/src/views/app/app_list_install.ms index 12ec0d7e..26c86e9c 100644 --- a/src/views/app/app_list_install.ms +++ b/src/views/app/app_list_install.ms @@ -51,8 +51,8 @@
{{formatDate updateDate day="numeric" month="long" year="numeric"}} - - {{#maintained}} {{manifest.maintainer.name}}{{/maintained}} - {{^maintained}} {{t 'unmaintained'}}{{/maintained}} + {{manifest.maintainer.name}} + {{^maintained}} {{t MaintainedStatus}}{{/maintained}}