bnomei / kirby3-doctor

Plugin to check health of your CMS installation
https://forum.getkirby.com/t/kirby3-doctor-check-health-of-kirby-installation/23579
MIT License
19 stars 1 forks source link

make it a panel view not a field #6

Closed bnomei closed 2 years ago

Daandelange commented 3 years ago

Hey, as a quick workaround, here's some minimal code to wrap the field in a panel view.

panel.plugin('me/doctorpanelview', {
  views: {
    doctorview: {
      component: {
        template: `
          <k-view class="doctor-panel-view">
            <k-header>Kirby Doctor</k-header>
            <k-doctor-field label="Doctor" progress="Performing checks..." job="plugin-doctor/check">
          </k-view>
        `
      },
      icon: "bug",
      label: "Doctor"
    }
  }
});
Daandelange commented 2 years ago

Updated for K3.6 :

// index.js
panel.plugin('me/doctorpanelview', {
  components: {
    'doctor-view': {
      template: `
          <k-inside class="doctor-panel-view">
            <k-view>
            <k-header>
                Kirby Doctor
            </k-header>
            <k-doctor-field label="Doctor" progress="Performing checks..." job="plugin-doctor/check" />
            </k-view>
          </k-inside>
        `
    }
  }
})
// index.php
Kirby::plugin('me/doctorpanelview', [
    'areas' => [
        'doctor' => function ($kirby) {
            return [
                'label' => 'Doctor',
                'icon' => 'bug',
                'breadcrumbLabel' => function () {
                  return 'Doctor - Keep Kirby healthy !';
                },
                'menu' => true,
                'link' => 'doctor',
                'views' => [
                  [
                    'pattern' => 'doctor',
                    'action'  => function () use ($kirby)  {
                      return [
                        'component' => 'doctor-view',
                        'title' => 'Kirby Doctor'
                      ];
                    }
                  ]
                ]
            ];
        },
    ],
]);
bnomei commented 2 years ago

@Daandelange wow. i will give it a try asap. thanks for your contribution