mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Add eslint rule padding-line-between-statements (#1593)
Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
This commit is contained in:
1 parent
7b77f18376
commit
dcf253e7d5
401 files changed
+2018
-40
No files matched your search
@@ -81,9 +81,11 @@ export class AddSecretDialog extends React.Component<Props> {
|
||||
private getDataFromFields = (fields: ISecretTemplateField[] = [], processValue?: (val: string) => string) => {
|
||||
return fields.reduce<any>((data, field) => {
|
||||
const { key, value } = field;
|
||||
|
||||
if (key) {
|
||||
data[key] = processValue ? processValue(value) : value;
|
||||
}
|
||||
|
||||
return data;
|
||||
}, {});
|
||||
};
|
||||
@@ -101,8 +103,10 @@ export class AddSecretDialog extends React.Component<Props> {
|
||||
labels: this.getDataFromFields(labels),
|
||||
} as IKubeObjectMetadata
|
||||
};
|
||||
|
||||
try {
|
||||
const newSecret = await secretsApi.create({ namespace, name }, secret);
|
||||
|
||||
showDetails(newSecret.selfLink);
|
||||
this.reset();
|
||||
this.close();
|
||||
@@ -113,17 +117,20 @@ export class AddSecretDialog extends React.Component<Props> {
|
||||
|
||||
addField = (field: ISecretField) => {
|
||||
const fields = this.secret[this.type][field] || [];
|
||||
|
||||
fields.push({ key: "", value: "" });
|
||||
this.secret[this.type][field] = fields;
|
||||
};
|
||||
|
||||
removeField = (field: ISecretField, index: number) => {
|
||||
const fields = this.secret[this.type][field] || [];
|
||||
|
||||
fields.splice(index, 1);
|
||||
};
|
||||
|
||||
renderFields(field: ISecretField) {
|
||||
const fields = this.secret[this.type][field] || [];
|
||||
|
||||
return (
|
||||
<>
|
||||
<SubTitle compact className="fields-title" title={upperFirst(field.toString())}>
|
||||
@@ -137,6 +144,7 @@ export class AddSecretDialog extends React.Component<Props> {
|
||||
<div className="secret-fields">
|
||||
{fields.map((item, index) => {
|
||||
const { key = "", value = "", required } = item;
|
||||
|
||||
return (
|
||||
<div key={index} className="secret-field flex gaps auto align-center">
|
||||
<Input
|
||||
@@ -174,6 +182,7 @@ export class AddSecretDialog extends React.Component<Props> {
|
||||
const { ...dialogProps } = this.props;
|
||||
const { namespace, name, type } = this;
|
||||
const header = <h5><Trans>Create Secret</Trans></h5>;
|
||||
|
||||
return (
|
||||
<Dialog
|
||||
{...dialogProps}
|
||||
|
||||
@@ -31,6 +31,7 @@ export class SecretDetails extends React.Component<Props> {
|
||||
disposeOnUnmount(this, [
|
||||
autorun(() => {
|
||||
const { object: secret } = this.props;
|
||||
|
||||
if (secret) {
|
||||
this.data = secret.data;
|
||||
this.revealSecret = {};
|
||||
@@ -41,7 +42,9 @@ export class SecretDetails extends React.Component<Props> {
|
||||
|
||||
saveSecret = async () => {
|
||||
const { object: secret } = this.props;
|
||||
|
||||
this.isSaving = true;
|
||||
|
||||
try {
|
||||
await secretsStore.update(secret, { ...secret, data: this.data });
|
||||
Notifications.ok(<Trans>Secret successfully updated.</Trans>);
|
||||
@@ -57,7 +60,9 @@ export class SecretDetails extends React.Component<Props> {
|
||||
|
||||
render() {
|
||||
const { object: secret } = this.props;
|
||||
|
||||
if (!secret) return null;
|
||||
|
||||
return (
|
||||
<div className="SecretDetails">
|
||||
<KubeObjectMeta object={secret}/>
|
||||
@@ -71,12 +76,14 @@ export class SecretDetails extends React.Component<Props> {
|
||||
Object.entries(this.data).map(([name, value]) => {
|
||||
const revealSecret = this.revealSecret[name];
|
||||
let decodedVal = "";
|
||||
|
||||
try {
|
||||
decodedVal = base64.decode(value);
|
||||
} catch {
|
||||
decodedVal = "";
|
||||
}
|
||||
value = revealSecret ? decodedVal : value;
|
||||
|
||||
return (
|
||||
<div key={name} className="data">
|
||||
<div className="name">{name}</div>
|
||||
|
||||
Reference in new issue
Block a user