Remove Clock, Connected Apps and Notifications from the settings menu and move Site Links under Integrations. Extract a shared integration grid (two-column cards with settings/reconnect/remove icon buttons) used by both Calendar and Site Links, and add a Site Links section that lists the dashboard quick-link integrations alphabetically. Manage Integrations now excludes calendars and site links, which are managed from their settings sections.
85 lines
2.2 KiB
Plaintext
85 lines
2.2 KiB
Plaintext
import Component from '@glimmer/component';
|
|
import { action } from '@ember/object';
|
|
import { fn } from '@ember/helper';
|
|
import { on } from '@ember/modifier';
|
|
import { service } from '@ember/service';
|
|
import { formFor } from '../../../../config/integration-forms';
|
|
import { CALENDAR_TYPES } from '../../../../config/calendar';
|
|
import { CALDAV_TYPE } from '../../../../config/caldav';
|
|
import { ICS_TYPE } from '../../../../config/ics';
|
|
import IntegrationGrid from './integration-grid.gjs';
|
|
|
|
// The connected calendars, moved out of Manage Integrations. Add/edit open the
|
|
// calendar wizards on top of the settings dialog via the modal stack.
|
|
export default class SettingsCalendarList extends Component {
|
|
@service integrations;
|
|
@service modal;
|
|
|
|
get rows() {
|
|
return this.integrations.rows.filter((row) =>
|
|
CALENDAR_TYPES.includes(row.type)
|
|
);
|
|
}
|
|
|
|
@action
|
|
edit(row) {
|
|
const component = formFor(row.type);
|
|
|
|
if (!component) {
|
|
return;
|
|
}
|
|
|
|
this.modal.open({
|
|
component,
|
|
props: { mode: 'edit', integration: row },
|
|
size: 'md',
|
|
});
|
|
}
|
|
|
|
@action
|
|
async remove(row) {
|
|
await this.integrations.remove(row);
|
|
}
|
|
|
|
@action
|
|
add(type) {
|
|
const component = formFor(type);
|
|
|
|
if (!component) {
|
|
return;
|
|
}
|
|
|
|
this.modal.open({ component, props: { mode: 'add' }, size: 'md' });
|
|
}
|
|
|
|
<template>
|
|
<div>
|
|
<IntegrationGrid
|
|
@rows={{this.rows}}
|
|
@onEdit={{this.edit}}
|
|
@onRemove={{this.remove}}
|
|
@emptyLabel="No calendars connected yet."
|
|
/>
|
|
|
|
<div class="mt-6 flex flex-wrap gap-2">
|
|
<button
|
|
type="button"
|
|
data-add={{CALDAV_TYPE}}
|
|
{{on "click" (fn this.add CALDAV_TYPE)}}
|
|
class="rounded-md bg-white px-3 py-2 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50"
|
|
>
|
|
Add CalDAV account
|
|
</button>
|
|
<button
|
|
type="button"
|
|
data-add={{ICS_TYPE}}
|
|
{{on "click" (fn this.add ICS_TYPE)}}
|
|
class="rounded-md bg-white px-3 py-2 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50"
|
|
>
|
|
Subscribe via link
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
}
|