Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.jobId = params["jobId"];
this.taskId = params["taskId"];
this.poolId = params["poolId"];
this.nodeId = params["nodeId"];
this.outputKind = params["outputKind"];
this.filename = params["filename"];
this._loadFileProperties();
}));
}
public ngOnDestroy() {
this._paramsSubscribers.forEach(x => x.unsubscribe());
}
@autobind()
public refresh() {
return Observable.of({});
}
@autobind()
public downloadFile() {
const dialog = remote.dialog;
const localPath = dialog.showSaveDialog({
buttonLabel: "Download",
// Set default filename of file to download
defaultPath: FileUrlUtils.getFileName(this.url),
});
if (localPath) {
return this._saveFile(localPath);
}
constructor(private fileService: FileService) { }
public ngOnChanges(inputs) {
if (inputs.poolId || inputs.nodeId || inputs.folder || inputs.filter) {
this._initProxyMap(inputs);
this.refresh();
}
}
public ngOnDestroy(): void {
this.status.unsubscribe();
this.error.unsubscribe();
}
@autobind()
public refresh(): Observable {
if (this.poolId && this.nodeId) {
// filter is changed in two different situation (search field of node file list and file nav list)
const filterProp = ((this.filter.properties && this.filter.properties.length > 0) ?
this.filter.properties[0] : this.filter) as Property;
const quickSearch = filterProp && filterProp.value;
const loadPath = [this.folder, quickSearch].filter(x => Boolean(x)).join("/");
if (this.treeDisplay) {
return this.treeDisplay.initNodes(loadPath, true);
}
}
return Observable.of(true);
}
public get baseUrl() {
return ["/pools", this.poolId, "nodes", this.nodeId];
} from "./connect-field";
import Input from "@/components/Input";
export interface BooleanFieldProps extends EditorFieldProps {}
type Props = BooleanFieldProps & InjectedProps;
class BooleanField extends React.Component {
render() {
const { value } = this.props;
return (
<input value="{value}" type="checkbox">
);
}
@autobind()
private _onValueChange(e: React.ChangeEvent) {
const value = e.target.checked;
const { onCommit } = this.props;
onCommit(value);
}
}
export default connectEditorField()(BooleanField);
return (
x}
onChange={this._onValueChange}
onSelect={this._onValueSelect}
selectOnBlur
/>
);
}
@autobind()
private _onValueChange(e: React.ChangeEvent) {
const value = e.target.value;
this._setEditValue(value);
}
@autobind()
private _onValueSelect(value: string) {
this._setEditValue(value, () => {
this._commitEdit();
});
}
private _setEditValue(value: string, onSet?: () => void) {
const validation = this._validate(value);
const isValid = !validation;
return (
<input value="{currentValue}" maxlength="{maxLength}" minlength="{minLength}" type="text">
);
}
@autobind()
private _onValueChange(e: React.ChangeEvent) {
const value = e.target.value;
this._setEditValue(value);
}
@autobind()
private _onInputKeyPress(e: React.KeyboardEvent) {
if (e.key === Keys.Enter) {
this._commitEdit();
}
}
@autobind()
private _onInputBlur() {
this._commitEdit();
}
export interface CheckInputProps {
value: boolean;
onCommit(value: boolean): void;
}
type Props = CheckInputProps;
export default class CheckInput extends React.Component {
render() {
const { value } = this.props;
return (
<input checked="{value}" type="checkbox">
);
}
@autobind()
private _onValueChange(e: React.ChangeEvent) {
const { onCommit } = this.props;
const value = e.target.checked;
onCommit(value);
}
}
return (
<input step="{step}" value="{currentValue}" max="{maxValue}" min="{minValue}" type="number">
);
}
@autobind()
private _onValueChange(e: React.ChangeEvent) {
const { minValue, maxValue } = this.props;
const editValue = e.target.value;
const numberValue = parseFloat(editValue);
let validationMessage: string | null = null;
if (maxValue != null && numberValue > maxValue) {
validationMessage = `Value must be less than ${maxValue}`;
} else if (minValue != null && numberValue < minValue) {
validationMessage = `Value must be greater than ${minValue}`;
}
e.target.setCustomValidity(validationMessage || "");
this.setState({
editValue,
});
}
public ngOnChanges(inputs) {
if (inputs.jobId || inputs.taskId || inputs.filter) {
this.refresh();
}
}
public ngOnDestroy() {
this.status.unsubscribe();
this._autoStorageSub.unsubscribe();
this._statuSub.unsubscribe();
}
@autobind()
public refresh(): Observable {
if (this.jobId && this.taskId && this.outputKind) {
this._loadFiles();
}
return Observable.of(true);
}
@autobind()
public loadMore(): Observable {
if (this.data && this.hasAutoStorage) {
return this.data.fetchNext();
}
return new Observable(null);
}
private nodeService: NodeService,
private taskService: TaskService) { }
public ngOnChanges(inputs) {
if (inputs.jobId || inputs.taskId || inputs.filter) {
this._initProxyMap(inputs);
this.refresh();
}
}
public ngOnDestroy(): void {
this.status.unsubscribe();
this.error.unsubscribe();
}
@autobind()
public refresh(): Observable {
if (this.jobId && this.taskId) {
this._loadIfNodeExists();
}
return Observable.of(true);
}
public get baseUrl() {
return ["/jobs", this.jobId, "tasks", this.taskId];
}
public get filterPlaceholder() {
return "Filter by file name";
}
@autobind()
...other
} = this.props
const pathName = location.pathname;
let match: boolean;
if (exact) match = to === pathName;
else match = matchPartialPath(pathName, to.toString());
if (match) {
return <span>{children}</span>;
}
return {children};
}
@autobind()
private _onClick(event: React.MouseEvent) {
const {
exact,
location,
to,
onClick
} = this.props;
const pathName = location.pathname;
let match: boolean;
if (exact) match = to === pathName;
else match = matchPartialPath(pathName, to.toString());
if (match) {
event.preventDefault();
return;