mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Improve Table typing and remove annotations on callbacks
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
22c9d03edb
commit
defb0ea0dd
55 files changed
+498
-490
No files matched your search
@@ -55,7 +55,7 @@ enum sortBy {
|
||||
status = "status"
|
||||
}
|
||||
|
||||
interface Props extends RouteComponentProps<ICatalogViewRouteParam> {}
|
||||
interface Props extends RouteComponentProps<ICatalogViewRouteParam> { }
|
||||
|
||||
@observer
|
||||
export class Catalog extends React.Component<Props> {
|
||||
@@ -182,7 +182,7 @@ export class Catalog extends React.Component<Props> {
|
||||
</MenuItem>
|
||||
))
|
||||
}
|
||||
<MenuItem key="add-to-hotbar" onClick={() => this.addToHotbar(item) }>
|
||||
<MenuItem key="add-to-hotbar" onClick={() => this.addToHotbar(item)}>
|
||||
Pin to Hotbar
|
||||
</MenuItem>
|
||||
</MenuActions>
|
||||
@@ -211,12 +211,12 @@ export class Catalog extends React.Component<Props> {
|
||||
store={this.catalogEntityStore}
|
||||
tableId="catalog-items"
|
||||
sortingCallbacks={{
|
||||
[sortBy.name]: (item: CatalogEntityItem) => item.name,
|
||||
[sortBy.source]: (item: CatalogEntityItem) => item.source,
|
||||
[sortBy.status]: (item: CatalogEntityItem) => item.phase,
|
||||
[sortBy.name]: entity => entity.name,
|
||||
[sortBy.source]: entity => entity.source,
|
||||
[sortBy.status]: entity => entity.phase,
|
||||
}}
|
||||
searchFilters={[
|
||||
(entity: CatalogEntityItem) => entity.searchFields,
|
||||
entity => entity.searchFields,
|
||||
]}
|
||||
renderTableHeader={[
|
||||
{ title: "", className: styles.iconCell },
|
||||
@@ -225,14 +225,14 @@ export class Catalog extends React.Component<Props> {
|
||||
{ title: "Labels", className: styles.labelsCell },
|
||||
{ title: "Status", className: styles.statusCell, sortBy: sortBy.status },
|
||||
]}
|
||||
renderTableContents={(item: CatalogEntityItem) => [
|
||||
this.renderIcon(item),
|
||||
item.name,
|
||||
item.source,
|
||||
item.labels.map((label) => <Badge key={label} label={label} title={label} />),
|
||||
{ title: item.phase, className: kebabCase(item.phase) }
|
||||
renderTableContents={entity => [
|
||||
this.renderIcon(entity),
|
||||
entity.name,
|
||||
entity.source,
|
||||
entity.labels.map((label) => <Badge key={label} label={label} title={label} />),
|
||||
{ title: entity.phase, className: kebabCase(entity.phase) }
|
||||
]}
|
||||
onDetails={(item: CatalogEntityItem) => this.onDetails(item) }
|
||||
onDetails={entity => this.onDetails(entity) }
|
||||
renderItemMenu={this.renderItemMenu}
|
||||
/>
|
||||
);
|
||||
@@ -248,13 +248,13 @@ export class Catalog extends React.Component<Props> {
|
||||
store={this.catalogEntityStore}
|
||||
tableId="catalog-items"
|
||||
sortingCallbacks={{
|
||||
[sortBy.name]: (item: CatalogEntityItem) => item.name,
|
||||
[sortBy.kind]: (item: CatalogEntityItem) => item.kind,
|
||||
[sortBy.source]: (item: CatalogEntityItem) => item.source,
|
||||
[sortBy.status]: (item: CatalogEntityItem) => item.phase,
|
||||
[sortBy.name]: entity => entity.name,
|
||||
[sortBy.kind]: entity => entity.kind,
|
||||
[sortBy.source]: entity => entity.source,
|
||||
[sortBy.status]: entity => entity.phase,
|
||||
}}
|
||||
searchFilters={[
|
||||
(entity: CatalogEntityItem) => entity.searchFields,
|
||||
entity => entity.searchFields,
|
||||
]}
|
||||
renderTableHeader={[
|
||||
{ title: "", className: styles.iconCell },
|
||||
@@ -263,16 +263,16 @@ export class Catalog extends React.Component<Props> {
|
||||
{ title: "Labels", className: styles.labelsCell },
|
||||
{ title: "Status", className: styles.statusCell, sortBy: sortBy.status },
|
||||
]}
|
||||
renderTableContents={(item: CatalogEntityItem) => [
|
||||
this.renderIcon(item),
|
||||
item.name,
|
||||
item.kind,
|
||||
item.source,
|
||||
item.labels.map((label) => <Badge key={label} label={label} title={label} />),
|
||||
{ title: item.phase, className: kebabCase(item.phase) }
|
||||
renderTableContents={entity => [
|
||||
this.renderIcon(entity),
|
||||
entity.name,
|
||||
entity.kind,
|
||||
entity.source,
|
||||
entity.labels.map((label) => <Badge key={label} label={label} title={label} />),
|
||||
{ title: entity.phase, className: kebabCase(entity.phase) }
|
||||
]}
|
||||
detailsItem={this.selectedItem}
|
||||
onDetails={(item: CatalogEntityItem) => this.onDetails(item) }
|
||||
onDetails={entity => this.onDetails(entity) }
|
||||
renderItemMenu={this.renderItemMenu}
|
||||
/>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user