Skip to content
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

Euified Management Saved Objects view component. #47652

Closed
wants to merge 6 commits into from

Conversation

sainthkh
Copy link
Contributor

@sainthkh sainthkh commented Oct 9, 2019

Summary

Partially solves #47022. Euified management/sections/objects/view.

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

For maintainers

@elasticmachine
Copy link
Contributor

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

1 similar comment
@elasticmachine
Copy link
Contributor

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

Comment on lines -227 to -258
// This handles the validation of the Ace Editor. Since we don't have any
// other hooks into the editors to tell us if the content is valid or not
// we need to use the annotations to see if they have any errors. If they
// do then we push the field.name to aceInvalidEditor variable.
// Otherwise we remove it.
const loadedEditors = [];
$scope.aceInvalidEditors = [];

$scope.aceLoaded = function (editor) {
if (_.contains(loadedEditors, editor)) return;
loadedEditors.push(editor);

editor.$blockScrolling = Infinity;

const session = editor.getSession();
const fieldName = editor.container.id;

session.setTabSize(2);
session.setUseSoftTabs(true);
session.on('changeAnnotation', function () {
const annotations = session.getAnnotations();
if (_.some(annotations, { type: 'error' })) {
if (!_.contains($scope.aceInvalidEditors, fieldName)) {
$scope.aceInvalidEditors.push(fieldName);
}
} else {
$scope.aceInvalidEditors = _.without($scope.aceInvalidEditors, fieldName);
}

if (!$rootScope.$$phase) $scope.$apply();
});
};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need this any more because we can validate the values directly inside the <Form> component.

Comment on lines +194 to +204
disabled={fields
.filter(f => f.type === 'json' || f.type === 'array')
.map(f => {
try {
JSON.parse(f.value || '[]');
return true;
} catch (e) {
return false;
}
})
.includes(false)}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the validation part.

|| '[]' in f.value || '[]' is there because JSON.parse(undefined) or JSON.parse('') is error.

link: string;
canViewInApp: boolean;
canDelete: boolean;
removeObject: any;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any will be removed when View is de-angularized.

} from '@elastic/eui';

interface Props {
initialFields: any[];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Field will be defined when View is de-angularized.

@sainthkh
Copy link
Contributor Author

sainthkh commented Nov 4, 2019

When you (Kibana team) are ready to handle this, please leave me a comment. I'll come back to handle the conflicts and bugs.

@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-arch (Team:AppArch)

@pgayvallet
Copy link
Contributor

Would have loved to know about this PR before I actually started #59490 😄

Guess this one can be closed now? @sainthkh would love to have your review on #59490 though.

@sainthkh sainthkh closed this Mar 6, 2020
@sainthkh
Copy link
Contributor Author

sainthkh commented Mar 6, 2020

It was 5 months ago I wrote this and I forgot most of the code. So, I guess I should skip the review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants