-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add updatedAt to SimpleSavedObject #126359
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [SimpleSavedObject](./kibana-plugin-core-public.simplesavedobject.md) > [updatedAt](./kibana-plugin-core-public.simplesavedobject.updatedat.md) | ||
|
||
## SimpleSavedObject.updatedAt property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
updatedAt: SavedObjectType<T>['updated_at']; | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ export class SimpleSavedObject<T = unknown> { | |
public coreMigrationVersion: SavedObjectType<T>['coreMigrationVersion']; | ||
public error: SavedObjectType<T>['error']; | ||
public references: SavedObjectType<T>['references']; | ||
public updatedAt: SavedObjectType<T>['updated_at']; | ||
/** | ||
* Space(s) that this saved object exists in. This attribute is not used for "global" saved object types which are registered with | ||
* `namespaceType: 'agnostic'`. | ||
|
@@ -48,6 +49,7 @@ export class SimpleSavedObject<T = unknown> { | |
migrationVersion, | ||
coreMigrationVersion, | ||
namespaces, | ||
updated_at: updatedAt, | ||
}: SavedObjectType<T> | ||
) { | ||
this.id = id; | ||
|
@@ -58,6 +60,7 @@ export class SimpleSavedObject<T = unknown> { | |
this.migrationVersion = migrationVersion; | ||
this.coreMigrationVersion = coreMigrationVersion; | ||
this.namespaces = namespaces; | ||
this.updatedAt = updatedAt; | ||
if (error) { | ||
this.error = error; | ||
} | ||
|
@@ -77,15 +80,25 @@ export class SimpleSavedObject<T = unknown> { | |
|
||
public save(): Promise<SimpleSavedObject<T>> { | ||
if (this.id) { | ||
return this.client.update(this.type, this.id, this.attributes, { | ||
references: this.references, | ||
}); | ||
return this.client | ||
.update(this.type, this.id, this.attributes, { | ||
references: this.references, | ||
}) | ||
.then((sso) => { | ||
this.updatedAt = sso.updatedAt; | ||
return sso; | ||
}); | ||
Comment on lines
+87
to
+90
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wasn't sure if this change warrants adding a test. thoughts? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know that the current test suite is pretty lackluster, but let's not make the situation worse, and let's add tests on new enhancements if that's fine with you. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. happy to help. don't mind iterating too if needed 👍 |
||
} else { | ||
return this.client.create(this.type, this.attributes, { | ||
migrationVersion: this.migrationVersion, | ||
coreMigrationVersion: this.coreMigrationVersion, | ||
references: this.references, | ||
}); | ||
return this.client | ||
.create(this.type, this.attributes, { | ||
migrationVersion: this.migrationVersion, | ||
coreMigrationVersion: this.coreMigrationVersion, | ||
references: this.references, | ||
}) | ||
.then((sso) => { | ||
this.updatedAt = sso.updatedAt; | ||
return sso; | ||
}); | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needed in order to show the value in a table column