Improve DVCS accounts configuration page loading in Jira

XMLWordPrintable

    • Type: Suggestion
    • Resolution: Fixed
    • 8.14.0
    • Component/s: DVCS Accounts
    • None
    • 1

      Summary

      Jira Administration > Applications > DVCS accounts shows all repositories/organizations, which cause high CPU usage on browser if user connected with large number of repositories.

      Suggestion

      Set pagination or "Load More" buttons to reduce browser load without showing all repositories.

      Workaround

      Update repositories through the API.

      Check DVCS status of repositories

      1. Grab the repos from JIRA
        curl -X GET \
          <base-url>/rest/bitbucket/1.0/repositories \
          -H 'Authorization: Basic YWRtaW46YWRtaW4='=
        
      2. Gather more info based on repository
        curl -X POST \
          <base-url>/rest/bitbucket/1.0/repo/<repository-id>/autolink \
          -H 'Authorization: Basic YWRtaW46YWRtaW4=' \
          -H 'Content-Type: application/json' \
          -H 'cache-control: no-cache' \
          -d '{"payload": true}'
        

      Finding new repos when auto-sync is disabled by a namespace or organization:

      1. Find organisation ids:
        GET /rest/bitbucket/1.0/organization
        [
        {
        "id": 2,
        "hostUrl": "https://github.com",
        "name": "organizatioins11",
        "displayName": "organizatioins11",
        "dvcsType": "github",
        "autolinkNewRepos": false,
        "smartcommitsOnNewRepos": false,
        "organizationUrl": "https://github.com/organizatioins11",
        "repositories": [
        {
        "id": 4,
        "organizationId": 2,
        "dvcsType": "github",
        "slug": "number2",
        "name": "number2",
        "linked": false,
        "deleted": false,
        "smartcommitsEnabled": false,
        "repositoryUrl": "https://github.com/organizatioins11/number2",
        "fork": false
        },
        {
        "id": 5,
        "organizationId": 2,
        "dvcsType": "github",
        "slug": "number-3",
        "name": "number-3",
        "linked": false,
        "deleted": false,
        "smartcommitsEnabled": false,
        "repositoryUrl": "https://github.com/organizatioins11/number-3",
        "fork": false
        },
        {
        "id": 6,
        "organizationId": 2,
        "dvcsType": "github",
        "slug": "number-4-",
        "name": "number-4-",
        "lastCommitDate": 1567105357000,
        "linked": true,
        "deleted": false,
        "smartcommitsEnabled": false,
        "lastActivityDate": 1567105357000,
        "repositoryUrl": "https://github.com/organizatioins11/number-4-",
        "fork": false,
        "sync": {
        "finished": true,
        "changesetCount": 0,
        "jiraCount": 0,
        "pullRequestActivityCount": 0,
        "synchroErrorCount": 0,
        "startTime": 1567107596473,
        "finishTime": 1567107596603,
        "flightTimeMs": 0,
        "numRequests": 0,
        "softsync": true,
        "webHookSync": false,
        "warning": false,
        "hasAdminPermission": true
        }
        },
        {
        
      2. Update the list of the available repos from GHE to Jira:
        GET /rest/bitbucket/1.0/organization/<organization-id>/syncRepoList
      3. Find the list of the repos for that org that have not been updated:
        GET /rest/bitbucket/1.0/organization/<organization-id>
        {
        "id": 2,
        "hostUrl": "https://github.com",
        "name": "organizatioins11",
        "displayName": "organizatioins11",
        "dvcsType": "github",
        "autolinkNewRepos": false,
        "smartcommitsOnNewRepos": false,
        "organizationUrl": "https://github.com/organizatioins11",
        "repositories": [
        {
        "id": 4,
        "organizationId": 2,
        "dvcsType": "github",
        "slug": "number2",
        "name": "number2",
        "linked": false,
        "deleted": false,
        "smartcommitsEnabled": false,
        "repositoryUrl": "https://github.com/organizatioins11/number2",
        "fork": false
        },
        {
        "id": 5,
        "organizationId": 2,
        "dvcsType": "github",
        "slug": "number-3",
        "name": "number-3",
        "linked": false,
        "deleted": false,
        "smartcommitsEnabled": false,
        "repositoryUrl": "https://github.com/organizatioins11/number-3",
        "fork": false
        },
        {
        "id": 6,
        "organizationId": 2,
        "dvcsType": "github",
        "slug": "number-4-",
        "name": "number-4-",
        "lastCommitDate": 1567105357000,
        "linked": true,
        "deleted": false,
        "smartcommitsEnabled": false,
        "lastActivityDate": 1567105357000,
        "repositoryUrl": "https://github.com/organizatioins11/number-4-",
        "fork": false,
        "sync": {
        "finished": true,
        "changesetCount": 0,
        "jiraCount": 0,
        "pullRequestActivityCount": 0,
        "synchroErrorCount": 0,
        "startTime": 1567107596473,
        "finishTime": 1567107596603,
        "flightTimeMs": 0,
        "numRequests": 0,
        "softsync": true,
        "webHookSync": false,
        "warning": false,
        "hasAdminPermission": true
        }
        },
        {
        "id": 7,
        "organizationId": 2,
        "dvcsType": "github",
        "slug": "number-5",
        "name": "number-5",
        "linked": false,
        "deleted": false,
        "smartcommitsEnabled": false,
        "repositoryUrl": "https://github.com/organizatioins11/number-5",
        "fork": false
        },
        {
        "id": 8,
        "organizationId": 2,
        "dvcsType": "github",
        "slug": "number-6",
        "name": "number-6",
        "linked": false,
        "deleted": false,
        "smartcommitsEnabled": false,
        "repositoryUrl": "https://github.com/organizatioins11/number-6",
        "fork": false
        },
        {
        "id": 3,
        "organizationId": 2,
        "dvcsType": "github",
        "slug": "test",
        "name": "test",
        "linked": false,
        "deleted": false,
        "smartcommitsEnabled": false,
        "repositoryUrl": "https://github.com/organizatioins11/test",
        "fork": false
        }
        ],
        "approvalState": "APPROVED",
        "lastPolled": 1567106182667
        }
        
        • We are looking for:
          "linked": false,
        • We just take any of the ids that are false, in this example, I will use 8
          "id": 8
      4. ADD the repos to JIRA by repo id:
        curl -X POST \
        <base-url>/rest/bitbucket/1.0/repository/<repository-id>/enable  
        

      Syncing Repos outside the GUI

      1. Get the list of Repositories that have not been synced:
        GET /rest/bitbucket/1.0/repositories/
            {
              "id": 8,
              "organizationId": 2,
              "dvcsType": "github",
              "slug": "testrepository",
              "name": "testrepository",
              "linked": true,
              "deleted": false,
              "smartcommitsEnabled": false,
              "repositoryUrl": "https://github.com/testorganizatioin/testrepository",
              "fork": false
            },
        
      2. Sync the repository:
        curl -X POST \
          <base-url>/rest/bitbucket/1.0/repository/<repository-id>/sync
        

      Optimize the DVCS page

      A workaround for this is to add the following CSS to the announcer bar which will load the orgs in collapsed view as it described in JSWSERVER-20096.

      <style>/Collapse DVCS Org repos on page load/[ID^="dvcs-account-repos-"]
      
      {display: none;}
      
      </style>
      

            Assignee:
            Chris van Es (Inactive)
            Reporter:
            Tomoko Suzuki
            Votes:
            3 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: