Compare commits

..

25 Commits

Author SHA1 Message Date
bilal
fa4660d819 rebase master 2020-06-16 17:24:40 +02:00
bilal
2238338710 fix MR comments 2020-06-16 17:23:28 +02:00
bilal
3650d6022c set AWS_BUCKET just in one spec file 2020-06-16 17:23:28 +02:00
Senad Uka
16d4d7511c Rebased match 2020-06-16 17:23:28 +02:00
bilal
c83e6cae0e delete unused files 2020-06-16 17:22:53 +02:00
bilal
fbd07a6ea6 remove old specs 2020-06-16 17:22:53 +02:00
bilal
badc3786dd update matching features specs 2020-06-16 17:22:53 +02:00
bilal
47b68e86e6 skipp failing test 2020-06-16 17:22:53 +02:00
bilal
f6e6d5d049 add job spec 2020-06-16 17:22:53 +02:00
bilal
eeec214cc8 add AWS_BUCKET env variable for tests 2020-06-16 17:22:53 +02:00
bilal
dc7f50b932 refactor matching job 2020-06-16 17:22:53 +02:00
bilal
1d1df4a1da add appearance_release_imports factory 2020-06-16 17:22:53 +02:00
bilal
dbda554cd7 add job specs 2020-06-16 17:22:53 +02:00
bilal
62019bcc37 update features specs 2020-06-16 17:22:53 +02:00
bilal
3307f0ebe8 update specs 2020-06-16 17:22:53 +02:00
bilal
29d3fa258a add fixture files 2020-06-16 17:22:53 +02:00
bilal
9a96bf708d update spec 2020-06-16 17:22:53 +02:00
bilal
ffc93b470b increase QrCode size; remove serial number from blank contract 2020-06-16 17:22:53 +02:00
bilal
2a6305b417 update feature specs 2020-06-16 17:22:53 +02:00
bilal
ed312c186f remove commented code 2020-06-16 17:22:53 +02:00
bilal
c903a2dcde use attachment key for BrayniacAI API payload 2020-06-16 17:22:53 +02:00
bilal
f2283782e8 send attachment keys using ActiveResource 2020-06-16 17:22:53 +02:00
bilal
21e8933471 add QrMatching to the BrayniacAI lib 2020-06-16 17:22:53 +02:00
bilal
94c0dc3732 Handle QrMatching response - mock 2020-06-16 17:22:53 +02:00
Senad Uka
dafef462b2 Sync of the branch 2020-06-16 17:22:53 +02:00
9 changed files with 16 additions and 59 deletions

View File

@@ -8,16 +8,11 @@ $(document).on "turbolinks:load", ->
# Called when the subscription has been terminated by the server
received: (data) ->
return unless document.querySelector("meta[name=broadcast-token][content='#{broadcastToken}']")
switch data.event
when "broadcast_stream_update"
return unless document.querySelector("meta[name=broadcast-token][current=true][content='#{broadcastToken}']")
@refreshBroadcastVideo(data)
when "stream_recording_ready"
return unless document.querySelector("meta[name=broadcast-token][current=true][content='#{broadcastToken}']")
@showBroadcastRecordings(data)
when "file_upload_update"
return unless document.querySelector("meta[name=broadcast-token][content='#{broadcastToken}']")
@refreshBroadcastFilesTab(data)
when "broadcast_stream_update" then @refreshBroadcastVideo(data)
when "stream_recording_ready" then @showBroadcastRecordings(data)
when "file_upload_update" then @refreshBroadcastFilesTab(data)
refreshBroadcastVideo: (data) ->
$("#broadcast_updates").html data.status_content

View File

@@ -3,25 +3,15 @@
class Api::DirectUploadsController < Api::ApiController
include ActiveStorage::SetCurrent
deserializable_resource :direct_upload, only: [:create]
def create
blob = ActiveStorage::Blob.create_before_direct_upload!(blob_params)
blob = ActiveStorage::Blob.create_before_direct_upload!(blob_args)
render jsonapi: DirectUpload.new(blob)
end
private
def blob_params
params.
require(:direct_upload).
permit(:type, :filename, :byte_size, :checksum, :content_type, :metadata).
except(:type).
to_h.symbolize_keys
end
class DeserializableDirectUpload < JSONAPI::Deserializable::Resource
attributes :filename, :byte_size, :checksum, :content_type, :metadata
def blob_args
params.require(:blob).permit(:filename, :byte_size, :checksum, :content_type, :metadata).to_h.symbolize_keys
end
class SerializableDirectUpload < JSONAPI::Serializable::Resource

View File

@@ -23,7 +23,7 @@ class HeadshotCollection
collection_uid: collection_uid.to_s,
bucket_name: aws_bucket_name,
ids_to_images: map_ids_to_images,
}.reject { |k, v| v.blank? && k != :ids_to_images }
}.reject { |_, v| v.blank? }
end
private

View File

@@ -1,4 +1,4 @@
<%= bootstrap_form_for model, layout: :inline, remote: true do |form| %>
<%= form.file_field :files, direct_upload: true, multiple: true, accept: "*", hide_label: true, required: true, wrapper_class: "w-65 mr-2", id: "broadcast_files_#{token}" %>
<%= form.file_field :files, direct_upload: true, multiple: true, accept: "*", hide_label: true, wrapper_class: "w-65 mr-2", id: "broadcast_files_#{token}" %>
<%= form.button fa_icon("upload", text: "Add File"), class: "btn btn-primary", type: :submit, data: { disable_with: fa_icon("spinner", text: "Adding File") } %>
<% end %>

View File

@@ -3,12 +3,12 @@
<meta name="project-id" content="<%= @project.id %>">
<% end %>
<% if @broadcast %>
<meta name="broadcast-token" current="true" content="<%= @broadcast.token %>">
<meta name="broadcast-token" content="<%= @broadcast.token %>">
<% end %>
<% # Subscribe to Action Cable for every broadcast including those in multi-view %>
<% @multi_view_broadcasts.each do |multi_view_broadcast| %>
<% if multi_view_broadcast.token != @broadcast.token %>
<meta name="broadcast-token" current="false" content="<%= multi_view_broadcast.token %>">
<meta name="broadcast-token" content="<%= multi_view_broadcast.token %>">
<% end %>
<% end %>
<% end %>

View File

@@ -1,4 +1,4 @@
<%= bootstrap_form_for model, url: broadcast_url(token: token), layout: :inline, remote: true do |form| %>
<%= form.file_field :files, direct_upload: true, multiple: true, accept: "*", hide_label: true, required: true, wrapper_class: "w-65 mr-2", id: "broadcast_files_#{token}" %>
<%= form.file_field :files, direct_upload: true, multiple: true, accept: "*", hide_label: true, wrapper_class: "w-65 mr-2", id: "broadcast_files_#{token}" %>
<%= form.button fa_icon("upload", text: "Add File"), class: "btn btn-primary", type: :submit, data: { disable_with: fa_icon("spinner", text: "Adding File") } %>
<% end %>

View File

@@ -10,7 +10,7 @@ RSpec.describe Api::DirectUploadsController, type: :controller do
describe '#create' do
it 'returns data for a direct upload' do
post :create, params: { direct_upload: direct_upload_params }
post :create, params: { blob: blob_params }
expect(response).to be_successful
expect(response_body_data_attributes).to include('id', 'key', 'signed_id', 'url', 'headers')
@@ -19,7 +19,7 @@ RSpec.describe Api::DirectUploadsController, type: :controller do
private
def direct_upload_params
def blob_params
file = file_fixture("video_file.mp4")
checksum = Digest::MD5.base64digest(StringIO.new(file.read).to_s)

View File

@@ -40,12 +40,12 @@ feature "User managing broadcasts" do
scenario "visit show page of broadcast", js: true do
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
recording = create(:broadcast_recording, broadcast: broadcast)
visit project_broadcast_path(project, broadcast)
expect(page).to have_content("Live stream is waiting to begin.")
expect(page).to have_content("Copy URL")
within "#files" do
expect(page).to have_content("contract.pdf")
end
@@ -54,17 +54,6 @@ feature "User managing broadcasts" do
expect(page).to have_content(recording.download_file_name)
end
scenario "form will not submit if user clicks Add files without selected files", js: true do
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
visit project_broadcast_path(project, broadcast)
expect(page).to have_content("Live stream is waiting to begin.")
expect(page).to have_content add_file_button
click_on add_file_button
end
scenario "visit multi-view broadcast page", js: true do
broadcast_one = create(:broadcast, :with_stream, :with_files, name: "Broadcast 1", project: project)
broadcast_two = create(:broadcast, :with_stream, :with_files, name: "Broadcast 2", project: project)
@@ -91,13 +80,8 @@ feature "User managing broadcasts" do
end
end
private
def add_file_button
'Add File'
end
def broadcast_name_field
"broadcast[name]"
end

View File

@@ -97,18 +97,6 @@ describe HeadshotCollection do
expect(hash.keys).not_to include(:collection_uid)
end
end
context "when there are no releasables" do
it "includes a blank hash value for the ids_to_images key" do
releases = []
collection = HeadshotCollection.new(nil, releases)
hash = collection.to_hash
expect(hash.keys).to include(:ids_to_images)
expect(hash[:ids_to_images]).to eq(Hash.new)
end
end
end
private