Parcourir la source

make SelectList available for extensions

tags/6.6-RC1
Stas Vilchik il y a 6 ans
Parent
révision
24d034efcd

+ 3
- 1
server/sonar-web/src/main/js/app/utils/exposeLibraries.js Voir le fichier

@@ -28,6 +28,7 @@ import FavoriteContainer from '../../components/controls/FavoriteContainer';
import ListFooter from '../../components/controls/ListFooter';
import Tooltip from '../../components/controls/Tooltip';
import ModalForm from '../../components/common/modal-form';
import SelectList from '../../components/SelectList';

const exposeLibraries = () => {
window.moment = moment;
@@ -42,7 +43,8 @@ const exposeLibraries = () => {
Tooltip,
Select,
// deprecated, used in Governance
ModalForm_deprecated: ModalForm
ModalForm_deprecated: ModalForm,
SelectList
};
};


+ 2
- 2
server/sonar-web/src/main/js/apps/groups/users-view.js Voir le fichier

@@ -19,7 +19,7 @@
*/
import escapeHtml from 'escape-html';
import Modal from '../../components/common/modals';
import '../../components/SelectList';
import SelectList from '../../components/SelectList';
import Template from './templates/groups-users.hbs';

export default Modal.extend({
@@ -39,7 +39,7 @@ export default Modal.extend({
extra.organization = this.organization.key;
}

new window.SelectList({
new SelectList({
el: this.$('#groups-users'),
width: '100%',
readOnly: false,

+ 2
- 2
server/sonar-web/src/main/js/apps/quality-gates/views/gate-projects-view.js Voir le fichier

@@ -19,7 +19,7 @@
*/
import Marionette from 'backbone.marionette';
import escapeHtml from 'escape-html';
import '../../../components/SelectList';
import SelectList from '../../../components/SelectList';
import { translate } from '../../../helpers/l10n';

export default Marionette.ItemView.extend({
@@ -28,7 +28,7 @@ export default Marionette.ItemView.extend({
onRender() {
const { qualityGate } = this.options;

new window.SelectList({
new SelectList({
el: this.options.container,
width: '100%',
readOnly: !this.options.edit,

+ 2
- 1
server/sonar-web/src/main/js/apps/quality-profiles/details/ChangeProjectsForm.js Voir le fichier

@@ -22,6 +22,7 @@ import React from 'react';
import Modal from 'react-modal';
import escapeHtml from 'escape-html';
import type { Profile } from '../propTypes';
import SelectList from '../../../components/SelectList';
import { translate } from '../../../helpers/l10n';

type Props = {
@@ -49,7 +50,7 @@ export default class ChangeProjectsForm extends React.PureComponent {
const searchUrl =
window.baseUrl + '/api/qualityprofiles/projects?key=' + encodeURIComponent(key);

new window.SelectList({
new SelectList({
searchUrl,
el: this.container,
width: '100%',

+ 2
- 2
server/sonar-web/src/main/js/apps/users/groups-view.js Voir le fichier

@@ -19,7 +19,7 @@
*/
import escapeHtml from 'escape-html';
import Modal from '../../components/common/modals';
import '../../components/SelectList';
import SelectList from '../../components/SelectList';
import Template from './templates/users-groups.hbs';

export default Modal.extend({
@@ -27,7 +27,7 @@ export default Modal.extend({

onRender() {
Modal.prototype.onRender.apply(this, arguments);
new window.SelectList({
new SelectList({
el: this.$('#users-groups'),
width: '100%',
readOnly: false,

+ 7
- 5
server/sonar-web/src/main/js/components/SelectList/index.js Voir le fichier

@@ -370,8 +370,8 @@ const SelectListView = Backbone.View.extend({
* SelectList Entry Point
*/

window.SelectList = function(options) {
this.settings = $.extend(window.SelectList.defaults, options);
const SelectList = function(options) {
this.settings = $.extend(this.defaults, options);

this.collection = new SelectListCollection({
parse: this.settings.parse
@@ -392,12 +392,12 @@ window.SelectList = function(options) {
* SelectList API Methods
*/

window.SelectList.prototype.filter = function(filter) {
SelectList.prototype.filter = function(filter) {
this.view.filterBySelection(filter);
return this;
};

window.SelectList.prototype.search = function(query) {
SelectList.prototype.search = function(query) {
this.view.searchByQuery(query);
return this;
};
@@ -406,7 +406,7 @@ window.SelectList.prototype.search = function(query) {
* SelectList Defaults
*/

window.SelectList.defaults = {
SelectList.prototype.defaults = {
width: '50%',
height: 400,

@@ -438,3 +438,5 @@ window.SelectList.defaults = {

errorMessage: 'Something gone wrong, try to reload the page and try again.'
};

export default SelectList;

Chargement…
Annuler
Enregistrer