-
Notifications
You must be signed in to change notification settings - Fork 33
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
Feature/update slug #2868
Feature/update slug #2868
Conversation
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.
PR has new files as .DS_Store
.
If it is auto-generated files of your Editor or OS then add a rule for .gitignore
FlowRouter.go('viewApi', { slug }); | ||
} else { | ||
// Otherwise Redirect to API Catalog | ||
FlowRouter.go('apiCatalog'); |
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.
There is incorrect logic.
If a user will rename an API it would redirect to API Profile again
If a user will edit just URL it would redirect to API catalog
My suggestion (as I wrote in another PR) :
AutoForm.hooks({
apiDetailsForm: {
onSuccess () {
const slug = this.updateDoc.$set.slug;
// make sure slug was edited
if (slug) {
// Redirect to updated API with new slug
FlowRouter.go('viewApi', { slug });
}
// Get success message translation
const message = TAPi18n.__('apiDetailsForm_text_updateInformation');
// Show message
sAlert.success(message);
},
},
});
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.
if it return this.updateDoc.$set.slug
undefined then code will stuck.
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.
then code will stuck.
I tested it local and everything is fine.
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.
ok i'll remove it
|
||
// Subscribe to public proxy details for proxy form | ||
instance.subscribe('publicProxyDetails'); | ||
const templateInstance = this; |
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.
Why does it need two variable for this
?
Remove templateInstance
variable and use instance
for that
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.
@marla-singer we use the variable templateInstance
to refer to the Template instance. This is following conventions from our lint rules.
See, for example, template event handler arguments:
'click #filter-icon': (event, templateInstance) => { |
Line 14 in 38bc28a
'click #confirm-change-selected-proxy': function (event, templateInstance) { |
'click #modal-delete-api': function (event, templateInstance) { |
'click #confirm-remove': function (event, templateInstance) { |
'click #confirm-remove': function (event, templateInstance) { |
'click #exportJSONConfig': function (event, templateInstance) { |
'click #modal-delete-post': function (event, templateInstance) { |
Etc...
https://github.com/apinf/platform/search?utf8=✓&q=templateInstance
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.
@brylie Then it should be resolved in another PR in a whole project
I don't mind to rename the variable.
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.
Yes, we should definitely be consistent with the templateInstance
variable. For this PR, lets go ahead and prefer the templateInstance
naming convention. The clean-up work for other files can take place, as you mention, in a separate PR.
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.
we can use templateInstance
instead on instance
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.
@saransh-dev Remove const instance = this
and rename all instance
to templateInstance
in current file
templateInstance.autorun(() => { | ||
// Take slug from params | ||
const slug = FlowRouter.getParam('slug'); | ||
instance.slug = slug; |
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.
Why do you duplication value of slug
?
I saw that you didn't use instance.slug
in helpers.
Keep variable const slug
and remove instance.slug
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.
ok i'll do this
// Subscribe to public proxy details for proxy form | ||
instance.subscribe('publicProxyDetails'); | ||
if (instance.subscriptionsReady()) { | ||
// Get single API Backend |
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.
Remove condition if (instance.subscriptionsReady()) {
@saransh-dev Also don't send a review request to no developer team member. The PR can be merged by myself, Brylie (@brylie), Matti (@matleppa ) and Mauricio (@mauriciovieira) |
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.
Can you squash all 'Delete .DS_Store' commits into a single one?
… into feature/update-slug
@saransh-dev Resolve conflict |
@saransh-dev It would probably just be better to cherry-pick your commits in a new branch from |
@marla-singer Above conflict occur because of following:-
|
@saransh-dev Make |
… into feature/update-slug
Update based on a new translation round
Update Finnish translations
… into feature/update-slug
@saransh-dev May I take over this branch and do the rebase? |
@mauriciovieira , Yes, you can rebase it. |
@marla-singer @saransh-dev I squashed all @saransh-dev commits and added a final one in #2991. |
Fixed issue #2805
Closes: #2805