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

[Tech] - Fixed save queries, Added share queries in saved/successful … #16

Merged

Conversation

AlKaliada
Copy link
Collaborator

…queries dialogs

@AlKaliada AlKaliada requested a review from smiakchilo February 21, 2022 13:50
@@ -9,6 +9,11 @@
</coral-dialog-content>
<coral-dialog-footer>
<button class="executeQueryButton" type="button" is="coral-button" variant="primary" disabled>Open</button>
<button type="button" autocomplete="off" is="coral-button" icon="share" variant="secondary" trackingfeature="" trackingelement="" tracking="ON" class="shareQueryButton coral3-Button coral3-Button--secondary" size="M" disabled>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let us call the classes in the more UI-style manner) See below, in the <coral-icon> tag, all classes are dash-separated and mostly go with the small letter (except for the "Icon" which has some special meaning).
We can do this in a voice call later

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed, thanks

return function () {
foundationUi.notify('URL copied to clipboard');
const urlWithoutParams = window.location.origin + window.location.pathname;
navigator.clipboard.writeText(urlWithoutParams + '?query=' + encodeURIComponent(query));
Copy link
Collaborator

Choose a reason for hiding this comment

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

-query. The query param doesn't go without a prefix. A number of variants has already changed, though) The latest one is -query

@@ -93,6 +107,7 @@
function toggleActionButtonsState(value) {
$('.deleteQueryButton').prop('disabled', value);
$('.executeQueryButton').prop('disabled', value);
$('.shareQueryButton').prop('disabled', value);
Copy link
Collaborator

@smiakchilo smiakchilo Feb 21, 2022

Choose a reason for hiding this comment

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

Would be far better, to create a common class for them all

  • Please take a note, that in Granite, there's a particular way to change states of things
    $(window).adaptTo("foundation-registry").register("foundation.collection.action.activecondition", {
        name: "some.name.of.condition",
        handler: function(name, el, config, collection, selections) {
            return selections.every(function(item) {
                return item.value; // of item['some-attr'], etc.
            });
        }
    });

Then, in the button itself

 <button
              jcr:primaryType="nt:unstructured"
              sling:resourceType="granite/ui/components/coral/foundation/collection/action"
              action="some.action"
              activeCondition="some.name.of.condition"/>

This is the way it was invented to be. Merely to avoid the event listeners like above. This is an element of reactive programming, like in React/angular etc. But frankly speaking, it was invented for Lists (Tables etc). I have no idea how it would work with a TextArea. But it's worth trying))

$(document).on('click', '.executeQueryButton', function () {
executeAction && executeAction();
});

$(document).on('click', '.deleteQueryButton', function () {
deleteAction && deleteAction();
});

$(document).on('click', '.shareQueryButton', function () {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Consider using registered actions instead of direct event hooks

@smiakchilo smiakchilo changed the title [TECH] - Fixed save queries, Added share queries in saved/successful … [Tech] - Fixed save queries, Added share queries in saved/successful … Feb 21, 2022
@smiakchilo smiakchilo merged commit 763d75d into tech/query-service-refactor Feb 21, 2022
@smiakchilo smiakchilo deleted the tech/fix-saved-share-queries-feature branch March 14, 2022 12:50
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.

2 participants