Make days back filter a setting
| | |
| | | - Improve Gerrit change ref decoration in the refs panel (issue 206)
|
| | | - Disable Gson's pretty printing which has a huge performance gain
|
| | | - Properly set application/json content-type on api calls
|
| | | - Make days back filter choices a setting
|
| | | - Changed default days back filter setting to 7 days
|
| | | - Improved page title
|
| | | - Updated Polish translation
|
| | | - Updated Japanese translation
|
| | |
| | | - { name: 'mail.smtps', defaultValue: false }
|
| | | - { name: 'realm.salesforce.backingUserService', defaultValue: 'users.conf' }
|
| | | - { name: 'realm.salesforce.orgId', defaultValue: 0 }
|
| | | - { name: 'web.activityDurationChoices', defaultValue: '7 14 28 60 90 180' }
|
| | | - { name: 'web.allowAppCloneLinks', defaultValue: true }
|
| | | - { name: 'web.forceDefaultLocale', defaultValue: ' ' }
|
| | | - { name: 'web.overviewPushCount', defaultValue: 5 }
|
| | |
| | | # SINCE 0.5.0
|
| | | web.generateActivityGraph = true
|
| | |
|
| | | # The number of days to show on the activity page.
|
| | | # Value must exceed 0 else default of 14 is used
|
| | | # The default number of days to show on the activity page.
|
| | | # Value must exceed 0 else default of 7 is used
|
| | | #
|
| | | # SINCE 0.8.0
|
| | | web.activityDuration = 14
|
| | | web.activityDuration = 7
|
| | |
|
| | | # Choices for days of activity to display.
|
| | | #
|
| | | # SPACE-DELIMITED
|
| | | # SINCE 1.3.0
|
| | | web.activityDurationChoices = 7 14 28 60 90 180
|
| | |
|
| | | # The number of commits to display on the summary page
|
| | | # Value must exceed 0 else default of 20 is used
|
| | |
| | | public static int getInteger(String key, int defaultValue) { |
| | | return self().settings.getInteger(key, defaultValue); |
| | | } |
| | | |
| | | /** |
| | | * Returns the integer list for the specified key. If the key does not |
| | | * exist or the value for the key can not be interpreted as an integer, an |
| | | * empty list is returned. |
| | | * |
| | | * @see IStoredSettings.getIntegers(String key) |
| | | * @param key |
| | | * @return key value or defaultValue |
| | | */ |
| | | public static List<Integer> getIntegers(String key) { |
| | | return self().settings.getIntegers(key); |
| | | } |
| | | |
| | | /** |
| | | * Returns the value in bytes for the specified key. If the key does not |
| | |
| | | }
|
| | |
|
| | | /**
|
| | | * Returns a list of space-separated integers from the specified key.
|
| | | * |
| | | * @param name
|
| | | * @return list of strings
|
| | | */
|
| | | public List<Integer> getIntegers(String name) {
|
| | | return getIntegers(name, " ");
|
| | | }
|
| | |
|
| | | /**
|
| | | * Returns a list of integers from the specified key using the specified
|
| | | * string separator.
|
| | | * |
| | | * @param name
|
| | | * @param separator
|
| | | * @return list of integers
|
| | | */
|
| | | public List<Integer> getIntegers(String name, String separator) {
|
| | | List<Integer> ints = new ArrayList<Integer>();
|
| | | Properties props = getSettings();
|
| | | if (props.containsKey(name)) {
|
| | | String value = props.getProperty(name);
|
| | | List<String> strings = StringUtils.getStringsFromValue(value, separator);
|
| | | for (String str : strings) {
|
| | | try {
|
| | | int i = Integer.parseInt(str);
|
| | | ints.add(i);
|
| | | } catch (NumberFormatException e) {
|
| | | }
|
| | | }
|
| | | }
|
| | | return ints;
|
| | | }
|
| | | |
| | | /**
|
| | | * Returns a map of strings from the specified key.
|
| | | *
|
| | | * @param name
|
| | |
| | | ActivityPage.class);
|
| | |
|
| | | PageParameters currentParameters = getPageParameters();
|
| | | int daysBack = GitBlit.getInteger(Keys.web.activityDuration, 14);
|
| | | int daysBack = GitBlit.getInteger(Keys.web.activityDuration, 7);
|
| | | if (currentParameters != null && !currentParameters.containsKey("db")) {
|
| | | currentParameters.put("db", daysBack);
|
| | | }
|
| | |
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.Set;
|
| | | import java.util.TreeSet;
|
| | | import java.util.concurrent.atomic.AtomicInteger;
|
| | | import java.util.regex.Pattern;
|
| | |
|
| | |
| | |
|
| | | // remove days back parameter if it is the default value
|
| | | if (params.containsKey("db")
|
| | | && params.getInt("db") == GitBlit.getInteger(Keys.web.activityDuration, 14)) {
|
| | | && params.getInt("db") == GitBlit.getInteger(Keys.web.activityDuration, 7)) {
|
| | | params.remove("db");
|
| | | }
|
| | | return params;
|
| | |
| | |
|
| | | protected List<DropDownMenuItem> getTimeFilterItems(PageParameters params) {
|
| | | // days back choices - additive parameters
|
| | | int daysBack = GitBlit.getInteger(Keys.web.activityDuration, 14);
|
| | | int daysBack = GitBlit.getInteger(Keys.web.activityDuration, 7);
|
| | | if (daysBack < 1) {
|
| | | daysBack = 14;
|
| | | daysBack = 7;
|
| | | }
|
| | | List<DropDownMenuItem> items = new ArrayList<DropDownMenuItem>();
|
| | | Set<Integer> choicesSet = new HashSet<Integer>(Arrays.asList(daysBack, 14, 28, 60, 90, 180));
|
| | | Set<Integer> choicesSet = new TreeSet<Integer>(GitBlit.getIntegers(Keys.web.activityDurationChoices));
|
| | | if (choicesSet.isEmpty()) {
|
| | | choicesSet.addAll(Arrays.asList(7, 14, 28, 60, 90, 180));
|
| | | }
|
| | | List<Integer> choices = new ArrayList<Integer>(choicesSet);
|
| | | Collections.sort(choices);
|
| | | String lastDaysPattern = getString("gb.lastNDays");
|