Skip to content

Conversation

@aaronucsd
Copy link

@aaronucsd aaronucsd commented Mar 16, 2018

screen shot 2018-03-19 at 10 56 29 am

  1. Added new resolution custom component
  2. fixed the icon issue on resolution select for model table
  3. Updated styling for the fix in Comment typo in last SQL example. #2
  4. Added new method to anomaly util file and moved a few needed anomaly methods from
    app/pods/manage/alert/explore/controller.js
  5. Moved anomalyResponseObj constant to anomaly util from
    app/pods/manage/alert/explore/route.js
  6. Updated app/pods/manage/alert/explore/* to use the methods from anomaly util
  7. updated anomaly util unit test and ran all tests for sanity
  8. Added new api anomaly file and unit test

@aaronucsd aaronucsd requested review from justYves and newsummit March 16, 2018 22:12
@aaronucsd aaronucsd force-pushed the resolution-template branch 2 times, most recently from 0101e48 to cab99c7 Compare March 16, 2018 22:19
Copy link
Contributor

@justYves justYves left a comment

Choose a reason for hiding this comment

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

Thanks for doing this! Super clean PR, added a few minor comments. Let me know if they make sense.

comments with nit or fyi are of course non-blocking.

Copy link
Contributor

Choose a reason for hiding this comment

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

sanity check: is this the format the back end will send this? no camelCase? metricAnomalyId

Copy link
Author

@aaronucsd aaronucsd Mar 16, 2018

Choose a reason for hiding this comment

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

Ah darn. I did a replace all for Id:..with anomalyId. Need to revert.

Copy link
Author

Choose a reason for hiding this comment

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

DONE

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: could use .mapBy('name') here

example:

import EmberObject from '@ember/object';

let hawaii = EmberObject.create({
  capital: 'Honolulu'
});

let california = EmberObject.create({
  capital: 'Sacramento'
});

let states = [hawaii, california];

states.mapBy('capital')

documentation:

https://guides.emberjs.com/v2.18.0/object-model/enumerables/#toc_map

Copy link
Author

Choose a reason for hiding this comment

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

DONE

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: let's use async/await to avoid the nested then's?

Copy link
Author

@aaronucsd aaronucsd Mar 16, 2018

Choose a reason for hiding this comment

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

Ok cool. It was copied of existing codes didn't check to refractor the method itself. I can do it now.

Copy link
Contributor

Choose a reason for hiding this comment

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

@aaronucsd ah didn't realize this was a copy/pasta. a TODO comment in the code is fine for now 👍

Copy link
Author

Choose a reason for hiding this comment

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

DONE

Copy link
Contributor

Choose a reason for hiding this comment

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

fyi, We could leverage getWithDefault here:

documentation:

https://emberjs.com/api/ember/2.18/functions/@ember%2Fobject/getWithDefault

example:

import { getWithDefault } from '@ember/object';
// ....
const filterMap = getWithDefault(res, 'searchFilters. statusFilterMap', null);

Copy link
Author

Choose a reason for hiding this comment

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

Sure. But i don't see why we need invoke a method that does the same kind of ternary underneath. I like it this way, it's more explicit to read.

Copy link
Author

Choose a reason for hiding this comment

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

DONE

Copy link
Contributor

Choose a reason for hiding this comment

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

if anomalyRecord is an ember object (it should be),

we can utilize setProperties so that we don't notify property changes for each sets. An alternative would be to wrap that in an ember run.

documentation:

https://emberjs.com/api/ember/2.18/functions/@ember%2Fobject/setProperties

example:

anomalyRecord.setProperties({
  anomalyFeedback: selectedResponse,
  showResponseSaved: true
})

Copy link
Author

Choose a reason for hiding this comment

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

again existing codes. But updated. Thanks.

Copy link
Author

Choose a reason for hiding this comment

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

DONE

Copy link
Contributor

Choose a reason for hiding this comment

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

let's use setProperties here

Copy link
Author

Choose a reason for hiding this comment

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

again existing codes. But updated. Thanks.

Copy link
Author

Choose a reason for hiding this comment

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

DONE

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: if we're sure that range contains both name and value property, we could deconstruct it

({ name, value }) => {
 // ...
  return {
       name,
       value,
       isActive: false
    };
 // ...
}

Copy link
Author

Choose a reason for hiding this comment

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

i'm not sure on this code. It existing and shows green because of merge conflict resolved.

Copy link
Author

Choose a reason for hiding this comment

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

SKIPPED

Copy link
Contributor

Choose a reason for hiding this comment

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

👍 fyi, I believe Steve started an API file, we can start thinking about putting new urls there in an effort to alleviate new tech debt

Copy link
Author

Choose a reason for hiding this comment

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

He has it for self-serve only. I can put another one for maybe something general.

app/utils/api/self-serve.js

Copy link
Author

Choose a reason for hiding this comment

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

added utils/api/anomaly.js. DONE

Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious what's the rationale behind choosing to implement it as a utils vs a service?

Copy link
Author

Choose a reason for hiding this comment

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

https://guides.emberjs.com/v3.0.0/applications/services/ explains the criteria for when to create a service. THere is no need to require shared state etc here.

Copy link
Author

Choose a reason for hiding this comment

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

DONE

@justYves
Copy link
Contributor

Also, understand that styling is not the highest priority, but I feel that some spacing between the icon and the input would be nicer visually. Perhaps 4 or 8 px? this should already exist as sass spacing variables

Copy link
Contributor

@newsummit newsummit left a comment

Choose a reason for hiding this comment

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

Thanks for modularizing. Lets test thoroughly to make sure all is well with Alert Page.

Copy link
Contributor

Choose a reason for hiding this comment

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

The jsDoc here doesn't seem to match the component.

Copy link
Author

Choose a reason for hiding this comment

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

done

@aaronucsd aaronucsd force-pushed the resolution-template branch 4 times, most recently from eebb4ae to a313575 Compare March 19, 2018 19:03
Copy link
Contributor

@justYves justYves left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

Choose a reason for hiding this comment

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

Every new line above 435 should be removed (merge resolution fix)

Copy link
Author

Choose a reason for hiding this comment

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

DONE

Copy link
Contributor

Choose a reason for hiding this comment

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

onRangeOptionClick no longer needed.

Copy link
Author

Choose a reason for hiding this comment

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

removed.

Copy link
Author

Choose a reason for hiding this comment

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

DONE

Copy link
Contributor

Choose a reason for hiding this comment

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

You can restore onRangeSelection

Copy link
Author

Choose a reason for hiding this comment

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

DONE

Copy link
Contributor

Choose a reason for hiding this comment

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

Lets try import { anomalyResponseObj } from 'thirdeye-frontend/utils/anomaly';

Copy link
Author

Choose a reason for hiding this comment

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

DONE

Copy link
Contributor

Choose a reason for hiding this comment

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

Not needed, right?

Copy link
Author

Choose a reason for hiding this comment

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

yep. Let me remove.

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice - thank you!

Copy link
Contributor

@newsummit newsummit left a comment

Choose a reason for hiding this comment

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

Thanks for modularizing/extending the resolution bit. I just indicated some cleanup items for manage/alert/explore controller.

1. Added new resolution custom component
2. fixed the icon issue on resolution select for model table
3. Updated styling for the fix in apache#2
4. Added new method to anomaly util file and moved a few needed anomaly methods from
app/pods/manage/alert/explore/controller.js
5. Moved anomalyResponseObj constant to anomaly util from
app/pods/manage/alert/explore/route.js
6. Updated app/pods/manage/alert/explore/* to use the methods from anomaly util
7. updated anomaly util unit test and ran all tests for sanity
8. Added new api anomaly file and unit test
@aaronucsd aaronucsd force-pushed the resolution-template branch from a313575 to acef124 Compare March 19, 2018 22:44
Copy link
Contributor

@newsummit newsummit left a comment

Choose a reason for hiding this comment

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

OK - Looks good.

@aaronucsd aaronucsd merged commit b0f405f into apache:master Mar 19, 2018
@aaronucsd aaronucsd deleted the resolution-template branch March 19, 2018 23:23
npawar pushed a commit that referenced this pull request Apr 6, 2018
…2634)

1. Added new resolution custom component
2. fixed the icon issue on resolution select for model table
3. Updated styling for the fix in #2
4. Added new method to anomaly util file and moved a few needed anomaly methods from
app/pods/manage/alert/explore/controller.js
5. Moved anomalyResponseObj constant to anomaly util from
app/pods/manage/alert/explore/route.js
6. Updated app/pods/manage/alert/explore/* to use the methods from anomaly util
7. updated anomaly util unit test and ran all tests for sanity
8. Added new api anomaly file and unit test
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.

3 participants