Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix connect endpoint issues in Firefox #3679

Merged
merged 3 commits into from
Jul 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/frontend/packages/core/src/core/browser-helper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export const getEventTarget = (event) => {
// Ensure we work on Firefox as well as Chrome etc
return event.target || event.srcElement;
};

export const getEventFiles = (event) => {
return getEventTarget(event).files;
};
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,14 @@ export class DeployApplicationFsUtils {
for (const item of items) {
const filePath = item.webkitRelativePath.split('/');
// First part is the root folder name
if (filePath.length === 2 && !rootFolderName) {
if (filePath.length > 1 && !rootFolderName) {
rootFolderName = filePath[0];
}
if (filePath.length > 2) {
// Don't traverse below the 1st level of files (could take a while)
break;
}

if (!cfIgnoreFile && filePath.length === 2 && filePath[1] === CF_IGNORE_FILE) {
cfIgnoreFile = item;
}

if (filePath.length === 2 && filePath[1] === CF_MANIFEST_FILE) {
manifestFile = item;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
import { BehaviorSubject } from 'rxjs';
import { filter, first } from 'rxjs/operators';

import { getEventFiles } from '../../../../../core/browser-helper';
import { FileScannerInfo } from './deploy-application-fs-scanner';
import { DeployApplicationFsUtils } from './deploy-application-fs-utils';

Expand Down Expand Up @@ -31,7 +32,7 @@ export class DeployApplicationFsComponent implements ControlValueAccessor {

// Handle result of a file input form field selection
onFileChange(event) {
const files = event.srcElement.files;
const files = getEventFiles(event);
const utils = new DeployApplicationFsUtils();
utils.handleFileInputSelection(files).pipe(
filter(res => !!res),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
<mat-checkbox class="connect__checkbox" [(ngModel)]="doConnect">Connect to
<b>{{ connectService?.config.name }}</b> now
(optional).
<div class="connect__subtext">You may connect this endpoint at a later date from the
endpoints page.</div>
</mat-checkbox>
<div class="connect__subtext">You may connect this endpoint at a later date from the
endpoints page.
</div>
</div>
<div>
<div class="connect__title">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
}
&__subtext {
font-size: 13px;
margin-top: -5px;
margin: 2px 0 0 24px;
opacity: .5;
position: absolute;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
import { ControlContainer, FormGroupName } from '@angular/forms';
import { Subscription } from 'rxjs';

import { getEventFiles } from '../../../core/browser-helper';
import { safeUnsubscribe } from '../../../core/utils.service';

@Component({
Expand Down Expand Up @@ -58,7 +59,7 @@ export class FileInputComponent implements OnInit, OnDestroy {
get fileCount(): number { return this.files && this.files.length || 0; }

onNativeInputFileSelect($event) {
const fs = $event.srcElement.files;
const fs = getEventFiles($event);
if (fs.length > 0) {
this.files = fs;
this.onFileSelect.emit(this.files[0]);
Expand Down