OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Re-add video dialog removed in Angular
Oliver Günther53e034006393
diff --git a/app/components/enterprise_trials/welcome_dialog_component.html.erb b/app/components/enterprise_trials/welcome_dialog_component.html.erbnew file mode 100644index 00000000000..0e7cb47f152--- /dev/null+++ b/app/components/enterprise_trials/welcome_dialog_component.html.erb@@ -0,0 +1,33 @@+<%=+ render(+ Primer::Alpha::Dialog.new(+ id: "enterprise-trial-welcome-dialog",+ data: {+ "application-target": "dynamic",+ controller: "auto-show-dialog"+ },+ title: I18n.t("ee.trial.welcome_title"),+ size: :large+ )+ ) do |dialog|+ dialog.with_header(variant: :large)+ dialog.with_body do+ flex_layout do |flex|+ flex.with_row do+ render(Primer::Beta::Text.new(color: :subtle)) { I18n.t("ee.trial.welcome_description") }+ end+ flex.with_row(mt: 2) do+ content_tag :div, class: "onboarding--video iframe-target-wrapper" do+ content_tag(:iframe,+ "",+ frameborder: "0",+ height: "400",+ width: "100%",+ src: OpenProject::Static::Links.links[:enterprise_welcome_video][:href],+ allowfullscreen: true)+ end+ end+ end+ end+ end+%>diff --git a/app/components/enterprise_trials/welcome_dialog_component.rb b/app/components/enterprise_trials/welcome_dialog_component.rbnew file mode 100644index 00000000000..23a9fb1ac3a--- /dev/null+++ b/app/components/enterprise_trials/welcome_dialog_component.rb@@ -0,0 +1,38 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++module EnterpriseTrials+ class WelcomeDialogComponent < ApplicationComponent+ include ApplicationHelper+ include OpenProject::FormTagHelper+ include OpTurbo::Streamable+ include OpPrimer::ComponentHelpers+ end+enddiff --git a/app/controllers/enterprise_tokens_controller.rb b/app/controllers/enterprise_tokens_controller.rbindex bfd2ba15a3e..98049054ced 100644--- a/app/controllers/enterprise_tokens_controller.rb+++ b/app/controllers/enterprise_tokens_controller.rb@@ -30,6 +30,7 @@class EnterpriseTokensController < ApplicationControllerinclude OpTurbo::DialogStreamHelperinclude OpTurbo::ComponentStream+ include OpModalFlashablelayout "admin"menu_item :enterprise@@ -117,23 +118,34 @@ class EnterpriseTokensController < ApplicationControllerenddef check_trial_status+ token_saved_flash@trial_key = Token::EnterpriseTrialKey.find_by(user_id: User.system.id)return if @trial_key.nil?@trial_status = EnterpriseTrials::AugurLoadTrialService.new(@trial_key).callcase @trial_status.result+ when EnterpriseTrials::AugurLoadTrialService::STATUS_TOKEN_SAVED+ token_saved_flashwhen EnterpriseTrials::AugurLoadTrialService::STATUS_WAITING_CONFIRMATION- flash.now[:warning] = {- message: @trial_status.message,- action_button_arguments: {- tag: :a,- href: request_resend_enterprise_trial_path,- data: { turbo_method: :post }- },- action_button_content: I18n.t("ee.trial.resend_action")- }+ set_waiting_for_confirmation_flashelse@trial_status.apply_flash_message!(flash)endend++ def token_saved_flash+ flash_op_modal(component: EnterpriseTrials::WelcomeDialogComponent)+ end++ def set_waiting_for_confirmation_flash+ flash.now[:warning] = {+ message: @trial_status.message,+ action_button_arguments: {+ tag: :a,+ href: request_resend_enterprise_trial_path,+ data: { turbo_method: :post }+ },+ action_button_content: I18n.t("ee.trial.resend_action")+ }+ endenddiff --git a/app/services/enterprise_trials/augur_load_trial_service.rb b/app/services/enterprise_trials/augur_load_trial_service.rbindex 3c73000d6f5..f866c03fc21 100644--- a/app/services/enterprise_trials/augur_load_trial_service.rb+++ b/app/services/enterprise_trials/augur_load_trial_service.rb@@ -31,6 +31,7 @@module EnterpriseTrialsclass AugurLoadTrialServiceSTATUS_WAITING_CONFIRMATION = :awaiting_confirmation+ STATUS_TOKEN_SAVED = :token_saveddef initialize(trial_key)@trial_key = trial_key@@ -64,19 +65,17 @@ module EnterpriseTrialsenddef handle_successful_trial(trial_json)- if trial_json["token"]- token = EnterpriseToken.new(encoded_token: trial_json["token"])- if token.save- @trial_key.destroy- return ServiceResult.success(result: token, message: I18n.t("ee.trial.successfully_saved"))- else- return ServiceResult.failure(result: token,- message_type: :info,- message: I18n.t("ee.trial.successfully_saved"))- end+ if trial_json["token"].nil?+ return ServiceResult.success(result: nil, message: I18n.t("ee.trial.already_retrieved"))end- ServiceResult.success(result: nil, message: I18n.t("ee.trial.already_retrieved"))+ token = EnterpriseToken.new(encoded_token: trial_json["token"])+ if token.save+ @trial_key.destroy+ ServiceResult.success(result: STATUS_TOKEN_SAVED, message: I18n.t("ee.trial.successfully_saved"))+ else+ ServiceResult.failure(result: token)+ endenddef augur_hostdiff --git a/config/locales/en.yml b/config/locales/en.ymlindex 83b1d1b4bc2..5e43e473002 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -2195,6 +2195,8 @@ en:successfully_saved: "Your trial enterprise token has been successfully retrieved."start_over: "Start over trial request"resend_action: "Resend confirmation email"+ welcome_title: "Quick feature overview"+ welcome_description: "Get a quick overview of project management and team collaboration with OpenProject Enterprise edition."confirmation_info: >We sent you an email on %{date} to %{email}.Please check your inbox and click the confirmation link provided to start your 14 days trial.diff --git a/config/static_links.yml b/config/static_links.ymlindex 01fd2380fdb..9c9c3558843 100644--- a/config/static_links.yml+++ b/config/static_links.yml@@ -121,6 +121,8 @@ webinar_videos:href: https://www.youtube.com/watch?v=un6zCm8_FT4get_started_videos:href: https://www.youtube.com/playlist?list=PLGzJ4gG7hPb8WWOWmeXqlfMfhdXReu-RJ+enterprise_welcome_video:+ href: https://www.youtube.com/embed/zLMSydhFSkw?autoplay=1'openproject_docs:href: https://www.openproject.org/docs/contact_us:diff --git a/spec/features/admin/enterprise/enterprise_trial_spec.rb b/spec/features/admin/enterprise/enterprise_trial_spec.rbindex 816fb556f8c..04214afa095 100644--- a/spec/features/admin/enterprise/enterprise_trial_spec.rb+++ b/spec/features/admin/enterprise/enterprise_trial_spec.rb@@ -33,6 +33,8 @@ require "spec_helper"RSpec.describe "Enterprise trial management",:js,:webmock do+ include Redmine::I18n+let(:admin) { create(:admin) }let(:trial_id) { "1b6486b4-5a30-4042-8714-99d7c8e6b637" }@@ -178,9 +180,11 @@ RSpec.describe "Enterprise trial management",endit "does not send a request when an internal validation fails" do+ click_link_or_button("Start free trial")fill_in "Company", with: "Foo Corp."- click_link_or_button("Continue")+ # No stubbed request with webmock -> No allowed requests+ click_link_or_button("Continue")page.within("#enterprise-trial-dialog") doexpect(page).to have_text("First name can't be blank.")@@ -231,7 +235,7 @@ RSpec.describe "Enterprise trial management",context "with a waiting request pending" dobefore dostub_request(:post, "https://start.openproject-edge.com:443/public/v1/trials")- .to_return(status: 200, headers: { "Content-Type" => "application/json" }, body: created_body.to_json)+ .to_return(status: 202, headers: { "Content-Type" => "application/json" }, body: created_body.to_json)stub_request(:get, "https://start.openproject-edge.com:443/public/v1/trials/#{trial_id}").to_return(status: 422, headers: { "Content-Type" => "application/json" }, body: waiting_body.to_json)@@ -246,22 +250,14 @@ RSpec.describe "Enterprise trial management",endit "can get the trial if reloading the page" do- # We need to go to another page to stop the request cycle- visit info_admin_index_path-# Stub with successful body# Stub the proxy to a successful return# which marks the user has confirmed the mail linkstub_request(:get, "https://start.openproject-edge.com:443/public/v1/trials/#{trial_id}").to_return(status: 200, headers: { "Content-Type" => "application/json" }, body: confirmed_body.to_json)- # Stub the details URL to still return 403- stub_request(:get, "https://start.openproject-edge.com:443/public/v1/trials/#{trial_id}/details")- .to_return(status: 403)-visit enterprise_tokens_path- expect_and_dismiss_flash(message: "Successful update.")expect(page).to have_text("Enterprise Plan (Token Version 1)")expect(page).to have_text("OpenProject Test")expect(page).to have_text("5")@@ -270,27 +266,14 @@ RSpec.describe "Enterprise trial management",endit "can confirm that trial regularly" do- find_test_selector("op-ee-trial-waiting-resend-link", text: "Resend").click- expect(page).to have_css(".op-toast", text: "Email has been resent.", wait: 20)-- expect(page).to have_text "[email protected]"- expect(page).to have_text "email sent - waiting for confirmation"-+ expect(page).to have_text "We sent you an email on #{format_date(Date.current)} to [email protected]"# Stub the proxy to a successful return# which marks the user has confirmed the mail linkstub_request(:get, "https://start.openproject-edge.com:443/public/v1/trials/#{trial_id}")- .to_return(status: 200, headers: { "Content-Type" => "application/json" }, body: confirmed_body.to_json)-- # Wait until the next request- expect(page).to have_test_selector "op-ee-trial-waiting-status--confirmed", text: "confirmed", wait: 20-- # advance to video- click_on "Continue"+ .to_return(status: 202, headers: { "Content-Type" => "application/json" }, body: confirmed_body.to_json)- # advance to close- click_on "Continue"+ click_link_or_button("Resend confirmation email")- expect_and_dismiss_flash(message: "Successful update.")expect(page).to have_text("Enterprise Plan (Token Version 1)")expect(page).to have_text("OpenProject Test")expect(page).to have_text("5")