From 0bc527e552e5b2237cc6e4b39bef78b7177939cb Mon Sep 17 00:00:00 2001 From: gabe-heim Date: Mon, 4 Mar 2019 17:11:15 -0600 Subject: [PATCH 01/21] last 5 dev commits affecting the frontend --- augur/datasources/facade/facade.py | 539 ++++++++++ augur/datasources/facade/routes.py | 104 +- frontend/app/Augur.js | 136 ++- frontend/app/components/AugurCards.vue | 230 +--- frontend/app/components/AugurHeader.vue | 5 +- .../app/components/DownloadedReposCard.vue | 49 +- frontend/app/components/MainControls.vue | 57 +- frontend/app/components/OverviewCard.vue | 58 + frontend/app/components/TableView.vue | 317 ++++++ frontend/app/components/Tabs.vue | 72 ++ .../components/charts/DynamicLineChart.vue | 19 +- frontend/app/router/router.js | 289 ++++- frontend/package-lock.json | 14 +- frontend/public/app.js | 989 ++++++++++++++---- 14 files changed, 2397 insertions(+), 481 deletions(-) create mode 100644 frontend/app/components/OverviewCard.vue create mode 100644 frontend/app/components/TableView.vue create mode 100644 frontend/app/components/Tabs.vue diff --git a/augur/datasources/facade/facade.py b/augur/datasources/facade/facade.py index 9ea6710e29..6b4ca184c2 100644 --- a/augur/datasources/facade/facade.py +++ b/augur/datasources/facade/facade.py @@ -144,3 +144,542 @@ def commits_by_week(self, repo_url): """) results = pd.read_sql(commitsByMonthSQL, self.db, params={"repourl": '%{}%'.format(repo_url)}) return results + + + # cd - code + # rg - repo group + # tp - time period (fixed time period) + # interval + # ranked - ordered top to bottom + # commits + # loc - lines of code + # rep - repo + # ua - unaffiliated + + @annotate(tag='cd-rg-newrep-ranked-commits') + def cd_rg_newrep_ranked_commits(self, repo_url, calendar_year=None, repo_group=None): + """ + For each repository in a collection of repositories being managed, each REPO that first appears in the parameterized + calendar year (a new repo in that year), + show all commits for that year (total for year by repo). + Result ranked from highest number of commits to lowest by default. + :param repo_url: the repository's URL + :param calendar_year: the calendar year a repo is created in to be considered "new" + :param repo_group: the group of repositories to analyze + """ + if calendar_year == None: + calendar_year = 'year' + + if repo_group == None: + repo_group = 'facade_project' + + cdRgNewrepRankedCommitsSQL = None + + if repo_group == 'facade_project': + cdRgNewrepRankedCommitsSQL = s.sql.text(""" + SELECT repos_id, sum(cast(repo_monthly_cache.added as signed) - cast(removed as signed) - cast(whitespace as signed)) as net, patches, projects.name + FROM repo_monthly_cache, projects, repos + where projects.name = (SELECT projects.name FROM repos, projects + WHERE git LIKE :repourl + and repos.projects_id = projects.id + and YEAR(repos.added) = YEAR(CURDATE()) + LIMIT 1) + and repo_annual_cache.repos_id = repos.id + and repos.projects_id = projects.id + group by repos_id + ORDER BY net desc + LIMIT 10 + """) + else: + cdRgNewrepRankedCommitsSQL = s.sql.text(""" + SELECT repos_id, sum(cast(repo_monthly_cache.added as signed) - cast(removed as signed) - cast(whitespace as signed)) as net, patches, projects.name + FROM repo_monthly_cache, projects, repos + where projects.name = :repo_group + and repo_annual_cache.repos_id = repos.id + and repos.projects_id = projects.id + group by repos_id + ORDER BY net desc + LIMIT 10 + """) + results = pd.read_sql(cdRgNewrepRankedCommitsSQL, self.db, params={"repourl": '%{}%'.format(repo_url), "repo_group": repo_group}) + return results + + @annotate(tag='cd-rg-newrep-ranked-loc') + def cd_rg_newrep_ranked_loc(self, repo_url, calendar_year=None, repo_group=None): + """ + For each repository in a collection of repositories being managed, each REPO that first appears in the parameterized + calendar year (a new repo in that year), + show all lines of code for that year (total for year by repo). Result ranked from highest number of commits to lowest by default. + :param repo_url: the repository's URL + :param calendar_year: the calendar year a repo is created in to be considered "new" + :param repo_group: the group of repositories to analyze + """ + + if calendar_year == None: + calendar_year = 'year' + + if repo_group == None: + repo_group = 'facade_project' + + cdRgNewrepRankedLocSQL = None + if repo_group == 'facade_project': + if timeframe == 'year': + cdRgNewrepRankedLocSQL = s.sql.text(""" + SELECT repos_id, sum(cast(repo_annual_cache.added as signed) - cast(removed as signed) - cast(whitespace as signed)) as net, patches, projects.name + FROM repo_annual_cache, projects, repos + where projects.name = (SELECT projects.name FROM repos, projects + WHERE git LIKE :repourl + and YEAR(repos.added) = YEAR(CURDATE()) + and repos.projects_id = projects.id + LIMIT 1) + and repo_annual_cache.repos_id = repos.id + and repos.projects_id = projects.id + group by repos_id + ORDER BY net desc + LIMIT 10 + """) + elif timeframe == 'month': + cdRgNewrepRankedLocSQL = s.sql.text(""" + SELECT repos_id, sum(cast(repo_annual_cache.added as signed) - cast(removed as signed) - cast(whitespace as signed)) as net, patches, projects.name + FROM repo_annual_cache, projects, repos + where projects.name = (SELECT projects.name FROM repos, projects + WHERE git LIKE :repourl + and MONTH(repos.added) = MONTH(CURDATE()) + and repos.projects_id = projects.id + LIMIT 1) + and repo_monthly_cache.repos_id = repos.id + and repos.projects_id = projects.id + group by repos_id + ORDER BY net desc + LIMIT 10 + """) + else: + if timeframe == 'year': + cdRgNewrepRankedLocSQL = s.sql.text(""" + SELECT repos_id, sum(cast(repo_annual_cache.added as signed) - cast(removed as signed) - cast(whitespace as signed)) as net, patches, projects.name + FROM repo_annual_cache, projects, repos + where projects.name = :repo_group + and repos.projects_id = projects.id + LIMIT 1) + and repo_annual_cache.repos_id = repos.id + and repos.projects_id = projects.id + group by repos_id + ORDER BY net desc + LIMIT 10 + """) + elif timeframe == 'month': + cdRgNewrepRankedLocSQL = s.sql.text(""" + SELECT repos_id, sum(cast(repo_annual_cache.added as signed) - cast(removed as signed) - cast(whitespace as signed)) as net, patches, projects.name + FROM repo_annual_cache, projects, repos + where projects.name = :repo_group + and repo_monthly_cache.repos_id = repos.id + and repos.projects_id = projects.id + group by repos_id + ORDER BY net desc + LIMIT 10 + """) + + results = pd.read_sql(cdRgNewrepRankedLocSQL, self.db, params={"repourl": '%{}%'.format(repo_url), "repo_group": repo_group}) + return results + + @annotate(tag='cd-rg-tp-ranked-commits') + def cd_rg_tp_ranked_commits(self, repo_url, timeframe=None, repo_group=None): + """ + For each repository in a collection of repositories being managed, each REPO's total commits during the current Month, + Year or Week. Result ranked from highest number of commits to lowest by default. + :param repo_url: the repository's URL + :param timeframe: Year, month, or week. Contribution data from the timeframe that the current date is within will be considered + :param repo_group: the group of repositories to analyze + """ + if repo_group == None: + repo_group = 'facade_project' + + if timeframe == None: + timeframe = 'year' + + cdRgTpRankedCommitsSQL = None + + if repo_group == 'facade_project': + if timeframe == "year": + cdRgTpRankedCommitsSQL = s.sql.text(""" + SELECT repos_id, repos.name as name, sum(cast(repo_annual_cache.added as signed) - cast(removed as signed) - cast(whitespace as signed)) as net, patches + FROM repo_annual_cache, projects, repos + where projects.name = (SELECT projects.name FROM repos, projects + WHERE git LIKE :repourl + and repos.projects_id = projects.id + LIMIT 1) + and repo_annual_cache.repos_id = repos.id + and repos.projects_id = projects.id + group by repos_id + ORDER BY net desc + LIMIT 10 + """) + elif timeframe == 'month': + cdRgTpRankedCommitsSQL = s.sql.text(""" + SELECT repos_id, repos.name as name, sum(cast(repo_annual_cache.added as signed) - cast(removed as signed) - cast(whitespace as signed)) as net, patches + FROM repo_annual_cache, projects, repos + where projects.name = (SELECT projects.name FROM repos, projects + WHERE git LIKE :repourl + and repos.projects_id = projects.id + LIMIT 1) + and repo_annual_cache.repos_id = repos.id + and repos.projects_id = projects.id + group by repos_id + ORDER BY net desc + LIMIT 10 + """) + else: + if timeframe == "year": + cdRgTpRankedCommitsSQL = s.sql.text(""" + SELECT repos_id, repos.name as name, sum(cast(repo_annual_cache.added as signed) - cast(removed as signed) - cast(whitespace as signed)) as net, patches + FROM repo_annual_cache, projects, repos + where projects.name = :repo_group + and repo_annual_cache.repos_id = repos.id + and repos.projects_id = projects.id + group by repos_id + ORDER BY net desc + LIMIT 10 + """) + elif timeframe == 'month': + cdRgTpRankedCommitsSQL = s.sql.text(""" + SELECT repos_id, repos.name as name, sum(cast(repo_annual_cache.added as signed) - cast(removed as signed) - cast(whitespace as signed)) as net, patches + FROM repo_annual_cache, projects, repos + where projects.name = :repo_group + and repo_annual_cache.repos_id = repos.id + and repos.projects_id = projects.id + group by repos_id + ORDER BY net desc + LIMIT 10 + """) + results = pd.read_sql(cdRgTpRankedCommitsSQL, self.db, params={"repourl": '%{}%'.format(repo_url), "repo_group": repo_group}) + return results + + @annotate(tag='cd-rg-tp-ranked-loc') + def cd_rg_tp_ranked_loc(self, repo_url, timeframe=None, repo_group=None): + """ + For each repository in a collection of repositories being managed, each REPO's total commits during the current Month, + Year or Week. Result ranked from highest number of LOC to lowest by default. + :param repo_url: the repository's URL + :param timeframe: Year, month, or week. Contribution data from the timeframe that the current date is within will be considered + :param repo_group: the group of repositories to analyze + """ + + if repo_group == None: + repo_group = 'facade_project' + + if timeframe == None: + timeframe = 'year' + + cdRgTpRankedLocSQL = None + + if repo_group == 'facade_project': + if timeframe == "year": + cdRgTpRankedLocSQL = s.sql.text(""" + SELECT repos_id, repos.name as name, sum(cast(repo_annual_cache.added as signed) - cast(removed as signed) - cast(whitespace as signed)) as net, patches + FROM repo_annual_cache, projects, repos + where projects.name = (SELECT projects.name FROM repos, projects + WHERE git LIKE :repourl + and repos.projects_id = projects.id + LIMIT 1) + and repo_annual_cache.repos_id = repos.id + and repos.projects_id = projects.id + group by repos_id + ORDER BY net desc + LIMIT 10 + """) + elif timeframe == 'month': + cdRgTpRankedLocSQL = s.sql.text(""" + SELECT repos_id, repos.name as name, sum(cast(repo_annual_cache.added as signed) - cast(removed as signed) - cast(whitespace as signed)) as net, patches + FROM repo_annual_cache, projects, repos + where projects.name = (SELECT projects.name FROM repos, projects + WHERE git LIKE :repourl + and repos.projects_id = projects.id + LIMIT 1) + and repo_annual_cache.repos_id = repos.id + and repos.projects_id = projects.id + group by repos_id + ORDER BY net desc + LIMIT 10 + """) + else: + if timeframe == "year": + cdRgTpRankedLocSQL = s.sql.text(""" + SELECT repos_id, repos.name as name, sum(cast(repo_annual_cache.added as signed) - cast(removed as signed) - cast(whitespace as signed)) as net, patches + FROM repo_annual_cache, projects, repos + where projects.name = :repo_group + and repo_annual_cache.repos_id = repos.id + and repos.projects_id = projects.id + group by repos_id + ORDER BY net desc + LIMIT 10 + """) + elif timeframe == 'month': + cdRgTpRankedLocSQL = s.sql.text(""" + SELECT repos_id, repos.name as name, sum(cast(repo_annual_cache.added as signed) - cast(removed as signed) - cast(whitespace as signed)) as net, patches + FROM repo_annual_cache, projects, repos + where projects.name = :repo_group + and repo_annual_cache.repos_id = repos.id + and repos.projects_id = projects.id + group by repos_id + ORDER BY net desc + LIMIT 10 + """) + results = pd.read_sql(cdRgTpRankedLocSQL, self.db, params={"repourl": '%{}%'.format(repo_url), "repo_group": repo_group}) + return results + + @annotate(tag='cd-rep-tp-interval-loc-commits') + def cd_rep_tp_interval_loc_commits(self, repo_url, calendar_year=None, interval=None): + """ + For a single repository, all the commits and lines of code occuring for the specified year, grouped by the specified interval (week or month) + + :param repo_url: the repository's URL + :param calendar_year: the calendar year a repo is created in to be considered "new" + :param interval: Month or week. The periodocity of which to examine data within the given calendar_year + """ + + if calendar_year == None: + calendar_year = 2019 + + if interval == None: + interval = 'month' + + cdRepTpIntervalLocCommitsSQL = None + + if interval == "month": + cdRepTpIntervalLocCommitsSQL = s.sql.text(""" + SELECT name, sum(cast(IFNULL(added, 0) as signed) - cast(IFNULL(removed, 0) as signed) - cast(IFNULL(whitespace, 0) as signed)) as net_lines_minus_whitespace, + sum(IFNULL(added, 0)) as added, sum(IFNULL(removed, 0)) as removed, sum(IFNULL(whitespace, 0)) as whitespace, + IFNULL(patches, 0) as commits, a.month, IFNULL(year, :calendar_year) as year + FROM (select month from repo_monthly_cache group by month) a + LEFT JOIN (SELECT name, repo_monthly_cache.added, removed, whitespace, patches, month, IFNULL(year, :calendar_year) as year + FROM repo_monthly_cache, repos + WHERE repos_id = (SELECT id FROM repos WHERE git LIKE :repourl LIMIT 1) + AND year = :calendar_year + AND repos.id = repos_id + GROUP BY month) b + ON a.month = b.month + GROUP BY month + """) + elif interval == "week": + cdRepTpIntervalLocCommitsSQL = s.sql.text(""" + SELECT name, sum(cast(IFNULL(added, 0) as signed) - cast(IFNULL(removed, 0) as signed) - cast(IFNULL(whitespace, 0) as signed)) as net_lines_minus_whitespace, + sum(IFNULL(added, 0)) as added, sum(IFNULL(removed, 0)) as removed, sum(IFNULL(whitespace, 0)) as whitespace, + IFNULL(patches, 0) as commits, a.month, IFNULL(year, :calendar_year) as year + FROM (select month from repo_monthly_cache group by month) a + LEFT JOIN (SELECT name, repo_monthly_cache.added, removed, whitespace, patches, month, IFNULL(year, :calendar_year) as year + FROM repo_monthly_cache, repos + WHERE repos_id = (SELECT id FROM repos WHERE git LIKE :repourl LIMIT 1) + AND year = :calendar_year + AND repos.id = repos_id + GROUP BY month) b + ON a.month = b.month + GROUP BY month + """) + + results = pd.read_sql(cdRepTpIntervalLocCommitsSQL, self.db, params={"repourl": '%{}%'.format(repo_url), 'calendar_year': calendar_year}) + return results + + @annotate(tag='cd-rep-tp-interval-loc-commits-ua') + def cd_rep_tp_interval_loc_commits_ua(self, repo_url, calendar_year=None, interval=None, repo_group=None): + """ + For a single repository, all the commits and lines of code occuring for the specified year, grouped by the specified interval + (week or month) and by the affiliation of individuals and domains that are not mapped as "inside" within the repositories gitdm file. + "Unknown" is, in this case, interpreted as "outside" + + :param repo_url: the repository's URL + :param calendar_year: the calendar year a repo is created in to be considered "new" + :param interval: Month or week. The periodocity of which to examine data within the given calendar_year + :param repo_group: the group of repositories to analyze + """ + + if calendar_year == None: + calendar_year = 2019 + + if interval == None: + interval = 'month' + + if repo_group == None: + repo_group = 'facade_project' + + cdRepTpIntervalLocCommitsUaSQL = None + + if repo_group == 'facade_project': + if interval == "month": + cdRepTpIntervalLocCommitsUaSQL = s.sql.text(""" + SELECT added, whitespace, removed, (cast(IFNULL(added, 0) as signed) - cast(IFNULL(removed, 0) as signed) - cast(IFNULL(whitespace, 0) as signed)) as net_lines_minus_whitespace, patches, a.month, affiliation + FROM (SELECT month FROM repo_monthly_cache GROUP BY month) a + LEFT JOIN + ( + SELECT SUM(repo_monthly_cache.added) AS added, SUM(whitespace) as whitespace, SUM(removed) as removed, month, SUM(patches) as patches, repo_monthly_cache.`affiliation` as affiliation + FROM repo_monthly_cache, repos, projects + WHERE repo_monthly_cache.repos_id = repos.id + AND repos.projects_id = (SELECT projects.id FROM repos, projects + WHERE git LIKE :repo_url + and repos.projects_id = projects.id + LIMIT 1) + AND projects.id = repos.projects_id + AND repo_monthly_cache.`affiliation` <> projects.name + AND year = 2018 + GROUP BY month, affiliation + ) b ON a.month = b.month + ORDER BY month + """) + elif interval == "week": + cdRepTpIntervalLocCommitsUaSQL = s.sql.text(""" + SELECT added, whitespace, removed, (cast(IFNULL(added, 0) as signed) - cast(IFNULL(removed, 0) as signed) - cast(IFNULL(whitespace, 0) as signed)) as net_lines_minus_whitespace, patches, a.month, affiliation + FROM (SELECT month FROM repo_monthly_cache GROUP BY month) a + LEFT JOIN + ( + SELECT SUM(repo_monthly_cache.added) AS added, SUM(whitespace) as whitespace, SUM(removed) as removed, month, SUM(patches) as patches, repo_monthly_cache.`affiliation` as affiliation + FROM repo_monthly_cache, repos, projects + WHERE repo_monthly_cache.repos_id = repos.id + AND repos.projects_id = (SELECT projects.id FROM repos, projects + WHERE git LIKE :repo_url + and repos.projects_id = projects.id + LIMIT 1) + AND projects.id = repos.projects_id + AND repo_monthly_cache.`affiliation` <> projects.name + AND year = 2018 + GROUP BY month, affiliation + ) b ON a.month = b.month + ORDER BY month + """) + else: + if interval == "month": + cdRepTpIntervalLocCommitsUaSQL = s.sql.text(""" + SELECT added, whitespace, removed, (cast(IFNULL(added, 0) as signed) - cast(IFNULL(removed, 0) as signed) - cast(IFNULL(whitespace, 0) as signed)) as net_lines_minus_whitespace, patches, a.month, affiliation + FROM (SELECT month FROM repo_monthly_cache GROUP BY month) a + LEFT JOIN + ( + SELECT SUM(repo_monthly_cache.added) AS added, SUM(whitespace) as whitespace, SUM(removed) as removed, month, SUM(patches) as patches, repo_monthly_cache.`affiliation` as affiliation + FROM repo_monthly_cache, repos, projects + WHERE repo_monthly_cache.repos_id = repos.id + AND repos.projects_id = :repo_group + AND projects.id = repos.projects_id + AND repo_monthly_cache.`affiliation` <> projects.name + AND year = 2018 + GROUP BY month, affiliation + ) b ON a.month = b.month + ORDER BY month + """) + elif interval == "week": + cdRepTpIntervalLocCommitsUaSQL = s.sql.text(""" + SELECT added, whitespace, removed, (cast(IFNULL(added, 0) as signed) - cast(IFNULL(removed, 0) as signed) - cast(IFNULL(whitespace, 0) as signed)) as net_lines_minus_whitespace, patches, a.month, affiliation + FROM (SELECT month FROM repo_monthly_cache GROUP BY month) a + LEFT JOIN + ( + SELECT SUM(repo_monthly_cache.added) AS added, SUM(whitespace) as whitespace, SUM(removed) as removed, month, SUM(patches) as patches, repo_monthly_cache.`affiliation` as affiliation + FROM repo_monthly_cache, repos, projects + WHERE repo_monthly_cache.repos_id = repos.id + AND repos.projects_id = :repo_group + AND projects.id = repos.projects_id + AND repo_monthly_cache.`affiliation` <> projects.name + AND year = 2018 + GROUP BY month, affiliation + ) b ON a.month = b.month + ORDER BY month + """) + results = pd.read_sql(cdRepTpIntervalLocCommitsUaSQL, self.db, params={"repourl": '%{}%'.format(repo_url), "repo_group": repo_group}) + return results + + @annotate(tag='cd-rg-tp-interval-loc-commits') + def cd_rg_tp_interval_loc_commits(self, repo_url, calendar_year=None, interval=None, repo_group=None): + """ + For each repository in a collection of repositories, all the commits and lines of code occuring for the specified year, + grouped by repository and the specified interval (week or month). Results ordered by repo. + + :param repo_url: the repository's URL + :param calendar_year: the calendar year a repo is created in to be considered "new" + :param interval: Month or week. The periodocity of which to examine data within the given calendar_year + :param repo_group: the group of repositories to analyze + """ + + if calendar_year == None: + calendar_year = 2019 + + if interval == None: + interval = 'month' + + if repo_group == None: + repo_group = 'facade_project' + + cdRgTpIntervalLocCommitsSQL = None + + if repo_group == 'facade_project': + if interval == "month": + cdRgTpIntervalLocCommitsSQL = s.sql.text(""" + SELECT name, added, whitespace, removed, (cast(IFNULL(added, 0) as signed) - cast(IFNULL(removed, 0) as signed) - cast(IFNULL(whitespace, 0) as signed)) as net_lines_minus_whitespace, patches, a.month + FROM (SELECT month FROM repo_monthly_cache GROUP BY month) a + LEFT JOIN + ( + SELECT repos.name, SUM(repo_monthly_cache.added) AS added, SUM(whitespace) as whitespace, SUM(removed) as removed, month, SUM(patches) as patches + FROM repo_monthly_cache, repos, projects + WHERE repo_monthly_cache.repos_id = repos.id + AND repos.projects_id = (SELECT projects.id FROM repos, projects + WHERE git LIKE :repo_url + and repos.projects_id = projects.id + LIMIT 1) + AND projects.id = repos.projects_id + AND repos_id = repos.id + AND year = :calendar_year + GROUP BY month, repos.name + ) b ON a.month = b.month + ORDER BY name, month + """) + elif interval == "week": + cdRgTpIntervalLocCommitsSQL = s.sql.text(""" + SELECT name, added, whitespace, removed, (cast(IFNULL(added, 0) as signed) - cast(IFNULL(removed, 0) as signed) - cast(IFNULL(whitespace, 0) as signed)) as net_lines_minus_whitespace, patches, a.month + FROM (SELECT month FROM repo_monthly_cache GROUP BY month) a + LEFT JOIN + ( + SELECT repos.name, SUM(repo_monthly_cache.added) AS added, SUM(whitespace) as whitespace, SUM(removed) as removed, month, SUM(patches) as patches + FROM repo_monthly_cache, repos, projects + WHERE repo_monthly_cache.repos_id = repos.id + AND repos.projects_id = (SELECT projects.id FROM repos, projects + WHERE git LIKE :repo_url + and repos.projects_id = projects.id + LIMIT 1) + AND projects.id = repos.projects_id + AND repos_id = repos.id + AND year = :calendar_year + GROUP BY month, repos.name + ) b ON a.month = b.month + ORDER BY name, month + """) + else: + if interval == "month": + cdRgTpIntervalLocCommitsSQL = s.sql.text(""" + SELECT name, added, whitespace, removed, (cast(IFNULL(added, 0) as signed) - cast(IFNULL(removed, 0) as signed) - cast(IFNULL(whitespace, 0) as signed)) as net_lines_minus_whitespace, patches, a.month + FROM (SELECT month FROM repo_monthly_cache GROUP BY month) a + LEFT JOIN + ( + SELECT repos.name, SUM(repo_monthly_cache.added) AS added, SUM(whitespace) as whitespace, SUM(removed) as removed, month, SUM(patches) as patches + FROM repo_monthly_cache, repos, projects + WHERE repo_monthly_cache.repos_id = repos.id + AND repos.projects_id = :repo_group + AND projects.id = repos.projects_id + AND repos_id = repos.id + AND year = :calendar_year + GROUP BY month, repos.name + ) b ON a.month = b.month + ORDER BY name, month + """) + elif interval == "week": + cdRgTpIntervalLocCommitsSQL = s.sql.text(""" + SELECT name, added, whitespace, removed, (cast(IFNULL(added, 0) as signed) - cast(IFNULL(removed, 0) as signed) - cast(IFNULL(whitespace, 0) as signed)) as net_lines_minus_whitespace, patches, a.month + FROM (SELECT month FROM repo_monthly_cache GROUP BY month) a + LEFT JOIN + ( + SELECT repos.name, SUM(repo_monthly_cache.added) AS added, SUM(whitespace) as whitespace, SUM(removed) as removed, month, SUM(patches) as patches + FROM repo_monthly_cache, repos, projects + WHERE repo_monthly_cache.repos_id = repos.id + AND repos.projects_id = :repo_group + AND projects.id = repos.projects_id + AND repos_id = repos.id + AND year = :calendar_year + GROUP BY month, repos.name + ) b ON a.month = b.month + ORDER BY name, month + """) + results = pd.read_sql(cdRgTpIntervalLocCommitsSQL, self.db, params={"repourl": '%{}%'.format(repo_url), "calendar_year": calendar_year, "repo_group": repo_group}) + return results \ No newline at end of file diff --git a/augur/datasources/facade/routes.py b/augur/datasources/facade/routes.py index 540d6dbecb..eea361bb0d 100644 --- a/augur/datasources/facade/routes.py +++ b/augur/datasources/facade/routes.py @@ -3,7 +3,7 @@ Creates routes for the facade data source plugin """ -from flask import Response +from flask import Response, request def create_routes(server): @@ -146,3 +146,105 @@ def facade_downloaded_repos(): #TODO: make this name automatic - wrapper? ] """ server.addGitMetric(facade.commits_by_week, 'commits_by_week') + + + @server.app.route('/{}/git/cd_rg_tp_ranked_loc'.format(server.api_version)) + def cd_rg_tp_ranked_loc(): + + repo_url_base = request.args.get('repo_url_base') + + timeframe = request.args.get('timeframe') + repo_group = request.args.get('repo_group') + + data = server.transform(facade.cd_rg_tp_ranked_loc, args=([]), repo_url_base=repo_url_base, kwargs=({'timeframe': timeframe, 'repo_group': repo_group})) + + return Response(response=data, + status=200, + mimetype="application/json") + + # server.addGitMetric(facade.top_repos_commits, 'top_repos_commits') + @server.app.route('/{}/git/cd_rg_tp_ranked_commits'.format(server.api_version)) + def cd_rg_tp_ranked_commits(): + + repo_url_base = request.args.get('repo_url_base') + + timeframe = request.args.get('timeframe') + repo_group = request.args.get('repo_group') + + data = server.transform(facade.cd_rg_tp_ranked_commits, args=([]), repo_url_base=repo_url_base, kwargs=({'timeframe': timeframe, 'repo_group': repo_group})) + + return Response(response=data, + status=200, + mimetype="application/json") + + @server.app.route('/{}/git/cd_rg_newrep_ranked_loc'.format(server.api_version)) + def cd_rg_newrep_ranked_loc(): + + repo_url_base = request.args.get('repo_url_base') + + calendar_year = request.args.get('calendar_year') + repo_group = request.args.get('repo_group') + + data = server.transform(facade.cd_rg_newrep_ranked_loc, args=([]), repo_url_base=repo_url_base, kwargs=({'calendar_year': calendar_year, 'repo_group': repo_group})) + + return Response(response=data, + status=200, + mimetype="application/json") + + # server.addGitMetric(facade.cd_rg_newrep_ranked_commits, 'top_new_repos_commits') + @server.app.route('/{}/git/cd_rg_newrep_ranked_commits'.format(server.api_version)) + def cd_rg_newrep_ranked_commits(): + + repo_url_base = request.args.get('repo_url_base') + + calendar_year = request.args.get('calendar_year') + repo_group = request.args.get('repo_group') + + data = server.transform(facade.cd_rg_newrep_ranked_commits, args=([]), repo_url_base=repo_url_base, kwargs=({'calendar_year': calendar_year, 'repo_group': repo_group})) + + return Response(response=data, + status=200, + mimetype="application/json") + + @server.app.route('/{}/git/cd_rep_tp_interval_loc_commits'.format(server.api_version)) + def cd_rep_tp_interval_loc_commits(): + + repo_url_base = request.args.get('repo_url_base') + + calendar_year = request.args.get('calendar_year') + interval = request.args.get('interval') + + data = server.transform(facade.cd_rep_tp_interval_loc_commits, args=([]), repo_url_base=repo_url_base, kwargs=({'calendar_year': calendar_year, 'interval': interval})) + + return Response(response=data, + status=200, + mimetype="application/json") + + @server.app.route('/{}/git/cd_rep_tp_interval_loc_commits_ua'.format(server.api_version)) + def cd_rep_tp_interval_loc_commits_ua(): + + repo_url_base = request.args.get('repo_url_base') + + calendar_year = request.args.get('calendar_year') + interval = request.args.get('interval') + + data = server.transform(facade.cd_rep_tp_interval_loc_commits_ua, args=([]), repo_url_base=repo_url_base, kwargs=({'calendar_year': calendar_year, 'interval': interval})) + + return Response(response=data, + status=200, + mimetype="application/json") + + @server.app.route('/{}/git/cd_rg_tp_interval_loc_commits'.format(server.api_version)) + def cd_rg_tp_interval_loc_commits(): + + repo_url_base = request.args.get('repo_url_base') + + calendar_year = request.args.get('calendar_year') + interval = request.args.get('interval') + repo_group = request.args.get('repo_group') + + data = server.transform(facade.cd_rg_tp_interval_loc_commits, args=([]), repo_url_base=repo_url_base, kwargs=({'calendar_year': calendar_year, 'interval': interval, 'repo_group': repo_group})) + + return Response(response=data, + status=200, + mimetype="application/json") \ No newline at end of file diff --git a/frontend/app/Augur.js b/frontend/app/Augur.js index 31e684f4e0..946bc6c0d5 100644 --- a/frontend/app/Augur.js +++ b/frontend/app/Augur.js @@ -44,9 +44,9 @@ export default function Augur () { gitRepo: null, comparedRepos: [], trailingAverage: 180, - startDate: new Date('1 January 2011'), + startDate: new Date('1 February 2011'), endDate: new Date(), - compare: 'zscore', + compare: 'rolling', showBelowAverage: false, rawWeekly: false, showArea: true, @@ -67,9 +67,7 @@ export default function Augur () { } }, setRepo (state, payload) { - console.log("js",payload) let repo = window.AugurAPI.Repo(payload) - console.log(repo) if (!window.AugurRepos[repo.toString()]) { window.AugurRepos[repo.toString()] = repo } else { @@ -97,24 +95,44 @@ export default function Augur () { state.compare = 'zscore' state.hasState = true let repo = window.AugurAPI.Repo(payload) - if (!window.AugurRepos[repo.toString()]) { - window.AugurRepos[repo.toString()] = repo - } else { - repo = window.AugurRepos[repo.toString()] - } - state.hasState = true - if (repo.owner && repo.name) { - state.comparedRepos.push(repo.toString()) - let title = repo.owner + '/' + repo.name + '- Augur' - state.tab = 'gmd' - let queryString = window.location.search + '&comparedTo[]=' + repo.owner + '+' + repo.name - window.history.pushState(null, title, queryString) - } - if (payload.gitURL) { - let queryString = '&git=' + window.btoa(repo.gitURL) - window.history.pushState(null, 'Git Analysis - Augur', window.location.search + queryString) - state.tab = 'git' - state.gitRepo = repo.gitURL + if(!state.comparedRepos.includes(repo.toString()) && state.baseRepo != repo.toString()){ + if (!window.AugurRepos[repo.toString()]) { + window.AugurRepos[repo.toString()] = repo + } else { + repo = window.AugurRepos[repo.toString()] + } + state.hasState = true + if (repo.owner && repo.name) { + state.comparedRepos.push(repo.toString()) + let title = repo.owner + '/' + repo.name + '- Augur' + } + if (payload.gitURL) { + state.gitRepo = repo.gitURL + } + if (state.comparedRepos.length == 1) { + if (!router.currentRoute.params.comparedrepo) { + + let owner = state.gitRepo ? null : state.baseRepo.substring(0, state.baseRepo.indexOf('/')) + let repo = state.gitRepo ? state.gitRepo : state.baseRepo.slice(state.baseRepo.indexOf('/') + 1) + let name = state.tab + "compare" + router.push({ + name, + params: {owner, repo, comparedowner: payload.owner, comparedrepo: payload.name} + }) + } + } else { + let groupid = (state.gitRepo ? String(state.gitRepo) + '+' : String(state.baseRepo) + "+") + state.comparedRepos.forEach((repo) => { + groupid += (String(repo) + '+') + }) + let name = state.tab + "group" + router.push({ + name, + params: { + groupid + } + }) + } } }, setDates (state, payload) { @@ -155,9 +173,8 @@ export default function Augur () { resetComparedRepos (state) { state.comparedRepos = [] router.push({ - name: 'single', - params: {tab: state.tab, domain: state.domain, owner: state.baseRepo.substring(0, state.baseRepo.indexOf('/')), repo: state.baseRepo.slice(state.baseRepo.indexOf('/') + 1)} - }) + name: state.tab, + params: {owner: state.baseRepo.substring(0, state.baseRepo.indexOf('/')), repo: state.baseRepo.slice(state.baseRepo.indexOf('/') + 1)} }) }, resetBaseRepo (state) { state.baseRepo = null @@ -181,14 +198,67 @@ export default function Augur () { }) AugurApp.store = window.augur - - - - // AugurApp.router = router - // AugurApp.render = h => h(AugurApp) - - // window.AugurApp = new window.Vue(AugurApp).$mount('#app') - + + router.beforeEach((to, from, next) => { + if(to.params.repo || to.params.groupid){ + if (!to.params.groupid && !to.params.comparedrepo){ + AugurApp.store.commit("resetTab") + AugurApp.store.commit('setTab', { + tab: to.name + }) + if (to.params.repo.includes('github')) { + AugurApp.store.commit('setRepo', { + gitURL: to.params.repo + }) + } else { + AugurApp.store.commit('setRepo', { + githubURL: to.params.owner + '/' + to.params.repo + }) + } + } else if(to.params.comparedrepo && augur.state.comparedRepos.length == 0) { + let tab = to.name + tab = tab.substring(0, tab.length-7) + AugurApp.store.commit("resetTab") + AugurApp.store.commit('setTab', { + tab + }) + AugurApp.store.commit('setRepo', { + githubURL: to.params.owner + '/' + to.params.repo + }) + AugurApp.store.commit('addComparedRepo', { + githubURL: to.params.comparedowner + '/' + to.params.comparedrepo + }) + } else if(to.params.groupid && augur.state.comparedRepos.length == 0){ + AugurApp.store.commit("resetTab") + let tab = to.name + tab = tab.substring(0, tab.length-5) + AugurApp.store.commit('setTab', { + tab + }) + let repos = to.params.groupid.split('+') + if (repos[0].includes('github')) { + AugurApp.store.commit('setRepo', { + gitURL: repos[0] + }) + } else { + AugurApp.store.commit('setRepo', { + githubURL: repos[0] + }) + } + repos.shift() + // repos.pop() + repos.forEach((cmprepo) => { + AugurApp.store.commit('addComparedRepo', { + githubURL: cmprepo + }) + }) + } + } + + next() + }) + + window.AugurApp = new window.Vue({ // components: { AugurApp }, // store: window.augur, diff --git a/frontend/app/components/AugurCards.vue b/frontend/app/components/AugurCards.vue index ef71bfd032..bb34fcc21d 100644 --- a/frontend/app/components/AugurCards.vue +++ b/frontend/app/components/AugurCards.vue @@ -1,86 +1,40 @@ \ No newline at end of file diff --git a/frontend/app/components/TableView.vue b/frontend/app/components/TableView.vue new file mode 100644 index 0000000000..17d90ed6eb --- /dev/null +++ b/frontend/app/components/TableView.vue @@ -0,0 +1,317 @@ + + + + + diff --git a/frontend/app/components/Tabs.vue b/frontend/app/components/Tabs.vue new file mode 100644 index 0000000000..3e4ef4468f --- /dev/null +++ b/frontend/app/components/Tabs.vue @@ -0,0 +1,72 @@ + + + \ No newline at end of file diff --git a/frontend/app/components/charts/DynamicLineChart.vue b/frontend/app/components/charts/DynamicLineChart.vue index e2859211f1..911fd5404c 100644 --- a/frontend/app/components/charts/DynamicLineChart.vue +++ b/frontend/app/components/charts/DynamicLineChart.vue @@ -45,7 +45,8 @@ export default { detail: this.$store.state.showDetail, compRepos: this.$store.state.comparedRepos, metricSource: null, - timeperiod: 'all' + timeperiod: 'all', + forceRecomputeCounter: 0 } }, watch: { @@ -63,7 +64,17 @@ export default { $(this.$el).find('.spacing').removeClass('hidden') } }, - mounted() { + beforeUpdate() { + this.$store.watch( + // When the returned result changes... + function (state) { + console.log("WORKED") + this.thisShouldTriggerRecompute() + return + }, + // // Run this callback + // callback + ) }, computed: { repo () { @@ -100,6 +111,7 @@ export default { return this.$store.state.showDetail }, spec() { + this.forceRecomputeCounter; // Get the repos we need let repos = [] if (this.repo) { @@ -866,6 +878,9 @@ export default { }, // end computed methods: { + thisShouldTriggerRecompute() { + this.forceRecomputeCounter++; + }, downloadSVG (e) { var svgsaver = new window.SvgSaver() var svg = window.$(this.$refs.holder).find('svg')[0] diff --git a/frontend/app/router/router.js b/frontend/app/router/router.js index 6aeaa9e362..55460e476e 100644 --- a/frontend/app/router/router.js +++ b/frontend/app/router/router.js @@ -1,21 +1,286 @@ import Vue from 'vue' import Router from 'vue-router' -import AugurCards from '../components/AugurCards.vue' import MetricsStatusCard from '../components/MetricsStatusCard.vue' -import GitCard from '../components/GitCard.vue' -import ExperimentalCard from '../components/ExperimentalCard.vue' -import GrowthMaturityDeclineCard from '../components/GrowthMaturityDeclineCard.vue' +import BaseRepoActivityCard from '../components/BaseRepoActivityCard.vue' +import BaseRepoEcosystemCard from '../components/BaseRepoEcosystemCard.vue' +import GrowthMaturityDeclineCard from '../components/GrowthMaturityDeclineCard' +import RiskCard from '../components/RiskCard' +import ValueCard from '../components/ValueCard' +import DiversityInclusionCard from '../components/DiversityInclusionCard' +import GitCard from '../components/GitCard' +import OverviewCard from '../components/OverviewCard.vue' +import ExperimentalCard from '../components/ExperimentalCard' +import DownloadedReposCard from '../components/DownloadedReposCard.vue' +import LoginForm from '../components/LoginForm' +import AugurCards from '../components/AugurCards.vue' +import MainControls from '../components/MainControls.vue' +import AugurHeader from '../components/AugurHeader.vue' +import Tabs from '../components/Tabs.vue' +import TableView from '../components/TableView.vue' let routes = [ - {path: '/', component: AugurCards}, - {path: '/metrics_status', component: MetricsStatusCard}, - // {path: '/:tab/:owner/:repo', component: AugurCards, name: 'single'}, - {path: '/single/:tab/:owner?/:repo', component: AugurCards, name: 'single', props: true, canReuse: false,}, - {path: '/singlegit/:tab/:repo', component: AugurCards, name: 'singlegit', props: true, canReuse: false,}, + {path: '/', component: AugurCards, + children: [ + { + path: "", + name: "reposcard", + components: { + header: AugurHeader, + content: DownloadedReposCard + } + }, + ] + }, + {path: '/login', component: LoginForm}, + {path: '/metrics_status', + components: { + header: AugurHeader, + content: MainControls + } + }, + {path: '/single/:owner?/:repo', name: 'single', props: true, canReuse: false, component: AugurCards, + children: [ + { + path: "gmd", + name: "gmd", + components: { + header: AugurHeader, + tabs: Tabs, + controls: MainControls, + content: GrowthMaturityDeclineCard + } + }, + { + path: "diversityinclusion", + name: "diversityinclusion", + components: { + header: AugurHeader, + tabs: Tabs, + controls: MainControls, + content: DiversityInclusionCard + } + }, + { + path: "risk", + name: "risk", + components: { + header: AugurHeader, + tabs: Tabs, + controls: MainControls, + content: RiskCard + } + }, + { + path: "activity", + name: "activity", + components: { + header: AugurHeader, + tabs: Tabs, + controls: MainControls, + content: BaseRepoActivityCard + } + }, + { + path: "value", + name: "value", + components: { + header: AugurHeader, + tabs: Tabs, + controls: MainControls, + content: ValueCard + } + }, + { + path: "experimental", + name: "experimental", + components: { + header: AugurHeader, + tabs: Tabs, + controls: MainControls, + content: ExperimentalCard + } + }, + { + path: "git", + name: "git", + components: { + header: AugurHeader, + tabs: Tabs, + controls: MainControls, + content: GitCard + } + }, + { + path: "overview", + name: "overview", + components: { + header: AugurHeader, + tabs: Tabs, + controls: MainControls, + content: OverviewCard + } + }, + ] + }, // {path: '/:tab/:domain/:owner/:repo/comparedto/:comparedowner/:comparedrepo', component: AugurCards, name: 'gitsinglecompare'}, - {path: '/compare/:tab/:owner?/:repo/:domain?/comparedto/:comparedowner/:comparedrepo/:compareddomain?', component: AugurCards, name: 'singlecompare', props: true, canReuse: false,}, - // {path: '/:tab/:owner/:repo/comparedto/:comparedowner/:comparedrepo', component: AugurCards, name: 'singlecompare'}, - {path: '/groupcompare/:tab/:groupid', component: AugurCards, name: 'group', props: true, canReuse: false,}, + {path: '/compare/:owner?/:repo/comparedto/:comparedowner/:comparedrepo', component: AugurCards, name: 'singlecompare', props: true, canReuse: false, + children: [ + { + path: "gmd", + name: "gmdcompare", + components: { + header: AugurHeader, + tabs: Tabs, + controls: MainControls, + content: GrowthMaturityDeclineCard + } + }, + { + path: "diversityinclusion", + name: "diversityinclusioncompare", + components: { + header: AugurHeader, + tabs: Tabs, + controls: MainControls, + content: DiversityInclusionCard + } + }, + { + path: "risk", + name: "riskcompare", + components: { + header: AugurHeader, + tabs: Tabs, + controls: MainControls, + content: RiskCard + } + }, + { + path: "value", + name: "valuecompare", + components: { + header: AugurHeader, + tabs: Tabs, + controls: MainControls, + content: ValueCard + } + }, + { + path: "activity", + name: "activitycompare", + components: { + header: AugurHeader, + tabs: Tabs, + controls: MainControls, + content: BaseRepoActivityCard + } + }, + { + path: "experimental", + name: "experimentalcompare", + components: { + header: AugurHeader, + tabs: Tabs, + controls: MainControls, + content: ExperimentalCard + } + }, + { + path: "git", + name: "gitcompare", + components: { + header: AugurHeader, + tabs: Tabs, + controls: MainControls, + content: GitCard + } + }, + ] + }, + {path: '/groupcompare/:groupid', component: AugurCards, name: 'group', props: true, canReuse: false, + children: [ + { + path: "gmd", + name: "gmdgroup", + components: { + header: AugurHeader, + tabs: Tabs, + controls: MainControls, + content: GrowthMaturityDeclineCard + } + }, + { + path: "diversityinclusion", + name: "diversityinclusiongroup", + components: { + header: AugurHeader, + tabs: Tabs, + controls: MainControls, + content: DiversityInclusionCard + } + }, + { + path: "risk", + name: "riskgroup", + components: { + header: AugurHeader, + tabs: Tabs, + controls: MainControls, + content: RiskCard + } + }, + { + path: "value", + name: "valuegroup", + components: { + header: AugurHeader, + tabs: Tabs, + controls: MainControls, + content: ValueCard + } + }, + { + path: "activity", + name: "activitygroup", + components: { + header: AugurHeader, + tabs: Tabs, + controls: MainControls, + content: BaseRepoActivityCard + } + }, + { + path: "experimental", + name: "experimentalgroup", + components: { + header: AugurHeader, + tabs: Tabs, + controls: MainControls, + content: ExperimentalCard + } + }, + { + path: "git", + name: "gitgroup", + components: { + header: AugurHeader, + tabs: Tabs, + controls: MainControls, + content: GitCard + } + }, + { + path: "overview", + name: "overviewgroup", + components: { + header: AugurHeader, + tabs: Tabs, + controls: MainControls, + content: OverviewCard + } + }, + ] + }, ] let downloadedRepos = [], repos = [], projects = [] window.AugurAPI.getDownloadedGitRepos().then((data) => { diff --git a/frontend/package-lock.json b/frontend/package-lock.json index dbf57d8ca5..cae437a90f 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -2978,7 +2978,8 @@ "version": "1.1.0", "resolved": false, "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", @@ -2990,7 +2991,8 @@ "version": "1.1.0", "resolved": false, "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -3121,13 +3123,15 @@ "version": "2.0.3", "resolved": false, "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true + "dev": true, + "optional": true }, "is-fullwidth-code-point": { "version": "1.0.0", "resolved": false, "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -3267,7 +3271,8 @@ "version": "1.0.1", "resolved": false, "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -3418,6 +3423,7 @@ "resolved": false, "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", diff --git a/frontend/public/app.js b/frontend/public/app.js index 7bcfc89707..70fcec0349 100644 --- a/frontend/public/app.js +++ b/frontend/public/app.js @@ -198,9 +198,9 @@ function Augur() { gitRepo: null, comparedRepos: [], trailingAverage: 180, - startDate: new Date('1 January 2011'), + startDate: new Date('1 February 2011'), endDate: new Date(), - compare: 'zscore', + compare: 'rolling', showBelowAverage: false, rawWeekly: false, showArea: true, @@ -221,9 +221,7 @@ function Augur() { } }, setRepo: function setRepo(state, payload) { - console.log("js", payload); var repo = window.AugurAPI.Repo(payload); - console.log(repo); if (!window.AugurRepos[repo.toString()]) { window.AugurRepos[repo.toString()] = repo; } else { @@ -252,24 +250,44 @@ function Augur() { state.compare = 'zscore'; state.hasState = true; var repo = window.AugurAPI.Repo(payload); - if (!window.AugurRepos[repo.toString()]) { - window.AugurRepos[repo.toString()] = repo; - } else { - repo = window.AugurRepos[repo.toString()]; - } - state.hasState = true; - if (repo.owner && repo.name) { - state.comparedRepos.push(repo.toString()); - var title = repo.owner + '/' + repo.name + '- Augur'; - state.tab = 'gmd'; - var _queryString = window.location.search + '&comparedTo[]=' + repo.owner + '+' + repo.name; - window.history.pushState(null, title, _queryString); - } - if (payload.gitURL) { - var _queryString2 = '&git=' + window.btoa(repo.gitURL); - window.history.pushState(null, 'Git Analysis - Augur', window.location.search + _queryString2); - state.tab = 'git'; - state.gitRepo = repo.gitURL; + if (!state.comparedRepos.includes(repo.toString()) && state.baseRepo != repo.toString()) { + if (!window.AugurRepos[repo.toString()]) { + window.AugurRepos[repo.toString()] = repo; + } else { + repo = window.AugurRepos[repo.toString()]; + } + state.hasState = true; + if (repo.owner && repo.name) { + state.comparedRepos.push(repo.toString()); + var title = repo.owner + '/' + repo.name + '- Augur'; + } + if (payload.gitURL) { + state.gitRepo = repo.gitURL; + } + if (state.comparedRepos.length == 1) { + if (!router.currentRoute.params.comparedrepo) { + + var owner = state.gitRepo ? null : state.baseRepo.substring(0, state.baseRepo.indexOf('/')); + var _repo = state.gitRepo ? state.gitRepo : state.baseRepo.slice(state.baseRepo.indexOf('/') + 1); + var name = state.tab + "compare"; + router.push({ + name: name, + params: { owner: owner, repo: _repo, comparedowner: payload.owner, comparedrepo: payload.name } + }); + } + } else { + var groupid = state.gitRepo ? String(state.gitRepo) + '+' : String(state.baseRepo) + "+"; + state.comparedRepos.forEach(function (repo) { + groupid += String(repo) + '+'; + }); + var _name = state.tab + "group"; + router.push({ + name: _name, + params: { + groupid: groupid + } + }); + } } }, setDates: function setDates(state, payload) { @@ -310,9 +328,8 @@ function Augur() { resetComparedRepos: function resetComparedRepos(state) { state.comparedRepos = []; router.push({ - name: 'single', - params: { tab: state.tab, domain: state.domain, owner: state.baseRepo.substring(0, state.baseRepo.indexOf('/')), repo: state.baseRepo.slice(state.baseRepo.indexOf('/') + 1) } - }); + name: state.tab, + params: { owner: state.baseRepo.substring(0, state.baseRepo.indexOf('/')), repo: state.baseRepo.slice(state.baseRepo.indexOf('/') + 1) } }); }, resetBaseRepo: function resetBaseRepo(state) { state.baseRepo = null; @@ -338,10 +355,64 @@ function Augur() { AugurApp.store = window.augur; - // AugurApp.router = router - // AugurApp.render = h => h(AugurApp) + router.beforeEach(function (to, from, next) { + if (to.params.repo || to.params.groupid) { + if (!to.params.groupid && !to.params.comparedrepo) { + AugurApp.store.commit("resetTab"); + AugurApp.store.commit('setTab', { + tab: to.name + }); + if (to.params.repo.includes('github')) { + AugurApp.store.commit('setRepo', { + gitURL: to.params.repo + }); + } else { + AugurApp.store.commit('setRepo', { + githubURL: to.params.owner + '/' + to.params.repo + }); + } + } else if (to.params.comparedrepo && augur.state.comparedRepos.length == 0) { + var tab = to.name; + tab = tab.substring(0, tab.length - 7); + AugurApp.store.commit("resetTab"); + AugurApp.store.commit('setTab', { + tab: tab + }); + AugurApp.store.commit('setRepo', { + githubURL: to.params.owner + '/' + to.params.repo + }); + AugurApp.store.commit('addComparedRepo', { + githubURL: to.params.comparedowner + '/' + to.params.comparedrepo + }); + } else if (to.params.groupid && augur.state.comparedRepos.length == 0) { + AugurApp.store.commit("resetTab"); + var _tab = to.name; + _tab = _tab.substring(0, _tab.length - 5); + AugurApp.store.commit('setTab', { + tab: _tab + }); + var repos = to.params.groupid.split('+'); + if (repos[0].includes('github')) { + AugurApp.store.commit('setRepo', { + gitURL: repos[0] + }); + } else { + AugurApp.store.commit('setRepo', { + githubURL: repos[0] + }); + } + repos.shift(); + // repos.pop() + repos.forEach(function (cmprepo) { + AugurApp.store.commit('addComparedRepo', { + githubURL: cmprepo + }); + }); + } + } - // window.AugurApp = new window.Vue(AugurApp).$mount('#app') + next(); + }); window.AugurApp = new window.Vue({ // components: { AugurApp }, @@ -1061,55 +1132,59 @@ if (module.hot) {(function () { var hotAPI = require("vue-hot-reload-api") ;(function(){ 'use strict'; -var _MainControls = require('./MainControls'); - -var _MainControls2 = _interopRequireDefault(_MainControls); - -var _AugurHeader = require('./AugurHeader'); +var _AugurHeader = require('../components/AugurHeader.vue'); var _AugurHeader2 = _interopRequireDefault(_AugurHeader); -var _MetricsStatusCard = require('./MetricsStatusCard'); +var _MetricsStatusCard = require('../components/MetricsStatusCard.vue'); var _MetricsStatusCard2 = _interopRequireDefault(_MetricsStatusCard); -var _BaseRepoActivityCard = require('./BaseRepoActivityCard'); +var _BaseRepoActivityCard = require('../components/BaseRepoActivityCard.vue'); var _BaseRepoActivityCard2 = _interopRequireDefault(_BaseRepoActivityCard); -var _BaseRepoEcosystemCard = require('./BaseRepoEcosystemCard'); +var _BaseRepoEcosystemCard = require('../components/BaseRepoEcosystemCard.vue'); var _BaseRepoEcosystemCard2 = _interopRequireDefault(_BaseRepoEcosystemCard); -var _GrowthMaturityDeclineCard = require('./GrowthMaturityDeclineCard'); +var _GrowthMaturityDeclineCard = require('../components/GrowthMaturityDeclineCard'); var _GrowthMaturityDeclineCard2 = _interopRequireDefault(_GrowthMaturityDeclineCard); -var _RiskCard = require('./RiskCard'); +var _RiskCard = require('../components/RiskCard'); var _RiskCard2 = _interopRequireDefault(_RiskCard); -var _ValueCard = require('./ValueCard'); +var _ValueCard = require('../components/ValueCard'); var _ValueCard2 = _interopRequireDefault(_ValueCard); -var _DiversityInclusionCard = require('./DiversityInclusionCard'); +var _DiversityInclusionCard = require('../components/DiversityInclusionCard'); var _DiversityInclusionCard2 = _interopRequireDefault(_DiversityInclusionCard); -var _GitCard = require('./GitCard'); +var _GitCard = require('../components/GitCard'); var _GitCard2 = _interopRequireDefault(_GitCard); -var _ExperimentalCard = require('./ExperimentalCard'); +var _OverviewCard = require('../components/OverviewCard.vue'); + +var _OverviewCard2 = _interopRequireDefault(_OverviewCard); + +var _ExperimentalCard = require('../components/ExperimentalCard'); var _ExperimentalCard2 = _interopRequireDefault(_ExperimentalCard); -var _DownloadedReposCard = require('./DownloadedReposCard'); +var _DownloadedReposCard = require('../components/DownloadedReposCard.vue'); var _DownloadedReposCard2 = _interopRequireDefault(_DownloadedReposCard); -var _LoginForm = require('./LoginForm'); +var _MainControls = require('../components/MainControls.vue'); + +var _MainControls2 = _interopRequireDefault(_MainControls); + +var _LoginForm = require('../components/LoginForm'); var _LoginForm2 = _interopRequireDefault(_LoginForm); @@ -1118,7 +1193,7 @@ var _vuex = require('vuex'); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } module.exports = { - props: ['tab', 'owner', 'repo', 'domain', 'comparedowner', 'comparedrepo', 'groupid'], + props: ['owner', 'repo', 'domain', 'comparedowner', 'comparedrepo', 'groupid'], components: { MainControls: _MainControls2.default, AugurHeader: _AugurHeader2.default, @@ -1134,59 +1209,9 @@ module.exports = { DownloadedReposCard: _DownloadedReposCard2.default, LoginForm: _LoginForm2.default }, - created: function created(to, from, next) { - var _this = this; - - if (this.repo || this.groupid) { - this.$store.commit("resetTab"); - this.$store.commit('setTab', { - tab: this.tab - }); - if (this.$router.history.current.name == "singlegit") { - this.$store.commit('setRepo', { - gitURL: this.repo - }); - } else if (!this.groupid) { - if (this.repo.includes('github')) { - this.$store.commit('setRepo', { - gitURL: this.repo - }); - } else { - this.$store.commit('setRepo', { - githubURL: this.owner + '/' + this.repo - }); - } - } - if (this.comparedrepo) { - this.$store.commit('addComparedRepo', { - githubURL: this.comparedowner + '/' + this.comparedrepo - }); - } - if (this.groupid) { - var repos = this.groupid.split('+'); - if (repos[0].includes('github')) { - this.$store.commit('setRepo', { - gitURL: repos[0] - }); - } else { - this.$store.commit('setRepo', { - githubURL: repos[0] - }); - } - repos.shift(); - - repos.forEach(function (cmprepo) { - _this.$store.commit('addComparedRepo', { - githubURL: cmprepo - }); - }); - } - } - }, - watch: { '$route': function $route(to, from) { - if (to.path != from.path) window.location.replace(to.path); + if (to.path != from.path) window.location.reload(); } }, data: function data() { @@ -1199,69 +1224,22 @@ module.exports = { }; }, - computed: { - hasState: function hasState() { - return this.$store.state.hasState; - }, - baseRepo: function baseRepo() { - return this.$store.state.baseRepo; - }, - gitRepo: function gitRepo() { - return this.$store.state.gitRepo; - }, - comparedRepos: function comparedRepos() { - return this.$store.state.comparedRepos; - }, - currentTab: function currentTab() { - return this.$store.state.tab; - }, - goBack: function goBack() { - window.history.length > 1 ? this.$router.go(-1) : this.$router.push('/'); - } - }, methods: { - collapseText: function collapseText() { - this.isCollapsed = !this.isCollapsed; - if (!this.isCollapsed) { - $(this.$el).find('.section').addClass('collapsed'); - } else $(this.$el).find('.section').removeClass('collapsed'); - }, onRepo: function onRepo(e) { - this.$store.commit('setRepo', { + var repo = window.AugurAPI.Repo({ githubURL: e.target.value }); - }, - changeTab: function changeTab(e) { - this.$store.commit('setTab', { - tab: e.target.dataset['value'] - }); - - var repo = this.repo; - - if (this.$store.state.comparedRepos.length == 1) { - this.$router.push({ - name: 'singlecompare', - params: { tab: e.target.dataset['value'], owner: this.owner, repo: this.repo, comparedowner: this.comparedowner, comparedrepo: this.comparedrepo } - }); - } else if (this.$store.state.comparedRepos.length > 1) { - this.$router.push({ - name: 'group', - params: { tab: e.target.dataset['value'], groupid: this.groupid } - }); - } else if (this.$router.history.current.name == "singlegit") { - this.$router.push({ - name: 'singlegit', - params: { tab: e.target.dataset['value'], repo: this.repo } - }); + if (!repo.batch(['codeCommits'], true)[0]) { + alert("The repo " + repo.githubURL + " could not be found. Please try again."); } else { - this.$router.push({ - name: 'single', - params: { tab: e.target.dataset['value'], owner: this.owner, repo: this.repo } + this.$store.commit('resetBaseRepo'); + this.$store.commit('setRepo', { + githubURL: e.target.value }); + this.$router.push({ + name: 'gmd', + params: { owner: repo.owner, repo: repo.name } }); } - }, - btoa: function btoa(s) { - return window.btoa(s); } } }; @@ -1269,8 +1247,8 @@ module.exports = { if (module.exports.__esModule) module.exports = module.exports.default var __vue__options__ = (typeof module.exports === "function"? module.exports.options: module.exports) if (__vue__options__.functional) {console.error("[vueify] functional components are not supported and should be defined in plain js files using render functions.")} -__vue__options__.render = function render () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('div',{staticClass:"fullwidth"},[_c('augur-header')],1),_vm._v(" "),_c('div',{class:{ hidden: _vm.hasState }},[_c('section',{staticClass:"unmaterialized"},[_vm._m(0),_vm._v(" "),_c('downloaded-repos-card')],1)]),_vm._v(" "),_c('div',{class:{ hidden: !_vm.hasState }},[_c('nav',{staticClass:"tabs"},[_c('ul',[_c('li',{class:{ active: (_vm.currentTab == 'gmd'), hidden: !_vm.baseRepo }},[_c('a',{attrs:{"href":"#","data-value":"gmd"},on:{"click":_vm.changeTab}},[_vm._v("Growth, Maturity, and Decline")])]),_vm._v(" "),_c('li',{class:{ active: (_vm.currentTab == 'diversityInclusion'), hidden: !_vm.baseRepo }},[_c('a',{attrs:{"href":"#","data-value":"diversityInclusion"},on:{"click":_vm.changeTab}},[_vm._v("Diversity and Inclusion")])]),_vm._v(" "),_c('li',{class:{ active: (_vm.currentTab == 'risk'), hidden: !_vm.baseRepo }},[_c('a',{attrs:{"href":"#","data-value":"risk"},on:{"click":_vm.changeTab}},[_vm._v("Risk")])]),_vm._v(" "),_c('li',{class:{ active: (_vm.currentTab == 'value'), hidden: !_vm.baseRepo }},[_c('a',{attrs:{"href":"#","data-value":"value"},on:{"click":_vm.changeTab}},[_vm._v("Value")])]),_vm._v(" "),_c('li',{class:{ active: (_vm.currentTab == 'activity'), hidden: !_vm.baseRepo }},[_c('a',{attrs:{"href":"#","data-value":"activity"},on:{"click":_vm.changeTab}},[_vm._v("Activity")])]),_vm._v(" "),_c('li',{class:{ active: (_vm.currentTab == 'experimental'), hidden: !_vm.baseRepo }},[_c('a',{attrs:{"href":"#","data-value":"experimental"},on:{"click":_vm.changeTab}},[_vm._v("Experimental")])]),_vm._v(" "),_c('li',{class:{ active: (_vm.currentTab == 'git'), hidden: !_vm.gitRepo }},[_c('a',{attrs:{"href":"#","data-value":"git"},on:{"click":_vm.changeTab}},[_vm._v("Git")])])])]),_vm._v(" "),_c('div',{ref:"cards"},[_c('main-controls'),_vm._v(" "),((_vm.baseRepo && (_vm.currentTab == 'gmd')))?_c('div',{key:_vm.update},[_c('growth-maturity-decline-card'),_vm._v(" "),_vm._l((_vm.comparedRepos),function(repo){return _c('div',{class:{ hidden: !_vm.comparedRepos.length },attrs:{"id":"comparisonCards"}},[_c('compared-repo-growth-maturity-decline-card',{attrs:{"comparedTo":repo}})],1)})],2):_vm._e(),_vm._v(" "),((_vm.baseRepo && (_vm.currentTab == 'diversityInclusion')))?_c('div',[_c('diversity-inclusion-card')],1):_vm._e(),_vm._v(" "),((_vm.baseRepo && (_vm.currentTab == 'risk')))?_c('div',[_c('risk-card')],1):_vm._e(),_vm._v(" "),((_vm.baseRepo && (_vm.currentTab == 'value')))?_c('div',[_c('value-card')],1):_vm._e(),_vm._v(" "),((_vm.baseRepo && (_vm.currentTab == 'activity')))?_c('div',{attrs:{"id":"activity"}},[_c('base-repo-activity-card'),_vm._v(" "),_c('base-repo-ecosystem-card')],1):_vm._e(),_vm._v(" "),((_vm.baseRepo && (_vm.currentTab == 'experimental')))?_c('div',[_c('experimental-card')],1):_vm._e(),_vm._v(" "),((_vm.gitRepo && (_vm.currentTab == 'git')))?_c('div',[_c('git-card')],1):_vm._e()],1)])])} -__vue__options__.staticRenderFns = [function render () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{attrs:{"id":"collapse"}},[_c('h3',[_vm._v("Downloaded Git Repos by Project")])])}] +__vue__options__.render = function render () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('div',{staticClass:"fullwidth"},[_c('router-view',{attrs:{"name":"header"}})],1),_vm._v(" "),_c('div',{ref:"cards",staticStyle:{"margin":"0 0 0 0"}},[_c('router-view',{attrs:{"name":"tabs"}}),_vm._v(" "),_c('router-view',{attrs:{"name":"controls"}}),_vm._v(" "),_c('router-view',{attrs:{"name":"content"}})],1)])} +__vue__options__.staticRenderFns = [] if (module.hot) {(function () { var hotAPI = require("vue-hot-reload-api") hotAPI.install(require("vue"), true) if (!hotAPI.compatible) return @@ -1278,14 +1256,14 @@ if (module.hot) {(function () { var hotAPI = require("vue-hot-reload-api") if (!module.hot.data) { hotAPI.createRecord("data-v-78eb2940", __vue__options__) } else { - hotAPI.reload("data-v-78eb2940", __vue__options__) + hotAPI.rerender("data-v-78eb2940", __vue__options__) } })()} }); ;require.register("components/AugurHeader.vue", function(exports, require, module) { ;(function(){ -'use strict'; +"use strict"; module.exports = { methods: { @@ -1293,7 +1271,6 @@ module.exports = { var repo = window.AugurAPI.Repo({ githubURL: e.target.value }); - console.log("check", repo.batch(['codeCommits'], true)); if (!repo.batch(['codeCommits'], true)[0]) { alert("The repo " + repo.githubURL + " could not be found. Please try again."); } else { @@ -1302,8 +1279,8 @@ module.exports = { githubURL: e.target.value }); this.$router.push({ - name: 'single', - params: { tab: 'gmd', owner: repo.owner, repo: repo.name } + name: 'gmd', + params: { owner: repo.owner, repo: repo.name } }); } } @@ -1518,9 +1495,13 @@ module.exports = { gitURL: e.url }); + this.$store.commit('setTab', { + tab: 'git' + }); + this.$router.push({ - name: 'singlegit', - params: { tab: 'git', repo: e.url } + name: 'git', + params: { repo: e.url } }); }, getDownloadedRepos: function getDownloadedRepos() { @@ -1546,7 +1527,7 @@ module.exports = { if (module.exports.__esModule) module.exports = module.exports.default var __vue__options__ = (typeof module.exports === "function"? module.exports.options: module.exports) if (__vue__options__.functional) {console.error("[vueify] functional components are not supported and should be defined in plain js files using render functions.")} -__vue__options__.render = function render () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"row section"},[_c('hr'),_vm._v(" "),_c('div',{staticClass:"col col-12 relative spinner loader",staticStyle:{"margin-left":"42.4%"}}),_vm._v(" "),_vm._l((_vm.projects),function(project){return _c('div',{staticClass:"col-6"},[_c('h4',[_vm._v(_vm._s(project))]),_vm._v(" "),_c('div',{staticClass:"repo-link-holder"},[_c('table',{staticClass:"is-responsive"},[_vm._m(0,true),_vm._v(" "),_c('tbody',{staticClass:"repo-link-table repo-link-table-body"},_vm._l((_vm.repos[project]),function(repo){return _c('tr',[_c('td',[_c('a',{attrs:{"href":"#"},on:{"click":function($event){_vm.onGitRepo(repo)}}},[_vm._v(_vm._s(repo.url))])]),_vm._v(" "),_c('td',[_vm._v(_vm._s(repo.status))])])}))])])])})],2)} +__vue__options__.render = function render () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('section',{staticClass:"unmaterialized"},[_c('h3',[_vm._v("Downloaded Git Repos by Project")]),_vm._v(" "),_c('div',{staticClass:"row section"},[_c('hr'),_vm._v(" "),_c('div',{staticClass:"col col-12 relative spinner loader",staticStyle:{"margin-left":"42.4%"}}),_vm._v(" "),_vm._l((_vm.projects),function(project){return _c('div',{staticClass:"col-6"},[_c('h4',[_vm._v(_vm._s(project))]),_vm._v(" "),_c('div',{staticClass:"repo-link-holder"},[_c('table',{staticClass:"is-responsive"},[_vm._m(0,true),_vm._v(" "),_c('tbody',{staticClass:"repo-link-table repo-link-table-body"},_vm._l((_vm.repos[project]),function(repo){return _c('tr',[_c('td',[_c('a',{attrs:{"href":"#"},on:{"click":function($event){_vm.onGitRepo(repo)}}},[_vm._v(_vm._s(repo.url))])]),_vm._v(" "),_c('td',[_vm._v(_vm._s(repo.status))])])}))])])])})],2)])} __vue__options__.staticRenderFns = [function render () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('thead',{staticClass:"repo-link-table repo-link-table-body"},[_c('tr',[_c('th',[_vm._v("URL")]),_vm._v(" "),_c('th',[_vm._v("Status")])])])}] if (module.hot) {(function () { var hotAPI = require("vue-hot-reload-api") hotAPI.install(require("vue"), true) @@ -1864,7 +1845,15 @@ module.exports = { onStartDateChange: function onStartDateChange(e) { var _this2 = this; - var date = Date.parse(this.$refs.startMonth.value + "/01/" + this.$refs.startYear.value); + var date = null; + + console.log("again", e.target.value); + if (e.target.value > 12) { + date = Date.parse(this.startMonth + "/01/" + e.target.value); + } else { + var month = (parseInt(e.target.value) + 1).toString(); + date = Date.parse(month + "/01/" + this.startYear); + } if (this.startDateTimeout) { clearTimeout(this.startDateTimeout); delete this.startDateTimeout; @@ -1878,7 +1867,16 @@ module.exports = { onEndDateChange: function onEndDateChange(e) { var _this3 = this; - var date = Date.parse(this.$refs.endMonth.value + "/01/" + this.$refs.endYear.value); + var date = null; + + console.log("again", e.target.value); + if (e.target.value > 12) { + date = Date.parse(this.endMonth + "/01/" + e.target.value); + } else { + var month = (parseInt(e.target.value) + 1).toString(); + console.log(); + date = Date.parse(month + "/01/" + this.endYear); + } if (this.endDateTimeout) { clearTimeout(this.endDateTimeout); delete this.endDateTimeout; @@ -1927,7 +1925,6 @@ module.exports = { var repo = window.AugurAPI.Repo({ githubURL: e.target.value }); - console.log(repo.batch(['codeCommits'], true)); if (!repo.batch(['codeCommits'], true)[0]) { element.classList.remove("invisible"); } else { @@ -1946,7 +1943,6 @@ module.exports = { var link = url; var end = url.slice(url.length - 4); if (end == ".git") link = link.substring(0, url.length - 4); - console.log("link: ", link); _this4.$store.commit('addComparedRepo', { githubURL: link }); @@ -1981,6 +1977,9 @@ module.exports = { } }, computed: { + compare: function compare() { + return this.$store.state.compare; + }, months: function months() { return [{ name: 'January', value: 0 }, { name: 'February', value: 1 }, { name: 'March', value: 2 }, { name: 'April', value: 3 }, { name: 'May', value: 4 }, { name: 'June', value: 5 }, { name: 'July', value: 6 }, { name: 'August', value: 7 }, { name: 'September', value: 8 }, { name: 'October', value: 9 }, { name: 'November', value: 10 }, { name: 'December', value: 11 }]; }, @@ -1996,6 +1995,18 @@ module.exports = { yearArray.push(i); } return yearArray; + }, + startMonth: function startMonth() { + return this.$store.state.startDate.getMonth(); + }, + startYear: function startYear() { + return this.$store.state.startDate.getUTCFullYear(); + }, + endMonth: function endMonth() { + return this.$store.state.endDate.getMonth(); + }, + endYear: function endYear() { + return this.$store.state.endDate.getUTCFullYear(); } }, mounted: function mounted() { @@ -2003,6 +2014,7 @@ module.exports = { window.$(this.$el).find('.multiselect__input').addClass('search'); window.$(this.$el).find('.multiselect__input').addClass('reposearch'); + console.log("CHECKING", this.$store.state.startDate.getMonth(), this.$store.state.startDate.getUTCFullYear(), this.$store.state.endDate.getMonth(), this.$store.state.endDate.getUTCFullYear()); if (this.projects.length == 1) this.project = this.projects[0]; } @@ -2011,7 +2023,7 @@ module.exports = { if (module.exports.__esModule) module.exports = module.exports.default var __vue__options__ = (typeof module.exports === "function"? module.exports.options: module.exports) if (__vue__options__.functional) {console.error("[vueify] functional components are not supported and should be defined in plain js files using render functions.")} -__vue__options__.render = function render () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"row",attrs:{"id":"controls"}},[_c('div',{staticClass:"col col-12"},[_c('div',{staticClass:"form"},[_c('div',{staticClass:"topic"},[_c('div',{staticClass:"container"},[_c('div',{staticClass:"row justify-content-md-center"},[_c('div',{staticClass:"col col-9"},[_c('div',{staticClass:"row"},[_vm._m(0),_vm._v(" "),_c('div',{directives:[{name:"click-outside",rawName:"v-click-outside",value:(_vm.stopSelecting),expression:"stopSelecting"}],staticClass:"row col col-4",staticStyle:{"text-align":"center !important"}},[_c('div',{staticClass:"col col-6",staticStyle:{"display":"inline !important"},on:{"click":_vm.keepSelecting}},[_c('multiselect',{attrs:{"options":_vm.projects,"placeholder":_vm.project},model:{value:(_vm.project),callback:function ($$v) {_vm.project=$$v},expression:"project"}})],1),_vm._v(" "),_c('div',{staticClass:"col col-6",staticStyle:{"display":"inline !important"},on:{"click":_vm.keepSelecting}},[_c('multiselect',{staticClass:"search reposearch special",attrs:{"options":_vm.options,"multiple":true,"group-label":"url","placeholder":"Select repos"},model:{value:(_vm.values),callback:function ($$v) {_vm.values=$$v},expression:"values"}})],1)]),_vm._v(" "),_c('div',{staticClass:"col col-1"},[_c('input',{staticStyle:{"max-width":"69.9px"},attrs:{"type":"button","value":"Apply"},on:{"click":function($event){_vm.onArrayCompare(); _vm.onValuesClear()}}})]),_vm._v(" "),_c('div',{staticClass:"col col-1"},[_c('input',{staticStyle:{"max-width":"69.9px"},attrs:{"type":"button","value":"Reset"},on:{"click":function($event){_vm.onClear()}}})]),_vm._v(" "),_c('div',{staticClass:"col col-3"},[_c('input',{staticClass:"search reposearch",attrs:{"type":"text","placeholder":"Search other GitHub URL"},on:{"change":_vm.onCompare}}),_vm._v(" "),_c('p')])])]),_vm._v(" "),_c('div',{staticClass:"col col-1 invisible invalid-search",attrs:{"id":"invalid","align":"center"}},[_vm._v("Repo not found.")]),_vm._v(" "),_c('div',{staticClass:"col col-2",attrs:{"id":"collapse"}},[_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.isCollapsed),expression:"isCollapsed"}],staticClass:"col col-12 align-bottom",attrs:{"align":"right"},on:{"click":function($event){_vm.collapseText()}}},[_vm._v("Less configuration options â–¼")]),_vm._v(" "),_c('div',{directives:[{name:"show",rawName:"v-show",value:(!_vm.isCollapsed),expression:"!isCollapsed"}],staticClass:"col col-12 align-bottom",attrs:{"align":"right"},on:{"click":function($event){_vm.collapseText()}}},[_vm._v("More configuration options â–¶")])])])]),_vm._v(" "),_c('div',{staticClass:"row gutters section collapsible collapsed"},[_c('div',{staticClass:"col col-5"},[_c('label',[_vm._v("Line Charts\n "),_c('div',{staticClass:"row"},[_c('div',{staticClass:"col col-6"},[_c('div',{staticClass:"form-item form-checkboxes"},[_c('label',{staticClass:"checkbox"},[_c('input',{attrs:{"name":"comparebaseline","value":"each","type":"checkbox"},on:{"change":_vm.onRawWeeklyChange}}),_vm._v("Raw weekly values"),_c('sup',{staticClass:"warn"})])]),_vm._v(" "),_c('div',{staticClass:"form-item form-checkboxes"},[_c('label',{staticClass:"checkbox"},[_c('input',{attrs:{"name":"comparebaseline","value":"each","type":"checkbox","disabled":!_vm.disabled,"checked":""},domProps:{"checked":_vm.disabled},on:{"change":_vm.onAreaChange}}),_vm._v("Standard deviation")])])]),_vm._v(" "),_c('div',{staticClass:"col col-6"},[_c('div',{staticClass:"form-item form-checkboxes"},[_c('label',{staticClass:"checkbox"},[_c('input',{attrs:{"name":"comparebaseline","value":"each","type":"checkbox","disabled":!_vm.disabled,"checked":""},domProps:{"checked":_vm.disabled},on:{"change":_vm.onTooltipChange}}),_vm._v("Show tooltip")])]),_vm._v(" "),_c('div',{staticClass:"form-item form-checkboxes"},[_c('label',{staticClass:"checkbox"},[_c('input',{attrs:{"name":"comparebaseline","value":"each","type":"checkbox","checked":""},on:{"change":_vm.onDetailChange}}),_vm._v("Enable detail")])])]),_vm._v(" "),_c('label',[_vm._v("Bubble Charts\n "),_c('div',{staticClass:"form-item form-checkboxes"},[_c('label',{staticClass:"checkbox"},[_c('input',{attrs:{"name":"comparebaseline","value":"each","type":"checkbox"},on:{"change":_vm.onShowBelowAverageChange}}),_vm._v("Show users with below-average total contributions"),_c('sup',{staticClass:"warn"})]),_c('br')])]),_vm._v(" "),_vm._m(1),_vm._v(" "),_c('div',{staticClass:"col col-11"},[_c('small',[_vm._v("1. Line charts show a rolling mean over "+_vm._s(_vm.info.days)+" days with data points at each "+_vm._s(_vm.info.points)+"-day interval")])])])])]),_vm._v(" "),_c('div',{staticClass:"col col-7"},[_c('div',{staticClass:"row"},[_c('div',{staticClass:"col col-6"},[_c('h6',[_vm._v("Configuration")]),_vm._v(" "),_c('div',{staticClass:"row gutters"},[_c('div',{staticClass:"col col-11"},[_c('div',{staticClass:"form-item"},[_c('label',[_vm._v("Start Date\n "),_c('div',{staticClass:"row gutters"},[_c('div',{staticClass:"col col-7"},[_c('div',{staticClass:"form-item"},[_c('select',{ref:"startMonth",on:{"change":_vm.onStartDateChange}},_vm._l((_vm.months),function(month){return _c('option',{domProps:{"value":month.value,"selected":month.value == _vm.thisMonth}},[_vm._v(_vm._s(month.name))])})),_vm._v(" "),_c('div',{staticClass:"desc"},[_vm._v("Month")])])]),_vm._v(" "),_c('div',{staticClass:"col col-5"},[_c('div',{staticClass:"form-item"},[_c('select',{ref:"startYear",on:{"change":_vm.onStartDateChange}},_vm._l((_vm.years),function(year){return _c('option',{domProps:{"value":year,"selected":year == 2010}},[_vm._v(_vm._s(year))])})),_vm._v(" "),_c('div',{staticClass:"desc"},[_vm._v("Year")])])])])])])])]),_vm._v(" "),_c('p'),_vm._v(" "),_c('div',{staticClass:"row gutters"},[_c('div',{staticClass:"col col-11"},[_c('div',{staticClass:"form-item"},[_c('label',[_vm._v("End Date\n "),_c('div',{staticClass:"row gutters"},[_c('div',{staticClass:"col col-7"},[_c('div',{staticClass:"form-item"},[_c('select',{ref:"endMonth",on:{"change":_vm.onEndDateChange}},_vm._l((_vm.months),function(month){return _c('option',{domProps:{"value":month.value,"selected":month.value == _vm.thisMonth}},[_vm._v(_vm._s(month.name))])})),_vm._v(" "),_c('div',{staticClass:"desc"},[_vm._v("Month")])])]),_vm._v(" "),_c('div',{staticClass:"col col-5"},[_c('div',{staticClass:"form-item"},[_c('select',{ref:"endYear",on:{"change":_vm.onEndDateChange}},_vm._l((_vm.years),function(year){return _c('option',{domProps:{"value":year,"selected":year == _vm.thisYear}},[_vm._v(_vm._s(year))])})),_vm._v(" "),_c('div',{staticClass:"desc"},[_vm._v("Year")])])])])])])])]),_vm._v(" "),_c('br')]),_vm._v(" "),_c('div',{staticClass:"col col-1"}),_vm._v(" "),_c('div',{staticClass:"col col-5"},[_c('h6',[_vm._v("Rendering")]),_vm._v(" "),_c('label',[_vm._v("Line Charts"),_c('sup',[_vm._v("1")]),_c('sup',{staticClass:"warn"}),_vm._v(" "),_c('div',{staticClass:"append col col-10"},[_c('input',{ref:"info",attrs:{"type":"number","min":"20","id":"averagetimespan","value":"180","placeholder":"180"},on:{"change":_vm.onTrailingAverageChange}}),_c('span',[_vm._v("day average")])]),_vm._v(" "),_c('p'),_vm._v(" "),_c('h6',[_vm._v("Comparison Type")]),_vm._v(" "),_c('label',[_c('div',{staticClass:"form-item form-checkboxes"},[_c('label',{staticClass:"checkbox"},[_c('input',{attrs:{"name":"comparebaseline","value":"zscore","type":"radio"},domProps:{"checked":_vm.compared},on:{"change":_vm.onCompareChange}}),_vm._v("Z-score")]),_c('br'),_vm._v(" "),_c('label',{staticClass:"checkbox"},[_c('input',{attrs:{"name":"comparebaseline","value":"baseline","type":"radio"},domProps:{"checked":!_vm.compared},on:{"change":_vm.onCompareChange}}),_vm._v("Baseline is compared")]),_vm._v(" "),_c('label',{staticClass:"checkbox"},[_c('input',{attrs:{"name":"comparebaseline","value":"rolling","type":"radio"},domProps:{"checked":!_vm.compared},on:{"change":_vm.onCompareChange}}),_vm._v("Rolling average")])])])]),_vm._v(" "),_c('br')])])])])])])])])} +__vue__options__.render = function render () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"row",attrs:{"id":"controls"}},[_c('div',{staticClass:"col col-12"},[_c('div',{staticClass:"form"},[_c('div',{staticClass:"topic"},[_c('div',{staticClass:"container"},[_c('div',{staticClass:"row justify-content-md-center"},[_c('div',{staticClass:"col col-9"},[_c('div',{staticClass:"row"},[_vm._m(0),_vm._v(" "),_c('div',{directives:[{name:"click-outside",rawName:"v-click-outside",value:(_vm.stopSelecting),expression:"stopSelecting"}],staticClass:"row col col-4",staticStyle:{"text-align":"center !important"}},[_c('div',{staticClass:"col col-6",staticStyle:{"display":"inline !important"},on:{"click":_vm.keepSelecting}},[_c('multiselect',{attrs:{"options":_vm.projects,"placeholder":_vm.project},model:{value:(_vm.project),callback:function ($$v) {_vm.project=$$v},expression:"project"}})],1),_vm._v(" "),_c('div',{staticClass:"col col-6",staticStyle:{"display":"inline !important"},on:{"click":_vm.keepSelecting}},[_c('multiselect',{staticClass:"search reposearch special",attrs:{"options":_vm.options,"multiple":true,"group-label":"url","placeholder":"Select repos"},model:{value:(_vm.values),callback:function ($$v) {_vm.values=$$v},expression:"values"}})],1)]),_vm._v(" "),_c('div',{staticClass:"col col-1"},[_c('input',{staticStyle:{"max-width":"69.9px"},attrs:{"type":"button","value":"Apply"},on:{"click":function($event){_vm.onArrayCompare(); _vm.onValuesClear()}}})]),_vm._v(" "),_c('div',{staticClass:"col col-1"},[_c('input',{staticStyle:{"max-width":"69.9px"},attrs:{"type":"button","value":"Reset"},on:{"click":function($event){_vm.onClear()}}})]),_vm._v(" "),_c('div',{staticClass:"col col-3"},[_c('input',{staticClass:"search reposearch",attrs:{"type":"text","placeholder":"Search other GitHub URL"},on:{"change":_vm.onCompare}}),_vm._v(" "),_c('p')])])]),_vm._v(" "),_c('div',{staticClass:"col col-1 invisible invalid-search",attrs:{"id":"invalid","align":"center"}},[_vm._v("Repo not found.")]),_vm._v(" "),_c('div',{staticClass:"col col-2",attrs:{"id":"collapse"}},[_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.isCollapsed),expression:"isCollapsed"}],staticClass:"col col-12 align-bottom",attrs:{"align":"right"},on:{"click":function($event){_vm.collapseText()}}},[_vm._v("Less configuration options â–¼")]),_vm._v(" "),_c('div',{directives:[{name:"show",rawName:"v-show",value:(!_vm.isCollapsed),expression:"!isCollapsed"}],staticClass:"col col-12 align-bottom",attrs:{"align":"right"},on:{"click":function($event){_vm.collapseText()}}},[_vm._v("More configuration options â–¶")])])])]),_vm._v(" "),_c('div',{staticClass:"row gutters section collapsible collapsed"},[_c('div',{staticClass:"col col-5"},[_c('label',[_vm._v("Line Charts\n "),_c('div',{staticClass:"row"},[_c('div',{staticClass:"col col-6"},[_c('div',{staticClass:"form-item form-checkboxes"},[_c('label',{staticClass:"checkbox"},[_c('input',{attrs:{"name":"comparebaseline","value":"each","type":"checkbox"},on:{"change":_vm.onRawWeeklyChange}}),_vm._v("Raw weekly values"),_c('sup',{staticClass:"warn"})])]),_vm._v(" "),_c('div',{staticClass:"form-item form-checkboxes"},[_c('label',{staticClass:"checkbox"},[_c('input',{attrs:{"name":"comparebaseline","value":"each","type":"checkbox","disabled":!_vm.disabled,"checked":""},domProps:{"checked":_vm.disabled},on:{"change":_vm.onAreaChange}}),_vm._v("Standard deviation")])])]),_vm._v(" "),_c('div',{staticClass:"col col-6"},[_c('div',{staticClass:"form-item form-checkboxes"},[_c('label',{staticClass:"checkbox"},[_c('input',{attrs:{"name":"comparebaseline","value":"each","type":"checkbox","disabled":!_vm.disabled,"checked":""},domProps:{"checked":_vm.disabled},on:{"change":_vm.onTooltipChange}}),_vm._v("Show tooltip")])]),_vm._v(" "),_c('div',{staticClass:"form-item form-checkboxes"},[_c('label',{staticClass:"checkbox"},[_c('input',{attrs:{"name":"comparebaseline","value":"each","type":"checkbox","checked":""},on:{"change":_vm.onDetailChange}}),_vm._v("Enable detail")])])]),_vm._v(" "),_c('label',[_vm._v("Bubble Charts\n "),_c('div',{staticClass:"form-item form-checkboxes"},[_c('label',{staticClass:"checkbox"},[_c('input',{attrs:{"name":"comparebaseline","value":"each","type":"checkbox"},on:{"change":_vm.onShowBelowAverageChange}}),_vm._v("Show users with below-average total contributions"),_c('sup',{staticClass:"warn"})]),_c('br')])]),_vm._v(" "),_vm._m(1),_vm._v(" "),_c('div',{staticClass:"col col-11"},[_c('small',[_vm._v("1. Line charts show a rolling mean over "+_vm._s(_vm.info.days)+" days with data points at each "+_vm._s(_vm.info.points)+"-day interval")])])])])]),_vm._v(" "),_c('div',{staticClass:"col col-7"},[_c('div',{staticClass:"row"},[_c('div',{staticClass:"col col-6"},[_c('h6',[_vm._v("Configuration")]),_vm._v(" "),_c('div',{staticClass:"row gutters"},[_c('div',{staticClass:"col col-11"},[_c('div',{staticClass:"form-item"},[_c('label',[_vm._v("Start Date\n "),_c('div',{staticClass:"row gutters"},[_c('div',{staticClass:"col col-7"},[_c('div',{staticClass:"form-item"},[_c('select',{ref:"startMonth",on:{"change":_vm.onStartDateChange}},_vm._l((_vm.months),function(month){return _c('option',{domProps:{"value":month.value,"selected":(_vm.startMonth) == month.value}},[_vm._v(_vm._s(month.name))])})),_vm._v(" "),_c('div',{staticClass:"desc"},[_vm._v("Month")])])]),_vm._v(" "),_c('div',{staticClass:"col col-5"},[_c('div',{staticClass:"form-item"},[_c('select',{ref:"startYear",on:{"change":_vm.onStartDateChange}},_vm._l((_vm.years),function(year){return _c('option',{domProps:{"value":year,"selected":_vm.startYear == year}},[_vm._v(_vm._s(year))])})),_vm._v(" "),_c('div',{staticClass:"desc"},[_vm._v("Year")])])])])])])])]),_vm._v(" "),_c('p'),_vm._v(" "),_c('div',{staticClass:"row gutters"},[_c('div',{staticClass:"col col-11"},[_c('div',{staticClass:"form-item"},[_c('label',[_vm._v("End Date\n "),_c('div',{staticClass:"row gutters"},[_c('div',{staticClass:"col col-7"},[_c('div',{staticClass:"form-item"},[_c('select',{ref:"endMonth",on:{"change":_vm.onEndDateChange}},_vm._l((_vm.months),function(month){return _c('option',{domProps:{"value":month.value,"selected":(_vm.endMonth) == month.value}},[_vm._v(_vm._s(month.name))])})),_vm._v(" "),_c('div',{staticClass:"desc"},[_vm._v("Month")])])]),_vm._v(" "),_c('div',{staticClass:"col col-5"},[_c('div',{staticClass:"form-item"},[_c('select',{ref:"endYear",on:{"change":_vm.onEndDateChange}},_vm._l((_vm.years),function(year){return _c('option',{domProps:{"value":year,"selected":_vm.endYear == year}},[_vm._v(_vm._s(year))])})),_vm._v(" "),_c('div',{staticClass:"desc"},[_vm._v("Year")])])])])])])])]),_vm._v(" "),_c('br')]),_vm._v(" "),_c('div',{staticClass:"col col-1"}),_vm._v(" "),_c('div',{staticClass:"col col-5"},[_c('h6',[_vm._v("Rendering")]),_vm._v(" "),_c('label',[_vm._v("Line Charts"),_c('sup',[_vm._v("1")]),_c('sup',{staticClass:"warn"}),_vm._v(" "),_c('div',{staticClass:"append col col-10"},[_c('input',{ref:"info",attrs:{"type":"number","min":"20","id":"averagetimespan","value":"180","placeholder":"180"},on:{"change":_vm.onTrailingAverageChange}}),_c('span',[_vm._v("day average")])]),_vm._v(" "),_c('p'),_vm._v(" "),_c('h6',[_vm._v("Comparison Type")]),_vm._v(" "),_c('label',[_c('div',{staticClass:"form-item form-checkboxes"},[_c('label',{staticClass:"checkbox"},[_c('input',{attrs:{"name":"comparebaseline","value":"zscore","type":"radio"},domProps:{"checked":_vm.compare == 'zscore'},on:{"change":_vm.onCompareChange}}),_vm._v("Z-score")]),_c('br'),_vm._v(" "),_c('label',{staticClass:"checkbox"},[_c('input',{attrs:{"name":"comparebaseline","value":"baseline","type":"radio"},domProps:{"checked":_vm.compare == 'baseline'},on:{"change":_vm.onCompareChange}}),_vm._v("Baseline is compared")]),_vm._v(" "),_c('label',{staticClass:"checkbox"},[_c('input',{attrs:{"name":"comparebaseline","value":"rolling","type":"radio"},domProps:{"checked":_vm.compare == 'rolling'},on:{"change":_vm.onCompareChange}}),_vm._v("Rolling average")])])])]),_vm._v(" "),_c('br')])])])])])])])])} __vue__options__.staticRenderFns = [function render () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"col col-3",attrs:{"align":"center","id":"comparetext"}},[_c('h6',[_vm._v("Compare from your repos:")])])},function render () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"col col-12"},[_c('small',{staticClass:"warn"},[_vm._v(" - These options affect performance")])])}] if (module.hot) {(function () { var hotAPI = require("vue-hot-reload-api") hotAPI.install(require("vue"), true) @@ -2140,21 +2152,33 @@ if (module.hot) {(function () { var hotAPI = require("vue-hot-reload-api") })()} }); -;require.register("components/RiskCard.vue", function(exports, require, module) { +;require.register("components/OverviewCard.vue", function(exports, require, module) { ;(function(){ 'use strict'; -var _DynamicLineChart = require('./charts/DynamicLineChart'); +var _AugurHeader = require('./AugurHeader'); -var _DynamicLineChart2 = _interopRequireDefault(_DynamicLineChart); +var _AugurHeader2 = _interopRequireDefault(_AugurHeader); -var _BubbleChart = require('./charts/BubbleChart'); +var _TickChart = require('./charts/TickChart'); -var _BubbleChart2 = _interopRequireDefault(_BubbleChart); +var _TickChart2 = _interopRequireDefault(_TickChart); -var _StackedBarChart = require('./charts/StackedBarChart'); +var _LinesOfCodeChart = require('./charts/LinesOfCodeChart'); -var _StackedBarChart2 = _interopRequireDefault(_StackedBarChart); +var _LinesOfCodeChart2 = _interopRequireDefault(_LinesOfCodeChart); + +var _NormalizedStackedBarChart = require('./charts/NormalizedStackedBarChart'); + +var _NormalizedStackedBarChart2 = _interopRequireDefault(_NormalizedStackedBarChart); + +var _OneDimensionalStackedBarChart = require('./charts/OneDimensionalStackedBarChart'); + +var _OneDimensionalStackedBarChart2 = _interopRequireDefault(_OneDimensionalStackedBarChart); + +var _HorizontalBarChart = require('./charts/HorizontalBarChart'); + +var _HorizontalBarChart2 = _interopRequireDefault(_HorizontalBarChart); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -2166,17 +2190,85 @@ module.exports = { }, components: { - DynamicLineChart: _DynamicLineChart2.default, - BubbleChart: _BubbleChart2.default, - StackedBarChart: _StackedBarChart2.default + AugurHeader: _AugurHeader2.default, + TickChart: _TickChart2.default, + LinesOfCodeChart: _LinesOfCodeChart2.default, + NormalizedStackedBarChart: _NormalizedStackedBarChart2.default, + OneDimensionalStackedBarChart: _OneDimensionalStackedBarChart2.default, + HorizontalBarChart: _HorizontalBarChart2.default + } +}; +})() +if (module.exports.__esModule) module.exports = module.exports.default +var __vue__options__ = (typeof module.exports === "function"? module.exports.options: module.exports) +if (__vue__options__.functional) {console.error("[vueify] functional components are not supported and should be defined in plain js files using render functions.")} +__vue__options__.render = function render () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('section',[_c('div',{staticStyle:{"display":"inline-block"}},[_c('h2',{staticStyle:{"display":"inline-block","color":"black !important"}},[_vm._v(_vm._s(_vm.$store.state.gitRepo))]),_vm._v(" "),(_vm.$store.state.comparedRepos.length > 0)?_c('h2',{staticClass:"repolisting",staticStyle:{"display":"inline-block"}},[_vm._v(" compared to: ")]):_vm._e(),_vm._v(" "),_vm._l((_vm.$store.state.comparedRepos),function(repo,index){return _c('h2',{staticStyle:{"display":"inline-block"}},[_c('span',{staticClass:"repolisting",style:({ 'color': _vm.colors[index] })},[_vm._v(" "+_vm._s(repo)+" ")])])})],2),_vm._v(" "),_c('tick-chart'),_vm._v(" "),_c('div',{staticClass:"row",staticStyle:{"transform":"translateY(-50px) !important"}},[_c('div',{staticClass:"col col-6",staticStyle:{"padding-right":"35px"}},[_c('normalized-stacked-bar-chart',{attrs:{"title":"Lines of code added by the top 10 authors as Percentages - By Time Period"}})],1),_vm._v(" "),_c('div',{staticClass:"col col-6",staticStyle:{"padding-left":"65px"}},[_c('div',{staticStyle:{"padding-top":"35px"}}),_vm._v(" "),_c('horizontal-bar-chart',{attrs:{"type":"lines","title":"Average Lines of Code Per Commit"}})],1)]),_vm._v(" "),_c('div',{staticClass:"row",staticStyle:{"transform":"translateY(-100px) !important"}},[_c('div',{staticClass:"col col-6"},[_c('one-dimensional-stacked-bar-chart',{attrs:{"type":"lines","title":"Lines of Code Added by the top 10 Authors as Percentages - All Time"}})],1),_vm._v(" "),_c('div',{staticClass:"col col-6"},[_c('one-dimensional-stacked-bar-chart',{attrs:{"type":"commit","title":"Commits by the top 10 Authors as Percentages - All Time"}})],1)]),_vm._v(" "),_c('div',{staticClass:"row",staticStyle:{"transform":"translateY(-50px) !important"}},[_c('lines-of-code-chart')],1)],1)} +__vue__options__.staticRenderFns = [] +if (module.hot) {(function () { var hotAPI = require("vue-hot-reload-api") + hotAPI.install(require("vue"), true) + if (!hotAPI.compatible) return + module.hot.accept() + if (!module.hot.data) { + hotAPI.createRecord("data-v-7117fe96", __vue__options__) + } else { + hotAPI.reload("data-v-7117fe96", __vue__options__) } +})()} +}); + +;require.register("components/RiskCard.vue", function(exports, require, module) { +;(function(){ +"use strict"; + +window.onload = function () { + document.getElementById("ciiBtn").addEventListener("click", function () { + document.getElementById("overcii").style.display = "block"; + document.getElementById("overcii").class = "row"; + document.getElementById("ciiBtn").style.visibility = "hidden"; + var request = new XMLHttpRequest(); + function loader() { + var basestr = document.getElementById("base").innerHTML; + var augURL = 'https://github.com/' + basestr; + request.open('GET', 'https://bestpractices.coreinfrastructure.org/projects.json?pq=' + augURL, true); + request.onload = function () { + var data = JSON.parse(this.response)[0]; + if (data != undefined) { + var badgeURL = 'https://bestpractices.coreinfrastructure.org/projects/' + data.id + '/badge'; + + document.getElementById("CIIbadge").src = badgeURL; + if (data.badge_percentage_0 < 100) { + document.getElementById("CII").innerHTML = data.name + ' is currently not passing CII Best Practices.'; + } else if (data.badge_percentage_1 < 100) { + document.getElementById("CII").innerHTML = data.name + ' is currently passing CII Best Practices.'; + } else if (data.badge_percentage_2 < 100) { + document.getElementById("CII").innerHTML = data.name + ' is currently passing CII Best Practices. This project has a siver status.'; + } else if (data.badge_percentage_2 == 100) { + document.getElementById("CII").innerHTML = data.name + ' is currently passing CII Best Practices.
' + data.name + ' maintains a gold status.'; + } + } else { + document.getElementById("CII").innerHTML = 'No best practice data for this repository.'; + } + }; + } + loader(); + request.send(); + }); +}; +module.exports = { + data: function data() { + return { + colors: ["#FF3647", "#4736FF", "#3cb44b", "#ffe119", "#f58231", "#911eb4", "#42d4f4", "#f032e6"] + }; + }, + + components: {} }; })() if (module.exports.__esModule) module.exports = module.exports.default var __vue__options__ = (typeof module.exports === "function"? module.exports.options: module.exports) if (__vue__options__.functional) {console.error("[vueify] functional components are not supported and should be defined in plain js files using render functions.")} -__vue__options__.render = function render () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('section',[_c('h1',[_vm._v("Risk")]),_vm._v(" "),_c('div',{staticStyle:{"display":"inline-block"}},[_c('h2',{staticStyle:{"display":"inline-block","color":"black !important"},attrs:{"id":"base"}},[_vm._v(_vm._s(_vm.$store.state.baseRepo))]),_vm._v(" "),(_vm.$store.state.comparedRepos.length > 0)?_c('h2',{staticClass:"repolisting",staticStyle:{"display":"inline-block"}},[_vm._v(" compared to: \n")]):_vm._e(),_vm._v(" "),_vm._l((_vm.$store.state.comparedRepos),function(repo,index){return _c('h2',{staticStyle:{"display":"inline-block"}},[_c('span',{staticClass:"repolisting",style:({ 'color': _vm.colors[index] }),attrs:{"id":"compared"}},[_vm._v(" "+_vm._s(repo)+" ")])])})],2),_vm._v(" "),_c('script',{attrs:{"type":"application/javascript"}},[_vm._v("\n var request = new XMLHttpRequest;\n async function loader() {\n const augURL = 'https://github.com/' + document.getElementById(\"base\").innerHTML;\n console.log(augURL);\n request.open('GET', 'https://bestpractices.coreinfrastructure.org/projects.json?pq=' + augURL, true);\n request.onload = function () {\n var data = JSON.parse(this.response)[0];\n if (data != undefined) {\n console.log('CII NAME: ' + data.name);\n console.log(data);\n badgeURL = 'https://bestpractices.coreinfrastructure.org/projects/' + data.id + '/badge';\n console.log(badgeURL);\n document.getElementById(\"CIIbadge\").src = badgeURL;\n if (data.badge_percentage_0 < 100) {\n document.getElementById(\"CII\").innerHTML = data.name + ' is currently not passing CII Best Practices.';\n }\n else if (data.badge_percentage_1 < 100) {\n document.getElementById(\"CII\").innerHTML = data.name + ' is currently passing CII Best Practices.';\n }\n else if (data.badge_percentage_2 < 100) {\n document.getElementById(\"CII\").innerHTML = data.name + ' is currently passing CII Best Practices. This project has a siver status.';\n }\n else if (data.badge_percentage_2 == 100) {\n document.getElementById(\"CII\").innerHTML = data.name + ' is currently passing CII Best Practices.
' + data.name + ' maintains a gold status.';\n }\n } else {\n document.getElementById(\"CII\").innerHTML = 'No best practice data for this repository.';\n }\n }\n }\n loader();\n request.send();\n ")]),_vm._v(" "),_c('h2',{staticClass:"col",staticStyle:{"margin-bottom":"20px"}},[_vm._v("CII Best Practices")]),_vm._v(" "),_vm._m(0)])} -__vue__options__.staticRenderFns = [function render () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"row"},[_c('div',{staticClass:"col-6",attrs:{"id":"CIIbp"}},[_c('div',{attrs:{"size":"total"}},[_c('img',{attrs:{"id":"CIIbadge"}}),_vm._v(" "),_c('p',{attrs:{"id":"CII"}})])]),_vm._v(" "),_c('div',{staticClass:"col-6",attrs:{"id":"CIIbp"}},[_c('div',{attrs:{"size":"total"}},[_c('img',{attrs:{"id":"CIIbadge2"}}),_vm._v(" "),_c('p',{attrs:{"id":"CII"}})])])])}] +__vue__options__.render = function render () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('section',[_c('h1',[_vm._v("Risk")]),_vm._v(" "),_c('div',{staticStyle:{"display":"inline-block"}},[_c('h2',{staticStyle:{"display":"inline-block","color":"black !important"},attrs:{"id":"base"}},[_vm._v(_vm._s(_vm.$store.state.baseRepo))]),_vm._v(" "),(_vm.$store.state.comparedRepos.length > 0)?_c('h2',{staticClass:"repolisting",staticStyle:{"display":"inline-block"}},[_vm._v(" compared to: ")]):_vm._e(),_vm._v(" "),_vm._l((_vm.$store.state.comparedRepos),function(repo,index){return _c('h2',{staticStyle:{"display":"inline-block"}},[_c('span',{staticClass:"repolisting",style:({ 'color': _vm.colors[index] }),attrs:{"id":"compared"}},[_vm._v(" "+_vm._s(repo)+" ")])])})],2),_vm._v(" "),_c('h2',{staticClass:"col",staticStyle:{"margin-bottom":"20px"}},[_vm._v("CII Best Practices")]),_vm._v(" "),_c('button',{staticStyle:{"border":"2px solid black","width":"100%"},attrs:{"id":"ciiBtn"}},[_vm._v("Retrieve CII information")]),_vm._v(" "),_vm._m(0)])} +__vue__options__.staticRenderFns = [function render () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticStyle:{"text-align":"center","width":"100%","display":"none"},attrs:{"id":"overcii"}},[_c('img',{staticClass:"col",staticStyle:{"width":"419px","height":"146px","margin-left":"auto","margin-right":"auto"},attrs:{"width":"200px","height":"200px","src":"https://i.ibb.co/n8f7NjX/CIITPARENT.png","href":"https://bestpractices.coreinfrastructure.org/en"}}),_vm._v(" "),_c('br'),_vm._v(" "),_c('div',{staticClass:"col-6",staticStyle:{"margin-left":"auto","margin-right":"auto","margin-top":"20px"},attrs:{"id":"CIIbp"}},[_c('div',{attrs:{"size":"total"}},[_c('img',{staticStyle:{"transform":"scale(2)"},attrs:{"id":"CIIbadge"}}),_vm._v(" "),_c('br'),_vm._v(" "),_c('h2',{attrs:{"id":"CII"}})])])])}] if (module.hot) {(function () { var hotAPI = require("vue-hot-reload-api") hotAPI.install(require("vue"), true) if (!hotAPI.compatible) return @@ -2189,6 +2281,230 @@ if (module.hot) {(function () { var hotAPI = require("vue-hot-reload-api") })()} }); +;require.register("components/TableView.vue", function(exports, require, module) { +;(function(){ +'use strict'; + +var _vueMultiselect = require('vue-multiselect'); + +var _vueMultiselect2 = _interopRequireDefault(_vueMultiselect); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +module.exports = { + components: { + Multiselect: _vueMultiselect2.default + }, + data: function data() { + return { + clipped: true, + drawer: true, + fixed: false, + items: [{ icon: 'bubble_chart', title: 'Inspire' }], + miniVariant: false, + right: true, + rightDrawer: false, + title: 'Vuetify.js', + dialog: false, + headers: [{ + text: 'Dessert (100g serving)', + align: 'left', + sortable: false, + value: 'name' + }, { text: 'Calories', value: 'calories' }, { text: 'Fat (g)', value: 'fat' }, { text: 'Carbs (g)', value: 'carbs' }, { text: 'Protein (g)', value: 'protein' }, { text: 'Actions', value: 'name', sortable: false }], + desserts: [], + editedIndex: -1, + editedItem: { + name: '', + calories: 0, + fat: 0, + carbs: 0, + protein: 0 + }, + defaultItem: { + name: '', + calories: 0, + fat: 0, + carbs: 0, + protein: 0 + }, + listPrimitive: null + }; + }, + + computed: { + formTitle: function formTitle() { + return this.editedIndex === -1 ? 'New Item' : 'Edit Item'; + } + }, + watch: { + dialog: function dialog(val) { + val || this.close(); + } + }, + mounted: function mounted() {}, + methods: { + initialise: function initialise(hamoni) { + var _this = this; + + hamoni.createList("vue-table", [{ + name: 'Frozen Yogurt', + calories: 159, + fat: 6.0, + carbs: 24, + protein: 4.0 + }, { + name: 'Ice cream sandwich', + calories: 237, + fat: 9.0, + carbs: 37, + protein: 4.3 + }, { + name: 'Eclair', + calories: 262, + fat: 16.0, + carbs: 23, + protein: 6.0 + }]).then(function (primitive) { + _this.listPrimitive = primitive; + _this.desserts = _this.listPrimitive.getAll(); + _this.subscribeToUpdate(); + }).catch(alert); + }, + subscribeToUpdate: function subscribeToUpdate() { + var _this2 = this; + + this.listPrimitive.onItemAdded(function (item) { + _this2.desserts.push(item.value); + }); + this.listPrimitive.onItemUpdated(function (item) { + _this2.desserts.splice(item.index, 1, item.value); + }); + this.listPrimitive.onItemRemoved(function (item) { + _this2.desserts.splice(item.index, 1); + }); + }, + editItem: function editItem(item) { + this.editedIndex = this.desserts.indexOf(item); + this.editedItem = Object.assign({}, item); + this.dialog = true; + }, + deleteItem: function deleteItem(item) { + var index = this.desserts.indexOf(item); + confirm('Are you sure you want to delete this item?') && this.listPrimitive.remove(index); + }, + close: function close() { + var _this3 = this; + + this.dialog = false; + setTimeout(function () { + _this3.editedItem = Object.assign({}, _this3.defaultItem); + _this3.editedIndex = -1; + }, 300); + }, + save: function save() { + if (this.editedIndex > -1) { + this.listPrimitive.update(this.editedIndex, this.editedItem); + } else { + this.listPrimitive.add(this.editedItem); + } + this.close(); + } + } +}; +})() +if (module.exports.__esModule) module.exports = module.exports.default +var __vue__options__ = (typeof module.exports === "function"? module.exports.options: module.exports) +if (__vue__options__.functional) {console.error("[vueify] functional components are not supported and should be defined in plain js files using render functions.")} +__vue__options__.render = function render () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('v-dialog',{attrs:{"max-width":"500px"},model:{value:(_vm.dialog),callback:function ($$v) {_vm.dialog=$$v},expression:"dialog"}},[_c('v-btn',{staticClass:"mb-2",attrs:{"slot":"activator","color":"primary","dark":""},slot:"activator"},[_vm._v("New Item")]),_vm._v(" "),_c('v-card',[_c('v-card-title',[_c('span',{staticClass:"headline"},[_vm._v(_vm._s(_vm.formTitle))])]),_vm._v(" "),_c('v-card-text',[_c('v-container',{attrs:{"grid-list-md":""}},[_c('v-layout',{attrs:{"wrap":""}},[_c('v-flex',{attrs:{"xs12":"","sm6":"","md4":""}},[_c('v-text-field',{attrs:{"label":"Dessert name"},model:{value:(_vm.editedItem.name),callback:function ($$v) {_vm.$set(_vm.editedItem, "name", $$v)},expression:"editedItem.name"}})],1),_vm._v(" "),_c('v-flex',{attrs:{"xs12":"","sm6":"","md4":""}},[_c('v-text-field',{attrs:{"label":"Calories"},model:{value:(_vm.editedItem.calories),callback:function ($$v) {_vm.$set(_vm.editedItem, "calories", $$v)},expression:"editedItem.calories"}})],1),_vm._v(" "),_c('v-flex',{attrs:{"xs12":"","sm6":"","md4":""}},[_c('v-text-field',{attrs:{"label":"Fat (g)"},model:{value:(_vm.editedItem.fat),callback:function ($$v) {_vm.$set(_vm.editedItem, "fat", $$v)},expression:"editedItem.fat"}})],1),_vm._v(" "),_c('v-flex',{attrs:{"xs12":"","sm6":"","md4":""}},[_c('v-text-field',{attrs:{"label":"Carbs (g)"},model:{value:(_vm.editedItem.carbs),callback:function ($$v) {_vm.$set(_vm.editedItem, "carbs", $$v)},expression:"editedItem.carbs"}})],1),_vm._v(" "),_c('v-flex',{attrs:{"xs12":"","sm6":"","md4":""}},[_c('v-text-field',{attrs:{"label":"Protein (g)"},model:{value:(_vm.editedItem.protein),callback:function ($$v) {_vm.$set(_vm.editedItem, "protein", $$v)},expression:"editedItem.protein"}})],1)],1)],1)],1),_vm._v(" "),_c('v-card-actions',[_c('v-spacer'),_vm._v(" "),_c('v-btn',{attrs:{"color":"blue darken-1","flat":""},nativeOn:{"click":function($event){return _vm.close($event)}}},[_vm._v("Cancel")]),_vm._v(" "),_c('v-btn',{attrs:{"color":"blue darken-1","flat":""},nativeOn:{"click":function($event){return _vm.save($event)}}},[_vm._v("Save")])],1)],1)],1),_vm._v(" "),_c('v-data-table',{staticClass:"elevation-1",attrs:{"headers":_vm.headers,"items":_vm.desserts,"hide-actions":""},scopedSlots:_vm._u([{key:"items",fn:function(props){return [_c('td',[_vm._v(_vm._s(props.item.name))]),_vm._v(" "),_c('td',{staticClass:"text-xs-right"},[_vm._v(_vm._s(props.item.calories))]),_vm._v(" "),_c('td',{staticClass:"text-xs-right"},[_vm._v(_vm._s(props.item.fat))]),_vm._v(" "),_c('td',{staticClass:"text-xs-right"},[_vm._v(_vm._s(props.item.carbs))]),_vm._v(" "),_c('td',{staticClass:"text-xs-right"},[_vm._v(_vm._s(props.item.protein))]),_vm._v(" "),_c('td',{staticClass:"justify-center layout px-0"},[_c('v-btn',{staticClass:"mx-0",attrs:{"icon":""},on:{"click":function($event){_vm.editItem(props.item)}}},[_c('v-icon',{attrs:{"color":"teal"}},[_vm._v("edit")])],1),_vm._v(" "),_c('v-btn',{staticClass:"mx-0",attrs:{"icon":""},on:{"click":function($event){_vm.deleteItem(props.item)}}},[_c('v-icon',{attrs:{"color":"pink"}},[_vm._v("delete")])],1)],1)]}}])})],1)} +__vue__options__.staticRenderFns = [] +if (module.hot) {(function () { var hotAPI = require("vue-hot-reload-api") + hotAPI.install(require("vue"), true) + if (!hotAPI.compatible) return + module.hot.accept() + if (!module.hot.data) { + hotAPI.createRecord("data-v-6147dc76", __vue__options__) + } else { + hotAPI.reload("data-v-6147dc76", __vue__options__) + } +})()} +}); + +;require.register("components/Tabs.vue", function(exports, require, module) { +;(function(){ +'use strict'; + +module.exports = { + props: ['owner', 'repo', 'comparedowner', 'comparedrepo', 'groupid'], + computed: { + gitRepo: function gitRepo() { + return this.$store.state.gitRepo; + }, + currentTab: function currentTab() { + return this.$store.state.tab; + }, + baseRepo: function baseRepo() { + return this.$store.state.baseRepo; + }, + comparedRepos: function comparedRepos() { + return this.$store.state.comparedRepos; + } + }, + methods: { + changeTab: function changeTab(e) { + console.log("changing tab to: ", e.target.dataset.value); + this.$store.commit('setTab', { + tab: e.target.dataset.value + }); + if (this.$store.state.comparedRepos.length == 1) { + var owner = this.gitRepo ? null : this.baseRepo.split('/')[0]; + var repo = this.gitRepo ? this.gitRepo : this.baseRepo.split('/')[1]; + var comparedowner = this.comparedRepos[0].split('/').length > 2 ? null : this.comparedRepos[0].split('/')[0]; + var comparedrepo = this.comparedRepos[0].split('/').length > 2 ? this.comparedRepos[0] : this.comparedRepos[0].split('/')[1]; + var name = e.target.dataset['value'] + "compare"; + this.$router.push({ + name: name, + params: { owner: owner, repo: repo, comparedowner: comparedowner, comparedrepo: comparedrepo } + }); + } else if (this.$store.state.comparedRepos.length > 1) { + var groupid = this.gitRepo ? String(this.gitRepo) + '+' : String(state.baseRepo) + "+"; + this.comparedRepos.forEach(function (repo) { + groupid += String(repo) + '+'; + }); + var _name = e.target.dataset['value'] + "group"; + this.$router.push({ + name: _name, + params: { groupid: groupid } + }); + } else { + var _owner = this.gitRepo ? null : this.baseRepo.split('/')[0]; + var _repo = this.gitRepo ? this.gitRepo : this.baseRepo.split('/')[1]; + this.$router.push({ + name: e.target.dataset['value'], + params: { owner: _owner, repo: _repo } + }); + } + } + } +}; +})() +if (module.exports.__esModule) module.exports = module.exports.default +var __vue__options__ = (typeof module.exports === "function"? module.exports.options: module.exports) +if (__vue__options__.functional) {console.error("[vueify] functional components are not supported and should be defined in plain js files using render functions.")} +__vue__options__.render = function render () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('nav',{staticClass:"tabs"},[_c('ul',[_c('li',{class:{ active: (_vm.currentTab == 'gmd') }},[_c('a',{attrs:{"href":"#","data-value":"gmd"},on:{"click":_vm.changeTab}},[_vm._v("Growth, Maturity, and Decline")])]),_vm._v(" "),_c('li',{class:{ active: (_vm.currentTab == 'diversityinclusion') }},[_c('a',{attrs:{"href":"#","data-value":"diversityinclusion"},on:{"click":_vm.changeTab}},[_vm._v("Diversity and Inclusion")])]),_vm._v(" "),_c('li',{class:{ active: (_vm.currentTab == 'risk') }},[_c('a',{attrs:{"href":"#","data-value":"risk"},on:{"click":_vm.changeTab}},[_vm._v("Risk")])]),_vm._v(" "),_c('li',{class:{ active: (_vm.currentTab == 'value') }},[_c('a',{attrs:{"href":"#","data-value":"value"},on:{"click":_vm.changeTab}},[_vm._v("Value")])]),_vm._v(" "),_c('li',{class:{ active: (_vm.currentTab == 'activity') }},[_c('a',{attrs:{"href":"#","data-value":"activity"},on:{"click":_vm.changeTab}},[_vm._v("Activity")])]),_vm._v(" "),_c('li',{class:{ active: (_vm.currentTab == 'experimental') }},[_c('a',{attrs:{"href":"#","data-value":"experimental"},on:{"click":_vm.changeTab}},[_vm._v("Experimental")])]),_vm._v(" "),_c('li',{class:{ active: (_vm.currentTab == 'git'), hidden: !_vm.gitRepo }},[_c('a',{attrs:{"href":"#","data-value":"git"},on:{"click":_vm.changeTab}},[_vm._v("Git")])])])])} +__vue__options__.staticRenderFns = [] +if (module.hot) {(function () { var hotAPI = require("vue-hot-reload-api") + hotAPI.install(require("vue"), true) + if (!hotAPI.compatible) return + module.hot.accept() + if (!module.hot.data) { + hotAPI.createRecord("data-v-004f2c6b", __vue__options__) + } else { + hotAPI.reload("data-v-004f2c6b", __vue__options__) + } +})()} +}); + ;require.register("components/ValueCard.vue", function(exports, require, module) { ;(function(){ 'use strict'; @@ -2653,7 +2969,8 @@ exports.default = { detail: this.$store.state.showDetail, compRepos: this.$store.state.comparedRepos, metricSource: null, - timeperiod: 'all' + timeperiod: 'all', + forceRecomputeCounter: 0 }; }, @@ -2672,7 +2989,13 @@ exports.default = { $(this.$el).find('.spacing').removeClass('hidden'); } }, - mounted: function mounted() {}, + beforeUpdate: function beforeUpdate() { + this.$store.watch(function (state) { + console.log("WORKED"); + this.thisShouldTriggerRecompute(); + return; + }); + }, computed: { repo: function repo() { @@ -2711,6 +3034,8 @@ exports.default = { spec: function spec() { var _this = this; + this.forceRecomputeCounter; + var repos = []; if (this.repo) { if (window.AugurRepos[this.repo]) repos.push(window.AugurRepos[this.repo]);else if (this.domain) { @@ -3366,6 +3691,9 @@ exports.default = { } }, methods: { + thisShouldTriggerRecompute: function thisShouldTriggerRecompute() { + this.forceRecomputeCounter++; + }, downloadSVG: function downloadSVG(e) { var svgsaver = new window.SvgSaver(); var svg = window.$(this.$refs.holder).find('svg')[0]; @@ -7143,35 +7471,306 @@ var _vueRouter = require('vue-router'); var _vueRouter2 = _interopRequireDefault(_vueRouter); -var _AugurCards = require('../components/AugurCards.vue'); - -var _AugurCards2 = _interopRequireDefault(_AugurCards); - var _MetricsStatusCard = require('../components/MetricsStatusCard.vue'); var _MetricsStatusCard2 = _interopRequireDefault(_MetricsStatusCard); -var _GitCard = require('../components/GitCard.vue'); +var _BaseRepoActivityCard = require('../components/BaseRepoActivityCard.vue'); + +var _BaseRepoActivityCard2 = _interopRequireDefault(_BaseRepoActivityCard); + +var _BaseRepoEcosystemCard = require('../components/BaseRepoEcosystemCard.vue'); + +var _BaseRepoEcosystemCard2 = _interopRequireDefault(_BaseRepoEcosystemCard); + +var _GrowthMaturityDeclineCard = require('../components/GrowthMaturityDeclineCard'); + +var _GrowthMaturityDeclineCard2 = _interopRequireDefault(_GrowthMaturityDeclineCard); + +var _RiskCard = require('../components/RiskCard'); + +var _RiskCard2 = _interopRequireDefault(_RiskCard); + +var _ValueCard = require('../components/ValueCard'); + +var _ValueCard2 = _interopRequireDefault(_ValueCard); + +var _DiversityInclusionCard = require('../components/DiversityInclusionCard'); + +var _DiversityInclusionCard2 = _interopRequireDefault(_DiversityInclusionCard); + +var _GitCard = require('../components/GitCard'); var _GitCard2 = _interopRequireDefault(_GitCard); -var _ExperimentalCard = require('../components/ExperimentalCard.vue'); +var _OverviewCard = require('../components/OverviewCard.vue'); + +var _OverviewCard2 = _interopRequireDefault(_OverviewCard); + +var _ExperimentalCard = require('../components/ExperimentalCard'); var _ExperimentalCard2 = _interopRequireDefault(_ExperimentalCard); -var _GrowthMaturityDeclineCard = require('../components/GrowthMaturityDeclineCard.vue'); +var _DownloadedReposCard = require('../components/DownloadedReposCard.vue'); -var _GrowthMaturityDeclineCard2 = _interopRequireDefault(_GrowthMaturityDeclineCard); +var _DownloadedReposCard2 = _interopRequireDefault(_DownloadedReposCard); + +var _LoginForm = require('../components/LoginForm'); + +var _LoginForm2 = _interopRequireDefault(_LoginForm); + +var _AugurCards = require('../components/AugurCards.vue'); + +var _AugurCards2 = _interopRequireDefault(_AugurCards); + +var _MainControls = require('../components/MainControls.vue'); + +var _MainControls2 = _interopRequireDefault(_MainControls); + +var _AugurHeader = require('../components/AugurHeader.vue'); + +var _AugurHeader2 = _interopRequireDefault(_AugurHeader); + +var _Tabs = require('../components/Tabs.vue'); + +var _Tabs2 = _interopRequireDefault(_Tabs); + +var _TableView = require('../components/TableView.vue'); + +var _TableView2 = _interopRequireDefault(_TableView); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var routes = [{ path: '/', component: _AugurCards2.default }, { path: '/metrics_status', component: _MetricsStatusCard2.default }, -// {path: '/:tab/:owner/:repo', component: AugurCards, name: 'single'}, -{ path: '/single/:tab/:owner?/:repo', component: _AugurCards2.default, name: 'single', props: true, canReuse: false }, { path: '/singlegit/:tab/:repo', component: _AugurCards2.default, name: 'singlegit', props: true, canReuse: false }, +var routes = [{ path: '/', component: _AugurCards2.default, + children: [{ + path: "", + name: "reposcard", + components: { + header: _AugurHeader2.default, + content: _DownloadedReposCard2.default + } + }] +}, { path: '/login', component: _LoginForm2.default }, { path: '/metrics_status', + components: { + header: _AugurHeader2.default, + content: _MainControls2.default + } +}, { path: '/single/:owner?/:repo', name: 'single', props: true, canReuse: false, component: _AugurCards2.default, + children: [{ + path: "gmd", + name: "gmd", + components: { + header: _AugurHeader2.default, + tabs: _Tabs2.default, + controls: _MainControls2.default, + content: _GrowthMaturityDeclineCard2.default + } + }, { + path: "diversityinclusion", + name: "diversityinclusion", + components: { + header: _AugurHeader2.default, + tabs: _Tabs2.default, + controls: _MainControls2.default, + content: _DiversityInclusionCard2.default + } + }, { + path: "risk", + name: "risk", + components: { + header: _AugurHeader2.default, + tabs: _Tabs2.default, + controls: _MainControls2.default, + content: _RiskCard2.default + } + }, { + path: "activity", + name: "activity", + components: { + header: _AugurHeader2.default, + tabs: _Tabs2.default, + controls: _MainControls2.default, + content: _BaseRepoActivityCard2.default + } + }, { + path: "value", + name: "value", + components: { + header: _AugurHeader2.default, + tabs: _Tabs2.default, + controls: _MainControls2.default, + content: _ValueCard2.default + } + }, { + path: "experimental", + name: "experimental", + components: { + header: _AugurHeader2.default, + tabs: _Tabs2.default, + controls: _MainControls2.default, + content: _ExperimentalCard2.default + } + }, { + path: "git", + name: "git", + components: { + header: _AugurHeader2.default, + tabs: _Tabs2.default, + controls: _MainControls2.default, + content: _GitCard2.default + } + }, { + path: "overview", + name: "overview", + components: { + header: _AugurHeader2.default, + tabs: _Tabs2.default, + controls: _MainControls2.default, + content: _OverviewCard2.default + } + }] +}, // {path: '/:tab/:domain/:owner/:repo/comparedto/:comparedowner/:comparedrepo', component: AugurCards, name: 'gitsinglecompare'}, -{ path: '/compare/:tab/:owner?/:repo/:domain?/comparedto/:comparedowner/:comparedrepo/:compareddomain?', component: _AugurCards2.default, name: 'singlecompare', props: true, canReuse: false }, -// {path: '/:tab/:owner/:repo/comparedto/:comparedowner/:comparedrepo', component: AugurCards, name: 'singlecompare'}, -{ path: '/groupcompare/:tab/:groupid', component: _AugurCards2.default, name: 'group', props: true, canReuse: false }]; +{ path: '/compare/:owner?/:repo/comparedto/:comparedowner/:comparedrepo', component: _AugurCards2.default, name: 'singlecompare', props: true, canReuse: false, + children: [{ + path: "gmd", + name: "gmdcompare", + components: { + header: _AugurHeader2.default, + tabs: _Tabs2.default, + controls: _MainControls2.default, + content: _GrowthMaturityDeclineCard2.default + } + }, { + path: "diversityinclusion", + name: "diversityinclusioncompare", + components: { + header: _AugurHeader2.default, + tabs: _Tabs2.default, + controls: _MainControls2.default, + content: _DiversityInclusionCard2.default + } + }, { + path: "risk", + name: "riskcompare", + components: { + header: _AugurHeader2.default, + tabs: _Tabs2.default, + controls: _MainControls2.default, + content: _RiskCard2.default + } + }, { + path: "value", + name: "valuecompare", + components: { + header: _AugurHeader2.default, + tabs: _Tabs2.default, + controls: _MainControls2.default, + content: _ValueCard2.default + } + }, { + path: "activity", + name: "activitycompare", + components: { + header: _AugurHeader2.default, + tabs: _Tabs2.default, + controls: _MainControls2.default, + content: _BaseRepoActivityCard2.default + } + }, { + path: "experimental", + name: "experimentalcompare", + components: { + header: _AugurHeader2.default, + tabs: _Tabs2.default, + controls: _MainControls2.default, + content: _ExperimentalCard2.default + } + }, { + path: "git", + name: "gitcompare", + components: { + header: _AugurHeader2.default, + tabs: _Tabs2.default, + controls: _MainControls2.default, + content: _GitCard2.default + } + }] +}, { path: '/groupcompare/:groupid', component: _AugurCards2.default, name: 'group', props: true, canReuse: false, + children: [{ + path: "gmd", + name: "gmdgroup", + components: { + header: _AugurHeader2.default, + tabs: _Tabs2.default, + controls: _MainControls2.default, + content: _GrowthMaturityDeclineCard2.default + } + }, { + path: "diversityinclusion", + name: "diversityinclusiongroup", + components: { + header: _AugurHeader2.default, + tabs: _Tabs2.default, + controls: _MainControls2.default, + content: _DiversityInclusionCard2.default + } + }, { + path: "risk", + name: "riskgroup", + components: { + header: _AugurHeader2.default, + tabs: _Tabs2.default, + controls: _MainControls2.default, + content: _RiskCard2.default + } + }, { + path: "value", + name: "valuegroup", + components: { + header: _AugurHeader2.default, + tabs: _Tabs2.default, + controls: _MainControls2.default, + content: _ValueCard2.default + } + }, { + path: "activity", + name: "activitygroup", + components: { + header: _AugurHeader2.default, + tabs: _Tabs2.default, + controls: _MainControls2.default, + content: _BaseRepoActivityCard2.default + } + }, { + path: "experimental", + name: "experimentalgroup", + components: { + header: _AugurHeader2.default, + tabs: _Tabs2.default, + controls: _MainControls2.default, + content: _ExperimentalCard2.default + } + }, { + path: "git", + name: "gitgroup", + components: { + header: _AugurHeader2.default, + tabs: _Tabs2.default, + controls: _MainControls2.default, + content: _GitCard2.default + } + }, { + path: "overview", + name: "overviewgroup", + components: { + header: _AugurHeader2.default, + tabs: _Tabs2.default, + controls: _MainControls2.default, + content: _OverviewCard2.default + } + }] +}]; var downloadedRepos = [], repos = [], projects = []; From 01a4118f9aa56a55584ffc15842a293999db6d01 Mon Sep 17 00:00:00 2001 From: gabe-heim Date: Mon, 4 Mar 2019 17:47:27 -0600 Subject: [PATCH 02/21] fix date option shwing wrong month bug --- frontend/app/components/MainControls.vue | 7 +++---- frontend/package-lock.json | 4 +++- frontend/public/app.js | 9 ++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/frontend/app/components/MainControls.vue b/frontend/app/components/MainControls.vue index db74891ac7..02f7d4bbfc 100644 --- a/frontend/app/components/MainControls.vue +++ b/frontend/app/components/MainControls.vue @@ -270,9 +270,9 @@ onStartDateChange (e) { var date = null // Date.parse((this.$refs.startMonth.value + "/01/" + this.$refs.startYear.value)) - console.log("again", e.target.value) if (e.target.value > 12) { - date = Date.parse((this.startMonth + "/01/" + e.target.value)) + console.log(this.startMonth) + date = Date.parse(((parseInt(this.startMonth)+1).toString() + "/01/" + e.target.value)) } else { let month = (parseInt(e.target.value) + 1).toString() date = Date.parse((month + "/01/" + this.startYear)) @@ -290,9 +290,8 @@ onEndDateChange (e) { var date = null // Date.parse((this.$refs.startMonth.value + "/01/" + this.$refs.startYear.value)) - console.log("again", e.target.value) if (e.target.value > 12) { - date = Date.parse((this.endMonth + "/01/" + e.target.value)) + date = Date.parse(((parseInt(this.endMonth)+1).toString() + "/01/" + e.target.value)) } else { let month = (parseInt(e.target.value) + 1).toString() console.log() diff --git a/frontend/package-lock.json b/frontend/package-lock.json index cae437a90f..cf7adec549 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -2931,7 +2931,8 @@ "version": "2.1.1", "resolved": false, "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true + "dev": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -3445,6 +3446,7 @@ "resolved": false, "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } diff --git a/frontend/public/app.js b/frontend/public/app.js index 70fcec0349..19034a45c9 100644 --- a/frontend/public/app.js +++ b/frontend/public/app.js @@ -1256,7 +1256,7 @@ if (module.hot) {(function () { var hotAPI = require("vue-hot-reload-api") if (!module.hot.data) { hotAPI.createRecord("data-v-78eb2940", __vue__options__) } else { - hotAPI.rerender("data-v-78eb2940", __vue__options__) + hotAPI.reload("data-v-78eb2940", __vue__options__) } })()} }); @@ -1847,9 +1847,9 @@ module.exports = { var date = null; - console.log("again", e.target.value); if (e.target.value > 12) { - date = Date.parse(this.startMonth + "/01/" + e.target.value); + console.log(this.startMonth); + date = Date.parse((parseInt(this.startMonth) + 1).toString() + "/01/" + e.target.value); } else { var month = (parseInt(e.target.value) + 1).toString(); date = Date.parse(month + "/01/" + this.startYear); @@ -1869,9 +1869,8 @@ module.exports = { var date = null; - console.log("again", e.target.value); if (e.target.value > 12) { - date = Date.parse(this.endMonth + "/01/" + e.target.value); + date = Date.parse((parseInt(this.endMonth) + 1).toString() + "/01/" + e.target.value); } else { var month = (parseInt(e.target.value) + 1).toString(); console.log(); From 4e271e877536d55dffa1bfc8e7bef8cfdbb9ae24 Mon Sep 17 00:00:00 2001 From: Robert Lincoln Truesdale III <31676518+tretrue@users.noreply.github.com> Date: Wed, 6 Mar 2019 13:09:55 -0600 Subject: [PATCH 03/21] update labels in more configurations menu --- augur/datasources/facade/facade.py | 606 +- augur/datasources/facade/facade.py.py | 210 + frontend/app/components/AugurCards.vue | 153 +- frontend/app/components/BaseRepoDashboard.vue | 8 + frontend/app/components/MainControls.vue | 21 +- frontend/app/components/YourProjects.vue | 39 + frontend/app/styles/ghdata.styl | 166 + frontend/app/styles/ghdata.styl.styl | 1310 +++ frontend/public/app.css | 2636 +++++ frontend/public/app.css.css | 3891 ++++++++ frontend/public/app.css.map | 1 + frontend/public/app.js | 586 +- frontend/public/app.js.js | 8466 +++++++++++++++++ frontend/public/app.js.map | 1 + package-lock.json | 1482 +-- package-lock.json.json | 1207 +++ 16 files changed, 19508 insertions(+), 1275 deletions(-) create mode 100644 augur/datasources/facade/facade.py.py create mode 100644 frontend/app/components/BaseRepoDashboard.vue create mode 100644 frontend/app/components/YourProjects.vue create mode 100644 frontend/app/styles/ghdata.styl.styl create mode 100644 frontend/public/app.css.css create mode 100644 frontend/public/app.css.map create mode 100644 frontend/public/app.js.js create mode 100644 frontend/public/app.js.map create mode 100644 package-lock.json.json diff --git a/augur/datasources/facade/facade.py b/augur/datasources/facade/facade.py index 6b4ca184c2..0bdb704fb4 100644 --- a/augur/datasources/facade/facade.py +++ b/augur/datasources/facade/facade.py @@ -144,542 +144,90 @@ def commits_by_week(self, repo_url): """) results = pd.read_sql(commitsByMonthSQL, self.db, params={"repourl": '%{}%'.format(repo_url)}) return results - - - # cd - code - # rg - repo group - # tp - time period (fixed time period) - # interval - # ranked - ordered top to bottom - # commits - # loc - lines of code - # rep - repo - # ua - unaffiliated - - @annotate(tag='cd-rg-newrep-ranked-commits') - def cd_rg_newrep_ranked_commits(self, repo_url, calendar_year=None, repo_group=None): + @annotate(tag='top-new-repos-this-year-commits') + def top_new_repos_this_year_commits(self, repo_url): """ - For each repository in a collection of repositories being managed, each REPO that first appears in the parameterized - calendar year (a new repo in that year), - show all commits for that year (total for year by repo). - Result ranked from highest number of commits to lowest by default. - :param repo_url: the repository's URL - :param calendar_year: the calendar year a repo is created in to be considered "new" - :param repo_group: the group of repositories to analyze + Returns top new repos this year by commits + :param limit: number of repos the user wishes to display """ - if calendar_year == None: - calendar_year = 'year' - - if repo_group == None: - repo_group = 'facade_project' - - cdRgNewrepRankedCommitsSQL = None - - if repo_group == 'facade_project': - cdRgNewrepRankedCommitsSQL = s.sql.text(""" - SELECT repos_id, sum(cast(repo_monthly_cache.added as signed) - cast(removed as signed) - cast(whitespace as signed)) as net, patches, projects.name - FROM repo_monthly_cache, projects, repos - where projects.name = (SELECT projects.name FROM repos, projects - WHERE git LIKE :repourl - and repos.projects_id = projects.id - and YEAR(repos.added) = YEAR(CURDATE()) - LIMIT 1) - and repo_annual_cache.repos_id = repos.id - and repos.projects_id = projects.id - group by repos_id - ORDER BY net desc - LIMIT 10 - """) - else: - cdRgNewrepRankedCommitsSQL = s.sql.text(""" - SELECT repos_id, sum(cast(repo_monthly_cache.added as signed) - cast(removed as signed) - cast(whitespace as signed)) as net, patches, projects.name - FROM repo_monthly_cache, projects, repos - where projects.name = :repo_group - and repo_annual_cache.repos_id = repos.id - and repos.projects_id = projects.id - group by repos_id - ORDER BY net desc - LIMIT 10 - """) - results = pd.read_sql(cdRgNewrepRankedCommitsSQL, self.db, params={"repourl": '%{}%'.format(repo_url), "repo_group": repo_group}) + + topNewReposCommits = s.sql.text(""" + SELECT repos_id, sum(cast(repo_annual_cache.added as signed) - cast(removed as signed) - cast(whitespace as signed)) as net, patches, projects.name + FROM repo_annual_cache, projects, repos + where projects.name = (SELECT projects.name FROM repos, projects + WHERE git LIKE :repourl + and repos.projects_id = projects.id + and YEAR(repos.added) = YEAR(CURDATE()) + LIMIT 1) + and repo_annual_cache.repos_id = repos.id + and repos.projects_id = projects.id + group by repos_id + ORDER BY net desc + LIMIT 10 + """) + results = pd.read_sql(topNewReposCommits, self.db, params={"repourl": '%{}%'.format(repo_url)}) return results - - @annotate(tag='cd-rg-newrep-ranked-loc') - def cd_rg_newrep_ranked_loc(self, repo_url, calendar_year=None, repo_group=None): + @annotate(tag='top-new-repos-this-year-lines-of-code') + def top_new_repos_this_year_lines_of_code(self, repo_url): """ - For each repository in a collection of repositories being managed, each REPO that first appears in the parameterized - calendar year (a new repo in that year), - show all lines of code for that year (total for year by repo). Result ranked from highest number of commits to lowest by default. - :param repo_url: the repository's URL - :param calendar_year: the calendar year a repo is created in to be considered "new" - :param repo_group: the group of repositories to analyze + Returns top new repos this year by lines of code + :param limit: number of repos the user wishes to display """ - - if calendar_year == None: - calendar_year = 'year' - - if repo_group == None: - repo_group = 'facade_project' - - cdRgNewrepRankedLocSQL = None - if repo_group == 'facade_project': - if timeframe == 'year': - cdRgNewrepRankedLocSQL = s.sql.text(""" - SELECT repos_id, sum(cast(repo_annual_cache.added as signed) - cast(removed as signed) - cast(whitespace as signed)) as net, patches, projects.name - FROM repo_annual_cache, projects, repos - where projects.name = (SELECT projects.name FROM repos, projects - WHERE git LIKE :repourl - and YEAR(repos.added) = YEAR(CURDATE()) - and repos.projects_id = projects.id - LIMIT 1) - and repo_annual_cache.repos_id = repos.id - and repos.projects_id = projects.id - group by repos_id - ORDER BY net desc - LIMIT 10 - """) - elif timeframe == 'month': - cdRgNewrepRankedLocSQL = s.sql.text(""" - SELECT repos_id, sum(cast(repo_annual_cache.added as signed) - cast(removed as signed) - cast(whitespace as signed)) as net, patches, projects.name - FROM repo_annual_cache, projects, repos - where projects.name = (SELECT projects.name FROM repos, projects - WHERE git LIKE :repourl - and MONTH(repos.added) = MONTH(CURDATE()) - and repos.projects_id = projects.id - LIMIT 1) - and repo_monthly_cache.repos_id = repos.id - and repos.projects_id = projects.id - group by repos_id - ORDER BY net desc - LIMIT 10 - """) - else: - if timeframe == 'year': - cdRgNewrepRankedLocSQL = s.sql.text(""" - SELECT repos_id, sum(cast(repo_annual_cache.added as signed) - cast(removed as signed) - cast(whitespace as signed)) as net, patches, projects.name - FROM repo_annual_cache, projects, repos - where projects.name = :repo_group - and repos.projects_id = projects.id - LIMIT 1) - and repo_annual_cache.repos_id = repos.id - and repos.projects_id = projects.id - group by repos_id - ORDER BY net desc - LIMIT 10 - """) - elif timeframe == 'month': - cdRgNewrepRankedLocSQL = s.sql.text(""" - SELECT repos_id, sum(cast(repo_annual_cache.added as signed) - cast(removed as signed) - cast(whitespace as signed)) as net, patches, projects.name - FROM repo_annual_cache, projects, repos - where projects.name = :repo_group - and repo_monthly_cache.repos_id = repos.id - and repos.projects_id = projects.id - group by repos_id - ORDER BY net desc - LIMIT 10 - """) - - results = pd.read_sql(cdRgNewrepRankedLocSQL, self.db, params={"repourl": '%{}%'.format(repo_url), "repo_group": repo_group}) + topNewReposLines = s.sql.text(""" + SELECT repos_id, sum(cast(repo_annual_cache.added as signed) - cast(removed as signed) - cast(whitespace as signed)) as net, patches, projects.name + FROM repo_annual_cache, projects, repos + where projects.name = (SELECT projects.name FROM repos, projects + WHERE git LIKE :repourl + and YEAR(repos.added) = YEAR(CURDATE()) + and repos.projects_id = projects.id + LIMIT 1) + and repo_annual_cache.repos_id = repos.id + and repos.projects_id = projects.id + group by repos_id + ORDER BY net desc + LIMIT 10 + """) + results = pd.read_sql(topNewReposLines, self.db, params={"repourl": '%{}%'.format(repo_url)}) return results - - @annotate(tag='cd-rg-tp-ranked-commits') - def cd_rg_tp_ranked_commits(self, repo_url, timeframe=None, repo_group=None): + @annotate(tag='top-repos-all-time-commits') + def top_repos_all_time_commits(self, repo_url): """ - For each repository in a collection of repositories being managed, each REPO's total commits during the current Month, - Year or Week. Result ranked from highest number of commits to lowest by default. - :param repo_url: the repository's URL - :param timeframe: Year, month, or week. Contribution data from the timeframe that the current date is within will be considered - :param repo_group: the group of repositories to analyze + Returns top new repos of all time by commits + :param limit: number of repos the user wishes to display """ - if repo_group == None: - repo_group = 'facade_project' - - if timeframe == None: - timeframe = 'year' - - cdRgTpRankedCommitsSQL = None - - if repo_group == 'facade_project': - if timeframe == "year": - cdRgTpRankedCommitsSQL = s.sql.text(""" - SELECT repos_id, repos.name as name, sum(cast(repo_annual_cache.added as signed) - cast(removed as signed) - cast(whitespace as signed)) as net, patches - FROM repo_annual_cache, projects, repos - where projects.name = (SELECT projects.name FROM repos, projects - WHERE git LIKE :repourl - and repos.projects_id = projects.id - LIMIT 1) - and repo_annual_cache.repos_id = repos.id - and repos.projects_id = projects.id - group by repos_id - ORDER BY net desc - LIMIT 10 - """) - elif timeframe == 'month': - cdRgTpRankedCommitsSQL = s.sql.text(""" - SELECT repos_id, repos.name as name, sum(cast(repo_annual_cache.added as signed) - cast(removed as signed) - cast(whitespace as signed)) as net, patches - FROM repo_annual_cache, projects, repos - where projects.name = (SELECT projects.name FROM repos, projects - WHERE git LIKE :repourl - and repos.projects_id = projects.id - LIMIT 1) - and repo_annual_cache.repos_id = repos.id - and repos.projects_id = projects.id - group by repos_id - ORDER BY net desc - LIMIT 10 - """) - else: - if timeframe == "year": - cdRgTpRankedCommitsSQL = s.sql.text(""" - SELECT repos_id, repos.name as name, sum(cast(repo_annual_cache.added as signed) - cast(removed as signed) - cast(whitespace as signed)) as net, patches - FROM repo_annual_cache, projects, repos - where projects.name = :repo_group - and repo_annual_cache.repos_id = repos.id - and repos.projects_id = projects.id - group by repos_id - ORDER BY net desc - LIMIT 10 - """) - elif timeframe == 'month': - cdRgTpRankedCommitsSQL = s.sql.text(""" - SELECT repos_id, repos.name as name, sum(cast(repo_annual_cache.added as signed) - cast(removed as signed) - cast(whitespace as signed)) as net, patches - FROM repo_annual_cache, projects, repos - where projects.name = :repo_group - and repo_annual_cache.repos_id = repos.id - and repos.projects_id = projects.id - group by repos_id - ORDER BY net desc - LIMIT 10 - """) - results = pd.read_sql(cdRgTpRankedCommitsSQL, self.db, params={"repourl": '%{}%'.format(repo_url), "repo_group": repo_group}) - return results - - @annotate(tag='cd-rg-tp-ranked-loc') - def cd_rg_tp_ranked_loc(self, repo_url, timeframe=None, repo_group=None): - """ - For each repository in a collection of repositories being managed, each REPO's total commits during the current Month, - Year or Week. Result ranked from highest number of LOC to lowest by default. - :param repo_url: the repository's URL - :param timeframe: Year, month, or week. Contribution data from the timeframe that the current date is within will be considered - :param repo_group: the group of repositories to analyze - """ - - if repo_group == None: - repo_group = 'facade_project' - - if timeframe == None: - timeframe = 'year' - - cdRgTpRankedLocSQL = None - - if repo_group == 'facade_project': - if timeframe == "year": - cdRgTpRankedLocSQL = s.sql.text(""" - SELECT repos_id, repos.name as name, sum(cast(repo_annual_cache.added as signed) - cast(removed as signed) - cast(whitespace as signed)) as net, patches - FROM repo_annual_cache, projects, repos - where projects.name = (SELECT projects.name FROM repos, projects - WHERE git LIKE :repourl - and repos.projects_id = projects.id - LIMIT 1) - and repo_annual_cache.repos_id = repos.id - and repos.projects_id = projects.id - group by repos_id - ORDER BY net desc - LIMIT 10 - """) - elif timeframe == 'month': - cdRgTpRankedLocSQL = s.sql.text(""" - SELECT repos_id, repos.name as name, sum(cast(repo_annual_cache.added as signed) - cast(removed as signed) - cast(whitespace as signed)) as net, patches - FROM repo_annual_cache, projects, repos - where projects.name = (SELECT projects.name FROM repos, projects - WHERE git LIKE :repourl - and repos.projects_id = projects.id - LIMIT 1) - and repo_annual_cache.repos_id = repos.id - and repos.projects_id = projects.id - group by repos_id - ORDER BY net desc - LIMIT 10 - """) - else: - if timeframe == "year": - cdRgTpRankedLocSQL = s.sql.text(""" - SELECT repos_id, repos.name as name, sum(cast(repo_annual_cache.added as signed) - cast(removed as signed) - cast(whitespace as signed)) as net, patches - FROM repo_annual_cache, projects, repos - where projects.name = :repo_group - and repo_annual_cache.repos_id = repos.id - and repos.projects_id = projects.id - group by repos_id - ORDER BY net desc - LIMIT 10 - """) - elif timeframe == 'month': - cdRgTpRankedLocSQL = s.sql.text(""" - SELECT repos_id, repos.name as name, sum(cast(repo_annual_cache.added as signed) - cast(removed as signed) - cast(whitespace as signed)) as net, patches - FROM repo_annual_cache, projects, repos - where projects.name = :repo_group - and repo_annual_cache.repos_id = repos.id - and repos.projects_id = projects.id - group by repos_id - ORDER BY net desc - LIMIT 10 - """) - results = pd.read_sql(cdRgTpRankedLocSQL, self.db, params={"repourl": '%{}%'.format(repo_url), "repo_group": repo_group}) - return results - - @annotate(tag='cd-rep-tp-interval-loc-commits') - def cd_rep_tp_interval_loc_commits(self, repo_url, calendar_year=None, interval=None): - """ - For a single repository, all the commits and lines of code occuring for the specified year, grouped by the specified interval (week or month) - - :param repo_url: the repository's URL - :param calendar_year: the calendar year a repo is created in to be considered "new" - :param interval: Month or week. The periodocity of which to examine data within the given calendar_year - """ - - if calendar_year == None: - calendar_year = 2019 - - if interval == None: - interval = 'month' - - cdRepTpIntervalLocCommitsSQL = None - - if interval == "month": - cdRepTpIntervalLocCommitsSQL = s.sql.text(""" - SELECT name, sum(cast(IFNULL(added, 0) as signed) - cast(IFNULL(removed, 0) as signed) - cast(IFNULL(whitespace, 0) as signed)) as net_lines_minus_whitespace, - sum(IFNULL(added, 0)) as added, sum(IFNULL(removed, 0)) as removed, sum(IFNULL(whitespace, 0)) as whitespace, - IFNULL(patches, 0) as commits, a.month, IFNULL(year, :calendar_year) as year - FROM (select month from repo_monthly_cache group by month) a - LEFT JOIN (SELECT name, repo_monthly_cache.added, removed, whitespace, patches, month, IFNULL(year, :calendar_year) as year - FROM repo_monthly_cache, repos - WHERE repos_id = (SELECT id FROM repos WHERE git LIKE :repourl LIMIT 1) - AND year = :calendar_year - AND repos.id = repos_id - GROUP BY month) b - ON a.month = b.month - GROUP BY month - """) - elif interval == "week": - cdRepTpIntervalLocCommitsSQL = s.sql.text(""" - SELECT name, sum(cast(IFNULL(added, 0) as signed) - cast(IFNULL(removed, 0) as signed) - cast(IFNULL(whitespace, 0) as signed)) as net_lines_minus_whitespace, - sum(IFNULL(added, 0)) as added, sum(IFNULL(removed, 0)) as removed, sum(IFNULL(whitespace, 0)) as whitespace, - IFNULL(patches, 0) as commits, a.month, IFNULL(year, :calendar_year) as year - FROM (select month from repo_monthly_cache group by month) a - LEFT JOIN (SELECT name, repo_monthly_cache.added, removed, whitespace, patches, month, IFNULL(year, :calendar_year) as year - FROM repo_monthly_cache, repos - WHERE repos_id = (SELECT id FROM repos WHERE git LIKE :repourl LIMIT 1) - AND year = :calendar_year - AND repos.id = repos_id - GROUP BY month) b - ON a.month = b.month - GROUP BY month - """) - - results = pd.read_sql(cdRepTpIntervalLocCommitsSQL, self.db, params={"repourl": '%{}%'.format(repo_url), 'calendar_year': calendar_year}) + topNewReposCommitsAllTime = s.sql.text(""" + SELECT repos_id, repos.name as name, sum(cast(repo_annual_cache.added as signed) - cast(removed as signed) - cast(whitespace as signed)) as net, patches + FROM repo_annual_cache, projects, repos + where projects.name = (SELECT projects.name FROM repos, projects + WHERE git LIKE :repourl + and repos.projects_id = projects.id + LIMIT 1) + and repo_annual_cache.repos_id = repos.id + and repos.projects_id = projects.id + group by repos_id + ORDER BY net desc + LIMIT 10 + """) + results = pd.read_sql(topNewReposCommitsAllTime, self.db, params={"repourl": '%{}%'.format(repo_url)}) return results - - @annotate(tag='cd-rep-tp-interval-loc-commits-ua') - def cd_rep_tp_interval_loc_commits_ua(self, repo_url, calendar_year=None, interval=None, repo_group=None): - """ - For a single repository, all the commits and lines of code occuring for the specified year, grouped by the specified interval - (week or month) and by the affiliation of individuals and domains that are not mapped as "inside" within the repositories gitdm file. - "Unknown" is, in this case, interpreted as "outside" - - :param repo_url: the repository's URL - :param calendar_year: the calendar year a repo is created in to be considered "new" - :param interval: Month or week. The periodocity of which to examine data within the given calendar_year - :param repo_group: the group of repositories to analyze - """ - - if calendar_year == None: - calendar_year = 2019 - - if interval == None: - interval = 'month' - - if repo_group == None: - repo_group = 'facade_project' - - cdRepTpIntervalLocCommitsUaSQL = None - - if repo_group == 'facade_project': - if interval == "month": - cdRepTpIntervalLocCommitsUaSQL = s.sql.text(""" - SELECT added, whitespace, removed, (cast(IFNULL(added, 0) as signed) - cast(IFNULL(removed, 0) as signed) - cast(IFNULL(whitespace, 0) as signed)) as net_lines_minus_whitespace, patches, a.month, affiliation - FROM (SELECT month FROM repo_monthly_cache GROUP BY month) a - LEFT JOIN - ( - SELECT SUM(repo_monthly_cache.added) AS added, SUM(whitespace) as whitespace, SUM(removed) as removed, month, SUM(patches) as patches, repo_monthly_cache.`affiliation` as affiliation - FROM repo_monthly_cache, repos, projects - WHERE repo_monthly_cache.repos_id = repos.id - AND repos.projects_id = (SELECT projects.id FROM repos, projects - WHERE git LIKE :repo_url - and repos.projects_id = projects.id - LIMIT 1) - AND projects.id = repos.projects_id - AND repo_monthly_cache.`affiliation` <> projects.name - AND year = 2018 - GROUP BY month, affiliation - ) b ON a.month = b.month - ORDER BY month - """) - elif interval == "week": - cdRepTpIntervalLocCommitsUaSQL = s.sql.text(""" - SELECT added, whitespace, removed, (cast(IFNULL(added, 0) as signed) - cast(IFNULL(removed, 0) as signed) - cast(IFNULL(whitespace, 0) as signed)) as net_lines_minus_whitespace, patches, a.month, affiliation - FROM (SELECT month FROM repo_monthly_cache GROUP BY month) a - LEFT JOIN - ( - SELECT SUM(repo_monthly_cache.added) AS added, SUM(whitespace) as whitespace, SUM(removed) as removed, month, SUM(patches) as patches, repo_monthly_cache.`affiliation` as affiliation - FROM repo_monthly_cache, repos, projects - WHERE repo_monthly_cache.repos_id = repos.id - AND repos.projects_id = (SELECT projects.id FROM repos, projects - WHERE git LIKE :repo_url - and repos.projects_id = projects.id - LIMIT 1) - AND projects.id = repos.projects_id - AND repo_monthly_cache.`affiliation` <> projects.name - AND year = 2018 - GROUP BY month, affiliation - ) b ON a.month = b.month - ORDER BY month - """) - else: - if interval == "month": - cdRepTpIntervalLocCommitsUaSQL = s.sql.text(""" - SELECT added, whitespace, removed, (cast(IFNULL(added, 0) as signed) - cast(IFNULL(removed, 0) as signed) - cast(IFNULL(whitespace, 0) as signed)) as net_lines_minus_whitespace, patches, a.month, affiliation - FROM (SELECT month FROM repo_monthly_cache GROUP BY month) a - LEFT JOIN - ( - SELECT SUM(repo_monthly_cache.added) AS added, SUM(whitespace) as whitespace, SUM(removed) as removed, month, SUM(patches) as patches, repo_monthly_cache.`affiliation` as affiliation - FROM repo_monthly_cache, repos, projects - WHERE repo_monthly_cache.repos_id = repos.id - AND repos.projects_id = :repo_group - AND projects.id = repos.projects_id - AND repo_monthly_cache.`affiliation` <> projects.name - AND year = 2018 - GROUP BY month, affiliation - ) b ON a.month = b.month - ORDER BY month - """) - elif interval == "week": - cdRepTpIntervalLocCommitsUaSQL = s.sql.text(""" - SELECT added, whitespace, removed, (cast(IFNULL(added, 0) as signed) - cast(IFNULL(removed, 0) as signed) - cast(IFNULL(whitespace, 0) as signed)) as net_lines_minus_whitespace, patches, a.month, affiliation - FROM (SELECT month FROM repo_monthly_cache GROUP BY month) a - LEFT JOIN - ( - SELECT SUM(repo_monthly_cache.added) AS added, SUM(whitespace) as whitespace, SUM(removed) as removed, month, SUM(patches) as patches, repo_monthly_cache.`affiliation` as affiliation - FROM repo_monthly_cache, repos, projects - WHERE repo_monthly_cache.repos_id = repos.id - AND repos.projects_id = :repo_group - AND projects.id = repos.projects_id - AND repo_monthly_cache.`affiliation` <> projects.name - AND year = 2018 - GROUP BY month, affiliation - ) b ON a.month = b.month - ORDER BY month - """) - results = pd.read_sql(cdRepTpIntervalLocCommitsUaSQL, self.db, params={"repourl": '%{}%'.format(repo_url), "repo_group": repo_group}) + @annotate(tag='top-repos-all-time-lines-of-code') + def top_repos_all_time_lines_of_code(self, repo_url): + """ + Returns top new repos of all time by lines of code + :param limit: number of repos the user wishes to display + """ + topNewReposLinesAllTime = s.sql.text(""" + SELECT repos_id, repos.name as name, sum(cast(repo_annual_cache.added as signed) - cast(removed as signed) - cast(whitespace as signed)) as net, patches + FROM repo_annual_cache, projects, repos + where projects.name = (SELECT projects.name FROM repos, projects + WHERE git LIKE :repourl + and repos.projects_id = projects.id + LIMIT 1) + and repo_annual_cache.repos_id = repos.id + and repos.projects_id = projects.id + group by repos_id + ORDER BY net desc + LIMIT 10 + """) + results = pd.read_sql(topNewReposLinesAllTime, self.db, params={"repourl": '%{}%'.format(repo_url)}) return results - - @annotate(tag='cd-rg-tp-interval-loc-commits') - def cd_rg_tp_interval_loc_commits(self, repo_url, calendar_year=None, interval=None, repo_group=None): - """ - For each repository in a collection of repositories, all the commits and lines of code occuring for the specified year, - grouped by repository and the specified interval (week or month). Results ordered by repo. - - :param repo_url: the repository's URL - :param calendar_year: the calendar year a repo is created in to be considered "new" - :param interval: Month or week. The periodocity of which to examine data within the given calendar_year - :param repo_group: the group of repositories to analyze - """ - - if calendar_year == None: - calendar_year = 2019 - - if interval == None: - interval = 'month' - - if repo_group == None: - repo_group = 'facade_project' - - cdRgTpIntervalLocCommitsSQL = None - - if repo_group == 'facade_project': - if interval == "month": - cdRgTpIntervalLocCommitsSQL = s.sql.text(""" - SELECT name, added, whitespace, removed, (cast(IFNULL(added, 0) as signed) - cast(IFNULL(removed, 0) as signed) - cast(IFNULL(whitespace, 0) as signed)) as net_lines_minus_whitespace, patches, a.month - FROM (SELECT month FROM repo_monthly_cache GROUP BY month) a - LEFT JOIN - ( - SELECT repos.name, SUM(repo_monthly_cache.added) AS added, SUM(whitespace) as whitespace, SUM(removed) as removed, month, SUM(patches) as patches - FROM repo_monthly_cache, repos, projects - WHERE repo_monthly_cache.repos_id = repos.id - AND repos.projects_id = (SELECT projects.id FROM repos, projects - WHERE git LIKE :repo_url - and repos.projects_id = projects.id - LIMIT 1) - AND projects.id = repos.projects_id - AND repos_id = repos.id - AND year = :calendar_year - GROUP BY month, repos.name - ) b ON a.month = b.month - ORDER BY name, month - """) - elif interval == "week": - cdRgTpIntervalLocCommitsSQL = s.sql.text(""" - SELECT name, added, whitespace, removed, (cast(IFNULL(added, 0) as signed) - cast(IFNULL(removed, 0) as signed) - cast(IFNULL(whitespace, 0) as signed)) as net_lines_minus_whitespace, patches, a.month - FROM (SELECT month FROM repo_monthly_cache GROUP BY month) a - LEFT JOIN - ( - SELECT repos.name, SUM(repo_monthly_cache.added) AS added, SUM(whitespace) as whitespace, SUM(removed) as removed, month, SUM(patches) as patches - FROM repo_monthly_cache, repos, projects - WHERE repo_monthly_cache.repos_id = repos.id - AND repos.projects_id = (SELECT projects.id FROM repos, projects - WHERE git LIKE :repo_url - and repos.projects_id = projects.id - LIMIT 1) - AND projects.id = repos.projects_id - AND repos_id = repos.id - AND year = :calendar_year - GROUP BY month, repos.name - ) b ON a.month = b.month - ORDER BY name, month - """) - else: - if interval == "month": - cdRgTpIntervalLocCommitsSQL = s.sql.text(""" - SELECT name, added, whitespace, removed, (cast(IFNULL(added, 0) as signed) - cast(IFNULL(removed, 0) as signed) - cast(IFNULL(whitespace, 0) as signed)) as net_lines_minus_whitespace, patches, a.month - FROM (SELECT month FROM repo_monthly_cache GROUP BY month) a - LEFT JOIN - ( - SELECT repos.name, SUM(repo_monthly_cache.added) AS added, SUM(whitespace) as whitespace, SUM(removed) as removed, month, SUM(patches) as patches - FROM repo_monthly_cache, repos, projects - WHERE repo_monthly_cache.repos_id = repos.id - AND repos.projects_id = :repo_group - AND projects.id = repos.projects_id - AND repos_id = repos.id - AND year = :calendar_year - GROUP BY month, repos.name - ) b ON a.month = b.month - ORDER BY name, month - """) - elif interval == "week": - cdRgTpIntervalLocCommitsSQL = s.sql.text(""" - SELECT name, added, whitespace, removed, (cast(IFNULL(added, 0) as signed) - cast(IFNULL(removed, 0) as signed) - cast(IFNULL(whitespace, 0) as signed)) as net_lines_minus_whitespace, patches, a.month - FROM (SELECT month FROM repo_monthly_cache GROUP BY month) a - LEFT JOIN - ( - SELECT repos.name, SUM(repo_monthly_cache.added) AS added, SUM(whitespace) as whitespace, SUM(removed) as removed, month, SUM(patches) as patches - FROM repo_monthly_cache, repos, projects - WHERE repo_monthly_cache.repos_id = repos.id - AND repos.projects_id = :repo_group - AND projects.id = repos.projects_id - AND repos_id = repos.id - AND year = :calendar_year - GROUP BY month, repos.name - ) b ON a.month = b.month - ORDER BY name, month - """) - results = pd.read_sql(cdRgTpIntervalLocCommitsSQL, self.db, params={"repourl": '%{}%'.format(repo_url), "calendar_year": calendar_year, "repo_group": repo_group}) - return results \ No newline at end of file diff --git a/augur/datasources/facade/facade.py.py b/augur/datasources/facade/facade.py.py new file mode 100644 index 0000000000..032af67ba3 --- /dev/null +++ b/augur/datasources/facade/facade.py.py @@ -0,0 +1,210 @@ +#SPDX-License-Identifier: MIT +""" +Data source that uses Facade's tables +""" +import base64 +import pandas as pd +import sqlalchemy as s +from augur import logger +from augur.util import annotate +# end imports +# (don't remove the above line, it's for a script) +class Facade(object): + """Queries Facade""" + def __init__(self, user, password, host, port, dbname, projects=None): + """ + Connect to the database + :param dbstr: The [database string](http://docs.sqlalchemy.org/en/latest/core/engines.html) to connect to the GHTorrent database + """ + self.DB_STR = 'mysql+pymysql://{}:{}@{}:{}/{}'.format( + user, password, host, port, dbname + ) + logger.debug('Facade: Connecting to {}:{}/{} as {}'.format(host, port, dbname, user)) + self.db = s.create_engine(self.DB_STR, poolclass=s.pool.NullPool) + self.projects = projects + ##################################### + ### DIVERSITY AND INCLUSION ### + ##################################### + ##################################### + ### GROWTH, MATURITY, AND DECLINE ### + ##################################### + ##################################### + ### RISK ### + ##################################### + ##################################### + ### VALUE ### + ##################################### + ##################################### + ### ACTIVITY ### + ##################################### + ##################################### + ### EXPERIMENTAL ### + ##################################### + @annotate(tag='downloaded-repos') + def downloaded_repos(self): + """ + Returns all repository names, URLs, and base64 URLs in the facade database + """ + downloadedReposSQL = s.sql.text(""" + SELECT git AS url, status, projects.name as project_name + FROM repos + JOIN projects + ON repos.projects_id = projects.id + """) + results = pd.read_sql(downloadedReposSQL, self.db) + results['url'] = results['url'].apply(lambda datum: datum.split('//')[1]) + if self.projects: + results = results[results.project_name.isin(self.projects)] + b64_urls = [] + for i in results.index: + b64_urls.append(base64.b64encode((results.at[i, 'url']).encode())) + results['base64_url'] = b64_urls + return results + @annotate(tag='lines-changed-by-author') + def lines_changed_by_author(self, repo_url): + """ + Returns number of lines changed per author per day + :param repo_url: the repository's URL + """ + linesChangedByAuthorSQL = s.sql.text(""" + SELECT author_email, author_date, author_affiliation as affiliation, SUM(added) as additions, SUM(removed) as deletions, SUM(whitespace) as whitespace + FROM analysis_data + WHERE repos_id = (SELECT id FROM repos WHERE git LIKE :repourl LIMIT 1) + GROUP BY repos_id, author_date, author_affiliation, author_email + ORDER BY author_date ASC; + """) + results = pd.read_sql(linesChangedByAuthorSQL, self.db, params={"repourl": '%{}%'.format(repo_url)}) + return results + @annotate(tag='lines-changed-by-week') + def lines_changed_by_week(self, repo_url): + """ + Returns lines changed of a sent repository per week + :param repo_url: the repository's URL + """ + linesChangedByWeekSQL = s.sql.text(""" + SELECT date(author_date) as date, SUM(added) as additions, SUM(removed) as deletions, SUM(whitespace) as whitespace + FROM analysis_data + WHERE repos_id = (SELECT id FROM repos WHERE git LIKE :repourl LIMIT 1) + GROUP BY YEARWEEK(author_date) + ORDER BY YEARWEEK(author_date) ASC + """) + results = pd.read_sql(linesChangedByWeekSQL, self.db, params={"repourl": '%{}%'.format(repo_url)}) + return results + @annotate(tag='lines-changed-by-month') + def lines_changed_by_month(self, repo_url): + """ + Returns lines changed of a sent repository per month + :param repo_url: the repository's URL + """ + linesChangedByMonthSQL = s.sql.text(""" + SELECT email as author_email, affiliation, month, year, SUM(added) as additions, SUM(removed) as deletions, SUM(whitespace) as whitespace FROM repo_monthly_cache + WHERE repos_id = (SELECT id FROM repos WHERE git LIKE :repourl LIMIT 1) + GROUP BY email, month, year + ORDER BY year, month, email ASC + """) + results = pd.read_sql(linesChangedByMonthSQL, self.db, params={"repourl": '%{}%'.format(repo_url)}) + return results + @annotate(tag='commits-by-week') + def commits_by_week(self, repo_url): + """ + Returns number of patches per commiter per week + :param repo_url: the repository's URL + """ + commitsByMonthSQL = s.sql.text(""" + SELECT email AS author_email, affiliation, WEEK AS `week`, YEAR AS `year`, patches FROM repo_weekly_cache + WHERE repos_id = (SELECT id FROM repos WHERE git LIKE :repourl LIMIT 1) + GROUP BY email, WEEK, YEAR + ORDER BY YEAR, WEEK, email ASC + """) + results = pd.read_sql(commitsByMonthSQL, self.db, params={"repourl": '%{}%'.format(repo_url)}) + return results +<<<<<<< Updated upstream +======= + @annotate(tag='top-new-repos-this-year-commits') + def top_new_repos_this_year_commits(self, repo_url): + """ + Returns top new repos this year by commits + :param limit: number of repos the user wishes to display + """ + + topNewReposCommits = s.sql.text(""" + SELECT repos_id, sum(cast(repo_annual_cache.added as signed) - cast(removed as signed) - cast(whitespace as signed)) as net, patches, projects.name + FROM repo_annual_cache, projects, repos + where projects.name = (SELECT projects.name FROM repos, projects + WHERE git LIKE :repourl + and repos.projects_id = projects.id + and YEAR(repos.added) = YEAR(CURDATE()) + LIMIT 1) + and repo_annual_cache.repos_id = repos.id + and repos.projects_id = projects.id + group by repos_id + ORDER BY net desc + LIMIT 10 + """) + results = pd.read_sql(topNewReposCommits, self.db, params={"repourl": '%{}%'.format(repo_url)}) + return results + @annotate(tag='top-new-repos-this-year-lines-of-code') + def top_new_repos_this_year_lines_of_code(self, repo_url): + """ + Returns top new repos this year by lines of code + :param limit: number of repos the user wishes to display + """ + topNewReposLines = s.sql.text(""" + SELECT repos_id, sum(cast(repo_annual_cache.added as signed) - cast(removed as signed) - cast(whitespace as signed)) as net, patches, projects.name + FROM repo_annual_cache, projects, repos + where projects.name = (SELECT projects.name FROM repos, projects + WHERE git LIKE :repourl + and YEAR(repos.added) = YEAR(CURDATE()) + and repos.projects_id = projects.id + LIMIT 1) + and repo_annual_cache.repos_id = repos.id + and repos.projects_id = projects.id + group by repos_id + ORDER BY net desc + LIMIT 10 + """) + results = pd.read_sql(topNewReposLines, self.db, params={"repourl": '%{}%'.format(repo_url)}) + return results + @annotate(tag='top-repos-all-time-commits') + def top_repos_all_time_commits(self, repo_url): + """ + Returns top new repos of all time by commits + :param limit: number of repos the user wishes to display + """ + topNewReposCommitsAllTime = s.sql.text(""" + SELECT repos_id, repos.name as name, sum(cast(repo_annual_cache.added as signed) - cast(removed as signed) - cast(whitespace as signed)) as net, patches + FROM repo_annual_cache, projects, repos + where projects.name = (SELECT projects.name FROM repos, projects + WHERE git LIKE :repourl + and repos.projects_id = projects.id + LIMIT 1) + and repo_annual_cache.repos_id = repos.id + and repos.projects_id = projects.id + group by repos_id + ORDER BY net desc + LIMIT 10 + """) + results = pd.read_sql(topNewReposCommitsAllTime, self.db, params={"repourl": '%{}%'.format(repo_url)}) + return results + @annotate(tag='top-repos-all-time-lines-of-code') + def top_repos_all_time_lines_of_code(self, repo_url): + """ + Returns top new repos of all time by lines of code + :param limit: number of repos the user wishes to display + """ + topNewReposLinesAllTime = s.sql.text(""" + SELECT repos_id, repos.name as name, sum(cast(repo_annual_cache.added as signed) - cast(removed as signed) - cast(whitespace as signed)) as net, patches + FROM repo_annual_cache, projects, repos + where projects.name = (SELECT projects.name FROM repos, projects + WHERE git LIKE :repourl + and repos.projects_id = projects.id + LIMIT 1) + and repo_annual_cache.repos_id = repos.id + and repos.projects_id = projects.id + group by repos_id + ORDER BY net desc + LIMIT 10 + """) + results = pd.read_sql(topNewReposLinesAllTime, self.db, params={"repourl": '%{}%'.format(repo_url)}) + return results +>>>>>>> Stashed changes diff --git a/frontend/app/components/AugurCards.vue b/frontend/app/components/AugurCards.vue index bb34fcc21d..aa6ae6e037 100644 --- a/frontend/app/components/AugurCards.vue +++ b/frontend/app/components/AugurCards.vue @@ -1,17 +1,75 @@ @@ -34,7 +92,7 @@ import LoginForm from '../components/LoginForm' import { mapState } from 'vuex' module.exports = { - props: ['owner', 'repo', 'domain', 'comparedowner', 'comparedrepo', 'groupid'], + props: ['tab', 'owner', 'repo', 'domain', 'comparedowner', 'comparedrepo', 'groupid'], components: { MainControls, AugurHeader, @@ -53,7 +111,9 @@ module.exports = { watch: { '$route': function (to, from) { if (to.path != from.path) - window.location.reload() } + // window.location.reload() + window.location.replace(to.path) + } }, data() { return { @@ -64,22 +124,75 @@ module.exports = { update: 0 } }, + computed: { + // ...mapState() + hasState() { + return this.$store.state.hasState + }, + baseRepo() { + return this.$store.state.baseRepo + }, + gitRepo() { + return this.$store.state.gitRepo + }, + comparedRepos() { + return this.$store.state.comparedRepos + }, + currentTab() { + return this.$store.state.tab + }, + goBack () { + window.history.length > 1 + ? this.$router.go(-1) + : this.$router.push('/') + }, + }, methods: { + collapseText () { + this.isCollapsed = !this.isCollapsed; + if(!this.isCollapsed) { + $(this.$el).find('.section').addClass('collapsed') + } + else $(this.$el).find('.section').removeClass('collapsed') + }, onRepo (e) { - let repo = window.AugurAPI.Repo({ - githubURL: e.target.value + this.$store.commit('setRepo', { + githubURL: e.target.value + }) + }, + changeTab (e) { + this.$store.commit('setTab', { + tab: e.target.dataset['value'] + }) + + let repo = this.repo + + if(this.$store.state.comparedRepos.length == 1){ + this.$router.push({ + name: 'singlecompare', + params: {tab: e.target.dataset['value'], owner: this.owner, repo: this.repo, comparedowner: this.comparedowner, comparedrepo: this.comparedrepo} + }) + } else if (this.$store.state.comparedRepos.length > 1) { + this.$router.push({ + name: 'group', + params: {tab: e.target.dataset['value'], groupid: this.groupid} }) - if(!repo.batch(['codeCommits'], true)[0]){ - alert("The repo " + repo.githubURL + " could not be found. Please try again.") - } else { - this.$store.commit('resetBaseRepo') - this.$store.commit('setRepo', { - githubURL: e.target.value + } else if (this.$router.history.current.name == "singlegit") { + this.$router.push({ + name: 'singlegit', + params: {tab: e.target.dataset['value'], repo: this.repo} }) + } else { this.$router.push({ - name: 'gmd', - params: {owner: repo.owner, repo: repo.name} }) + name: 'single', + params: {tab: e.target.dataset['value'], owner: this.owner, repo: this.repo} + }) + } + + }, + btoa(s) { + return window.btoa(s) } } } diff --git a/frontend/app/components/BaseRepoDashboard.vue b/frontend/app/components/BaseRepoDashboard.vue new file mode 100644 index 0000000000..1d5ab5b151 --- /dev/null +++ b/frontend/app/components/BaseRepoDashboard.vue @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/frontend/app/components/MainControls.vue b/frontend/app/components/MainControls.vue index 02f7d4bbfc..5d040444de 100644 --- a/frontend/app/components/MainControls.vue +++ b/frontend/app/components/MainControls.vue @@ -48,7 +48,8 @@