SmartView TriggerAction

I just missed the little mistake:

// This import is bad
import Component from '@ember/component';
// This should be
import Component from '@glimmer/component';
<div class="c-smart-view">
  <div class="c-smart-view__content">
    <span class="c-smart-view_icon fa fa-{{@collection.iconOrDefault}} fa-5x"></span>
    <h1>
    </h1>
    <p>
      <h1 class="title">Liste de clients ({{@recordsCount}})</h1>
      Current page : ({{@currentPage}})
      Number of pages : ({{@numberOfPages}})
      Collection : ({{@collection}})

      <table style="width:100%">
          <tr>
            <th>ID</th>
            <th>Email</th>
            <th>Company</th>
            <th>Actions</th>
          </tr>
            {{#each @records as |record|}}
              <tr>
                <td class="tableCell">{{record.id}}</td>
                <td class="tableCell">{{record.forest-email}}</td>
                <td class="tableCelle">{{record.forest-companyName}}</td>
                <td class="tableCell">
                     <Button::BetaButton
                        @type="primary"
                        @text="Connect as user"
                        @action={{fn this.triggerSmartAction @collection 'Connect as user' record}}
                      />
                       
                      <Button::BetaButton
                        @type="danger"
                        @text="Delete user"
                        @action={{fn this.deleteRecords record}}
                        @async={{false}}
                      />
                </td>
              </tr>
            {{/each}}
        </table>
    
    </p>

    
      <Button::BetaButton
      @type="primary"
      @action={{@fetchRecords}}
   >
        Refresh data
    </Button::BetaButton>

  </div>
  
</div>




Ok, it’s better with that modification

Now I have

import Component from '@glimmer/component';
import { triggerSmartAction, deleteRecords, getCollectionId, loadExternalStyle, loadExternalJavascript } from 'client/utils/smart-view-utils';
import { action } from '@ember/object';

export default class extends Component {
  @action
  triggerSmartAction(...args) {
    return triggerSmartAction(this, ...args);
  }
  
  @action
  deleteRecords(...args) {
    return deleteRecords(this, ...args);
  }
}
<div class="c-smart-view">
  <div class="c-smart-view__content">
    <span class="c-smart-view_icon fa fa-{{@collection.iconOrDefault}} fa-5x"></span>
    <h1>
    </h1>
    <p>
      <h1 class="title">Liste de clients ({{@recordsCount}})</h1>
      Current page : ({{@currentPage}})
      Number of pages : ({{@numberOfPages}})
      Collection : ({{@collection}})

      <table style="width:100%">
          <tr>
            <th>ID</th>
            <th>Email</th>
            <th>Company</th>
            <th>Actions</th>
          </tr>
            {{#each @records as |record|}}
              <tr>
                <td class="tableCell">{{record.id}}</td>
                <td class="tableCell">{{record.forest-email}}</td>
                <td class="tableCelle">{{record.forest-companyName}}</td>
                <td class="tableCell">
                     <Button::BetaButton
                        @type="primary"
                        @text="Connect as user"
                        @action={{fn this.triggerSmartAction @collection 'Connect as user' record}}
                      />
                       
                      <Button::BetaButton
                        @type="danger"
                        @text="Delete user"
                        @action={{fn this.deleteRecords record}}
                        @async={{false}}
                      />
                </td>
              </tr>
            {{/each}}
        </table>
    
    </p>

    
      <Button::BetaButton
      @type="primary"
      @action={{@fetchRecords}}
   >
        Refresh data
    </Button::BetaButton>

  </div>
  
</div>




try to print ...args in deleteRecords. Especially args[0].id

Here is a screencast with the print

args[0].id contains the user’s id

Is it possible to know how deleteRecords is implemented ?

It is very hard to debug or override something you can’t see

Their might be an issue on the deleteRecords. I will investigate :wink:

Hello @vince, any update on the topic ?

Sorry I’ve been busy. I’ll try to do a quick fix for you :wink:

Hi @vince,

I’m still stuck on this problem.

Do you have any solution to provide? It’s quite urgent for us.

Thanks

Hi @gaelperon,

The code is currently in review and should hopefully be validated soon. We will update this thread once the release is live.

Hi @gaelperon,

The fix has just been released. Could you confirm it fix your issue please :slightly_smiling_face: ?

Hi @vince

The issue is fixed.
The delete action is working well

Thanks

1 Like