<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Nimble Ltd on Medium]]></title>
        <description><![CDATA[Stories by Nimble Ltd on Medium]]></description>
        <link>https://medium.com/@nimbleltd?source=rss-5f72298d7d8b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*Oss_JUq9hUHRPBt4.jpeg</url>
            <title>Stories by Nimble Ltd on Medium</title>
            <link>https://medium.com/@nimbleltd?source=rss-5f72298d7d8b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 06:46:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nimbleltd/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Why not Build a web app for Jira administration?]]></title>
            <link>https://medium.com/@nimbleltd/why-not-build-a-web-app-for-jira-administration-b3f16a7e4bba?source=rss-5f72298d7d8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/b3f16a7e4bba</guid>
            <dc:creator><![CDATA[Nimble Ltd]]></dc:creator>
            <pubDate>Fri, 01 Nov 2024 10:34:06 GMT</pubDate>
            <atom:updated>2026-05-08T05:05:24.631Z</atom:updated>
            <content:encoded><![CDATA[<p>thinking about where or when or how much to make what about this?</p><pre>import json<br>import time<br>import configparser<br>import urllib3<br>from datetime import datetime, timezone<br>import pandas as pd<br>import requests<br>from requests.auth import HTTPBasicAuth<br>import dash<br>from dash import html, dcc<br>from dash.dependencies import Input, Output<br><br># Optional desktop window<br>try:<br>    import webview<br>    WEBVIEW_AVAILABLE = True<br>except Exception:<br>    WEBVIEW_AVAILABLE = False<br><br># ---------------- Config &amp; Session ----------------<br>urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)<br>config = configparser.ConfigParser()<br>config.read(&#39;Config.ini&#39;)<br>DEFAULT_EMAIL = config[&#39;AUTH&#39;][&#39;DEFAULT_EMAIL&#39;]<br>API_TOKEN = config[&#39;AUTH&#39;][&#39;API_TOKEN&#39;]<br>JIRA_BASE_URL = config.get(&#39;JIRA&#39;, &#39;BASE_URL&#39;, fallback=&quot;https://regionsbank.atlassian.net&quot;)<br>EXCLUDE_ARCHIVED = config.getboolean(&#39;JIRA&#39;, &#39;EXCLUDE_ARCHIVED&#39;, fallback=True)<br><br>auth = HTTPBasicAuth(DEFAULT_EMAIL, API_TOKEN)<br>session = requests.Session()<br>session.auth = (DEFAULT_EMAIL, API_TOKEN)<br>session.headers.update({&quot;Accept&quot;: &quot;application/json&quot;})<br>session.verify = False<br><br># ---------------- Jira API Helpers ----------------<br>def jira_get(url, params=None, max_retries=3, backoff=1.5):<br>    &quot;&quot;&quot;Simple GET with retry/backoff.&quot;&quot;&quot;<br>    for attempt in range(max_retries):<br>        resp = session.get(url, params=params, timeout=30, verify=False)<br>        if resp.status_code == 410:<br>            resp.raise_for_status()<br>        if resp.status_code == 429:<br>            wait = float(resp.headers.get(&#39;Retry-After&#39;, 60))<br>            time.sleep(wait)<br>            continue<br>        if resp.ok:<br>            return resp<br>        time.sleep(backoff * (attempt + 1))<br>    resp.raise_for_status()<br>    return resp<br><br># ---------------- Project &amp; Insight Helpers ----------------<br><br>def get_project_count_total():<br>    url = f&quot;{JIRA_BASE_URL}/rest/api/3/project/search&quot;<br>    resp = jira_get(url, params={&quot;startAt&quot;: 0, &quot;maxResults&quot;: 1})<br>    return int(resp.json().get(&quot;total&quot;, 0))<br><br><br>def get_project_count_excluding_archived():<br>    url = f&quot;{JIRA_BASE_URL}/rest/api/3/project/search&quot;<br>    startAt = 0<br>    maxResults = 50<br>    count = 0<br>    while True:<br>        resp = jira_get(url, params={&quot;startAt&quot;: startAt, &quot;maxResults&quot;: maxResults})<br>        data = resp.json()<br>        values = data.get(&quot;values&quot;, [])<br>        count += sum(1 for p in values if not p.get(&quot;archived&quot;, False))<br>        total = data.get(&quot;total&quot;, startAt + len(values))<br>        startAt += maxResults<br>        if startAt &gt;= total or not values:<br>            break<br>    return count<br><br><br>def get_all_statuses():<br>    url = f&quot;{JIRA_BASE_URL}/rest/api/3/status&quot;<br>    resp = jira_get(url)<br>    statuses = resp.json()<br>    rows = []<br>    for s in statuses:<br>        rows.append({<br>            &quot;id&quot;: s.get(&quot;id&quot;),<br>            &quot;name&quot;: s.get(&quot;name&quot;),<br>            &quot;statusCategory&quot;: (s.get(&quot;statusCategory&quot;) or {}).get(&quot;name&quot;),<br>            &quot;categoryKey&quot;: (s.get(&quot;statusCategory&quot;) or {}).get(&quot;key&quot;)<br>        })<br>    df = pd.DataFrame(rows)<br>    if df.empty:<br>        df = pd.DataFrame(columns=[&quot;id&quot;, &quot;name&quot;, &quot;statusCategory&quot;, &quot;categoryKey&quot;])<br>    return df<br><br><br>def get_projects_with_insight_df():<br>    url = f&quot;{JIRA_BASE_URL}/rest/api/3/project/search&quot;<br>    startAt = 0<br>    maxResults = 50<br>    projects = []<br>    while True:<br>        resp = jira_get(url, params={&quot;startAt&quot;: startAt, &quot;maxResults&quot;: maxResults,<br>                                     &quot;expand&quot;: &quot;insight&quot;})<br>        data = resp.json()<br>        values = data.get(&quot;values&quot;, [])<br>        for p in values:<br>            ins = p.get(&quot;insight&quot;) or {}<br>            projects.append({<br>                &quot;id&quot;: p.get(&quot;id&quot;),<br>                &quot;key&quot;: p.get(&quot;key&quot;),<br>                &quot;name&quot;: p.get(&quot;name&quot;),<br>                &quot;projectTypeKey&quot;: p.get(&quot;projectTypeKey&quot;),<br>                &quot;archived&quot;: p.get(&quot;archived&quot;, False),<br>                &quot;lead_displayName&quot;: (p.get(&quot;lead&quot;, {}) or {}).get(&quot;displayName&quot;),<br>                &quot;insight_totalIssueCount&quot;: ins.get(&quot;totalIssueCount&quot;),<br>                &quot;insight_lastIssueUpdateTime&quot;: ins.get(&quot;lastIssueUpdateTime&quot;),<br>            })<br>        total = data.get(&quot;total&quot;, startAt + len(values))<br>        startAt += maxResults<br>        if startAt &gt;= total or not values:<br>            break<br>    df = pd.DataFrame(projects)<br>    if df.empty:<br>        df = pd.DataFrame(columns=[<br>            &quot;id&quot;, &quot;key&quot;, &quot;name&quot;, &quot;projectTypeKey&quot;, &quot;archived&quot;, &quot;lead_displayName&quot;,<br>            &quot;insight_totalIssueCount&quot;, &quot;insight_lastIssueUpdateTime&quot;<br>        ])<br>    return df<br><br><br>def get_stale_projects_df(min_days: int = 90):<br>    df_projects = get_projects_with_insight_df()<br>    if EXCLUDE_ARCHIVED and &quot;archived&quot; in df_projects.columns:<br>        df_projects = df_projects[df_projects[&quot;archived&quot;] == False].copy()<br>    if df_projects.empty:<br>        return df_projects<br>    df_projects[&quot;last_updated&quot;] = df_projects[&quot;insight_lastIssueUpdateTime&quot;]<br>    df_projects[&quot;issue_count&quot;] = df_projects[&quot;insight_totalIssueCount&quot;].fillna(0)<br>    base_df = df_projects[df_projects[&quot;issue_count&quot;] &gt; 0].copy()<br><br>    import datetime as _dt, re as _re<br><br>    def parse_ts(ts: str):<br>        if not ts:<br>            return None<br>        s = str(ts).strip()<br>        if s.endswith(&#39;Z&#39;):<br>            s = s[:-1] + &#39;+00:00&#39;<br>        for fmt in (&quot;%Y-%m-%dT%H:%M:%S.%f%z&quot;, &quot;%Y-%m-%dT%H:%M:%S%z&quot;):<br>            try:<br>                return _dt.datetime.strptime(s, fmt)<br>            except Exception:<br>                pass<br>        if _re.search(r&quot;[\+\-]\d{4}$&quot;, s):<br>            s = s[:-2] + &quot;:&quot; + s[-2:]<br>        try:<br>            return _dt.datetime.fromisoformat(s)<br>        except Exception:<br>            return None<br><br>    base_df[&quot;last_dt&quot;] = base_df[&quot;last_updated&quot;].apply(parse_ts)<br>    base_df = base_df[base_df[&quot;last_dt&quot;].notna()].copy()<br><br>    def to_utc(dt):<br>        try:<br>            return dt.astimezone(_dt.timezone.utc)<br>        except Exception:<br>            return None<br><br>    base_df[&quot;last_dt_utc&quot;] = base_df[&quot;last_dt&quot;].apply(to_utc)<br>    base_df = base_df[base_df[&quot;last_dt_utc&quot;].notna()].copy()<br><br>    now = _dt.datetime.now(_dt.timezone.utc)<br>    cutoff = now - _dt.timedelta(days=min_days)<br>    stale_df = base_df[base_df[&quot;last_dt_utc&quot;] &lt;= cutoff].copy()<br>    stale_df[&quot;stale_days&quot;] = (now - stale_df[&quot;last_dt_utc&quot;]).dt.days<br><br>    stale_df = stale_df.sort_values(by=[&quot;last_dt_utc&quot;, &quot;name&quot;], ascending=[True, True])<br>    stale_df = stale_df.drop(columns=[&quot;last_dt&quot;, &quot;last_dt_utc&quot;], errors=&#39;ignore&#39;)<br>    return stale_df<br><br># ---------------- Config counts (existing) ----------------<br><br>def _get_page_total(url, extra_params=None):<br>    params = {&quot;startAt&quot;: 0, &quot;maxResults&quot;: 1}<br>    if extra_params:<br>        params.update(extra_params)<br>    resp = jira_get(url, params=params)<br>    return int(resp.json().get(&quot;total&quot;, 0))<br><br><br>def get_issue_types_count():<br>    resp = jira_get(f&quot;{JIRA_BASE_URL}/rest/api/3/issuetype&quot;)<br>    data = resp.json()<br>    return int(len(data)) if isinstance(data, list) else 0<br><br><br>def get_issue_type_schemes_count():<br>    return _get_page_total(f&quot;{JIRA_BASE_URL}/rest/api/3/issuetypescheme&quot;)<br><br><br>def get_workflow_schemes_count():<br>    return _get_page_total(f&quot;{JIRA_BASE_URL}/rest/api/3/workflowscheme&quot;)<br><br><br>def get_workflows_count():<br>    try:<br>        resp = jira_get(f&quot;{JIRA_BASE_URL}/rest/api/3/workflow/search&quot;, params={&quot;startAt&quot;:<br>                                                                                    0, &quot;maxResults&quot;: 1})<br>        return int(resp.json().get(&quot;total&quot;, 0))<br>    except Exception:<br>        try:<br>            resp = jira_get(f&quot;{JIRA_BASE_URL}/rest/api/3/workflow&quot;)<br>            data = resp.json()<br>            return int(len(data)) if isinstance(data, list) else (1 if isinstance(data,<br>                                                                                   dict) else 0)<br>        except Exception:<br>            return 0<br><br><br>def get_screens_count():<br>    return _get_page_total(f&quot;{JIRA_BASE_URL}/rest/api/3/screens&quot;)<br><br><br>def get_screen_schemes_count():<br>    return _get_page_total(f&quot;{JIRA_BASE_URL}/rest/api/3/screenscheme&quot;)<br><br><br>def get_issue_type_screen_schemes_count():<br>    return _get_page_total(f&quot;{JIRA_BASE_URL}/rest/api/3/issuetypescreenscheme&quot;)<br><br><br>def get_fields_count():<br>    resp = jira_get(f&quot;{JIRA_BASE_URL}/rest/api/3/field&quot;)<br>    data = resp.json()<br>    return int(len(data)) if isinstance(data, list) else 0<br><br><br>def get_field_configurations_count():<br>    return _get_page_total(f&quot;{JIRA_BASE_URL}/rest/api/3/fieldconfiguration&quot;)<br><br><br>def get_permission_schemes_count():<br>    resp = jira_get(f&quot;{JIRA_BASE_URL}/rest/api/3/permissionscheme&quot;)<br>    data = resp.json()<br>    if isinstance(data, list):<br>        return int(len(data))<br>    if isinstance(data, dict):<br>        return int(len(data.get(&quot;permissionSchemes&quot;) or data.get(&quot;values&quot;) or []))<br>    return 0<br><br># ---------------- New single-call totals (added in app.31) ----------------<br><br>def get_boards_count():<br>    url = f&quot;{JIRA_BASE_URL}/rest/agile/1.0/board&quot;<br>    resp = jira_get(url, params={&quot;startAt&quot;: 0, &quot;maxResults&quot;: 1})<br>    data = resp.json()<br>    return int(data.get(&quot;total&quot;, len(data.get(&quot;values&quot;, []))))<br><br><br>def get_roles_count():<br>    url = f&quot;{JIRA_BASE_URL}/rest/api/2/role&quot;<br>    resp = jira_get(url)<br>    data = resp.json()<br>    return int(len(data)) if isinstance(data, list) else int(len(data.get(&quot;roles&quot;, [])))<br><br><br>def get_filters_count():<br>    url = f&quot;{JIRA_BASE_URL}/rest/api/3/filter/search&quot;<br>    resp = jira_get(url, params={&quot;startAt&quot;: 0, &quot;maxResults&quot;: 1})<br>    data = resp.json()<br>    return int(data.get(&quot;total&quot;, len(data.get(&quot;values&quot;, []))))<br><br><br>def get_field_configuration_schemes_count():<br>    url = f&quot;{JIRA_BASE_URL}/rest/api/3/fieldconfigurationscheme&quot;<br>    resp = jira_get(url, params={&quot;startAt&quot;: 0, &quot;maxResults&quot;: 1})<br>    data = resp.json()<br>    return int(data.get(&quot;total&quot;, len(data.get(&quot;values&quot;, []))))<br><br><br>def get_priorities_count():<br>    url = f&quot;{JIRA_BASE_URL}/rest/api/3/priority&quot;<br>    resp = jira_get(url)<br>    data = resp.json()<br>    return int(len(data)) if isinstance(data, list) else 0<br><br><br>def get_priority_schemes_count():<br>    url = f&quot;{JIRA_BASE_URL}/rest/api/3/priorityscheme&quot;<br>    resp = jira_get(url, params={&quot;startAt&quot;: 0, &quot;maxResults&quot;: 1})<br>    data = resp.json()<br>    return int(data.get(&quot;total&quot;, len(data.get(&quot;values&quot;, []))))<br><br># ---------------- NEW totals for Issue Attributes pills (requested) ----------------<br><br>def get_security_schemes_count():<br>    &quot;&quot;&quot;Issue Security Schemes: GET /rest/api/3/issuesecurityschemes (returns list)&quot;&quot;&quot;<br>    url = f&quot;{JIRA_BASE_URL}/rest/api/3/issuesecurityschemes&quot;<br>    resp = jira_get(url)<br>    data = resp.json()<br>    # Response is typically {&quot;issueSecuritySchemes&quot;: [ ... ]} or list depending on SDK;<br>    # handle both<br>    if isinstance(data, list):<br>        return int(len(data))<br>    return int(len(data.get(&quot;issueSecuritySchemes&quot;) or data.get(&quot;values&quot;) or []))<br><br><br>def get_notification_schemes_count():<br>    &quot;&quot;&quot;Notification Schemes: paginated GET /rest/api/3/notificationscheme, read &#39;total&#39;&quot;&quot;&quot;<br>    url = f&quot;{JIRA_BASE_URL}/rest/api/3/notificationscheme&quot;<br>    resp = jira_get(url, params={&quot;startAt&quot;: 0, &quot;maxResults&quot;: 1})<br>    data = resp.json()<br>    return int(data.get(&quot;total&quot;, len(data.get(&quot;values&quot;, []))))<br><br><br>def get_resolutions_count():<br>    &quot;&quot;&quot;Resolutions: GET /rest/api/3/resolution (returns list)&quot;&quot;&quot;<br>    url = f&quot;{JIRA_BASE_URL}/rest/api/3/resolution&quot;<br>    resp = jira_get(url)<br>    data = resp.json()<br>    return int(len(data)) if isinstance(data, list) else 0<br><br># ---------------- Dash App ----------------<br>app = dash.Dash(__name__)<br>app.title = &quot;Jira Admin Dashboard&quot;<br><br># --- Styles ---<br>PAGE_STYLE = {<br>    &quot;fontFamily&quot;: &quot;Segoe UI, system-ui, sans-serif&quot;,<br>    &quot;padding&quot;: &quot;18px 24px&quot;,<br>    &quot;backgroundColor&quot;: &quot;#f5f7fb&quot;,<br>}<br><br>COLUMN_WRAPPER = {<br>    &quot;display&quot;: &quot;grid&quot;,<br>    &quot;gridAutoFlow&quot;: &quot;column&quot;,<br>    &quot;gridAutoColumns&quot;: &quot;minmax(260px, 1fr)&quot;,<br>    &quot;gap&quot;: &quot;0px&quot;,<br>    &quot;alignItems&quot;: &quot;start&quot;,<br>    &quot;overflowX&quot;: &quot;auto&quot;,<br>    &quot;paddingBottom&quot;: &quot;8px&quot;,<br>}<br><br>COLUMN_STYLE = {<br>    &quot;backgroundColor&quot;: &quot;#ffffff&quot;,<br>    &quot;border&quot;: &quot;1px solid #e5e7eb&quot;,<br>    &quot;borderRadius&quot;: &quot;12px&quot;,<br>    &quot;padding&quot;: &quot;12px&quot;,<br>}<br><br>COLUMN_STACK = {&quot;display&quot;: &quot;grid&quot;, &quot;gap&quot;: &quot;12px&quot;}<br>COL_HEADER_STYLE = {&quot;fontWeight&quot;: &quot;700&quot;, &quot;fontSize&quot;: &quot;18px&quot;, &quot;margin&quot;: &quot;0 0 8px 0&quot;}<br>BASE_PILL = {&quot;borderRadius&quot;: &quot;12px&quot;, &quot;padding&quot;: &quot;12px&quot;, &quot;color&quot;: &quot;white&quot;}<br>COLOR_ORANGE  = {**BASE_PILL, &quot;backgroundColor&quot;: &quot;#F59E0B&quot;}<br>COLOR_GREEN   = {**BASE_PILL, &quot;backgroundColor&quot;: &quot;#22C55E&quot;}<br>COLOR_TEAL    = {**BASE_PILL, &quot;backgroundColor&quot;: &quot;#14B8A6&quot;}<br>COLOR_PURPLE  = {**BASE_PILL, &quot;backgroundColor&quot;: &quot;#8B5CF6&quot;}<br>COLOR_BLUE    = {**BASE_PILL, &quot;backgroundColor&quot;: &quot;#3B82F6&quot;}<br>COLOR_INDIGO  = {**BASE_PILL, &quot;backgroundColor&quot;: &quot;#6366F1&quot;}<br>COLOR_RED     = {**BASE_PILL, &quot;backgroundColor&quot;: &quot;#EF4444&quot;}<br>COLOR_PINK    = {**BASE_PILL, &quot;backgroundColor&quot;: &quot;#EC4899&quot;}<br><br>BTN_STYLE = {<br>    &quot;padding&quot;: &quot;6px 10px&quot;,<br>    &quot;borderRadius&quot;: &quot;6px&quot;,<br>    &quot;border&quot;: &quot;1px solid #ffffff&quot;,<br>    &quot;backgroundColor&quot;: &quot;rgba(255,255,255,0.15)&quot;,<br>    &quot;color&quot;: &quot;white&quot;,<br>    &quot;cursor&quot;: &quot;pointer&quot;,<br>    &quot;marginTop&quot;: &quot;6px&quot;,<br>    &quot;marginBottom&quot;: &quot;8px&quot;,<br>}<br><br>COUNT_STYLE = {&quot;margin&quot;: 0}<br><br># --- Layout (swap: Priorities BEFORE Issue Attributes) ---<br>app.layout = html.Div([<br>    html.H2(&quot;Jira Admin Dashboard&quot;, style={&quot;margin&quot;: &quot;0 0 12px 0&quot;}),<br>    html.Div([html.Strong(&quot;Key:&quot;), html.Span(&quot; * = count me manually due to permissions&quot;)],<br>             style={&quot;fontSize&quot;: &quot;12px&quot;, &quot;color&quot;: &quot;#475569&quot;, &quot;margin&quot;: &quot;0 0 8px 0&quot;}),<br><br>    html.Div([<br>        # Issue Types<br>        html.Div([<br>            html.Div(&quot;Issue Types&quot;, style=COL_HEADER_STYLE),<br>            html.Div([<br>                html.Div([html.Div(&quot;Issue Types&quot;), html.Button(&quot;Refresh&quot;,<br>                    id=&quot;btn-refresh-issue-types&quot;, n_clicks=0, style=BTN_STYLE), dcc.Loading(<br>                    id=&quot;loading-issue-types&quot;, type=&quot;circle&quot;, color=&quot;#ffffff&quot;, children=html.<br>                    H1(id=&quot;total-issue-types&quot;, style=COUNT_STYLE))], style=COLOR_ORANGE),<br>                html.Div([html.Div(&quot;Issue Type Schemes&quot;), html.Button(&quot;Refresh&quot;,<br>                    id=&quot;btn-refresh-issue-type-schemes&quot;, n_clicks=0, style=BTN_STYLE), dcc.<br>                    Loading(id=&quot;loading-issue-type-schemes&quot;, type=&quot;circle&quot;, color=&quot;#ffffff&quot;,<br>                    children=html.H1(id=&quot;total-issue-type-schemes&quot;, style=COUNT_STYLE))],<br>                    style=COLOR_GREEN),<br>                html.Div([html.Div(&quot;Issue Type Screen Schemes&quot;), html.Button(&quot;Refresh&quot;,<br>                    id=&quot;btn-refresh-issue-type-screen-schemes&quot;, n_clicks=0, style=BTN_STYLE),<br>                    dcc.Loading(id=&quot;loading-issue-type-screen-schemes&quot;, type=&quot;circle&quot;,<br>                    color=&quot;#ffffff&quot;, children=html.H1(id=&quot;total-issue-type-screen-schemes&quot;,<br>                    style=COUNT_STYLE))], style=COLOR_TEAL),<br>            ], style=COLUMN_STACK)<br>        ], style=COLUMN_STYLE),<br><br>        # Workflows<br>        html.Div([<br>            html.Div(&quot;Workflows&quot;, style=COL_HEADER_STYLE),<br>            html.Div([<br>                html.Div([html.Div(&quot;Workflows&quot;), html.Button(&quot;Refresh&quot;,<br>                    id=&quot;btn-refresh-workflows&quot;, n_clicks=0, style=BTN_STYLE), dcc.Loading(<br>                    id=&quot;loading-workflows&quot;, type=&quot;circle&quot;, color=&quot;#ffffff&quot;, children=html.H1(<br>                    id=&quot;total-workflows&quot;, style=COUNT_STYLE))], style=COLOR_ORANGE),<br>                html.Div([html.Div(&quot;Workflow Schemes&quot;), html.Button(&quot;Refresh&quot;,<br>                    id=&quot;btn-refresh-workflow-schemes&quot;, n_clicks=0, style=BTN_STYLE), dcc.<br>                    Loading(id=&quot;loading-workflow-schemes&quot;, type=&quot;circle&quot;, color=&quot;#ffffff&quot;,<br>                    children=html.H1(id=&quot;total-workflow-schemes&quot;, style=COUNT_STYLE))],<br>                    style=COLOR_INDIGO),<br>            ], style=COLUMN_STACK)<br>        ], style=COLUMN_STYLE),<br><br>        # Screens<br>        html.Div([<br>            html.Div(&quot;Screens&quot;, style=COL_HEADER_STYLE),<br>            html.Div([<br>                html.Div([html.Div(&quot;Screens&quot;), html.Button(&quot;Refresh&quot;,<br>                    id=&quot;btn-refresh-screens&quot;, n_clicks=0, style=BTN_STYLE), dcc.Loading(<br>                    id=&quot;loading-screens&quot;, type=&quot;circle&quot;, color=&quot;#ffffff&quot;, children=html.H1(<br>                    id=&quot;total-screens&quot;, style=COUNT_STYLE))], style=COLOR_PURPLE),<br>                html.Div([html.Div(&quot;Screen Schemes&quot;), html.Button(&quot;Refresh&quot;,<br>                    id=&quot;btn-refresh-screen-schemes&quot;, n_clicks=0, style=BTN_STYLE), dcc.Loading(<br>                    id=&quot;loading-screen-schemes&quot;, type=&quot;circle&quot;, color=&quot;#ffffff&quot;,<br>                    children=html.H1(id=&quot;total-screen-schemes&quot;, style=COUNT_STYLE))],<br>                    style=COLOR_BLUE),<br>                # html.Div([html.Div(&quot;Issue Type Screen Schemes&quot;), html.Button(&quot;Refresh&quot;,<br>                #     id=&quot;btn-refresh-issue-type-screen-schemes-dup&quot;, n_clicks=0,<br>                #     style=BTN_STYLE), dcc.Loading(id=&quot;loading-issue-type-screen-schemes-dup&quot;,<br>                #     type=&quot;circle&quot;, color=&quot;#ffffff&quot;, children=html.H1(<br>                #     id=&quot;total-issue-type-screen-schemes-dup&quot;, style=COUNT_STYLE))],<br>                #     style=COLOR_TEAL),<br>            ], style=COLUMN_STACK)<br>        ], style=COLUMN_STYLE),<br><br>        # Fields (+ Field Configuration Schemes)<br>        html.Div([<br>            html.Div(&quot;Fields&quot;, style=COL_HEADER_STYLE),<br>            html.Div([<br>                html.Div([html.Div(&quot;Custom Fields&quot;), html.Button(&quot;Refresh&quot;,<br>                    id=&quot;btn-refresh-fields&quot;, n_clicks=0, style=BTN_STYLE), dcc.Loading(<br>                    id=&quot;loading-fields&quot;, type=&quot;circle&quot;, color=&quot;#ffffff&quot;, children=html.H1(<br>                    id=&quot;total-fields&quot;, style=COUNT_STYLE))], style=COLOR_ORANGE),<br>                html.Div([html.Div(&quot;Field Configurations&quot;), html.Button(&quot;Refresh&quot;,<br>                    id=&quot;btn-refresh-field-configurations&quot;, n_clicks=0, style=BTN_STYLE), dcc.<br>                    Loading(id=&quot;loading-field-configurations&quot;, type=&quot;circle&quot;,<br>                    color=&quot;#ffffff&quot;, children=html.H1(id=&quot;total-field-configurations&quot;,<br>                    style=COUNT_STYLE))], style=COLOR_GREEN),<br>                html.Div([html.Div(&quot;Field Configuration Schemes&quot;), html.Button(&quot;Refresh&quot;,<br>                    id=&quot;btn-refresh-field-config-schemes&quot;, n_clicks=0, style=BTN_STYLE), dcc.<br>                    Loading(id=&quot;loading-field-config-schemes&quot;, type=&quot;circle&quot;,<br>                    color=&quot;#ffffff&quot;, children=html.H1(id=&quot;total-field-config-schemes&quot;,<br>                    style=COUNT_STYLE))], style=COLOR_PINK),<br>            ], style=COLUMN_STACK)<br>        ], style=COLUMN_STYLE),<br><br>        # Priorities (placed BEFORE Issue Attributes)<br>        html.Div([<br>            html.Div(&quot;Priorities&quot;, style=COL_HEADER_STYLE),<br>            html.Div([<br>                html.Div([html.Div(&quot;Priorities&quot;), html.Button(&quot;Refresh&quot;,<br>                    id=&quot;btn-refresh-priorities&quot;, n_clicks=0, style=BTN_STYLE), dcc.Loading(<br>                    id=&quot;loading-priorities&quot;, type=&quot;circle&quot;, color=&quot;#ffffff&quot;, children=html.H1(<br>                    id=&quot;total-priorities&quot;, style=COUNT_STYLE))], style=COLOR_TEAL),<br>                html.Div([html.Div(&quot;Priority Schemes&quot;), html.Button(&quot;Refresh&quot;,<br>                    id=&quot;btn-refresh-priority-schemes&quot;, n_clicks=0, style=BTN_STYLE), dcc.<br>                    Loading(id=&quot;loading-priority-schemes&quot;, type=&quot;circle&quot;, color=&quot;#ffffff&quot;,<br>                    children=html.H1(id=&quot;total-priority-schemes&quot;, style=COUNT_STYLE))],<br>                    style=COLOR_INDIGO),<br>            ], style=COLUMN_STACK)<br>        ], style=COLUMN_STYLE),<br><br>        # Issue Attributes (AFTER Priorities) + added live-count pills<br>        html.Div([<br>            html.Div(&quot;Issue Attributes&quot;, style=COL_HEADER_STYLE),<br>            html.Div([<br>                html.Div([<br>                    html.Div(&quot;Statuses&quot;),<br>                    html.Button(&quot;Refresh&quot;, id=&quot;btn-refresh-statuses&quot;, n_clicks=0,<br>                                style=BTN_STYLE),<br>                    dcc.Loading(id=&quot;loading-statuses-pill&quot;, type=&quot;circle&quot;,<br>                                color=&quot;#ffffff&quot;,<br>                                children=html.H1(id=&quot;total-statuses&quot;, style=COUNT_STYLE)<br>                                ),<br>                    # Pie chart: bg matches teal pill<br>                    dcc.Loading(id=&quot;loading-statuses&quot;, type=&quot;circle&quot;, color=&quot;#ffffff&quot;,<br>                                children=dcc.Graph(id=&quot;status-pie&quot;, config={&quot;displayModeBar&quot;:<br>                                                                                False}, style={&quot;height&quot;: &quot;160px&quot;, &quot;marginTop&quot;: &quot;8px&quot;})<br>                                ),<br>                ], style=COLOR_TEAL),<br>                html.Div([html.Div(&quot;Permission Schemes&quot;), html.Button(&quot;Refresh&quot;,<br>                    id=&quot;btn-refresh-permission-schemes&quot;, n_clicks=0, style=BTN_STYLE), dcc.<br>                    Loading(id=&quot;loading-permission-schemes-pill&quot;, type=&quot;circle&quot;,<br>                    color=&quot;#ffffff&quot;, children=html.H1(id=&quot;total-permission-schemes&quot;,<br>                    style=COUNT_STYLE))], style=COLOR_ORANGE),<br>                # New live-count pills<br>                html.Div([html.Div(&quot;Security Schemes&quot;), html.Button(&quot;Refresh&quot;,<br>                    id=&quot;btn-refresh-security-schemes&quot;, n_clicks=0, style=BTN_STYLE), dcc.<br>                    Loading(id=&quot;loading-security-schemes&quot;, type=&quot;circle&quot;, color=&quot;#ffffff&quot;,<br>                    children=html.H1(id=&quot;total-security-schemes&quot;, style=COUNT_STYLE))],<br>                    style=COLOR_BLUE),<br>                html.Div([html.Div(&quot;Notification Schemes&quot;), html.Button(&quot;Refresh&quot;,<br>                    id=&quot;btn-refresh-notification-schemes&quot;, n_clicks=0, style=BTN_STYLE), dcc.<br>                    Loading(id=&quot;loading-notification-schemes&quot;, type=&quot;circle&quot;,<br>                    color=&quot;#ffffff&quot;, children=html.H1(id=&quot;total-notification-schemes&quot;,<br>                    style=COUNT_STYLE))], style=COLOR_INDIGO),<br>                html.Div([html.Div(&quot;Resolutions&quot;), html.Button(&quot;Refresh&quot;,<br>                    id=&quot;btn-refresh-resolutions&quot;, n_clicks=0, style=BTN_STYLE), dcc.Loading(<br>                    id=&quot;loading-resolutions&quot;, type=&quot;circle&quot;, color=&quot;#ffffff&quot;, children=html.<br>                    H1(id=&quot;total-resolutions&quot;, style=COUNT_STYLE))], style=COLOR_PURPLE),<br>            ], style=COLUMN_STACK)<br>        ], style=COLUMN_STYLE),<br><br>        # Project Attributes<br>        html.Div([<br>            html.Div(&quot;Project Attributes&quot;, style=COL_HEADER_STYLE),<br>            html.Div([<br>                html.Div([html.Div(&quot;Number of Projects *&quot;), html.Button(&quot;Refresh&quot;,<br>                    id=&quot;btn-refresh-projects&quot;, n_clicks=0, style=BTN_STYLE), dcc.Loading(<br>                    id=&quot;loading-projects-pill&quot;, type=&quot;circle&quot;, color=&quot;#ffffff&quot;,<br>                    children=html.H1(id=&quot;total-projects&quot;, style=COUNT_STYLE))],<br>                    style=COLOR_RED),<br>                html.Div([html.Div(&quot;Number of Boards *&quot;), html.Button(&quot;Refresh&quot;,<br>                    id=&quot;btn-refresh-boards&quot;, n_clicks=0, style=BTN_STYLE), dcc.Loading(<br>                    id=&quot;loading-boards&quot;, type=&quot;circle&quot;, color=&quot;#ffffff&quot;, children=html.H1(<br>                    id=&quot;total-boards&quot;, style=COUNT_STYLE))], style=COLOR_BLUE),<br>                html.Div([html.Div(&quot;Roles&quot;), html.Button(&quot;Refresh&quot;,<br>                    id=&quot;btn-refresh-roles&quot;, n_clicks=0, style=BTN_STYLE), dcc.Loading(<br>                    id=&quot;loading-roles&quot;, type=&quot;circle&quot;, color=&quot;#ffffff&quot;, children=html.H1(<br>                    id=&quot;total-roles&quot;, style=COUNT_STYLE))], style=COLOR_INDIGO),<br>                html.Div([html.Div(&quot;Filters *&quot;), html.Button(&quot;Refresh&quot;,<br>                    id=&quot;btn-refresh-filters&quot;, n_clicks=0, style=BTN_STYLE), dcc.Loading(<br>                    id=&quot;loading-filters&quot;, type=&quot;circle&quot;, color=&quot;#ffffff&quot;, children=html.H1(<br>                    id=&quot;total-filters&quot;, style=COUNT_STYLE))], style=COLOR_ORANGE),<br>            ], style=COLUMN_STACK)<br>        ], style=COLUMN_STYLE),<br>    ], style=COLUMN_WRAPPER),<br><br>    # Bottom section unchanged<br>    html.Div([<br>        html.Div([<br>            html.H4(&quot;Stale Jira Projects&quot;, style={&quot;margin&quot;: &quot;0 0 6px 0&quot;}),<br>            html.Div([<br>                html.Button(&quot;Refresh stale list&quot;, id=&quot;btn-refresh-stale&quot;, n_clicks=0,<br>                            style={<br>                                &quot;padding&quot;: &quot;6px 10px&quot;, &quot;borderRadius&quot;: &quot;6px&quot;,<br>                                &quot;border&quot;: &quot;1px solid #0078D4&quot;, &quot;backgroundColor&quot;: &quot;#0078D4&quot;,<br>                                &quot;color&quot;: &quot;white&quot;, &quot;cursor&quot;: &quot;pointer&quot;, &quot;marginRight&quot;: &quot;10px&quot;,<br>                            }),<br>                dcc.Dropdown(<br>                    id=&quot;stale-months&quot;,<br>                    options=[{&quot;label&quot;: f&quot;{m} month&quot; if m == 1 else f&quot;{m} months&quot;, &quot;value&quot;:<br>                              m} for m in range(1, 13)],<br>                    value=3,<br>                    clearable=False,<br>                    style={&quot;width&quot;: &quot;180px&quot;, &quot;display&quot;: &quot;inline-block&quot;, &quot;marginRight&quot;:<br>                           &quot;10px&quot;},<br>                ),<br>                html.Span(id=&quot;stale-count&quot;, style={&quot;display&quot;: &quot;inline-block&quot;,<br>                    &quot;backgroundColor&quot;: &quot;#EEF2FF&quot;, &quot;color&quot;: &quot;#1E40AF&quot;, &quot;border&quot;: &quot;1px solid &quot;<br>                    &quot;#CBD5E1&quot;, &quot;borderRadius&quot;: &quot;999px&quot;, &quot;padding&quot;: &quot;2px 10px&quot;, &quot;fontWeight&quot;:<br>                    &quot;600&quot;, &quot;fontSize&quot;: &quot;13px&quot;}),<br>            ], style={&quot;display&quot;: &quot;flex&quot;, &quot;alignItems&quot;: &quot;center&quot;, &quot;gap&quot;: &quot;10px&quot;}),<br>            dcc.Loading(<br>                id=&quot;loading-stale&quot;,<br>                type=&quot;circle&quot;,<br>                color=&quot;#0078D4&quot;,<br>                children=html.Div(id=&quot;stale-list&quot;, style={&quot;maxHeight&quot;: &quot;520px&quot;,<br>                                  &quot;overflowY&quot;: &quot;auto&quot;, &quot;marginTop&quot;: &quot;12px&quot;, &quot;paddingRight&quot;: &quot;6px&quot;}),<br>            ),<br>        ], style={&quot;border&quot;: &quot;1px solid #e5e7eb&quot;, &quot;borderRadius&quot;: &quot;12px&quot;, &quot;padding&quot;:<br>                  &quot;12px&quot;, &quot;backgroundColor&quot;: &quot;#ffffff&quot;}),<br><br>        html.Div([<br>            html.H4(&quot;Projects with No Issues&quot;, style={&quot;margin&quot;: &quot;0 0 6px 0&quot;}),<br>            html.Div([<br>                html.Button(&quot;Refresh empty list&quot;, id=&quot;btn-refresh-empty&quot;, n_clicks=0,<br>                            style={<br>                                &quot;padding&quot;: &quot;6px 10px&quot;, &quot;borderRadius&quot;: &quot;6px&quot;,<br>                                &quot;border&quot;: &quot;1px solid #0078D4&quot;, &quot;backgroundColor&quot;: &quot;#0078D4&quot;,<br>                                &quot;color&quot;: &quot;white&quot;, &quot;cursor&quot;: &quot;pointer&quot;, &quot;marginRight&quot;: &quot;10px&quot;,<br>                            }),<br>                html.Span(id=&quot;empty-count&quot;, style={&quot;display&quot;: &quot;inline-block&quot;,<br>                    &quot;backgroundColor&quot;: &quot;#EEF2FF&quot;, &quot;color&quot;: &quot;#1E40AF&quot;, &quot;border&quot;: &quot;1px solid &quot;<br>                    &quot;#CBD5E1&quot;, &quot;borderRadius&quot;: &quot;999px&quot;, &quot;padding&quot;: &quot;2px 10px&quot;, &quot;fontWeight&quot;:<br>                    &quot;600&quot;, &quot;fontSize&quot;: &quot;13px&quot;}),<br>            ], style={&quot;display&quot;: &quot;flex&quot;, &quot;alignItems&quot;: &quot;center&quot;, &quot;gap&quot;: &quot;10px&quot;}),<br>            dcc.Loading(<br>                id=&quot;loading-empty&quot;,<br>                type=&quot;circle&quot;,<br>                color=&quot;#0078D4&quot;,<br>                children=html.Div(id=&quot;empty-list&quot;, style={&quot;maxHeight&quot;: &quot;520px&quot;,<br>                                  &quot;overflowY&quot;: &quot;auto&quot;, &quot;marginTop&quot;: &quot;12px&quot;, &quot;paddingRight&quot;: &quot;6px&quot;}),<br>            ),<br>        ], style={&quot;border&quot;: &quot;1px solid #e5e7eb&quot;, &quot;borderRadius&quot;: &quot;12px&quot;, &quot;padding&quot;:<br>                  &quot;12px&quot;, &quot;backgroundColor&quot;: &quot;#ffffff&quot;}),<br>    ], style={&quot;display&quot;: &quot;grid&quot;, &quot;gridTemplateColumns&quot;: &quot;1fr 1fr&quot;, &quot;gap&quot;: &quot;16px&quot;,<br>              &quot;marginTop&quot;: &quot;16px&quot;}),<br>], style=PAGE_STYLE)<br><br># ---------------- Callbacks ----------------<br># Existing totals callbacks preserved<br>@app.callback(Output(&quot;total-projects&quot;, &quot;children&quot;), Input(&quot;btn-refresh-projects&quot;,<br>              &quot;n_clicks&quot;), prevent_initial_call=False)<br>def update_total_projects(_n):<br>    try:<br>        total = get_project_count_excluding_archived() if EXCLUDE_ARCHIVED else \<br>            get_project_count_total()<br>        return f&quot;{total}&quot;<br>    except Exception as e:<br>        print(f&quot;[Total Jira Projects] Error: {e}&quot;)<br>        return &quot;Error&quot;<br><br>@app.callback(Output(&quot;total-statuses&quot;, &quot;children&quot;), Output(&quot;status-pie&quot;, &quot;figure&quot;), Input(<br>              &quot;btn-refresh-statuses&quot;, &quot;n_clicks&quot;), prevent_initial_call=False)<br>def update_statuses(_n):<br>    try:<br>        df = get_all_statuses()<br>        total = len(df)<br>        td = int((df.get(&quot;statusCategory&quot;) == &quot;To Do&quot;).sum()) if &quot;statusCategory&quot; in df.columns else 0<br>        doing = int((df.get(&quot;statusCategory&quot;) == &quot;In Progress&quot;).sum()) if &quot;statusCategory&quot; \<br>            in df.columns else 0<br>        done = int((df.get(&quot;statusCategory&quot;) == &quot;Done&quot;).sum()) if &quot;statusCategory&quot; in df. \<br>            columns else 0<br><br>        labels = [&quot;To Do&quot;, &quot;In Progress&quot;, &quot;Done&quot;]<br>        values = [td, doing, done]<br>        y_max = max(values) if values else 1<br><br>        fig = {<br>            &quot;data&quot;: [{<br>                &quot;type&quot;: &quot;bar&quot;,<br>                &quot;orientation&quot;: &quot;v&quot;,<br>                &quot;x&quot;: labels,<br>                &quot;y&quot;: values,<br>                &quot;text&quot;: values,<br>                &quot;textposition&quot;: &quot;outside&quot;,<br>                &quot;textfont&quot;: {&quot;color&quot;: &quot;#FFFFFF&quot;, &quot;size&quot;: 12},<br>                &quot;marker&quot;: {&quot;color&quot;: &quot;#FFFFFF&quot;, &quot;line&quot;: {&quot;color&quot;: &quot;#0F172A&quot;, &quot;width&quot;: 1}},<br>                &quot;cliponaxis&quot;: False,<br>            }],<br>            &quot;layout&quot;: {<br>                &quot;margin&quot;: {&quot;l&quot;: 10, &quot;r&quot;: 10, &quot;t&quot;: 0, &quot;b&quot;: 38},<br>                &quot;showlegend&quot;: False,<br>                &quot;paper_bgcolor&quot;: &quot;#14B8A6&quot;,<br>                &quot;plot_bgcolor&quot;: &quot;#14B8A6&quot;,<br>                &quot;xaxis&quot;: {&quot;tickfont&quot;: {&quot;color&quot;: &quot;#FFFFFF&quot;, &quot;size&quot;: 12}},<br>                &quot;yaxis&quot;: {<br>                    &quot;tickfont&quot;: {&quot;color&quot;: &quot;#FFFFFF&quot;, &quot;size&quot;: 11},<br>                    &quot;range&quot;: [0, y_max * 1.2]<br>                },<br>            },<br>        }<br>        return (f&quot;{total}&quot;, fig)<br>    except Exception as e:<br>        print(f&quot;[Statuses] Error: {e}&quot;)<br>        empty_fig = {&quot;data&quot;: [{&quot;type&quot;: &quot;bar&quot;, &quot;x&quot;: [], &quot;y&quot;: []}], &quot;layout&quot;: {&quot;margin&quot;:<br>                     {&quot;l&quot;:1,&quot;r&quot;:0,&quot;t&quot;:0,&quot;b&quot;:0}, &quot;showlegend&quot;: False, &quot;paper_bgcolor&quot;: &quot;#14B8A6&quot;,<br>                     &quot;plot_bgcolor&quot;: &quot;#14B8A6&quot;}}<br>        return &quot;Error&quot;, empty_fig<br>    except Exception as e:<br>        print(f&quot;[Statuses] Error: {e}&quot;)<br>        empty_fig = {&quot;data&quot;: [{&quot;type&quot;: &quot;pie&quot;, &quot;labels&quot;: [], &quot;values&quot;: []}], &quot;layout&quot;:<br>                     {&quot;margin&quot;: {&quot;l&quot;:0,&quot;r&quot;:0,&quot;t&quot;:0,&quot;b&quot;:0}, &quot;showlegend&quot;: False, &quot;paper_bgcolor&quot;:<br>                     &quot;#14B8A6&quot;, &quot;plot_bgcolor&quot;: &quot;#14B8A6&quot;}}<br>        return &quot;Error&quot;, empty_fig<br><br>@app.callback(Output(&quot;empty-count&quot;, &quot;children&quot;), Output(&quot;empty-list&quot;, &quot;children&quot;), Input(<br>              &quot;btn-refresh-empty&quot;, &quot;n_clicks&quot;), prevent_initial_call=False)<br>def update_empty_projects(_n):<br>    try:<br>        df = get_projects_with_insight_df()<br>        if EXCLUDE_ARCHIVED and &quot;archived&quot; in df.columns:<br>            df = df[df[&quot;archived&quot;] == False].copy()<br>        if df.empty:<br>            return &quot;0 empty projects&quot;, html.Div(&quot;No empty projects. 🎉&quot;)<br><br>        df[&quot;issue_count&quot;] = df[&quot;insight_totalIssueCount&quot;].fillna(0)<br>        empty_df = df[df[&quot;issue_count&quot;] == 0].copy()<br>        empty_df = empty_df.sort_values(by=[&quot;name&quot;, &quot;key&quot;], ascending=[True, True])<br><br>        count = len(empty_df)<br>        badge_text = f&quot;{count} empty project{&#39;s&#39; if count != 1 else &#39;&#39;}&quot;<br>        if empty_df.empty:<br>            return badge_text, html.Div(&quot;No empty projects. 🎉&quot;)<br><br>        items = []<br>        for _, row in empty_df.iterrows():<br>            name = row.get(&quot;name&quot;, &quot;-&quot;)<br>            key = row.get(&quot;key&quot;, &quot;&quot;)<br>            archived_badge = &quot;&quot;<br>            if &quot;archived&quot; in df.columns:<br>                try:<br>                    if bool(row.get(&quot;archived&quot;, False)):<br>                        archived_badge = html.Span(&quot; (archived)&quot;, style={&quot;color&quot;: &quot;#a00&quot;})<br>                except Exception:<br>                    pass<br><br>            empty_badge = html.Span(&quot;Empty&quot;, style={&quot;display&quot;: &quot;inline-block&quot;,<br>                &quot;backgroundColor&quot;: &quot;#F1F5F9&quot;, &quot;color&quot;: &quot;#0F172A&quot;, &quot;border&quot;: &quot;1px solid &quot;<br>                &quot;#E2E8F0&quot;, &quot;borderRadius&quot;: &quot;999px&quot;, &quot;padding&quot;: &quot;2px 10px&quot;, &quot;fontWeight&quot;: &quot;600&quot;,<br>                &quot;fontSize&quot;: &quot;12px&quot;})<br>            items.append(html.Div([<br>                html.Strong(name), html.Span(f&quot; — {key}&quot;), archived_badge,<br>                html.Div([html.Span(&quot;No issues in this project&quot;), empty_badge], style=<br>                         {&quot;marginTop&quot;: &quot;4px&quot;})<br>            ], style={&quot;padding&quot;: &quot;8px 0&quot;, &quot;borderBottom&quot;: &quot;1px dashed #eee&quot;}))<br><br>        return badge_text, html.Div(items)<br>    except Exception as e:<br>        print(f&quot;[Empty Projects] Error: {e}&quot;)<br>        return &quot;Error&quot;, html.Div(&quot;Unable to load empty projects.&quot;)<br><br>@app.callback(Output(&quot;stale-count&quot;, &quot;children&quot;), Output(&quot;stale-list&quot;, &quot;children&quot;), Input(<br>              &quot;btn-refresh-stale&quot;, &quot;n_clicks&quot;), Input(&quot;stale-months&quot;, &quot;value&quot;),<br>              prevent_initial_call=False)<br>def update_stale_projects(_n, months):<br>    try:<br>        min_days = int(months) * 30 if months else 90<br>        df = get_stale_projects_df(min_days=min_days)<br>        count = len(df)<br>        badge_text = f&quot;{count} stale project{&#39;s&#39; if count != 1 else &#39;&#39;}&quot;<br>        if df.empty:<br>            return badge_text, html.Div(&quot;No stale projects in the selected period. 🎉&quot;)<br><br>        items = []<br>        for _, row in df.iterrows():<br>            name = row.get(&quot;name&quot;, &quot;-&quot;)<br>            key = row.get(&quot;key&quot;, &quot;&quot;)<br>            last = row.get(&quot;last_updated&quot;)<br>            stale_days = row.get(&quot;stale_days&quot;)<br>            archived_badge = &quot;&quot;<br>            if &quot;archived&quot; in df.columns:<br>                try:<br>                    if bool(row.get(&quot;archived&quot;, False)):<br>                        archived_badge = html.Span(&quot; (archived)&quot;, style={&quot;color&quot;: &quot;#a00&quot;})<br>                except Exception:<br>                    pass<br><br>            last_txt = &quot;No issues found&quot;<br>            if last:<br>                try:<br>                    s = str(last).strip()<br>                    if s.endswith(&quot;Z&quot;):<br>                        s = s[:-1] + &quot;+00:00&quot;<br>                    import re as _re<br>                    if _re.search(r&quot;[\+\-]\d{4}$&quot;, s):<br>                        s = s[:-2] + &quot;:&quot; + s[-2:]<br>                    dt = datetime.fromisoformat(s)<br>                    last_txt = f&quot;Last updated: {dt.strftime(&#39;%m/%d/%Y&#39;)}&quot;<br>                except Exception:<br>                    last_txt = f&quot;Last updated: {last}&quot;<br>            age_badge = html.Span(<br>                f&quot;{&#39;∞&#39; if stale_days == float(&#39;inf&#39;) else stale_days} days stale&quot;,<br>                style={&quot;display&quot;: &quot;inline-block&quot;, &quot;backgroundColor&quot;: &quot;#FFFYED&quot;, &quot;color&quot;:<br>                       &quot;#0F172A&quot;, &quot;border&quot;: &quot;1px solid #FED7AA&quot;, &quot;borderRadius&quot;: &quot;999px&quot;,<br>                       &quot;padding&quot;: &quot;2px 10px&quot;, &quot;fontWeight&quot;: &quot;600&quot;, &quot;fontSize&quot;: &quot;12px&quot;}<br>            )<br>            err_note = row.get(&quot;error_note&quot;)<br>            note_el = html.Span(f&quot; — error: {err_note}&quot;, style={&quot;color&quot;: &quot;#d97706&quot;}) if \<br>                err_note else &quot;&quot;<br><br>            items.append(html.Div([<br>                html.Strong(name), html.Span(f&quot; — {key}&quot;), archived_badge,<br>                html.Div([html.Span(last_txt), age_badge], style={&quot;marginTop&quot;: &quot;4px&quot;}),<br>                note_el<br>            ], style={&quot;padding&quot;: &quot;8px 0&quot;, &quot;borderBottom&quot;: &quot;1px dashed #eee&quot;}))<br>        return badge_text, html.Div(items)<br>    except Exception as e:<br>        print(f&quot;[Stale Projects] Error: {e}&quot;)<br>        return &quot;Error&quot;, html.Div(&quot;Unable to load stale projects.&quot;)<br><br># ---- Existing totals callbacks ----<br>@app.callback(Output(&quot;total-issue-types&quot;, &quot;children&quot;), Input(&quot;btn-refresh-issue-types&quot;,<br>              &quot;n_clicks&quot;), prevent_initial_call=False)<br>def update_issue_types_total(_n):<br>    try:<br>        return f&quot;{get_issue_types_count()}&quot;<br>    except Exception as e:<br>        print(f&quot;[Issue Types] Error: {e}&quot;)<br>        return &quot;Error&quot;<br><br>@app.callback(Output(&quot;total-issue-type-schemes&quot;, &quot;children&quot;), Input(<br>              &quot;btn-refresh-issue-type-schemes&quot;, &quot;n_clicks&quot;), prevent_initial_call=False)<br>def update_issue_type_schemes_total(_n):<br>    try:<br>        return f&quot;{get_issue_type_schemes_count()}&quot;<br>    except Exception as e:<br>        print(f&quot;[Issue Type Schemes] Error: {e}&quot;)<br>        return &quot;Error&quot;<br><br>@app.callback(Output(&quot;total-workflow-schemes&quot;, &quot;children&quot;), Input(<br>              &quot;btn-refresh-workflow-schemes&quot;, &quot;n_clicks&quot;), prevent_initial_call=False)<br>def update_workflow_schemes_total(_n):<br>    try:<br>        return f&quot;{get_workflow_schemes_count()}&quot;<br>    except Exception as e:<br>        print(f&quot;[Workflow Schemes] Error: {e}&quot;)<br>        return &quot;Error&quot;<br><br>@app.callback(Output(&quot;total-workflows&quot;, &quot;children&quot;), Input(&quot;btn-refresh-workflows&quot;,<br>              &quot;n_clicks&quot;), prevent_initial_call=False)<br>def update_workflows_total(_n):<br>    try:<br>        return f&quot;{get_workflows_count()}&quot;<br>    except Exception as e:<br>        print(f&quot;[Workflows] Error: {e}&quot;)<br>        return &quot;Error&quot;<br><br>@app.callback(Output(&quot;total-screens&quot;, &quot;children&quot;), Input(&quot;btn-refresh-screens&quot;,<br>              &quot;n_clicks&quot;), prevent_initial_call=False)<br>def update_screens_total(_n):<br>    try:<br>        return f&quot;{get_screens_count()}&quot;<br>    except Exception as e:<br>        print(f&quot;[Screens] Error: {e}&quot;)<br>        return &quot;Error&quot;<br><br>@app.callback(Output(&quot;total-screen-schemes&quot;, &quot;children&quot;), Input(<br>              &quot;btn-refresh-screen-schemes&quot;, &quot;n_clicks&quot;), prevent_initial_call=False)<br>def update_screen_schemes_total(_n):<br>    try:<br>        return f&quot;{get_screen_schemes_count()}&quot;<br>    except Exception as e:<br>        print(f&quot;[Screen Schemes] Error: {e}&quot;)<br>        return &quot;Error&quot;<br><br># Duplicate mapping for second UI instance<br>@app.callback(Output(&quot;total-issue-type-screen-schemes&quot;, &quot;children&quot;), Input(<br>              &quot;btn-refresh-issue-type-screen-schemes&quot;, &quot;n_clicks&quot;), prevent_initial_call=False)<br>def update_issue_type_screen_schemes_total(_n):<br>    try:<br>        return f&quot;{get_issue_type_screen_schemes_count()}&quot;<br>    except Exception as e:<br>        print(f&quot;[Issue Type Screen Schemes] Error: {e}&quot;)<br>        return &quot;Error&quot;<br><br>@app.callback(Output(&quot;total-issue-type-screen-schemes-dup&quot;, &quot;children&quot;), Input(<br>              &quot;btn-refresh-issue-type-screen-schemes-dup&quot;, &quot;n_clicks&quot;), prevent_initial_call=False)<br>def update_issue_type_screen_schemes_total_dup(_n):<br>    try:<br>        return f&quot;{get_issue_type_screen_schemes_count()}&quot;<br>    except Exception as e:<br>        print(f&quot;[Issue Type Screen Schemes DUP] Error: {e}&quot;)<br>        return &quot;Error&quot;<br><br>@app.callback(Output(&quot;total-fields&quot;, &quot;children&quot;), Input(&quot;btn-refresh-fields&quot;, &quot;n_clicks&quot;),<br>              prevent_initial_call=False)<br>def update_fields_total(_n):<br>    try:<br>        return f&quot;{get_fields_count()}&quot;<br>    except Exception as e:<br>        print(f&quot;[Fields] Error: {e}&quot;)<br>        return &quot;Error&quot;<br><br>@app.callback(Output(&quot;total-field-configurations&quot;, &quot;children&quot;), Input(<br>              &quot;btn-refresh-field-configurations&quot;, &quot;n_clicks&quot;), prevent_initial_call=False)<br>def update_field_configurations_total(_n):<br>    try:<br>        return f&quot;{get_field_configurations_count()}&quot;<br>    except Exception as e:<br>        print(f&quot;[Field Configurations] Error: {e}&quot;)<br>        return &quot;Error&quot;<br><br>@app.callback(Output(&quot;total-permission-schemes&quot;, &quot;children&quot;), Input(<br>              &quot;btn-refresh-permission-schemes&quot;, &quot;n_clicks&quot;), prevent_initial_call=False)<br>def update_permission_schemes_total(_n):<br>    try:<br>        return f&quot;{get_permission_schemes_count()}&quot;<br>    except Exception as e:<br>        print(f&quot;[Permission Schemes] Error: {e}&quot;)<br>        return &quot;Error&quot;<br><br># ---- Existing new totals callbacks from app.31 ----<br>@app.callback(Output(&quot;total-boards&quot;, &quot;children&quot;), Input(&quot;btn-refresh-boards&quot;, &quot;n_clicks&quot;),<br>              prevent_initial_call=False)<br>def update_boards_total(_n):<br>    try:<br>        return f&quot;{get_boards_count()}&quot;<br>    except Exception as e:<br>        print(f&quot;[Boards] Error: {e}&quot;)<br>        return &quot;Error&quot;<br><br>@app.callback(Output(&quot;total-roles&quot;, &quot;children&quot;), Input(&quot;btn-refresh-roles&quot;, &quot;n_clicks&quot;),<br>              prevent_initial_call=False)<br>def update_roles_total(_n):<br>    try:<br>        return f&quot;{get_roles_count()}&quot;<br>    except Exception as e:<br>        print(f&quot;[Roles] Error: {e}&quot;)<br>        return &quot;Error&quot;<br><br>@app.callback(Output(&quot;total-filters&quot;, &quot;children&quot;), Input(&quot;btn-refresh-filters&quot;,<br>              &quot;n_clicks&quot;), prevent_initial_call=False)<br>def update_filters_total(_n):<br>    try:<br>        return f&quot;{get_filters_count()}&quot;<br>    except Exception as e:<br>        print(f&quot;[Filters] Error: {e}&quot;)<br>        return &quot;Error&quot;<br><br>@app.callback(Output(&quot;total-field-config-schemes&quot;, &quot;children&quot;), Input(<br>              &quot;btn-refresh-field-config-schemes&quot;, &quot;n_clicks&quot;), prevent_initial_call=False)<br>def update_field_config_schemes_total(_n):<br>    try:<br>        return f&quot;{get_field_configuration_schemes_count()}&quot;<br>    except Exception as e:<br>        print(f&quot;[Field Config Schemes] Error: {e}&quot;)<br>        return &quot;Error&quot;<br><br>@app.callback(Output(&quot;total-priorities&quot;, &quot;children&quot;), Input(&quot;btn-refresh-priorities&quot;,<br>              &quot;n_clicks&quot;), prevent_initial_call=False)<br>def update_priorities_total(_n):<br>    try:<br>        return f&quot;{get_priorities_count()}&quot;<br>    except Exception as e:<br>        print(f&quot;[Priorities] Error: {e}&quot;)<br>        return &quot;Error&quot;<br><br>@app.callback(Output(&quot;total-priority-schemes&quot;, &quot;children&quot;), Input(<br>              &quot;btn-refresh-priority-schemes&quot;, &quot;n_clicks&quot;), prevent_initial_call=False)<br>def update_priority_schemes_total(_n):<br>    try:<br>        return f&quot;{get_priority_schemes_count()}&quot;<br>    except Exception as e:<br>        print(f&quot;[Priority Schemes] Error: {e}&quot;)<br>        return &quot;Error&quot;<br><br># ---- NEW callbacks for live counts (Issue Attributes) ----<br>@app.callback(Output(&quot;total-security-schemes&quot;, &quot;children&quot;), Input(<br>              &quot;btn-refresh-security-schemes&quot;, &quot;n_clicks&quot;), prevent_initial_call=False)<br>def update_security_schemes_total(_n):<br>    try:<br>        return f&quot;{get_security_schemes_count()}&quot;<br>    except Exception as e:<br>        print(f&quot;[Security Schemes] Error: {e}&quot;)<br>        return &quot;Error&quot;<br><br>@app.callback(Output(&quot;total-notification-schemes&quot;, &quot;children&quot;), Input(<br>              &quot;btn-refresh-notification-schemes&quot;, &quot;n_clicks&quot;), prevent_initial_call=False)<br>def update_notification_schemes_total(_n):<br>    try:<br>        return f&quot;{get_notification_schemes_count()}&quot;<br>    except Exception as e:<br>        print(f&quot;[Notification Schemes] Error: {e}&quot;)<br>        return &quot;Error&quot;<br><br>@app.callback(Output(&quot;total-resolutions&quot;, &quot;children&quot;), Input(&quot;btn-refresh-resolutions&quot;,<br>              &quot;n_clicks&quot;), prevent_initial_call=False)<br>def update_resolutions_total(_n):<br>    try:<br>        return f&quot;{get_resolutions_count()}&quot;<br>    except Exception as e:<br>        print(f&quot;[Resolutions] Error: {e}&quot;)<br>        return &quot;Error&quot;<br><br># --- Entrypoint ---<br>def run():<br>    if WEBVIEW_AVAILABLE:<br>        import threading<br>        def run_server():<br>            app.run_server(host=&quot;127.0.0.2&quot;, port=8050, debug=False)<br>        t = threading.Thread(target=run_server, daemon=True)<br>        t.start()<br>        webview.create_window(&quot;Jira Admin Dashboard&quot;, &quot;http://127.0.0.2:8050&quot;, width=1200,<br>                              height=900)<br>        webview.start()<br>    else:<br>        app.run_server(host=&quot;127.0.0.2&quot;, port=8050, debug=True)<br><br>if __name__ == &quot;__main__&quot;:<br>    run()</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b3f16a7e4bba" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>