Commit 96a57bd5 authored by Krasimir Angelov's avatar Krasimir Angelov

Enable seat usage export

Allow group owners to export seat usage data as CSV file.

https://gitlab.com/gitlab-org/gitlab/-/issues/262877.

Changelog: added
EE: true
parent a67ecc71
......@@ -120,6 +120,20 @@ For example:
| Amir | `ami` | Yes |
| Amir | `amr` | No |
### Export seat usage
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/262877) in GitLab 14.2.
To export seat usage data as a CSV file:
1. On the top bar, select **Menu > Groups** and find your group.
1. On the left sidebar, select **Settings > Billing**.
1. Under **Seats currently in use**, select **See usage**.
1. Select **Export list**.
The generated list contains all seats being used,
and is not affected by the current search.
## Subscription expiry
When your subscription expires, you can continue to use paid features of GitLab for 14 days.
......
......@@ -4,7 +4,6 @@ class Groups::SeatUsageController < Groups::ApplicationController
before_action :verify_top_level_group
before_action :authorize_admin_group_member!
before_action :verify_namespace_plan_check_enabled
before_action :verify_seat_usage_export_enabled, if: -> { request.format.csv? }
layout "group_settings"
......@@ -40,8 +39,4 @@ class Groups::SeatUsageController < Groups::ApplicationController
def verify_top_level_group
not_found unless group.root?
end
def verify_seat_usage_export_enabled
not_found unless Feature.enabled?(:seat_usage_export, group, default_enabled: :yaml)
end
end
- page_title s_('SeatUsage|Seat usage')
- add_to_breadcrumbs _('Billing'), group_billings_path(@group)
#js-seat-usage{ data: { namespace_id: @group.id, namespace_name: @group.name, seat_usage_export_path: (group_seat_usage_path(@group, format: :csv) if Feature.enabled?(:seat_usage_export, @group, default_enabled: :yaml)) } }
#js-seat-usage{ data: { namespace_id: @group.id, namespace_name: @group.name, seat_usage_export_path: group_seat_usage_path(@group, format: :csv) } }
---
name: seat_usage_export
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/67202
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/337397
milestone: '14.2'
type: development
group: group::utilization
default_enabled: false
......@@ -24,10 +24,6 @@ RSpec.describe Groups::SeatUsageController do
end
context 'when html format' do
before do
stub_feature_flags(seat_usage_export: false)
end
it 'renders show with 200 status code' do
get_show
......@@ -54,21 +50,8 @@ RSpec.describe Groups::SeatUsageController do
expect(response).to have_gitlab_http_status(:not_found)
end
context 'when seat_usage_export feature flag is disabled' do
before do
stub_feature_flags(seat_usage_export: false)
end
it 'responds with 404 status code' do
get_show(format: :csv)
expect(response).to have_gitlab_http_status(:not_found)
end
end
context 'when seat_usage_export feature flag is enabled' do
context 'when the group is a top-level group' do
before do
stub_feature_flags(seat_usage_export: true)
expect(Groups::SeatUsageExportService).to receive(:execute).with(group, user).and_return(result)
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment