Skip to content

Commit

Permalink
yarn prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
smerschjohann committed Jun 26, 2022
1 parent 88c36e1 commit a7200c5
Show file tree
Hide file tree
Showing 21 changed files with 2,706 additions and 4,921 deletions.
2 changes: 1 addition & 1 deletion dashboard/src/actions/namespace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export function fetchNamespaces(
export function createNamespace(
cluster: string,
ns: string,
labels: {[key: string]: string}
labels: { [key: string]: string },
): ThunkAction<Promise<boolean>, IStoreState, null, NamespaceAction> {
return async dispatch => {
try {
Expand Down
6 changes: 4 additions & 2 deletions dashboard/src/components/Header/ContextSelector.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ it("submits the form to create a new namespace with custom labels", () => {

const config = cloneDeep(initialState.config);
config.createNamespaceLabels = {
"managed-by": "kubeapps"
"managed-by": "kubeapps",
};
const wrapper = mountWrapper(getStore({ config }), <ContextSelector />);

Expand All @@ -160,7 +160,9 @@ it("submits the form to create a new namespace with custom labels", () => {
});
wrapper.update();

expect(createNamespace).toHaveBeenCalledWith(initialState.clusters.currentCluster, "new-ns", {"managed-by": "kubeapps"});
expect(createNamespace).toHaveBeenCalledWith(initialState.clusters.currentCluster, "new-ns", {
"managed-by": "kubeapps",
});
});

it("shows an error creating a namespace", () => {
Expand Down
6 changes: 4 additions & 2 deletions dashboard/src/components/Header/ContextSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function ContextSelector() {
const [namespace, setStateNamespace] = useState(namespaceSelected);
const [newNSModalIsOpen, setNewNSModalIsOpen] = useState(false);
const [newNS, setNewNS] = useState("");
const { createNamespaceLabels } = useSelector( (state: IStoreState) => state.config)
const { createNamespaceLabels } = useSelector((state: IStoreState) => state.config);

// Control when users click outside
const ref = useRef(null);
Expand Down Expand Up @@ -83,7 +83,9 @@ function ContextSelector() {
setNewNS(event.target.value);
const createNewNS = async (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
const created = await dispatch(actions.namespace.createNamespace(cluster, newNS, createNamespaceLabels));
const created = await dispatch(
actions.namespace.createNamespace(cluster, newNS, createNamespaceLabels),
);
if (created) {
closeNewNSModal();
dispatch(actions.namespace.setNamespace(cluster, newNS));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const makeStore = (
remoteComponentsUrl: "",
customAppViews: [],
skipAvailablePackageDetails: false,
createNamespaceLabels: {},
};
const clusters: IClustersState = {
currentCluster: "default",
Expand Down
72 changes: 18 additions & 54 deletions dashboard/src/gen/google/api/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,9 +397,7 @@ export const Http = {

fromJSON(object: any): Http {
return {
rules: Array.isArray(object?.rules)
? object.rules.map((e: any) => HttpRule.fromJSON(e))
: [],
rules: Array.isArray(object?.rules) ? object.rules.map((e: any) => HttpRule.fromJSON(e)) : [],
fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion)
? Boolean(object.fullyDecodeReservedExpansion)
: false,
Expand All @@ -409,9 +407,7 @@ export const Http = {
toJSON(message: Http): unknown {
const obj: any = {};
if (message.rules) {
obj.rules = message.rules.map((e) =>
e ? HttpRule.toJSON(e) : undefined
);
obj.rules = message.rules.map(e => (e ? HttpRule.toJSON(e) : undefined));
} else {
obj.rules = [];
}
Expand All @@ -422,9 +418,8 @@ export const Http = {

fromPartial<I extends Exact<DeepPartial<Http>, I>>(object: I): Http {
const message = createBaseHttp();
message.rules = object.rules?.map((e) => HttpRule.fromPartial(e)) || [];
message.fullyDecodeReservedExpansion =
object.fullyDecodeReservedExpansion ?? false;
message.rules = object.rules?.map(e => HttpRule.fromPartial(e)) || [];
message.fullyDecodeReservedExpansion = object.fullyDecodeReservedExpansion ?? false;
return message;
},
};
Expand All @@ -445,10 +440,7 @@ function createBaseHttpRule(): HttpRule {
}

export const HttpRule = {
encode(
message: HttpRule,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
encode(message: HttpRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.selector !== "") {
writer.uint32(10).string(message.selector);
}
Expand All @@ -468,10 +460,7 @@ export const HttpRule = {
writer.uint32(50).string(message.patch);
}
if (message.custom !== undefined) {
CustomHttpPattern.encode(
message.custom,
writer.uint32(66).fork()
).ldelim();
CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).ldelim();
}
if (message.body !== "") {
writer.uint32(58).string(message.body);
Expand Down Expand Up @@ -520,9 +509,7 @@ export const HttpRule = {
message.responseBody = reader.string();
break;
case 11:
message.additionalBindings.push(
HttpRule.decode(reader, reader.uint32())
);
message.additionalBindings.push(HttpRule.decode(reader, reader.uint32()));
break;
default:
reader.skipType(tag & 7);
Expand All @@ -540,13 +527,9 @@ export const HttpRule = {
post: isSet(object.post) ? String(object.post) : undefined,
delete: isSet(object.delete) ? String(object.delete) : undefined,
patch: isSet(object.patch) ? String(object.patch) : undefined,
custom: isSet(object.custom)
? CustomHttpPattern.fromJSON(object.custom)
: undefined,
custom: isSet(object.custom) ? CustomHttpPattern.fromJSON(object.custom) : undefined,
body: isSet(object.body) ? String(object.body) : "",
responseBody: isSet(object.responseBody)
? String(object.responseBody)
: "",
responseBody: isSet(object.responseBody) ? String(object.responseBody) : "",
additionalBindings: Array.isArray(object?.additionalBindings)
? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e))
: [],
Expand All @@ -562,15 +545,12 @@ export const HttpRule = {
message.delete !== undefined && (obj.delete = message.delete);
message.patch !== undefined && (obj.patch = message.patch);
message.custom !== undefined &&
(obj.custom = message.custom
? CustomHttpPattern.toJSON(message.custom)
: undefined);
(obj.custom = message.custom ? CustomHttpPattern.toJSON(message.custom) : undefined);
message.body !== undefined && (obj.body = message.body);
message.responseBody !== undefined &&
(obj.responseBody = message.responseBody);
message.responseBody !== undefined && (obj.responseBody = message.responseBody);
if (message.additionalBindings) {
obj.additionalBindings = message.additionalBindings.map((e) =>
e ? HttpRule.toJSON(e) : undefined
obj.additionalBindings = message.additionalBindings.map(e =>
e ? HttpRule.toJSON(e) : undefined,
);
} else {
obj.additionalBindings = [];
Expand All @@ -592,8 +572,7 @@ export const HttpRule = {
: undefined;
message.body = object.body ?? "";
message.responseBody = object.responseBody ?? "";
message.additionalBindings =
object.additionalBindings?.map((e) => HttpRule.fromPartial(e)) || [];
message.additionalBindings = object.additionalBindings?.map(e => HttpRule.fromPartial(e)) || [];
return message;
},
};
Expand All @@ -603,10 +582,7 @@ function createBaseCustomHttpPattern(): CustomHttpPattern {
}

export const CustomHttpPattern = {
encode(
message: CustomHttpPattern,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
encode(message: CustomHttpPattern, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.kind !== "") {
writer.uint32(10).string(message.kind);
}
Expand Down Expand Up @@ -651,24 +627,15 @@ export const CustomHttpPattern = {
return obj;
},

fromPartial<I extends Exact<DeepPartial<CustomHttpPattern>, I>>(
object: I
): CustomHttpPattern {
fromPartial<I extends Exact<DeepPartial<CustomHttpPattern>, I>>(object: I): CustomHttpPattern {
const message = createBaseCustomHttpPattern();
message.kind = object.kind ?? "";
message.path = object.path ?? "";
return message;
},
};

type Builtin =
| Date
| Function
| Uint8Array
| string
| number
| boolean
| undefined;
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;

export type DeepPartial<T> = T extends Builtin
? T
Expand All @@ -683,10 +650,7 @@ export type DeepPartial<T> = T extends Builtin
type KeysOfUnion<T> = T extends T ? keyof T : never;
export type Exact<P, I extends P> = P extends Builtin
? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & Record<
Exclude<keyof I, KeysOfUnion<P>>,
never
>;
: P & { [K in keyof P]: Exact<P[K], I[K]> } & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;

if (_m0.util.Long !== Long) {
_m0.util.Long = Long as any;
Expand Down
30 changes: 7 additions & 23 deletions dashboard/src/gen/google/protobuf/any.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,19 +162,15 @@ export const Any = {
fromJSON(object: any): Any {
return {
typeUrl: isSet(object.typeUrl) ? String(object.typeUrl) : "",
value: isSet(object.value)
? bytesFromBase64(object.value)
: new Uint8Array(),
value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(),
};
},

toJSON(message: Any): unknown {
const obj: any = {};
message.typeUrl !== undefined && (obj.typeUrl = message.typeUrl);
message.value !== undefined &&
(obj.value = base64FromBytes(
message.value !== undefined ? message.value : new Uint8Array()
));
(obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array()));
return obj;
},

Expand All @@ -198,8 +194,7 @@ var globalThis: any = (() => {
})();

const atob: (b64: string) => string =
globalThis.atob ||
((b64) => globalThis.Buffer.from(b64, "base64").toString("binary"));
globalThis.atob || (b64 => globalThis.Buffer.from(b64, "base64").toString("binary"));
function bytesFromBase64(b64: string): Uint8Array {
const bin = atob(b64);
const arr = new Uint8Array(bin.length);
Expand All @@ -210,24 +205,16 @@ function bytesFromBase64(b64: string): Uint8Array {
}

const btoa: (bin: string) => string =
globalThis.btoa ||
((bin) => globalThis.Buffer.from(bin, "binary").toString("base64"));
globalThis.btoa || (bin => globalThis.Buffer.from(bin, "binary").toString("base64"));
function base64FromBytes(arr: Uint8Array): string {
const bin: string[] = [];
arr.forEach((byte) => {
arr.forEach(byte => {
bin.push(String.fromCharCode(byte));
});
return btoa(bin.join(""));
}

type Builtin =
| Date
| Function
| Uint8Array
| string
| number
| boolean
| undefined;
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;

export type DeepPartial<T> = T extends Builtin
? T
Expand All @@ -242,10 +229,7 @@ export type DeepPartial<T> = T extends Builtin
type KeysOfUnion<T> = T extends T ? keyof T : never;
export type Exact<P, I extends P> = P extends Builtin
? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & Record<
Exclude<keyof I, KeysOfUnion<P>>,
never
>;
: P & { [K in keyof P]: Exact<P[K], I[K]> } & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;

if (_m0.util.Long !== Long) {
_m0.util.Long = Long as any;
Expand Down
Loading

0 comments on commit a7200c5

Please sign in to comment.