-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* data loader init * fix timecolumn text * feedback changes * fixing typos and improving error reporting * added local firehose warning * update warning copy * refine copy * better copy * fix tests * remove console log * copy change * add banner message
- Loading branch information
1 parent
afbcb9c
commit baf54f3
Showing
47 changed files
with
6,505 additions
and
1,010 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
#!/usr/bin/env node | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
let fs = require('fs-extra'); | ||
|
||
if (!(process.argv.length === 3 || process.argv.length === 4)) { | ||
console.log('Usage: mkcomp <what?> <component-name>'); | ||
process.exit(); | ||
} | ||
|
||
let name; | ||
let what; | ||
if (process.argv.length === 4) { | ||
what = process.argv[2]; | ||
name = process.argv[3]; | ||
if (!(what === 'component' || what === 'dialog' || what === 'singleton')) { | ||
console.log(`Bad what, should be on of: component, dialog, singleton`); | ||
process.exit(); | ||
} | ||
} else { | ||
what = 'component'; | ||
name = process.argv[2]; | ||
} | ||
|
||
if (!/^([a-z-])+$/.test(name)) { | ||
console.log('must be a hyphen case name'); | ||
process.exit(); | ||
} | ||
|
||
let path = `./src/${what}s/`; | ||
fs.ensureDirSync(path); | ||
console.log('Making path:', path); | ||
|
||
const camelName = name.replace(/(^|-)[a-z]/g, (s) => s.replace('-', '').toUpperCase()); | ||
const year = (new Date()).getFullYear(); | ||
|
||
function writeFile(path, data) { | ||
try { | ||
return fs.writeFileSync(path, data, { | ||
flag: 'wx', // x = fail if file exists | ||
encoding: 'utf8' | ||
}); | ||
} catch (error) { | ||
return console.log(`Skipping ${path}`); | ||
} | ||
} | ||
|
||
// Make the TypeScript file | ||
writeFile(path + name + '.tsx', | ||
`/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
import { Button, InputGroup } from '@blueprintjs/core'; | ||
import { IconNames } from '@blueprintjs/icons'; | ||
import classNames from 'classnames'; | ||
import * as React from 'react'; | ||
import './${name}.scss'; | ||
export interface ${camelName}Props extends React.Props<any> { | ||
} | ||
export interface ${camelName}State { | ||
} | ||
export class ${camelName} extends React.Component<${camelName}Props, ${camelName}State> { | ||
constructor(props: ${camelName}Props, context: any) { | ||
super(props, context); | ||
// this.state = {}; | ||
} | ||
render() { | ||
return <div className="${name}"> | ||
</div>; | ||
} | ||
} | ||
`); | ||
|
||
// Make the SASS file | ||
writeFile(path + name + '.scss', | ||
`/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
.${name} { | ||
} | ||
`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
|
||
import { InputGroup, ITagInputProps } from '@blueprintjs/core'; | ||
import * as React from 'react'; | ||
|
||
export interface ArrayInputProps extends ITagInputProps { | ||
|
||
} | ||
|
||
export class ArrayInput extends React.Component<ArrayInputProps, { stringValue: string }> { | ||
constructor(props: ArrayInputProps) { | ||
super(props); | ||
this.state = { | ||
stringValue: Array.isArray(props.values) ? props.values.join(', ') : '' | ||
}; | ||
} | ||
|
||
private handleChange = (e: any) => { | ||
const { onChange } = this.props; | ||
const stringValue = e.target.value; | ||
const newValues = stringValue.split(',').map((v: string) => v.trim()); | ||
const newValuesFiltered = newValues.filter(Boolean); | ||
this.setState({ | ||
stringValue: newValues.length === newValuesFiltered.length ? newValues.join(', ') : stringValue | ||
}); | ||
if (onChange) onChange(stringValue === '' ? undefined : newValuesFiltered); | ||
} | ||
|
||
render() { | ||
const { className, placeholder, large, disabled } = this.props; | ||
const { stringValue } = this.state; | ||
return <InputGroup | ||
className={className} | ||
value={stringValue} | ||
onChange={this.handleChange} | ||
placeholder={placeholder} | ||
large={large} | ||
disabled={disabled} | ||
/>; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.