#562 [frontend] remove old_status column from package table
Merged 8 months ago by msuchy. Opened 8 months ago by dturecek.
copr/ dturecek/copr remove-old-status  into  master

@@ -0,0 +1,22 @@ 

+ """remove old_status column

+ 

+ Revision ID: ca76b7902c2f

+ Revises: code4beaf000

+ Create Date: 2019-03-05 08:47:31.519455

+ 

+ """

+ 

+ # revision identifiers, used by Alembic.

+ revision = 'ca76b7902c2f'

+ down_revision = 'code4beaf000'

+ 

+ from alembic import op

+ import sqlalchemy as sa

+ 

+ 

+ def upgrade():

+     op.drop_column('package', 'old_status')

+ 

+ 

+ def downgrade():

+     op.add_column('package', sa.Column('old_status', sa.Integer(), nullable=True))

@@ -1,82 +0,0 @@ 

- {% extends "layout.html" %}

- {% from "_helpers.html" import build_href_from_sql, build_state, build_state_text, copr_url %}

- {% block title %}Migration Report{% endblock %}

- {% block header %}Migration Report{% endblock %}

- 

- {% block breadcrumbs %}

- <ol class="breadcrumb">

-   <li><a href="{{ url_for('coprs_ns.coprs_show') }}">Home</a></li>

-   {% if user %}

-     <li><a href="{{ url_for('coprs_ns.coprs_by_user', username=user.name) }}">{{ user.name }}</a></li>

-   {% else %}

-     <li><a href="{{ url_for('groups_ns.list_projects_by_group', group_name=group.name) }}">{{ group.name }}</a></li>

-   {% endif %}

-   <li class="active">Migration Report</li>

- </ol>

- {% endblock %}

- 

- {% block body %}

- <div id="profile">

-   {% if user %}

-     <img src="{{ user.gravatar_url }}" alt="User Image" class="avatar">

-     <h1>{{ user.name|capitalize }}'s Migration</h1>

-     {% if (user and user.name == g.user.name) %}

-     {% endif %}

-   {% else %}

-     <img src="https://seccdn.libravatar.org/avatar/" alt="" class="avatar">

-     <h1>Migration of @{{ group.name }} Group</h1>

-     <p>

-       <a href="https://admin.fedoraproject.org/accounts/group/view/{{ group.fas_name }}" title="{{ group.fas_name }}'s FAS details" target="_blank">FAS details</a> |

-       <a href="https://admin.fedoraproject.org/accounts/group/members/{{ group.fas_name }}" title="{{ group.fas_name }}'s Members" target="_blank">View Members</a>

-     </p>

-   {% endif %}

- 

-   {% if g.user and ((user and user.name == g.user.name) or (group and g.user.can_build_in_group(group))) %}

-     <p style="color:#333">Hello {{ g.user.name|capitalize }}, we have performed migration of Copr service to foo and therefore bar</p>

-   {% endif %}

- </div>

- 

- {% for copr in coprs |sort(attribute='group_id') %}

-   <h2 class="page-title"><a href="{{ copr_url('coprs_ns.copr_detail', copr) }}">{{ copr.full_name }}</a></h2>

- 

-   {% if copr.packages %}

-   <table class="datatable table table-striped table-bordered">

-     <thead>

-       <tr>

-         <th class="col-md-2">Package Name</th>

-         <th class="col-md-2">State Before Migration</th>

-         <th class="col-md-2">State After Migration</th>

-         <th class="col-md-1">Build</th>

-       </tr>

-     </thead>

-     <tbody>

-       {% set packages_succeeded = copr.packages |selectattr('old_status', 'sameas', 1) |list %}

-       {% set packages_other = copr.packages |rejectattr('old_status', 'sameas', 1) |sort(attribute='old_status') |list %}

-       {% for package in packages_succeeded + packages_other %}

-       <tr>

-         <td>

-           <a href="{{ copr_url('coprs_ns.copr_package', copr, package_name=package.name) }}">{{ package.name }}</a>

-         </td>

-         <td>

-           {{ build_state_text(package.old_status | state_from_num) }}

-         </td>

-         <td>

-           {{ build_state(package.last_build()) if package.last_build() else '-' }}

-         </td>

-         <td>

-           {% if package.last_build() %}

-             <a href="{{ build_href_from_sql(package.last_build()) }}">{{ package.last_build().id }}</a>

-           {% else %}

-             -

-           {% endif %}

-         </td>

-       </tr>

-       {% endfor %}

-     </tbody>

-   </table>

-   {% else %}

-     <h3>No packages</h3>

-   {% endif %}

- {% endfor %}

- 

- {% endblock %}

@@ -358,36 +358,6 @@ 

      return wrapper

  

  

- @misc.route("/migration-report/")

- @misc.route("/migration-report/<username>")

- def coprs_migration_report(username=None):

-     if not username and not flask.g.user:

-         return generic_error("You are not logged in")

-     elif not username:

-         username = flask.g.user.name

-     user = UsersLogic.get(username).first()

- 

-     coprs = CoprsLogic.filter_without_group_projects(CoprsLogic.get_multiple_owned_by_username(username)).all()

-     for group in UsersLogic.get_groups_by_fas_names_list(user.user_teams).all():

-         coprs.extend(CoprsLogic.get_multiple_by_group_id(group.id).all())

- 

-     return render_migration_report(coprs, user=user)

- 

- 

- @misc.route("/migration-report/g/<group_name>")

- def group_coprs_migration_report(group_name=None):

-     group = ComplexLogic.get_group_by_name_safe(group_name)

-     coprs = CoprsLogic.get_multiple_by_group_id(group.id)

-     return render_migration_report(coprs, group=group)

- 

- 

- def render_migration_report(coprs, user=None, group=None):

-     return flask.render_template("migration-report.html",

-                                  user=user,

-                                  group=group,

-                                  coprs=coprs)

- 

- 

  def send_build_icon(build):

      if not build:

          return send_file("static/status_images/unknown.png",

@@ -338,9 +338,8 @@ 

              client=self.client,

              ownername=self.ownername, projectname=self.projectname,

              copr_id=self.copr_id, enable_net=self.enable_net, name=self.name,

-             id=self.id, old_status=self.old_status,

-             source_json=self.source_json, source_type=self.source_type,

-             webhook_rebuild=self.webhook_rebuild

+             id=self.id, source_json=self.source_json,

+             source_type=self.source_type, webhook_rebuild=self.webhook_rebuild

          )

  

      def __getattr__(self, item):