Diff
checker
テキスト
テキスト
画像
ドキュメント
Excel
フォルダ
Legal
Enterprise
デスクトップ
料金
ログイン
Diffchecker デスクトップのダウンロード
テキスト比較
2 つのテキスト ファイルの違いを見つける
ツール
履歴
ライブエディター
空白の変更を非表示
未変更行を折りたたむ
折り返しなし
レイアウト
分割
統合
比較精度
スマート
単語
文字
テキストスタイル
外観を変更
シンタックスハイライト
構文を選択
無視
テキスト変換
最初の差分へ移動
入力を編集
Diffchecker Desktop
Diffcheckerを実行する最も安全な方法。Diffchecker Desktopアプリを入手:あなたの差分はコンピューターから出ることはありません!
Desktopを入手
providerdeleteconfirm.js
作成日
2 年前
差分は期限切れになりません
クリア
エクスポート
共有
説明
5 削除
行
合計
削除
文字
合計
削除
この機能を引き続き使用するには、アップグレードしてください
Diff
checker
Pro
価格を見る
94 行
すべてコピー
23 追加
行
合計
追加
文字
合計
追加
この機能を引き続き使用するには、アップグレードしてください
Diff
checker
Pro
価格を見る
114 行
すべてコピー
// This file is part of Moodle - http://moodle.org/ //
// This file is part of Moodle - http://moodle.org/ //
// Moodle is free software: you can redistribute it and/or modify
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// (at your option) any later version.
//
//
// Moodle is distributed in the hope that it will be useful,
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// GNU General Public License for more details.
//
//
// You should have received a copy of the GNU General Public License
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
/**
* AI provider deletion confirmation.
* AI provider deletion confirmation.
* Renders a confirmation modal when deleting an AI provider.
* Renders a confirmation modal when deleting an AI provider.
*
*
* @module core_ai/providerdeleteconfirm
* @module core_ai/providerdeleteconfirm
* @copyright 2024 Matt Porritt <matt.porritt@moodle.com>
* @copyright 2024 Matt Porritt <matt.porritt@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
*/
import {getString} from 'core/str';
import {getString} from 'core/str';
コピー
コピー済み
コピー
コピー済み
import {prefetchStrings} from 'core/prefetch';
import DeleteCancelModal from 'core/modal_delete_cancel';
import DeleteCancelModal from 'core/modal_delete_cancel';
import ModalEvents from 'core/modal_events';
import ModalEvents from 'core/modal_events';
import Ajax from 'core/ajax';
import Ajax from 'core/ajax';
コピー
コピー済み
コピー
コピー済み
import {refreshTableContent} from 'core_table/dynamic';
import {fetchNotifications} from 'core/notification';
import * as Selectors from 'core_table/local/dynamic/selectors';
import * as DynamicTable from 'core_table/dynamic';
/**
/**
* Call the delete service.
* Call the delete service.
*
*
* @param {String} providerid The provider id.
* @param {String} providerid The provider id.
* @return {Promise} The promise.
* @return {Promise} The promise.
*/
*/
const deleteProviderService = async(providerid) => Ajax.call([{
const deleteProviderService = async(providerid) => Ajax.call([{
methodname: 'core_ai_delete_provider_instance',
methodname: 'core_ai_delete_provider_instance',
args: {
args: {
providerid: providerid,
providerid: providerid,
},
},
}])[0];
}])[0];
/**
/**
* Handle the delete event.
* Handle the delete event.
* Calls the delete service and reloads the page.
* Calls the delete service and reloads the page.
*
*
* @param {String} providerid The provider id.
* @param {String} providerid The provider id.
* @returns {Promise<void>}
* @returns {Promise<void>}
*/
*/
const handleDelete = async(providerid) => {
const handleDelete = async(providerid) => {
await deleteProviderService(providerid);
await deleteProviderService(providerid);
コピー
コピー済み
コピー
コピー済み
//
Refresh
the
page
, so we get the updated list of providers, and any messages.
//
Reload
the
table
, so we get the updated list of providers, and any messages.
window.location.reload();
const tableRoot = document.querySelector(Selectors.main.region);
await Promise.all([
refreshTableContent(tableRoot),
fetchNotifications(),
]);
};
};
/**
/**
* Show the delete confirmation modal.
* Show the delete confirmation modal.
*
*
* @param {Event} e The event object.
* @param {Event} e The event object.
*/
*/
const showDeleteModal = async(e) => {
const showDeleteModal = async(e) => {
const providerid = e.target.dataset.id;
const providerid = e.target.dataset.id;
const provider = e.target.dataset.provider;
const provider = e.target.dataset.provider;
const name = e.target.dataset.name;
const name = e.target.dataset.name;
const bodyparams = {
const bodyparams = {
provider: provider,
provider: provider,
name: name,
name: name,
};
};
const modal = await DeleteCancelModal.create({
const modal = await DeleteCancelModal.create({
コピー
コピー済み
コピー
コピー済み
title:
await
getString('providerinstancedelete', 'core_ai'),
title:
getString('providerinstancedelete', 'core_ai'),
body:
await
getString('providerinstancedeleteconfirm', 'core_ai', bodyparams),
body:
getString('providerinstancedeleteconfirm', 'core_ai', bodyparams),
show: true,
show: true,
removeOnClose: true,
removeOnClose: true,
});
});
// Handle delete event.
// Handle delete event.
modal.getRoot().on(ModalEvents.delete, (e) => {
modal.getRoot().on(ModalEvents.delete, (e) => {
e.preventDefault();
e.preventDefault();
handleDelete(providerid);
handleDelete(providerid);
modal.destroy();
modal.destroy();
});
});
};
};
/**
/**
* Initialise the delete listeners.
* Initialise the delete listeners.
*
*
*/
*/
export const init = () => {
export const init = () => {
コピー
コピー済み
コピー
コピー済み
prefetchStrings('core_ai', [
'providerinstancedelete',
'providerinstancedeleteconfirm',
]);
document.querySelectorAll('.ai-provider-delete').forEach((button) => {
document.querySelectorAll('.ai-provider-delete').forEach((button) => {
button.addEventListener('click', (e) => {
button.addEventListener('click', (e) => {
e.preventDefault();
e.preventDefault();
showDeleteModal(e);
showDeleteModal(e);
});
});
});
});
コピー
コピー済み
コピー
コピー済み
document.addEventListener(DynamicTable.Events.tableContentRefreshed, () => {
init();
}, {once: true});
};
};
コピー
コピー済み
コピー
コピー済み
保存された差分
原文
ファイルを開く
// This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * AI provider deletion confirmation. * Renders a confirmation modal when deleting an AI provider. * * @module core_ai/providerdeleteconfirm * @copyright 2024 Matt Porritt <matt.porritt@moodle.com> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ import {getString} from 'core/str'; import DeleteCancelModal from 'core/modal_delete_cancel'; import ModalEvents from 'core/modal_events'; import Ajax from 'core/ajax'; /** * Call the delete service. * * @param {String} providerid The provider id. * @return {Promise} The promise. */ const deleteProviderService = async(providerid) => Ajax.call([{ methodname: 'core_ai_delete_provider_instance', args: { providerid: providerid, }, }])[0]; /** * Handle the delete event. * Calls the delete service and reloads the page. * * @param {String} providerid The provider id. * @returns {Promise<void>} */ const handleDelete = async(providerid) => { await deleteProviderService(providerid); // Refresh the page, so we get the updated list of providers, and any messages. window.location.reload(); }; /** * Show the delete confirmation modal. * * @param {Event} e The event object. */ const showDeleteModal = async(e) => { const providerid = e.target.dataset.id; const provider = e.target.dataset.provider; const name = e.target.dataset.name; const bodyparams = { provider: provider, name: name, }; const modal = await DeleteCancelModal.create({ title: await getString('providerinstancedelete', 'core_ai'), body: await getString('providerinstancedeleteconfirm', 'core_ai', bodyparams), show: true, removeOnClose: true, }); // Handle delete event. modal.getRoot().on(ModalEvents.delete, (e) => { e.preventDefault(); handleDelete(providerid); modal.destroy(); }); }; /** * Initialise the delete listeners. * */ export const init = () => { document.querySelectorAll('.ai-provider-delete').forEach((button) => { button.addEventListener('click', (e) => { e.preventDefault(); showDeleteModal(e); }); }); };
変更されたテキスト
ファイルを開く
// This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * AI provider deletion confirmation. * Renders a confirmation modal when deleting an AI provider. * * @module core_ai/providerdeleteconfirm * @copyright 2024 Matt Porritt <matt.porritt@moodle.com> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ import {getString} from 'core/str'; import {prefetchStrings} from 'core/prefetch'; import DeleteCancelModal from 'core/modal_delete_cancel'; import ModalEvents from 'core/modal_events'; import Ajax from 'core/ajax'; import {refreshTableContent} from 'core_table/dynamic'; import {fetchNotifications} from 'core/notification'; import * as Selectors from 'core_table/local/dynamic/selectors'; import * as DynamicTable from 'core_table/dynamic'; /** * Call the delete service. * * @param {String} providerid The provider id. * @return {Promise} The promise. */ const deleteProviderService = async(providerid) => Ajax.call([{ methodname: 'core_ai_delete_provider_instance', args: { providerid: providerid, }, }])[0]; /** * Handle the delete event. * Calls the delete service and reloads the page. * * @param {String} providerid The provider id. * @returns {Promise<void>} */ const handleDelete = async(providerid) => { await deleteProviderService(providerid); // Reload the table, so we get the updated list of providers, and any messages. const tableRoot = document.querySelector(Selectors.main.region); await Promise.all([ refreshTableContent(tableRoot), fetchNotifications(), ]); }; /** * Show the delete confirmation modal. * * @param {Event} e The event object. */ const showDeleteModal = async(e) => { const providerid = e.target.dataset.id; const provider = e.target.dataset.provider; const name = e.target.dataset.name; const bodyparams = { provider: provider, name: name, }; const modal = await DeleteCancelModal.create({ title: getString('providerinstancedelete', 'core_ai'), body: getString('providerinstancedeleteconfirm', 'core_ai', bodyparams), show: true, removeOnClose: true, }); // Handle delete event. modal.getRoot().on(ModalEvents.delete, (e) => { e.preventDefault(); handleDelete(providerid); modal.destroy(); }); }; /** * Initialise the delete listeners. * */ export const init = () => { prefetchStrings('core_ai', [ 'providerinstancedelete', 'providerinstancedeleteconfirm', ]); document.querySelectorAll('.ai-provider-delete').forEach((button) => { button.addEventListener('click', (e) => { e.preventDefault(); showDeleteModal(e); }); }); document.addEventListener(DynamicTable.Events.tableContentRefreshed, () => { init(); }, {once: true}); };
違いを見つける