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

Feature/update slug #2868

Closed
wants to merge 39 commits into from
Closed

Feature/update slug #2868

wants to merge 39 commits into from

Conversation

saransh-dev
Copy link
Contributor

Fixed issue #2805

Closes: #2805

Copy link
Contributor

@marla-singer marla-singer left a 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');
Copy link
Contributor

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);
    },
  },
});

Copy link
Contributor Author

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.

Copy link
Contributor

@marla-singer marla-singer Sep 1, 2017

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.

Copy link
Contributor Author

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;
Copy link
Contributor

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

Copy link
Contributor

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) => {

'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

Copy link
Contributor

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.

Copy link
Contributor

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.

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 can use templateInstance instead on instance

Copy link
Contributor

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;
Copy link
Contributor

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

Copy link
Contributor Author

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
Copy link
Contributor

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()) {

@marla-singer marla-singer removed the request for review from saralavanip September 1, 2017 08:51
@marla-singer
Copy link
Contributor

@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)

@marla-singer marla-singer added this to the Sprint 51 milestone Sep 1, 2017
@marla-singer marla-singer self-assigned this Sep 1, 2017
Copy link
Contributor

@mauriciovieira mauriciovieira left a 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?

@marla-singer
Copy link
Contributor

@saransh-dev Resolve conflict

@brylie
Copy link
Contributor

brylie commented Sep 7, 2017

@saransh-dev It would probably just be better to cherry-pick your commits in a new branch from develop, rather than continuing to work in this branch.

@saransh-dev
Copy link
Contributor Author

@marla-singer Above conflict occur because of following:-

1) 03 user creation create admin user:

     Uncaught Error: unknown error: Element is not clickable at point (392, 767)

      at SettingsPage.submit (tests/page-objects/settings.page.js:50:29)

      at SettingsPage.setupGithub (tests/page-objects/settings.page.js:45:10)

      at Context.<anonymous> (tests/end-to-end/ui/03-user-creation.js:39:18)

      at node_modules/chimp/dist/lib/utils/fiberize.js:29:22

I have also attached screen shot for more reference.
screen shot 2017-09-08 at 10 40 39-fullpage

@marla-singer
Copy link
Contributor

@saransh-dev

  1. you've got remarks from another reviewer
    joxi_screenshot_1504858070079

  2. YourPR conflicts with develop branch and it doesn't relate to test fails
    joxi_screenshot_1504858092595

@marla-singer
Copy link
Contributor

@saransh-dev Make git rebase develop - it allows to set your commits to up
https://git-scm.com/docs/git-rebase

@mauriciovieira
Copy link
Contributor

@saransh-dev May I take over this branch and do the rebase?

@saransh-dev
Copy link
Contributor Author

@mauriciovieira , Yes, you can rebase it.

@mauriciovieira
Copy link
Contributor

@marla-singer @saransh-dev I squashed all @saransh-dev commits and added a final one in #2991.

@marla-singer marla-singer deleted the feature/update-slug branch November 13, 2017 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants