refactor(ui): replace ng selectors with react-select [EE-3608] (#7203)

Co-authored-by: LP B <xAt0mZ@users.noreply.github.com>
pull/7592/head^2
Chaim Lev-Ari 2 years ago committed by GitHub
parent 1e21961e6a
commit ceaee4e175
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -692,60 +692,6 @@ input[type='checkbox'] {
/*!bootbox override*/ /*!bootbox override*/
/*angular-multi-select override*/
.multiSelect > button {
min-height: 30px !important;
background-image: var(--bg-image-multiselect-button);
border-color: var(--border-multiselect);
color: var(--text-multiselect);
background-color: var(--bg-multiselect-color);
}
.multiSelect > button:hover {
background-image: var(--bg-image-multiselect-hover);
}
.multiSelect .checkboxLayer {
border-color: var(--border-multiselect-checkboxlayer);
}
.multiSelect .checkBoxContainer {
background-color: var(--bg-multiselect-checkboxcontainer);
}
.multiSelect .multiSelectItem {
color: var(--text-multiselect-item);
}
.multiSelect .helperContainer {
background-color: var(--bg-multiselect-helpercontainer);
}
.multiSelect .multiSelectFocus {
background-image: var(--bg-image-multiselect);
}
.multiSelect .multiSelectItem:not(.multiSelectGroup).selected {
background-image: var(--bg-image-multiselect);
color: var(--white-color);
border: none;
}
.multiSelect .multiSelectItem:hover,
.multiSelect .multiSelectGroup:hover {
border-color: var(--grey-3);
background-image: var(--bg-image-multiselect) !important;
color: var(--white-color) !important;
}
.multiSelect .tickMark,
.widget .widget-body table tbody .multiSelect .tickMark {
top: 2px;
right: 12px;
font-size: 20px !important;
}
/*!angular-multi-select override*/
/*toaster override*/ /*toaster override*/
#toast-container > div { #toast-container > div {
opacity: 0.9; opacity: 0.9;

@ -1,4 +1,3 @@
import 'ui-select/dist/select.css';
import 'bootstrap/dist/css/bootstrap.css'; import 'bootstrap/dist/css/bootstrap.css';
import '@fortawesome/fontawesome-free/css/brands.css'; import '@fortawesome/fontawesome-free/css/brands.css';
import '@fortawesome/fontawesome-free/css/solid.css'; import '@fortawesome/fontawesome-free/css/solid.css';
@ -11,7 +10,6 @@ import 'codemirror/addon/lint/lint.css';
import 'angular-json-tree/dist/angular-json-tree.css'; import 'angular-json-tree/dist/angular-json-tree.css';
import 'angular-loading-bar/build/loading-bar.css'; import 'angular-loading-bar/build/loading-bar.css';
import 'angular-moment-picker/dist/angular-moment-picker.min.css'; import 'angular-moment-picker/dist/angular-moment-picker.min.css';
import 'angular-multiselect/isteven-multi-select.css';
import 'spinkit/spinkit.min.css'; import 'spinkit/spinkit.min.css';
import '@reach/menu-button/styles.css'; import '@reach/menu-button/styles.css';

@ -125,7 +125,6 @@
--border-pagination-color: var(--ui-white); --border-pagination-color: var(--ui-white);
--bg-pagination-span-color: var(--white-color); --bg-pagination-span-color: var(--white-color);
--bg-pagination-hover-color: var(--ui-blue-3); --bg-pagination-hover-color: var(--ui-blue-3);
--bg-ui-select-hover-color: var(--grey-14);
--bg-motd-body-color: var(--grey-20); --bg-motd-body-color: var(--grey-20);
--bg-item-highlighted-color: var(--grey-21); --bg-item-highlighted-color: var(--grey-21);
--bg-item-highlighted-null-color: var(--grey-14); --bg-item-highlighted-null-color: var(--grey-14);
@ -135,7 +134,6 @@
--bg-input-sm-color: var(--white-color); --bg-input-sm-color: var(--white-color);
--bg-app-datatable-thead: var(--grey-23); --bg-app-datatable-thead: var(--grey-23);
--bg-app-datatable-tbody: var(--grey-24); --bg-app-datatable-tbody: var(--grey-24);
--bg-multiselect-color: var(--white-color);
--bg-daterangepicker-color: var(--white-color); --bg-daterangepicker-color: var(--white-color);
--bg-calendar-color: var(--white-color); --bg-calendar-color: var(--white-color);
--bg-calendar-table-color: var(--white-color); --bg-calendar-table-color: var(--white-color);
@ -194,8 +192,6 @@
--text-pagination-color: var(--grey-26); --text-pagination-color: var(--grey-26);
--text-pagination-span-color: var(--grey-3); --text-pagination-span-color: var(--grey-3);
--text-pagination-span-hover-color: var(--grey-3); --text-pagination-span-hover-color: var(--grey-3);
--text-ui-select-color: var(--grey-6);
--text-ui-select-hover-color: var(--grey-28);
--text-summary-color: var(--black-color); --text-summary-color: var(--black-color);
--text-tooltip-color: var(--white-color); --text-tooltip-color: var(--white-color);
--text-rzslider-color: var(--grey-36); --text-rzslider-color: var(--grey-36);
@ -253,16 +249,6 @@
--button-opacity: 0.2; --button-opacity: 0.2;
--button-opacity-hover: 0.5; --button-opacity-hover: 0.5;
--bg-image-multiselect: linear-gradient(var(--blue-2), var(--blue-2));
--bg-image-multiselect-button: linear-gradient(var(--white-color), var(--grey-17));
--bg-image-multiselect-hover: linear-gradient(var(--white-color), var(--grey-43));
--border-multiselect: var(--grey-48);
--border-multiselect-checkboxlayer: var(--grey-51);
--text-multiselect: var(--grey-29);
--text-multiselect-selectitem: var(--white-color);
--bg-multiselect-checkboxcontainer: var(--white-color);
--text-multiselect-item: var(--grey-30);
--bg-multiselect-helpercontainer: var(--white-color);
--text-input-textarea: var(--white-color); --text-input-textarea: var(--white-color);
--user-menu-icon-color: var(--ui-gray-4); --user-menu-icon-color: var(--ui-gray-4);
@ -315,7 +301,6 @@
--bg-pagination-color: var(--grey-3); --bg-pagination-color: var(--grey-3);
--bg-pagination-span-color: var(--grey-1); --bg-pagination-span-color: var(--grey-1);
--bg-pagination-hover-color: var(--grey-3); --bg-pagination-hover-color: var(--grey-3);
--bg-ui-select-hover-color: var(--grey-3);
--bg-motd-body-color: var(--grey-1); --bg-motd-body-color: var(--grey-1);
--bg-item-highlighted-color: var(--grey-2); --bg-item-highlighted-color: var(--grey-2);
--bg-item-highlighted-null-color: var(--grey-2); --bg-item-highlighted-null-color: var(--grey-2);
@ -328,7 +313,6 @@
--bg-app-datatable-thead: var(--grey-1); --bg-app-datatable-thead: var(--grey-1);
--bg-service-datatable-tbody: var(--grey-1); --bg-service-datatable-tbody: var(--grey-1);
--bg-app-datatable-tbody: var(--grey-1); --bg-app-datatable-tbody: var(--grey-1);
--bg-multiselect-color: var(--grey-1);
--bg-daterangepicker-color: var(--grey-3); --bg-daterangepicker-color: var(--grey-3);
--bg-calendar-color: var(--grey-3); --bg-calendar-color: var(--grey-3);
--bg-calendar-table-color: var(--grey-3); --bg-calendar-table-color: var(--grey-3);
@ -386,8 +370,6 @@
--text-pagination-color: var(--white-color); --text-pagination-color: var(--white-color);
--text-pagination-span-color: var(--ui-white); --text-pagination-span-color: var(--ui-white);
--text-pagination-span-hover-color: var(--ui-white); --text-pagination-span-hover-color: var(--ui-white);
--text-ui-select-color: var(--white-color);
--text-ui-select-hover-color: var(--white-color);
--text-summary-color: var(--white-color); --text-summary-color: var(--white-color);
--text-boxselector-wrapper-color: var(--white-color); --text-boxselector-wrapper-color: var(--white-color);
--text-tooltip-color: var(--white-color); --text-tooltip-color: var(--white-color);
@ -447,15 +429,6 @@
--shadow-box-color: none; --shadow-box-color: none;
--shadow-boxselector-color: none; --shadow-boxselector-color: none;
--bg-image-multiselect: linear-gradient(var(--grey-38), var(--grey-38));
--bg-image-multiselect-button: linear-gradient(var(--grey-1), var(--grey-1));
--bg-image-multiselect-hover: linear-gradient(var(--grey-3), var(--grey-3));
--border-multiselect: var(--grey-3);
--border-multiselect-checkboxlayer: var(--grey-3);
--text-multiselect: var(--white-color);
--bg-multiselect-checkboxcontainer: var(--grey-3);
--text-multiselect-item: var(--white-color);
--bg-multiselect-helpercontainer: var(--grey-1);
--text-input-textarea: var(--grey-1); --text-input-textarea: var(--grey-1);
--user-menu-icon-color: var(--grey-3); --user-menu-icon-color: var(--grey-3);
@ -508,7 +481,6 @@
--bg-app-datatable-tbody: var(--black-color); --bg-app-datatable-tbody: var(--black-color);
--bg-pagination-color: var(--grey-3); --bg-pagination-color: var(--grey-3);
--bg-pagination-span-color: var(--ui-black); --bg-pagination-span-color: var(--ui-black);
--bg-multiselect-color: var(--grey-1);
--bg-daterangepicker-color: var(--black-color); --bg-daterangepicker-color: var(--black-color);
--bg-calendar-color: var(--black-color); --bg-calendar-color: var(--black-color);
--bg-calendar-table-color: var(--black-color); --bg-calendar-table-color: var(--black-color);
@ -568,7 +540,6 @@
--text-daterangepicker-end-date: var(--ui-white); --text-daterangepicker-end-date: var(--ui-white);
--text-daterangepicker-in-range: var(--white-color); --text-daterangepicker-in-range: var(--white-color);
--text-daterangepicker-active: var(--white-color); --text-daterangepicker-active: var(--white-color);
--text-ui-select-color: var(--white-color);
--text-json-tree-color: var(--white-color); --text-json-tree-color: var(--white-color);
--text-json-tree-leaf-color: var(--white-color); --text-json-tree-leaf-color: var(--white-color);
--text-json-tree-branch-preview-color: var(--white-color); --text-json-tree-branch-preview-color: var(--white-color);
@ -619,15 +590,6 @@
--shadow-box-color: none; --shadow-box-color: none;
--shadow-boxselector-color: none; --shadow-boxselector-color: none;
--bg-image-multiselect: linear-gradient(var(--black-color), var(--black-color));
--bg-image-multiselect-button: linear-gradient(var(--grey-1), var(--grey-1));
--bg-image-multiselect-hover: linear-gradient(var(--grey-3), var(--grey-3));
--border-multiselect: var(--black-color);
--border-multiselect-checkboxlayer: var(--grey-3);
--text-multiselect: var(--white-color);
--bg-multiselect-checkboxcontainer: var(--grey-3);
--text-multiselect-item: var(--white-color);
--bg-multiselect-helpercontainer: var(--grey-1);
--text-input-textarea: var(--black-color); --text-input-textarea: var(--black-color);
--bg-item-highlighted-null-color: var(--grey-2); --bg-item-highlighted-null-color: var(--grey-2);
--text-cm-default-color: var(--blue-9); --text-cm-default-color: var(--blue-9);

@ -245,37 +245,6 @@ json-tree .branch-preview {
background-color: var(--bg-progress-color); background-color: var(--bg-progress-color);
} }
.ui-select-search,
.ui-select-toggle {
height: 30px;
min-width: 260px;
padding: 4px 12px;
}
.ui-select-toggle {
justify-content: flex-start !important;
}
.ui-select-match-text {
display: flex;
flex-direction: row-reverse;
align-items: center;
}
.ui-select-match-text > a {
verical-align: middle;
}
.ui-select-bootstrap .ui-select-choices-row > span {
color: var(--text-ui-select-color);
}
.ui-select-bootstrap .ui-select-choices-row > span:hover,
.ui-select-bootstrap .ui-select-choices-row > span:focus {
background-color: var(--bg-ui-select-hover-color);
color: var(--text-ui-select-hover-color);
}
.motd-body { .motd-body {
background-color: var(--bg-motd-body-color) !important; background-color: var(--bg-motd-body-color) !important;
} }

@ -1,4 +1,5 @@
import _ from 'lodash-es'; import _ from 'lodash-es';
import { trimSHA } from './utils';
function includeString(text, values) { function includeString(text, values) {
return values.some(function (val) { return values.some(function (val) {
@ -253,15 +254,7 @@ angular
}) })
.filter('trimshasum', function () { .filter('trimshasum', function () {
'use strict'; 'use strict';
return function (imageName) { return trimSHA;
if (!imageName) {
return;
}
if (imageName.indexOf('sha256:') === 0) {
return imageName.substring(7, 19);
}
return _.split(imageName, '@sha256')[0];
};
}) })
.filter('trimversiontag', function () { .filter('trimversiontag', function () {
'use strict'; 'use strict';

@ -0,0 +1,11 @@
import _ from 'lodash';
export function trimSHA(imageName: string) {
if (!imageName) {
return '';
}
if (imageName.indexOf('sha256:') === 0) {
return imageName.substring(7, 19);
}
return _.split(imageName, '@sha256')[0];
}

@ -1,20 +0,0 @@
<!-- on-select/on-remove are called with model because ui-select uses 2-way-binding -->
<ui-select
multiple
ng-model="$ctrl.model"
close-on-select="false"
on-select="$ctrl.onChange($ctrl.model)"
on-remove="$ctrl.onChange($ctrl.model)"
data-cy="edgeGroupCreate-edgeGroupsSelector"
>
<ui-select-match placeholder="Select one or multiple group(s)">
<span>
{{ $item.Name }}
</span>
</ui-select-match>
<ui-select-choices repeat="item.Id as item in $ctrl.items | filter: { Name: $select.search }">
<span>
{{ item.Name }}
</span>
</ui-select-choices>
</ui-select>

@ -1,10 +0,0 @@
import angular from 'angular';
angular.module('portainer.edge').component('edgeGroupsSelector', {
templateUrl: './edgeGroupsSelector.html',
bindings: {
model: '<',
items: '<',
onChange: '<',
},
});

@ -2,7 +2,7 @@
<div class="col-sm-12 form-section-title"> Edge Groups </div> <div class="col-sm-12 form-section-title"> Edge Groups </div>
<div class="form-group"> <div class="form-group">
<div class="col-sm-12"> <div class="col-sm-12">
<edge-groups-selector model="$ctrl.model.EdgeGroups" items="$ctrl.edgeGroups" on-change="($ctrl.onChangeGroups)"></edge-groups-selector> <edge-groups-selector value="$ctrl.model.EdgeGroups" items="$ctrl.edgeGroups" on-change="($ctrl.onChangeGroups)"></edge-groups-selector>
</div> </div>
</div> </div>

@ -2,7 +2,8 @@ import { PortainerEndpointTypes } from '@/portainer/models/endpoint/models';
export class EditEdgeStackFormController { export class EditEdgeStackFormController {
/* @ngInject */ /* @ngInject */
constructor() { constructor($scope) {
this.$scope = $scope;
this.state = { this.state = {
endpointTypes: [], endpointTypes: [],
}; };
@ -32,9 +33,11 @@ export class EditEdgeStackFormController {
} }
onChangeGroups(groups) { onChangeGroups(groups) {
this.model.EdgeGroups = groups; return this.$scope.$evalAsync(() => {
this.model.EdgeGroups = groups;
this.checkEndpointTypes(groups); this.checkEndpointTypes(groups);
});
} }
isFormValid() { isFormValid() {

@ -1,6 +1,11 @@
import angular from 'angular'; import angular from 'angular';
export const componentsModule = angular.module( import { EdgeGroupsSelector } from '@/react/edge/components/EdgeGroupsSelector';
'portainer.edge.react.components', import { r2a } from '@/react-tools/react2angular';
[]
).name; export const componentsModule = angular
.module('portainer.edge.react.components', [])
.component(
'edgeGroupsSelector',
r2a(EdgeGroupsSelector, ['items', 'onChange', 'value'])
).name;

@ -1,7 +1,7 @@
export default class CreateEdgeStackViewController { export default class CreateEdgeStackViewController {
/* @ngInject */ /* @ngInject */
constructor($state, $window, ModalService, EdgeStackService, EdgeGroupService, EdgeTemplateService, Notifications, FormHelper, $async) { constructor($state, $window, ModalService, EdgeStackService, EdgeGroupService, EdgeTemplateService, Notifications, FormHelper, $async, $scope) {
Object.assign(this, { $state, $window, ModalService, EdgeStackService, EdgeGroupService, EdgeTemplateService, Notifications, FormHelper, $async }); Object.assign(this, { $state, $window, ModalService, EdgeStackService, EdgeGroupService, EdgeTemplateService, Notifications, FormHelper, $async, $scope });
this.formValues = { this.formValues = {
Name: '', Name: '',
@ -119,9 +119,11 @@ export default class CreateEdgeStackViewController {
} }
onChangeGroups(groups) { onChangeGroups(groups) {
this.formValues.Groups = groups; return this.$scope.$evalAsync(() => {
this.formValues.Groups = groups;
this.checkIfEndpointTypes(groups); this.checkIfEndpointTypes(groups);
});
} }
checkIfEndpointTypes(groups) { checkIfEndpointTypes(groups) {

@ -34,7 +34,7 @@
<div class="col-sm-12 form-section-title"> Edge Groups </div> <div class="col-sm-12 form-section-title"> Edge Groups </div>
<div class="form-group" ng-if="$ctrl.edgeGroups"> <div class="form-group" ng-if="$ctrl.edgeGroups">
<div class="col-sm-12"> <div class="col-sm-12">
<edge-groups-selector ng-if="!$ctrl.noGroups" model="$ctrl.formValues.Groups" on-change="($ctrl.onChangeGroups)" items="$ctrl.edgeGroups"></edge-groups-selector> <edge-groups-selector ng-if="!$ctrl.noGroups" value="$ctrl.formValues.Groups" on-change="($ctrl.onChangeGroups)" items="$ctrl.edgeGroups"></edge-groups-selector>
</div> </div>
<div ng-if="$ctrl.noGroups" class="col-sm-12 small text-muted"> <div ng-if="$ctrl.noGroups" class="col-sm-12 small text-muted">
No Edge groups are available. Head over to the <a ui-sref="edge.groups">Edge groups view</a> to create one. No Edge groups are available. Head over to the <a ui-sref="edge.groups">Edge groups view</a> to create one.

@ -28,8 +28,6 @@ angular
'ui.bootstrap', 'ui.bootstrap',
'ui.router', 'ui.router',
UI_ROUTER_REACT_HYBRID, UI_ROUTER_REACT_HYBRID,
'ui.select',
'isteven-multi-select',
'ngSanitize', 'ngSanitize',
'ngFileUpload', 'ngFileUpload',
'ngMessages', 'ngMessages',

@ -1,12 +1,20 @@
export default class HelmTemplatesListController { export default class HelmTemplatesListController {
/* @ngInject */ /* @ngInject */
constructor($async, DatatableService, HelmService, Notifications) { constructor($async, $scope, DatatableService, HelmService, Notifications) {
this.$async = $async; this.$async = $async;
this.$scope = $scope;
this.DatatableService = DatatableService; this.DatatableService = DatatableService;
this.HelmService = HelmService; this.HelmService = HelmService;
this.Notifications = Notifications; this.Notifications = Notifications;
this.state = {
textFilter: '',
selectedCategory: '',
categories: [],
};
this.updateCategories = this.updateCategories.bind(this); this.updateCategories = this.updateCategories.bind(this);
this.onCategoryChange = this.onCategoryChange.bind(this);
} }
async updateCategories() { async updateCategories() {
@ -16,18 +24,20 @@ export default class HelmTemplatesListController {
.filter((a) => a) // filter out undefined/nulls .filter((a) => a) // filter out undefined/nulls
.map((c) => c.category); // get annotation category .map((c) => c.category); // get annotation category
const availableCategories = [...new Set(annotationCategories)].sort(); // unique and sort const availableCategories = [...new Set(annotationCategories)].sort(); // unique and sort
this.state.categories = availableCategories; this.state.categories = availableCategories.map((cat) => ({ label: cat, value: cat }));
} catch (err) { } catch (err) {
this.Notifications.error('Failure', err, 'Unable to retrieve helm charts categories'); this.Notifications.error('Failure', err, 'Unable to retrieve helm charts categories');
} }
} }
onTextFilterChange() { onCategoryChange(value) {
this.DatatableService.setDataTableTextFilters(this.tableKey, this.state.textFilter); return this.$scope.$evalAsync(() => {
this.state.selectedCategory = value || '';
});
} }
clearCategory() { onTextFilterChange() {
this.state.selectedCategory = ''; this.DatatableService.setDataTableTextFilters(this.tableKey, this.state.textFilter);
} }
$onChanges() { $onChanges() {
@ -38,12 +48,6 @@ export default class HelmTemplatesListController {
$onInit() { $onInit() {
return this.$async(async () => { return this.$async(async () => {
this.state = {
textFilter: '',
selectedCategory: '',
categories: [],
};
const textFilter = this.DatatableService.getDataTableTextFilters(this.tableKey); const textFilter = this.DatatableService.getDataTableTextFilters(this.tableKey);
if (textFilter !== null) { if (textFilter !== null) {
this.state.textFilter = textFilter; this.state.textFilter = textFilter;

@ -22,24 +22,21 @@
ng-model-options="{ debounce: 300 }" ng-model-options="{ debounce: 300 }"
/> />
</div> </div>
<div> <div class="w-1/5">
<ui-select ng-model="$ctrl.state.selectedCategory" theme="bootstrap" append-to-body="true"> <por-select
<ui-select-match placeholder="Select a category"> placeholder="'Select a category'"
<a class="btn btn-xs btn-link pull-right vertical-center" ng-click="$ctrl.clearCategory()"> value="$ctrl.state.selectedCategory"
<pr-icon icon="'x'" feather="true"></pr-icon> options="$ctrl.state.categories"
</a> on-change="($ctrl.onCategoryChange)"
<span class="vertical-center">{{ $select.selected }}</span> is-clearable="true"
</ui-select-match> bind-to-body="true"
<ui-select-choices repeat="category in ($ctrl.state.categories | filter: $select.search)"> ></por-select>
<span>{{ category }}</span>
</ui-select-choices>
</ui-select>
</div> </div>
</div> </div>
<div class="blocklist"> <div class="blocklist">
<helm-templates-list-item <helm-templates-list-item
ng-repeat="chart in $ctrl.charts | filter:$ctrl.state.textFilter | filter: $ctrl.state.selectedCategory " ng-repeat="chart in $ctrl.charts | filter:$ctrl.state.textFilter | filter: $ctrl.state.selectedCategory"
model="chart" model="chart"
type-label="helm" type-label="helm"
on-select="($ctrl.selectAction)" on-select="($ctrl.selectAction)"

@ -1,6 +1,53 @@
import angular from 'angular'; import angular from 'angular';
export const componentsModule = angular.module( import { r2a } from '@/react-tools/react2angular';
'portainer.kubernetes.react.components', import { NamespacesSelector } from '@/react/kubernetes/cluster/RegistryAccessView/NamespacesSelector';
[] import { StorageAccessModeSelector } from '@/react/kubernetes/cluster/ConfigureView/StorageAccessModeSelector';
).name; import { NamespaceAccessUsersSelector } from '@/react/kubernetes/namespaces/AccessView/NamespaceAccessUsersSelector';
import { CreateNamespaceRegistriesSelector } from '@/react/kubernetes/namespaces/CreateView/CreateNamespaceRegistriesSelector';
export const componentsModule = angular
.module('portainer.kubernetes.react.components', [])
.component(
'namespacesSelector',
r2a(NamespacesSelector, [
'dataCy',
'inputId',
'name',
'namespaces',
'onChange',
'placeholder',
'value',
])
)
.component(
'storageAccessModeSelector',
r2a(StorageAccessModeSelector, [
'inputId',
'onChange',
'options',
'value',
'storageClassName',
])
)
.component(
'namespaceAccessUsersSelector',
r2a(NamespaceAccessUsersSelector, [
'inputId',
'onChange',
'options',
'value',
'dataCy',
'placeholder',
'name',
])
)
.component(
'createNamespaceRegistriesSelector',
r2a(CreateNamespaceRegistriesSelector, [
'inputId',
'onChange',
'options',
'value',
])
).name;

@ -2,8 +2,9 @@ import KubernetesNamespaceHelper from 'Kubernetes/helpers/namespaceHelper';
export default class KubernetesRegistryAccessController { export default class KubernetesRegistryAccessController {
/* @ngInject */ /* @ngInject */
constructor($async, $state, ModalService, EndpointService, Notifications, RegistryService, KubernetesResourcePoolService) { constructor($async, $scope, $state, ModalService, EndpointService, Notifications, RegistryService, KubernetesResourcePoolService) {
this.$async = $async; this.$async = $async;
this.$scope = $scope;
this.$state = $state; this.$state = $state;
this.ModalService = ModalService; this.ModalService = ModalService;
this.Notifications = Notifications; this.Notifications = Notifications;
@ -20,10 +21,11 @@ export default class KubernetesRegistryAccessController {
this.savedResourcePools = []; this.savedResourcePools = [];
this.handleRemove = this.handleRemove.bind(this); this.handleRemove = this.handleRemove.bind(this);
this.onChangeResourcePools = this.onChangeResourcePools.bind(this);
} }
async submit() { async submit() {
return this.updateNamespaces([...this.savedResourcePools.map(({ value }) => value), ...this.selectedResourcePools.map((pool) => pool.name)]); return this.updateNamespaces([...this.savedResourcePools.map(({ value }) => value), ...this.selectedResourcePools]);
} }
handleRemove(namespaces) { handleRemove(namespaces) {
@ -52,6 +54,12 @@ export default class KubernetesRegistryAccessController {
}); });
} }
onChangeResourcePools(resourcePools) {
return this.$scope.$evalAsync(() => {
this.selectedResourcePools = resourcePools;
});
}
$onInit() { $onInit() {
return this.$async(async () => { return this.$async(async () => {
try { try {

@ -12,19 +12,14 @@
<label class="col-sm-3 col-lg-2 control-label text-left" style="padding-top: 0"> Select namespaces </label> <label class="col-sm-3 col-lg-2 control-label text-left" style="padding-top: 0"> Select namespaces </label>
<div class="col-sm-9 col-lg-4" style="margin-bottom: 15px"> <div class="col-sm-9 col-lg-4" style="margin-bottom: 15px">
<span class="small text-muted" ng-if="!$ctrl.resourcePools.length"> No namespaces available. </span> <span class="small text-muted" ng-if="!$ctrl.resourcePools.length"> No namespaces available. </span>
<span
isteven-multi-select <namespaces-selector
ng-if="$ctrl.resourcePools.length" ng-if="$ctrl.resourcePools.length"
input-model="$ctrl.resourcePools" value="$ctrl.selectedResourcePools"
output-model="$ctrl.selectedResourcePools" namespaces="$ctrl.resourcePools"
button-label="name" placeholder="'Select one or more namespaces'"
item-label="name" on-change="($ctrl.onChangeResourcePools)"
tick-property="ticked" ></namespaces-selector>
helper-elements="filter"
search-property="name"
translation="{nothingSelected: 'Select one or more namespaces', search: 'Search...'}"
>
</span>
</div> </div>
<div class="col-sm-12 small text-muted vertical-center"> <div class="col-sm-12 small text-muted vertical-center">
<pr-icon icon="'alert-triangle'" mode="'warning'" feather="true"></pr-icon> <pr-icon icon="'alert-triangle'" mode="'warning'" feather="true"></pr-icon>

@ -299,19 +299,12 @@
</div> </div>
</td> </td>
<td> <td>
<span <storage-access-mode-selector
isteven-multi-select options="ctrl.availableAccessModes"
input-model="class.availableAccessModes" value="class.AccessModes"
output-model="class.AccessModes" on-change="(ctrl.onChangeStorageClassAccessMode)"
button-label="Name" storage-class-name="class.Name"
item-label="Description" ></storage-access-mode-selector>
tick-property="selected"
directive-id="{{ class.Name }}"
helper-elements=""
translation="{nothingSelected: 'Not configured'}"
data-cy="kubeSetup-storageAccessSelect{{ class.Name }}"
>
</span>
</td> </td>
<td> <td>
<div style="margin: 5px"> <div style="margin: 5px">

@ -45,6 +45,7 @@ class KubernetesConfigureController {
this.limitedFeatureAutoWindow = FeatureId.HIDE_AUTO_UPDATE_WINDOW; this.limitedFeatureAutoWindow = FeatureId.HIDE_AUTO_UPDATE_WINDOW;
this.onToggleAutoUpdate = this.onToggleAutoUpdate.bind(this); this.onToggleAutoUpdate = this.onToggleAutoUpdate.bind(this);
this.onChangeEnableResourceOverCommit = this.onChangeEnableResourceOverCommit.bind(this); this.onChangeEnableResourceOverCommit = this.onChangeEnableResourceOverCommit.bind(this);
this.onChangeStorageClassAccessMode = this.onChangeStorageClassAccessMode.bind(this);
} }
/* #endregion */ /* #endregion */
@ -263,6 +264,18 @@ class KubernetesConfigureController {
}); });
} }
onChangeStorageClassAccessMode(storageClassName, accessModes) {
return this.$scope.$evalAsync(() => {
const storageClass = this.StorageClasses.find((item) => item.Name === storageClassName);
if (!storageClass) {
throw new Error('Storage class not found');
}
storageClass.AccessModes = accessModes;
});
}
/* #region ON INIT */ /* #region ON INIT */
async onInit() { async onInit() {
this.state = { this.state = {
@ -288,18 +301,14 @@ class KubernetesConfigureController {
}; };
try { try {
this.availableAccessModes = new KubernetesStorageClassAccessPolicies();
[this.StorageClasses, this.endpoint] = await Promise.all([this.KubernetesStorageService.get(this.state.endpointId), this.EndpointService.endpoint(this.state.endpointId)]); [this.StorageClasses, this.endpoint] = await Promise.all([this.KubernetesStorageService.get(this.state.endpointId), this.EndpointService.endpoint(this.state.endpointId)]);
_.forEach(this.StorageClasses, (item) => { _.forEach(this.StorageClasses, (item) => {
item.availableAccessModes = new KubernetesStorageClassAccessPolicies();
const storage = _.find(this.endpoint.Kubernetes.Configuration.StorageClasses, (sc) => sc.Name === item.Name); const storage = _.find(this.endpoint.Kubernetes.Configuration.StorageClasses, (sc) => sc.Name === item.Name);
if (storage) { if (storage) {
item.selected = true; item.selected = true;
_.forEach(storage.AccessModes, (access) => { item.AccessModes = storage.AccessModes.map((name) => this.availableAccessModes.find((accessMode) => accessMode.Name === name));
const mode = _.find(item.availableAccessModes, { Name: access });
if (mode) {
mode.selected = true;
}
});
} }
}); });

@ -52,25 +52,19 @@
</span> </span>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 col-lg-2 control-label text-left"> Select user(s) and/or team(s) </label> <label class="col-sm-3 col-lg-2 control-label text-left" for="users-selector"> Select user(s) and/or team(s) </label>
<div class="col-sm-9 col-lg-4"> <div class="col-sm-9 col-lg-4">
<span class="small text-muted" ng-if="ctrl.availableUsersAndTeams.length === 0"> <span class="small text-muted" ng-if="ctrl.availableUsersAndTeams.length === 0">
No user nor team access has been set on the environment. Head over to the No user nor team access has been set on the environment. Head over to the
<a ui-sref="portainer.endpoints">Environments view</a> to manage them. <a ui-sref="portainer.endpoints">Environments view</a> to manage them.
</span> </span>
<span <namespace-access-users-selector
isteven-multi-select
ng-if="ctrl.availableUsersAndTeams.length > 0" ng-if="ctrl.availableUsersAndTeams.length > 0"
input-model="ctrl.availableUsersAndTeams" input-id="users-selector"
output-model="ctrl.formValues.multiselectOutput" value="ctrl.formValues.multiselectOutput"
button-label="icon Name" options="ctrl.availableUsersAndTeams"
item-label="icon Name" on-change="(ctrl.onUsersAndTeamsChange)"
tick-property="ticked" ></namespace-access-users-selector>
helper-elements="filter"
search-property="Name"
translation="{nothingSelected: 'Select one or more users and/or teams', search: 'Search...'}"
>
</span>
</div> </div>
</div> </div>
@ -80,7 +74,7 @@
<button <button
type="submit" type="submit"
class="btn btn-primary btn-sm !ml-0 vertical-center" class="btn btn-primary btn-sm !ml-0 vertical-center"
ng-disabled="(ctrl.availableUsersAndTeams | filter:{ticked:true}).length === 0 || ctrl.actionInProgress" ng-disabled="ctrl.formValues.multiselectOutput.length === 0 || ctrl.actionInProgress"
ng-click="ctrl.authorizeAccess()" ng-click="ctrl.authorizeAccess()"
button-spinner="ctrl.actionInProgress" button-spinner="ctrl.actionInProgress"
> >

@ -6,9 +6,10 @@ import KubernetesConfigMapHelper from 'Kubernetes/helpers/configMapHelper';
class KubernetesResourcePoolAccessController { class KubernetesResourcePoolAccessController {
/* @ngInject */ /* @ngInject */
constructor($async, $state, Notifications, KubernetesResourcePoolService, KubernetesConfigMapService, GroupService, AccessService) { constructor($async, $state, $scope, Notifications, KubernetesResourcePoolService, KubernetesConfigMapService, GroupService, AccessService) {
this.$async = $async; this.$async = $async;
this.$state = $state; this.$state = $state;
this.$scope = $scope;
this.Notifications = Notifications; this.Notifications = Notifications;
this.KubernetesResourcePoolService = KubernetesResourcePoolService; this.KubernetesResourcePoolService = KubernetesResourcePoolService;
this.KubernetesConfigMapService = KubernetesConfigMapService; this.KubernetesConfigMapService = KubernetesConfigMapService;
@ -19,7 +20,7 @@ class KubernetesResourcePoolAccessController {
this.onInit = this.onInit.bind(this); this.onInit = this.onInit.bind(this);
this.authorizeAccessAsync = this.authorizeAccessAsync.bind(this); this.authorizeAccessAsync = this.authorizeAccessAsync.bind(this);
this.unauthorizeAccessAsync = this.unauthorizeAccessAsync.bind(this); this.unauthorizeAccessAsync = this.unauthorizeAccessAsync.bind(this);
this.onUsersAndTeamsChange = this.onUsersAndTeamsChange.bind(this);
this.unauthorizeAccess = this.unauthorizeAccess.bind(this); this.unauthorizeAccess = this.unauthorizeAccess.bind(this);
} }
@ -72,6 +73,7 @@ class KubernetesResourcePoolAccessController {
return false; return false;
}); });
} }
this.availableUsersAndTeams = _.without(endpointAccesses.authorizedUsersAndTeams, ...this.authorizedUsersAndTeams); this.availableUsersAndTeams = _.without(endpointAccesses.authorizedUsersAndTeams, ...this.authorizedUsersAndTeams);
} catch (err) { } catch (err) {
this.Notifications.error('Failure', err, 'Unable to retrieve namespace information'); this.Notifications.error('Failure', err, 'Unable to retrieve namespace information');
@ -100,6 +102,12 @@ class KubernetesResourcePoolAccessController {
} }
} }
onUsersAndTeamsChange(value) {
this.$scope.$evalAsync(() => {
this.formValues.multiselectOutput = value;
});
}
authorizeAccess() { authorizeAccess() {
return this.$async(this.authorizeAccessAsync); return this.$async(this.authorizeAccessAsync);
} }

@ -403,7 +403,7 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 col-lg-2 control-label text-left !pt-0"> Select registries </label> <label class="col-sm-3 col-lg-2 control-label text-left !pt-0" for="registries-selector"> Select registries </label>
<div class="col-sm-8 col-lg-9"> <div class="col-sm-8 col-lg-9">
<span class="small text-muted" ng-if="!$ctrl.registries.length && $ctrl.state.isAdmin"> <span class="small text-muted" ng-if="!$ctrl.registries.length && $ctrl.state.isAdmin">
No registries available. Head over to the <a ui-sref="portainer.registries">registry view</a> to define a container registry. No registries available. Head over to the <a ui-sref="portainer.registries">registry view</a> to define a container registry.
@ -411,20 +411,13 @@
<span class="small text-muted" ng-if="!$ctrl.registries.length && !$ctrl.state.isAdmin"> <span class="small text-muted" ng-if="!$ctrl.registries.length && !$ctrl.state.isAdmin">
No registries available. Contact your administrator to create a container registry. No registries available. Contact your administrator to create a container registry.
</span> </span>
<span <create-namespace-registries-selector
isteven-multi-select input-id="'registries-selector'"
ng-if="$ctrl.registries.length" value="$ctrl.formValues.Registries"
input-model="$ctrl.registries" on-change="($ctrl.onRegistriesChange)"
output-model="$ctrl.formValues.Registries" options="$ctrl.registries"
button-label="Name"
item-label="Name"
tick-property="Checked"
helper-elements="filter"
search-property="Name"
translation="{nothingSelected: 'Select one or more registries', search: 'Search...'}"
data-cy="namespaceCreate-registrySelect"
> >
</span> </create-namespace-registries-selector>
</div> </div>
</div> </div>
<!-- #endregion --> <!-- #endregion -->

@ -39,6 +39,7 @@ class KubernetesCreateResourcePoolController {
this.onToggleStorageQuota = this.onToggleStorageQuota.bind(this); this.onToggleStorageQuota = this.onToggleStorageQuota.bind(this);
this.onToggleLoadBalancerQuota = this.onToggleLoadBalancerQuota.bind(this); this.onToggleLoadBalancerQuota = this.onToggleLoadBalancerQuota.bind(this);
this.onToggleResourceQuota = this.onToggleResourceQuota.bind(this); this.onToggleResourceQuota = this.onToggleResourceQuota.bind(this);
this.onRegistriesChange = this.onRegistriesChange.bind(this);
} }
/* #endregion */ /* #endregion */
@ -92,6 +93,12 @@ class KubernetesCreateResourcePoolController {
}); });
} }
onRegistriesChange(registries) {
return this.$scope.$evalAsync(() => {
this.formValues.Registries = registries;
});
}
addHostname(ingressClass) { addHostname(ingressClass) {
ingressClass.Hosts.push(new KubernetesResourcePoolIngressClassHostFormValue()); ingressClass.Hosts.push(new KubernetesResourcePoolIngressClassHostFormValue());
} }

@ -364,27 +364,21 @@
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 col-lg-2 control-label text-left !pt-0"> Select registries </label> <label class="col-sm-3 col-lg-2 control-label text-left !pt-0" for="registries-selector"> Select registries </label>
<div class="col-sm-8 col-lg-9"> <div class="col-sm-9 col-lg-4">
<span class="small text-muted" ng-if="!ctrl.registries.length && ctrl.isAdmin"> <span class="small text-muted" ng-if="!ctrl.registries.length && ctrl.isAdmin">
No registries available. Head over to the <a ui-sref="portainer.registries">registry view</a> to define a container registry. No registries available. Head over to the <a ui-sref="portainer.registries">registry view</a> to define a container registry.
</span> </span>
<span class="small text-muted" ng-if="!ctrl.registries.length && !ctrl.isAdmin"> <span class="small text-muted" ng-if="!ctrl.registries.length && !ctrl.isAdmin">
No registries available. Contact your administrator to create a container registry. No registries available. Contact your administrator to create a container registry.
</span> </span>
<span <create-namespace-registries-selector
isteven-multi-select input-id="'registries-selector'"
ng-if="ctrl.registries.length" value="ctrl.formValues.Registries"
input-model="ctrl.registries" on-change="(ctrl.onRegistriesChange)"
output-model="ctrl.formValues.Registries" options="ctrl.registries"
button-label="Name"
item-label="Name"
tick-property="Checked"
helper-elements="filter"
search-property="Name"
translation="{nothingSelected: 'Select one or more registries', search: 'Search...'}"
> >
</span> </create-namespace-registries-selector>
</div> </div>
</div> </div>
</div> </div>

@ -73,6 +73,7 @@ class KubernetesResourcePoolController {
this.getEvents = this.getEvents.bind(this); this.getEvents = this.getEvents.bind(this);
this.onToggleLoadBalancersQuota = this.onToggleLoadBalancersQuota.bind(this); this.onToggleLoadBalancersQuota = this.onToggleLoadBalancersQuota.bind(this);
this.onToggleStorageQuota = this.onToggleStorageQuota.bind(this); this.onToggleStorageQuota = this.onToggleStorageQuota.bind(this);
this.onRegistriesChange = this.onRegistriesChange.bind(this);
} }
/* #endregion */ /* #endregion */
@ -101,6 +102,12 @@ class KubernetesResourcePoolController {
} }
/* #endregion */ /* #endregion */
onRegistriesChange(registries) {
return this.$scope.$evalAsync(() => {
this.formValues.Registries = registries;
});
}
onToggleLoadBalancersQuota(checked) { onToggleLoadBalancersQuota(checked) {
return this.$scope.$evalAsync(() => { return this.$scope.$evalAsync(() => {
this.formValues.UseLoadBalancersQuota = checked; this.formValues.UseLoadBalancersQuota = checked;

@ -72,8 +72,8 @@
class="form-group mt-4" class="form-group mt-4"
ng-if="$ctrl.formData.AccessControlEnabled && $ctrl.formData.Ownership === $ctrl.RCO.RESTRICTED && ($ctrl.isAdmin || (!$ctrl.isAdmin && $ctrl.availableTeams.length > 1))" ng-if="$ctrl.formData.AccessControlEnabled && $ctrl.formData.Ownership === $ctrl.RCO.RESTRICTED && ($ctrl.isAdmin || (!$ctrl.isAdmin && $ctrl.availableTeams.length > 1))"
> >
<div class="col-sm-12 vertical-center"> <div class="w-full vertical-center">
<label for="group-access" class="control-label text-left col-sm-3 col-lg-2 !p-0"> <label for="group-access" class="control-label text-left col-sm-3 col-lg-2 !pt-0">
Authorized teams Authorized teams
<portainer-tooltip <portainer-tooltip
ng-if="$ctrl.isAdmin && $ctrl.availableTeams.length > 0" ng-if="$ctrl.isAdmin && $ctrl.availableTeams.length > 0"
@ -84,54 +84,45 @@
message="'As you are a member of multiple teams, you can select which teams(s) will be able to manage this resource.'" message="'As you are a member of multiple teams, you can select which teams(s) will be able to manage this resource.'"
></portainer-tooltip> ></portainer-tooltip>
</label> </label>
<span ng-if="$ctrl.isAdmin && $ctrl.availableTeams.length === 0" class="small text-muted" style="margin-left: 20px"> <div class="col-sm-9 col-lg-10">
You have not yet created any teams. Head over to the <a ui-sref="portainer.teams">Teams view</a> to manage teams. <span ng-if="$ctrl.isAdmin && $ctrl.availableTeams.length === 0" class="small text-muted">
</span> You have not yet created any teams. Head over to the <a ui-sref="portainer.teams">Teams view</a> to manage teams.
<div </span>
isteven-multi-select
ng-if="($ctrl.isAdmin && $ctrl.availableTeams.length > 0) || (!$ctrl.isAdmin && $ctrl.availableTeams.length > 1)" <por-access-control-form-team-selector
class="col-sm-9 col-lg-10" ng-if="($ctrl.isAdmin && $ctrl.availableTeams.length > 0) || (!$ctrl.isAdmin && $ctrl.availableTeams.length > 1)"
input-model="$ctrl.availableTeams" options="$ctrl.availableTeams"
output-model="$ctrl.formData.AuthorizedTeams" value="$ctrl.formData.AuthorizedTeams"
button-label="Name" input-id="'teams-selector'"
item-label="Name" on-change="($ctrl.onAuthorizedTeamsChange)"
tick-property="selected" ></por-access-control-form-team-selector>
helper-elements="filter"
search-property="Name"
translation="{nothingSelected: 'Select one or more teams', search: 'Search...'}"
data-cy="portainer-selectTeamAccess"
>
</div> </div>
</div> </div>
</div> </div>
<!-- !authorized-teams --> <!-- !authorized-teams -->
<!-- authorized-users --> <!-- authorized-users -->
<div class="form-group" ng-if="$ctrl.formData.AccessControlEnabled && $ctrl.formData.Ownership === $ctrl.RCO.RESTRICTED && $ctrl.isAdmin"> <div class="form-group" ng-if="$ctrl.formData.AccessControlEnabled && $ctrl.formData.Ownership === $ctrl.RCO.RESTRICTED && $ctrl.isAdmin">
<div class="col-sm-12 vertical-center"> <div class="w-full vertical-center">
<label for="group-access" class="control-label text-left col-sm-3 col-lg-2 !p-0"> <label for="group-access" class="control-label text-left col-sm-3 col-lg-2 !pt-0">
Authorized users Authorized users
<portainer-tooltip <portainer-tooltip
ng-if="$ctrl.isAdmin && $ctrl.availableUsers.length > 0" ng-if="$ctrl.isAdmin && $ctrl.availableUsers.length > 0"
message="'You can select which user(s) will be able to manage this resource.'" message="'You can select which user(s) will be able to manage this resource.'"
></portainer-tooltip> ></portainer-tooltip>
</label> </label>
<span ng-if="$ctrl.availableUsers.length === 0" class="small text-muted" style="margin-left: 20px"> <div class="col-sm-9 col-lg-10">
You have not yet created any users. Head over to the <a ui-sref="portainer.users">Users view</a> to manage users. <span ng-if="$ctrl.availableUsers.length === 0" class="small text-muted">
</span> You have not yet created any users. Head over to the <a ui-sref="portainer.users">Users view</a> to manage users.
<div </span>
isteven-multi-select
ng-if="$ctrl.availableUsers.length > 0" <por-access-control-form-user-selector
class="col-sm-9 col-lg-10" ng-if="$ctrl.availableUsers.length > 0"
input-model="$ctrl.availableUsers" options="$ctrl.availableUsers"
output-model="$ctrl.formData.AuthorizedUsers" value="$ctrl.formData.AuthorizedUsers"
button-label="Username" input-id="'users-selector'"
item-label="Username" on-change="($ctrl.onAuthorizedUsersChange)"
tick-property="selected" ></por-access-control-form-user-selector>
helper-elements="filter"
search-property="Username"
translation="{nothingSelected: 'Select one or more users', search: 'Search...'}"
data-cy="portainer-selectUserAccess"
>
</div> </div>
</div> </div>
</div> </div>

@ -15,6 +15,9 @@ angular.module('portainer.app').controller('porAccessControlFormController', [
ctrl.RCO = RCO; ctrl.RCO = RCO;
this.onAuthorizedTeamsChange = onAuthorizedTeamsChange.bind(this);
this.onAuthorizedUsersChange = onAuthorizedUsersChange.bind(this);
ctrl.availableTeams = []; ctrl.availableTeams = [];
ctrl.availableUsers = []; ctrl.availableUsers = [];
@ -31,18 +34,24 @@ angular.module('portainer.app').controller('porAccessControlFormController', [
} }
function setAuthorizedUsersAndTeams(authorizedUsers, authorizedTeams) { function setAuthorizedUsersAndTeams(authorizedUsers, authorizedTeams) {
angular.forEach(ctrl.availableUsers, function (user) { ctrl.formData.AuthorizedTeams = authorizedTeams;
var found = _.find(authorizedUsers, { Id: user.Id }); ctrl.formData.AuthorizedUsers = authorizedUsers;
if (found) { }
user.selected = true;
} function onAuthorizedTeamsChange(AuthorizedTeams) {
}); onChange({ AuthorizedTeams });
}
function onAuthorizedUsersChange(AuthorizedUsers) {
onChange({ AuthorizedUsers });
}
angular.forEach(ctrl.availableTeams, function (team) { function onChange(formData) {
var found = _.find(authorizedTeams, { Id: team.Id }); $scope.$evalAsync(() => {
if (found) { ctrl.formData = {
team.selected = true; ...ctrl.formData,
} ...formData,
};
}); });
} }

@ -1,9 +1,5 @@
import angular from 'angular'; import angular from 'angular';
import { porAccessManagement } from './por-access-management'; import { porAccessManagement } from './por-access-management';
import { porAccessManagementUsersSelector } from './por-access-management-users-selector';
export default angular export default angular.module('portainer.app.component.access-management', []).component('porAccessManagement', porAccessManagement).name;
.module('portainer.app.component.access-management', [])
.component('porAccessManagement', porAccessManagement)
.component('porAccessManagementUsersSelector', porAccessManagementUsersSelector).name;

@ -1,7 +0,0 @@
export const porAccessManagementUsersSelector = {
templateUrl: './por-access-management-users-selector.html',
bindings: {
options: '<',
value: '=',
},
};

@ -1,20 +0,0 @@
<div class="form-group">
<label class="col-sm-3 col-lg-2 control-label text-left vertical-center"> Select user(s) and/or team(s) </label>
<div class="col-sm-9 col-lg-4 vertical-center">
<span class="small text-muted" ng-if="$ctrl.options.length === 0"> No users or teams available. </span>
<span
isteven-multi-select
ng-if="$ctrl.options.length > 0"
input-model="$ctrl.options"
output-model="$ctrl.value"
button-label="icon Name"
item-label="icon Name"
tick-property="ticked"
helper-elements="filter"
search-property="Name"
translation="{nothingSelected: 'Select one or more users and/or teams', search: 'Search...'}"
data-cy="component-selectUser"
>
</span>
</div>
</div>

@ -13,7 +13,11 @@
</span> </span>
</div> </div>
<por-access-management-users-selector options="ctrl.availableUsersAndTeams" value="ctrl.formValues.multiselectOutput"></por-access-management-users-selector> <por-access-management-users-selector
options="ctrl.availableUsersAndTeams"
value="ctrl.formValues.multiselectOutput"
on-change="(ctrl.onChangeUsersAndTeams)"
></por-access-management-users-selector>
<div class="form-group" ng-if="ctrl.entityType !== 'registry'"> <div class="form-group" ng-if="ctrl.entityType !== 'registry'">
<label class="col-sm-3 col-lg-2 control-label text-left"> Role </label> <label class="col-sm-3 col-lg-2 control-label text-left"> Role </label>
@ -38,7 +42,7 @@
<button <button
type="submit" type="submit"
class="btn btn-primary btn-sm vertical-center" class="btn btn-primary btn-sm vertical-center"
ng-disabled="(ctrl.availableUsersAndTeams | filter:{ticked:true}).length === 0 || ctrl.actionInProgress" ng-disabled="ctrl.formValues.multiselectOutput.length === 0 || ctrl.actionInProgress"
ng-click="ctrl.authorizeAccess()" ng-click="ctrl.authorizeAccess()"
button-spinner="ctrl.actionInProgress" button-spinner="ctrl.actionInProgress"
data-cy="access-createAccess" data-cy="access-createAccess"

@ -6,13 +6,20 @@ import { isLimitedToBE } from '@/portainer/feature-flags/feature-flags.service';
class PorAccessManagementController { class PorAccessManagementController {
/* @ngInject */ /* @ngInject */
constructor(Notifications, AccessService, RoleService) { constructor($scope, Notifications, AccessService, RoleService) {
Object.assign(this, { Notifications, AccessService, RoleService }); Object.assign(this, { $scope, Notifications, AccessService, RoleService });
this.limitedToBE = false; this.limitedToBE = false;
this.unauthorizeAccess = this.unauthorizeAccess.bind(this); this.unauthorizeAccess = this.unauthorizeAccess.bind(this);
this.updateAction = this.updateAction.bind(this); this.updateAction = this.updateAction.bind(this);
this.onChangeUsersAndTeams = this.onChangeUsersAndTeams.bind(this);
}
onChangeUsersAndTeams(value) {
this.$scope.$evalAsync(() => {
this.formValues.multiselectOutput = value;
});
} }
updateAction() { updateAction() {

@ -1,9 +0,0 @@
angular.module('portainer.app').component('endpointSelector', {
templateUrl: './endpointSelector.html',
controller: 'EndpointSelectorController',
bindings: {
model: '=',
endpoints: '<',
groups: '<',
},
});

@ -1,8 +0,0 @@
<ui-select ng-model="$ctrl.model">
<ui-select-match placeholder="Select an environment">
<span>{{ $select.selected.Name }}</span>
</ui-select-match>
<ui-select-choices group-by="$ctrl.groupEndpoints" group-filter="$ctrl.sortGroups" repeat="endpoint in ($ctrl.endpoints | filter: $select.search) track by endpoint.Id">
<span>{{ endpoint.Name }}</span>
</ui-select-choices>
</ui-select>

@ -1,35 +0,0 @@
import _ from 'lodash-es';
angular.module('portainer.app').controller('EndpointSelectorController', function () {
var ctrl = this;
this.sortGroups = function (groups) {
return _.sortBy(groups, ['name']);
};
this.groupEndpoints = function (endpoint) {
for (var i = 0; i < ctrl.availableGroups.length; i++) {
var group = ctrl.availableGroups[i];
if (endpoint.GroupId === group.Id) {
return group.Name;
}
}
};
this.$onInit = function () {
this.availableGroups = filterEmptyGroups(this.groups, this.endpoints);
};
function filterEmptyGroups(groups, endpoints) {
return groups.filter(function f(group) {
for (var i = 0; i < endpoints.length; i++) {
var endpoint = endpoints[i];
if (endpoint.GroupId === group.Id) {
return true;
}
}
return false;
});
}
});

@ -2,16 +2,19 @@ import { STACK_NAME_VALIDATION_REGEX } from '@/constants';
angular.module('portainer.app').controller('StackDuplicationFormController', [ angular.module('portainer.app').controller('StackDuplicationFormController', [
'Notifications', 'Notifications',
function StackDuplicationFormController(Notifications) { '$scope',
function StackDuplicationFormController(Notifications, $scope) {
var ctrl = this; var ctrl = this;
ctrl.environmentSelectorOptions = null;
ctrl.state = { ctrl.state = {
duplicationInProgress: false, duplicationInProgress: false,
migrationInProgress: false, migrationInProgress: false,
}; };
ctrl.formValues = { ctrl.formValues = {
endpoint: null, endpointId: null,
newName: '', newName: '',
}; };
@ -23,15 +26,24 @@ angular.module('portainer.app').controller('StackDuplicationFormController', [
ctrl.migrateStack = migrateStack; ctrl.migrateStack = migrateStack;
ctrl.isMigrationButtonDisabled = isMigrationButtonDisabled; ctrl.isMigrationButtonDisabled = isMigrationButtonDisabled;
ctrl.isEndpointSelected = isEndpointSelected; ctrl.isEndpointSelected = isEndpointSelected;
ctrl.onChangeEnvironment = onChangeEnvironment;
ctrl.$onChanges = $onChanges;
function isFormValidForMigration() { function isFormValidForMigration() {
return ctrl.formValues.endpoint && ctrl.formValues.endpoint.Id; return ctrl.formValues.endpointId;
} }
function isFormValidForDuplication() { function isFormValidForDuplication() {
return isFormValidForMigration() && ctrl.formValues.newName && !ctrl.yamlError; return isFormValidForMigration() && ctrl.formValues.newName && !ctrl.yamlError;
} }
function onChangeEnvironment(endpointId) {
console.log({ endpointId });
return $scope.$evalAsync(() => {
ctrl.formValues.endpointId = endpointId;
});
}
function duplicateStack() { function duplicateStack() {
if (!ctrl.formValues.newName) { if (!ctrl.formValues.newName) {
Notifications.error('Failure', null, 'Stack name is required for duplication'); Notifications.error('Failure', null, 'Stack name is required for duplication');
@ -40,7 +52,7 @@ angular.module('portainer.app').controller('StackDuplicationFormController', [
ctrl.state.duplicationInProgress = true; ctrl.state.duplicationInProgress = true;
ctrl ctrl
.onDuplicate({ .onDuplicate({
endpointId: ctrl.formValues.endpoint.Id, endpointId: ctrl.formValues.endpointId,
name: ctrl.formValues.newName ? ctrl.formValues.newName : undefined, name: ctrl.formValues.newName ? ctrl.formValues.newName : undefined,
}) })
.finally(function () { .finally(function () {
@ -52,7 +64,7 @@ angular.module('portainer.app').controller('StackDuplicationFormController', [
ctrl.state.migrationInProgress = true; ctrl.state.migrationInProgress = true;
ctrl ctrl
.onMigrate({ .onMigrate({
endpointId: ctrl.formValues.endpoint.Id, endpointId: ctrl.formValues.endpointId,
name: ctrl.formValues.newName ? ctrl.formValues.newName : undefined, name: ctrl.formValues.newName ? ctrl.formValues.newName : undefined,
}) })
.finally(function () { .finally(function () {
@ -65,11 +77,42 @@ angular.module('portainer.app').controller('StackDuplicationFormController', [
} }
function isTargetEndpointAndCurrentEquals() { function isTargetEndpointAndCurrentEquals() {
return ctrl.formValues.endpoint && ctrl.formValues.endpoint.Id === ctrl.currentEndpointId; return ctrl.formValues.endpointId === ctrl.currentEndpointId;
} }
function isEndpointSelected() { function isEndpointSelected() {
return ctrl.formValues.endpoint && ctrl.formValues.endpoint.Id; return ctrl.formValues.endpointId;
}
function $onChanges() {
ctrl.environmentSelectorOptions = getOptions(ctrl.groups, ctrl.endpoints);
} }
}, },
]); ]);
function getOptions(groups, environments) {
if (!groups || !environments) {
return [];
}
const groupSet = environments.reduce((groupSet, environment) => {
const groupEnvironments = groupSet[environment.GroupId] || [];
return {
...groupSet,
[environment.GroupId]: [...groupEnvironments, { label: environment.Name, value: environment.Id }],
};
}, {});
return Object.entries(groupSet).map(([groupId, environments]) => {
const group = groups.find((group) => group.Id === parseInt(groupId, 10));
if (!group) {
throw new Error('missing group');
}
return {
label: group.Name,
options: environments,
};
});
}

@ -30,8 +30,8 @@
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group" ng-if="$ctrl.endpoints && $ctrl.groups">
<endpoint-selector ng-if="$ctrl.endpoints && $ctrl.groups" model="$ctrl.formValues.endpoint" endpoints="$ctrl.endpoints" groups="$ctrl.groups"></endpoint-selector> <por-select value="$ctrl.formValues.endpointId" on-change="($ctrl.onChangeEnvironment)" options="$ctrl.environmentSelectorOptions"></por-select>
</div> </div>
<div class="form-group"> <div class="form-group">

@ -17,6 +17,7 @@ type TeamAccessPolicies = Record<TeamId, AccessPolicy>;
export type RegistryId = number; export type RegistryId = number;
export interface Registry { export interface Registry {
Id: RegistryId; Id: RegistryId;
Name: string;
} }
interface RegistryAccess { interface RegistryAccess {

@ -6,7 +6,8 @@ import AccessViewerPolicyModel from '../../models/access';
export default class AccessViewerController { export default class AccessViewerController {
/* @ngInject */ /* @ngInject */
constructor(Notifications, RoleService, UserService, GroupService, TeamService, TeamMembershipService, Authentication) { constructor($scope, Notifications, RoleService, UserService, GroupService, TeamService, TeamMembershipService, Authentication) {
this.$scope = $scope;
this.Notifications = Notifications; this.Notifications = Notifications;
this.RoleService = RoleService; this.RoleService = RoleService;
this.UserService = UserService; this.UserService = UserService;
@ -17,40 +18,51 @@ export default class AccessViewerController {
this.limitedFeature = 'rbac-roles'; this.limitedFeature = 'rbac-roles';
this.users = []; this.users = [];
this.selectedUserId = null;
this.onUserSelect = this.onUserSelect.bind(this);
} }
onUserSelect() { onUserSelect(selectedUserId) {
this.userRoles = []; this.$scope.$evalAsync(() => {
const userRoles = {}; this.userRoles = [];
const user = this.selectedUser; this.selectedUserId = selectedUserId;
const userMemberships = _.filter(this.teamMemberships, { UserId: user.Id });
for (const [, endpoint] of _.entries(this.endpoints)) {
let role = this.getRoleFromUserEndpointPolicy(user, endpoint);
if (role) {
userRoles[endpoint.Id] = role;
continue;
}
role = this.getRoleFromUserEndpointGroupPolicy(user, endpoint); const userRoles = {};
if (role) { const user = this.allUsers.find((user) => user.Id === selectedUserId);
userRoles[endpoint.Id] = role; if (!user) {
continue; throw new Error('User not found');
} }
role = this.getRoleFromTeamEndpointPolicies(userMemberships, endpoint); const userMemberships = _.filter(this.teamMemberships, { UserId: user.value });
if (role) {
userRoles[endpoint.Id] = role;
continue;
}
role = this.getRoleFromTeamEndpointGroupPolicies(userMemberships, endpoint); for (const [, endpoint] of _.entries(this.endpoints)) {
if (role) { let role = this.getRoleFromUserEndpointPolicy(user, endpoint);
userRoles[endpoint.Id] = role; if (role) {
userRoles[endpoint.Id] = role;
continue;
}
role = this.getRoleFromUserEndpointGroupPolicy(user, endpoint);
if (role) {
userRoles[endpoint.Id] = role;
continue;
}
role = this.getRoleFromTeamEndpointPolicies(userMemberships, endpoint);
if (role) {
userRoles[endpoint.Id] = role;
continue;
}
role = this.getRoleFromTeamEndpointGroupPolicies(userMemberships, endpoint);
if (role) {
userRoles[endpoint.Id] = role;
}
} }
}
this.userRoles = _.values(userRoles); this.userRoles = _.values(userRoles);
});
} }
findLowestRole(policies) { findLowestRole(policies) {
@ -150,7 +162,8 @@ export default class AccessViewerController {
this.roles = _.keyBy(await this.RoleService.roles(), 'Id'); this.roles = _.keyBy(await this.RoleService.roles(), 'Id');
this.teams = _.keyBy(await this.TeamService.teams(), 'Id'); this.teams = _.keyBy(await this.TeamService.teams(), 'Id');
this.teamMemberships = await this.TeamMembershipService.memberships(); this.teamMemberships = await this.TeamMembershipService.memberships();
this.users = await this.teamMemberUsers(this.allUsers, this.teamMemberships); const teamUsers = await this.teamMemberUsers(this.allUsers, this.teamMemberships);
this.users = teamUsers.map((user) => ({ label: user.Username, value: user.Id }));
} catch (err) { } catch (err) {
this.Notifications.error('Failure', err, 'Unable to retrieve accesses'); this.Notifications.error('Failure', err, 'Unable to retrieve accesses');
} }

@ -12,14 +12,9 @@
<div class="form-group"> <div class="form-group">
<div class="col-sm-12"> <div class="col-sm-12">
<span class="small text-muted" ng-if="$ctrl.users.length === 0"> No user available </span> <span class="small text-muted" ng-if="$ctrl.users.length === 0"> No user available </span>
<ui-select ng-if="$ctrl.users.length > 0" ng-model="$ctrl.selectedUser" ng-change="$ctrl.onUserSelect()">
<ui-select-match placeholder="Select a user"> <por-select ng-if="$ctrl.users.length > 0" value="$ctrl.selectedUserId" options="$ctrl.users" on-change="($ctrl.onUserSelect)" placeholder="'Select a user'">
<span>{{ $select.selected.Username }}</span> </por-select>
</ui-select-match>
<ui-select-choices repeat="item in ($ctrl.users | filter: $select.search)">
<span>{{ item.Username }}</span>
</ui-select-choices>
</ui-select>
</div> </div>
</div> </div>
<access-viewer-datatable table-key="access_viewer" dataset="$ctrl.userRoles" order-by="EndpointName" is-admin="$ctrl.isAdmin"> </access-viewer-datatable> <access-viewer-datatable table-key="access_viewer" dataset="$ctrl.userRoles" order-by="EndpointName" is-admin="$ctrl.isAdmin"> </access-viewer-datatable>

@ -17,6 +17,9 @@ import { withI18nSuspense } from '@/react-tools/withI18nSuspense';
import { SettingsFDO } from '@/react/portainer/settings/EdgeComputeView/SettingsFDO'; import { SettingsFDO } from '@/react/portainer/settings/EdgeComputeView/SettingsFDO';
import { SettingsOpenAMT } from '@/react/portainer/settings/EdgeComputeView/SettingsOpenAMT'; import { SettingsOpenAMT } from '@/react/portainer/settings/EdgeComputeView/SettingsOpenAMT';
import { InternalAuth } from '@/react/portainer/settings/AuthenticationView/InternalAuth'; import { InternalAuth } from '@/react/portainer/settings/AuthenticationView/InternalAuth';
import { PorAccessControlFormTeamSelector } from '@/react/portainer/access-control/PorAccessControlForm/TeamsSelector';
import { PorAccessControlFormUserSelector } from '@/react/portainer/access-control/PorAccessControlForm/UsersSelector';
import { PorAccessManagementUsersSelector } from '@/react/portainer/access-control/AccessManagement/PorAccessManagementUsersSelector';
import { PageHeader } from '@@/PageHeader'; import { PageHeader } from '@@/PageHeader';
import { TagSelector } from '@@/TagSelector'; import { TagSelector } from '@@/TagSelector';
@ -29,6 +32,8 @@ import { DashboardItem } from '@@/DashboardItem';
import { SearchBar } from '@@/datatables/SearchBar'; import { SearchBar } from '@@/datatables/SearchBar';
import { FallbackImage } from '@@/FallbackImage'; import { FallbackImage } from '@@/FallbackImage';
import { BadgeIcon } from '@@/BoxSelector/BadgeIcon'; import { BadgeIcon } from '@@/BoxSelector/BadgeIcon';
import { TeamsSelector } from '@@/TeamsSelector';
import { PortainerSelect } from '@@/form-components/PortainerSelect';
import { fileUploadField } from './file-upload-field'; import { fileUploadField } from './file-upload-field';
import { switchField } from './switch-field'; import { switchField } from './switch-field';
@ -140,4 +145,54 @@ export const componentsModule = angular
.component( .component(
'internalAuth', 'internalAuth',
r2a(InternalAuth, ['onSaveSettings', 'isLoading', 'value', 'onChange']) r2a(InternalAuth, ['onSaveSettings', 'isLoading', 'value', 'onChange'])
)
.component(
'teamsSelector',
r2a(TeamsSelector, [
'onChange',
'value',
'dataCy',
'inputId',
'name',
'placeholder',
'teams',
])
)
.component(
'porAccessControlFormTeamSelector',
r2a(PorAccessControlFormTeamSelector, [
'inputId',
'onChange',
'options',
'value',
])
)
.component(
'porAccessControlFormUserSelector',
r2a(PorAccessControlFormUserSelector, [
'inputId',
'onChange',
'options',
'value',
])
)
.component(
'porSelect',
r2a(PortainerSelect, [
'name',
'inputId',
'placeholder',
'disabled',
'data-cy',
'bindToBody',
'value',
'onChange',
'options',
'isMulti',
'isClearable',
])
)
.component(
'porAccessManagementUsersSelector',
r2a(PorAccessManagementUsersSelector, ['onChange', 'options', 'value'])
).name; ).name;

@ -1,7 +1,7 @@
export default class LdapCustomAdminGroupController { export default class LdapCustomAdminGroupController {
/* @ngInject */ /* @ngInject */
constructor($async, Notifications, LDAPService) { constructor($async, $scope, Notifications, LDAPService) {
Object.assign(this, { $async, Notifications, LDAPService }); Object.assign(this, { $async, $scope, Notifications, LDAPService });
this.groups = null; this.groups = null;
this.groupstest = null; this.groupstest = null;
@ -10,6 +10,7 @@ export default class LdapCustomAdminGroupController {
this.onRemoveClick = this.onRemoveClick.bind(this); this.onRemoveClick = this.onRemoveClick.bind(this);
this.onAddClick = this.onAddClick.bind(this); this.onAddClick = this.onAddClick.bind(this);
this.search = this.search.bind(this); this.search = this.search.bind(this);
this.onAdminGroupChange = this.onAdminGroupChange.bind(this);
} }
onAddClick() { onAddClick() {
@ -24,7 +25,8 @@ export default class LdapCustomAdminGroupController {
return this.$async(async () => { return this.$async(async () => {
try { try {
this.groups = null; this.groups = null;
this.groups = await this.onSearchClick(); const groups = await this.onSearchClick();
this.groups = groups.map((group) => ({ label: group.name, value: group.name }));
this.enableAssignAdminGroup = this.groups && this.groups.length > 0; this.enableAssignAdminGroup = this.groups && this.groups.length > 0;
} catch (error) { } catch (error) {
this.Notifications.error('Failure', error, 'Failed to search groups'); this.Notifications.error('Failure', error, 'Failed to search groups');
@ -32,14 +34,15 @@ export default class LdapCustomAdminGroupController {
}); });
} }
onAdminGroupChange(value) {
return this.$scope.$evalAsync(() => {
this.selectedAdminGroups = value;
});
}
async $onInit() { async $onInit() {
if (this.settings.AdminAutoPopulate && this.settings.AdminGroups && this.settings.AdminGroups.length > 0) { if (this.settings.AdminAutoPopulate && this.settings.AdminGroups && this.settings.AdminGroups.length > 0) {
const settings = { await this.search();
...this.settings,
AdminGroupSearchSettings: this.settings.AdminGroupSearchSettings.map((search) => ({ ...search, GroupFilter: search.GroupFilter || this.defaultAdminGroupSearchFilter })),
};
this.groups = await this.LDAPService.adminGroups(settings);
} }
if (this.groups && this.groups.length > 0) { if (this.groups && this.groups.length > 0) {

@ -114,22 +114,18 @@
</div> </div>
</div> </div>
<div class="form-group" ng-if="$ctrl.settings.AdminAutoPopulate"> <div class="form-group" ng-if="$ctrl.settings.AdminAutoPopulate && $ctrl.groups">
<div class="col-sm-12"> <label for="group-access" class="control-label text-left col-sm-2"> Select Group(s) </label>
<label for="group-access" class="control-label text-left"> Select Group(s) </label> <div class="col-sm-8">
<span <por-select
class="ml-7" data-cy="'group-access-selector'"
isteven-multi-select input-id="'group-access'"
ng-if="$ctrl.enableAssignAdminGroup" value="$ctrl.selectedAdminGroups"
input-model="$ctrl.groups" on-change="($ctrl.onAdminGroupChange)"
output-model="$ctrl.selectedAdminGroups" options="$ctrl.groups"
button-label="name" placeholder="'Select one or more groups'"
item-label="name" is-multi="true"
tick-property="selected"
helper-elements="filter"
search-property="name"
translation="{nothingSelected: 'Select one or more groups', search: 'Search...'}"
> >
</span> </por-select>
</div> </div>
</div> </div>

@ -105,25 +105,20 @@
<!-- !admin-checkbox --> <!-- !admin-checkbox -->
<!-- teams --> <!-- teams -->
<div class="form-group" ng-if="!formValues.Administrator"> <div class="form-group" ng-if="!formValues.Administrator">
<label class="col-sm-3 col-lg-2 control-label text-left">Add to team(s)</label> <label class="col-sm-3 col-lg-2 control-label text-left" for="teams-selector">Add to team(s)</label>
<div class="col-sm-8"> <div class="col-sm-8">
<span class="small text-muted" ng-if="teams.length === 0"> <span class="small text-muted" ng-if="teams.length === 0">
You don't seem to have any teams to add users into. Head over to the <a ui-sref="portainer.teams">Teams view</a> to create some. You don't seem to have any teams to add users into. Head over to the <a ui-sref="portainer.teams">Teams view</a> to create some.
</span> </span>
<span <teams-selector
isteven-multi-select
ng-if="teams.length > 0" ng-if="teams.length > 0"
input-model="teams" value="formValues.TeamIds"
output-model="formValues.Teams" teams="teams"
button-label="Name" placeholder="'Select one or more teams'"
item-label="Name" data-cy="'user-teamSelect'"
tick-property="ticked" on-change="(onChangeTeamIds)"
helper-elements="filter" input-id="'teams-selector'"
search-property="Name" ></teams-selector>
translation="{nothingSelected: 'Select one or more teams', search: 'Search...'}"
data-cy="user-teamSelect"
>
</span>
</div> </div>
</div> </div>
<!-- !teams --> <!-- !teams -->

@ -23,7 +23,7 @@ angular.module('portainer.app').controller('UsersController', [
Password: '', Password: '',
ConfirmPassword: '', ConfirmPassword: '',
Administrator: false, Administrator: false,
Teams: [], TeamIds: [],
}; };
$scope.handleAdministratorChange = function (checked) { $scope.handleAdministratorChange = function (checked) {
@ -32,6 +32,12 @@ angular.module('portainer.app').controller('UsersController', [
}); });
}; };
$scope.onChangeTeamIds = function (teamIds) {
return $scope.$evalAsync(() => {
$scope.formValues.TeamIds = teamIds;
});
};
$scope.checkUsernameValidity = function () { $scope.checkUsernameValidity = function () {
var valid = true; var valid = true;
for (var i = 0; i < $scope.users.length; i++) { for (var i = 0; i < $scope.users.length; i++) {
@ -50,11 +56,7 @@ angular.module('portainer.app').controller('UsersController', [
var username = $scope.formValues.Username; var username = $scope.formValues.Username;
var password = $scope.formValues.Password; var password = $scope.formValues.Password;
var role = $scope.formValues.Administrator ? 1 : 2; var role = $scope.formValues.Administrator ? 1 : 2;
var teamIds = []; UserService.createUser(username, password, role, $scope.formValues.TeamIds)
angular.forEach($scope.formValues.Teams, function (team) {
teamIds.push(team.Id);
});
UserService.createUser(username, password, role, teamIds)
.then(function success() { .then(function success() {
Notifications.success('User successfully created', username); Notifications.success('User successfully created', username);
$state.reload(); $state.reload();

@ -13,14 +13,14 @@ export default meta;
export { Example }; export { Example };
function Example() { function Example() {
const [selectedTeams, setSelectedTeams] = useState([1]); const [selectedTeams, setSelectedTeams] = useState<readonly number[]>([1]);
const teams = [createMockTeam(1, 'team1'), createMockTeam(2, 'team2')]; const teams = [createMockTeam(1, 'team1'), createMockTeam(2, 'team2')];
return ( return (
<TeamsSelector <TeamsSelector
value={selectedTeams} value={selectedTeams}
onChange={setSelectedTeams} onChange={(value) => setSelectedTeams(value)}
teams={teams} teams={teams}
placeholder="Select one or more teams" placeholder="Select one or more teams"
/> />

@ -1,11 +1,11 @@
import { Team, TeamId } from '@/react/portainer/users/teams/types'; import { Team, TeamId } from '@/react/portainer/users/teams/types';
import { Select } from '@@/form-components/ReactSelect'; import { PortainerSelect } from '@@/form-components/PortainerSelect';
interface Props { interface Props {
name?: string; name?: string;
value: TeamId[]; value: TeamId[] | readonly TeamId[];
onChange(value: TeamId[]): void; onChange(value: readonly TeamId[]): void;
teams: Team[]; teams: Team[];
dataCy?: string; dataCy?: string;
inputId?: string; inputId?: string;
@ -21,18 +21,15 @@ export function TeamsSelector({
inputId, inputId,
placeholder, placeholder,
}: Props) { }: Props) {
const options = teams.map((team) => ({ label: team.Name, value: team.Id }));
return ( return (
<Select <PortainerSelect<number>
name={name} name={name}
isMulti isMulti
getOptionLabel={(team) => team.Name} options={options}
getOptionValue={(team) => String(team.Id)} value={value}
options={teams} onChange={(value) => onChange(value)}
value={teams.filter((team) => value.includes(team.Id))}
closeMenuOnSelect={false}
onChange={(selectedTeams) =>
onChange(selectedTeams.map((team) => team.Id))
}
data-cy={dataCy} data-cy={dataCy}
inputId={inputId} inputId={inputId}
placeholder={placeholder} placeholder={placeholder}

@ -10,9 +10,17 @@
.sort-button { .sort-button {
background-color: var(--bg-sortbutton-color); background-color: var(--bg-sortbutton-color);
color: var(--text-ui-select-color); color: var(--grey-6);
border: 1px solid var(--border-sortbutton); border: 1px solid var(--border-sortbutton);
display: inline-block; display: inline-block;
padding: 8px 10px; padding: 8px 10px;
border-radius: 5px; border-radius: 5px;
} }
:global(:root[theme='dark']) .sort-button {
color: var(--white-color);
}
:global(:root[theme='highcontrast']) .sort-button {
color: var(--white-color);
}

@ -0,0 +1,149 @@
import { OptionsOrGroups } from 'react-select';
import _ from 'lodash';
import { AutomationTestingProps } from '@/types';
import { Select as ReactSelect } from '@@/form-components/ReactSelect';
interface Option<TValue> {
value: TValue;
label: string;
}
type Group<TValue> = { label: string; options: Option<TValue>[] };
type Options<TValue> = OptionsOrGroups<Option<TValue>, Group<TValue>>;
interface SharedProps extends AutomationTestingProps {
name?: string;
inputId?: string;
placeholder?: string;
disabled?: boolean;
isClearable?: boolean;
bindToBody?: boolean;
}
interface MultiProps<TValue> extends SharedProps {
value: readonly TValue[];
onChange(value: readonly TValue[]): void;
options: Options<TValue>;
isMulti: true;
}
interface SingleProps<TValue> extends SharedProps {
value: TValue;
onChange(value: TValue | null): void;
options: Options<TValue>;
isMulti?: never;
}
type Props<TValue> = MultiProps<TValue> | SingleProps<TValue>;
export function PortainerSelect<TValue = string>(props: Props<TValue>) {
return isMultiProps(props) ? (
// eslint-disable-next-line react/jsx-props-no-spreading
<MultiSelect {...props} />
) : (
// eslint-disable-next-line react/jsx-props-no-spreading
<SingleSelect {...props} />
);
}
function isMultiProps<TValue>(
props: Props<TValue>
): props is MultiProps<TValue> {
return 'isMulti' in props && !!props.isMulti;
}
export function SingleSelect<TValue = string>({
name,
options,
onChange,
value,
'data-cy': dataCy,
disabled,
inputId,
placeholder,
isClearable,
bindToBody,
}: SingleProps<TValue>) {
const selectedValue = value
? _.first(findSelectedOptions<TValue>(options, value))
: null;
return (
<ReactSelect<Option<TValue>>
name={name}
isClearable={isClearable}
getOptionLabel={(option) => option.label}
getOptionValue={(option) => String(option.value)}
options={options}
value={selectedValue}
onChange={(option) => onChange(option ? option.value : null)}
data-cy={dataCy}
inputId={inputId}
placeholder={placeholder}
isDisabled={disabled}
menuPortalTarget={bindToBody ? document.body : undefined}
/>
);
}
function findSelectedOptions<TValue>(
options: Options<TValue>,
value: TValue | readonly TValue[]
) {
const valueArr = Array.isArray(value) ? value : [value];
return _.compact(
options.flatMap((option) => {
if (isGroup(option)) {
return option.options.find((option) => valueArr.includes(option.value));
}
if (valueArr.includes(option.value)) {
return option;
}
return null;
})
);
}
export function MultiSelect<TValue = string>({
name,
value,
onChange,
options,
'data-cy': dataCy,
inputId,
placeholder,
disabled,
isClearable,
bindToBody,
}: Omit<MultiProps<TValue>, 'isMulti'>) {
const selectedOptions = findSelectedOptions(options, value);
return (
<ReactSelect
name={name}
isMulti
isClearable={isClearable}
getOptionLabel={(option) => option.label}
getOptionValue={(option) => String(option.value)}
options={options}
value={selectedOptions}
closeMenuOnSelect={false}
onChange={(newValue) => onChange(newValue.map((option) => option.value))}
data-cy={dataCy}
inputId={inputId}
placeholder={placeholder}
isDisabled={disabled}
menuPortalTarget={bindToBody ? document.body : undefined}
/>
);
}
function isGroup<TValue>(
option: Option<TValue> | Group<TValue>
): option is Group<TValue> {
return 'options' in option;
}

@ -0,0 +1,100 @@
.portainer-selector-root {
--multi-value-tag-bg: var(--grey-51);
--single-value-option-text-color: currentColor;
}
:root[theme='dark'] .portainer-selector-root {
--multi-value-tag-bg: var(--grey-3);
--single-value-option-text-color: var(--white-color);
}
:root[theme='highcontrast'] .portainer-selector-root {
--multi-value-tag-bg: var(--grey-3);
--single-value-option-text-color: var(--white-color);
}
/* input style */
.portainer-selector-root .portainer-selector__control {
border-color: var(--border-form-control-color);
background-color: var(--bg-inputbox);
min-height: 34px;
}
.portainer-selector-root .portainer-selector__multi-value {
background-color: var(--multi-value-tag-bg);
}
.portainer-selector-root .portainer-selector__input-container {
color: var(--text-form-control-color);
}
.portainer-selector-root .portainer-selector__dropdown-indicator {
padding: 0 8px;
}
.portainer-selector-root .portainer-selector__multi-value__label {
@apply text-black;
@apply th-dark:text-white;
@apply th-highcontrast:text-white;
}
.portainer-selector-root .portainer-selector__single-value {
color: var(--single-value-option-text-color);
}
/* Menu colors */
.portainer-selector__menu {
--bg-multiselect-color: var(--white-color);
--border-multiselect: var(--grey-48);
--focused-option-bg: var(--ui-gray-3);
--focused-option-color: currentColor;
--selected-option-text-color: var(--grey-7);
}
:root[theme='dark'] .portainer-selector__menu {
--bg-multiselect-color: var(--grey-1);
--border-multiselect: var(--grey-3);
--focused-option-bg: var(--blue-2);
--focused-option-color: var(--white-color);
--selected-option-text-color: var(--white);
}
:root[theme='highcontrast'] .portainer-selector__menu {
--bg-multiselect-color: var(--black-color);
--border-multiselect: var(--grey-3);
--focused-option-bg: var(--blue-2);
--focused-option-color: var(--white-color);
--selected-option-text-color: var(--white);
}
.portainer-selector__menu-portal .portainer-selector__menu,
.portainer-selector-root .portainer-selector__menu {
background-color: var(--bg-multiselect-color);
border: 1px solid var(--border-multiselect);
padding: 5px;
z-index: 10;
}
.portainer-selector__menu-portal .portainer-selector__menu .portainer-selector__option,
.portainer-selector-root .portainer-selector__menu .portainer-selector__option {
background-color: var(--bg-multiselect-color);
border-radius: 5px;
}
.portainer-selector__menu-portal .portainer-selector__menu .portainer-selector__option:active,
.portainer-selector__menu-portal .portainer-selector__menu .portainer-selector__option--is-focused,
.portainer-selector-root .portainer-selector__menu .portainer-selector__option:active,
.portainer-selector-root .portainer-selector__menu .portainer-selector__option--is-focused {
background-color: var(--focused-option-bg);
color: var(--focused-option-color);
}
.portainer-selector__menu-portal .portainer-selector__menu .portainer-selector__option--is-selected,
.portainer-selector-root .portainer-selector__menu .portainer-selector__option--is-selected {
color: var(--selected-option-text-color);
}

@ -1,65 +0,0 @@
.root :global .selector__control {
border: 1px solid var(--border-multiselect);
background-color: var(--bg-multiselect-color);
}
.root :global .selector__multi-value {
background-color: var(--grey-51);
}
:global :root[theme='dark'] :local .root :global .selector__multi-value {
background-color: var(--grey-3);
}
:global :root[theme='highcontrast'] :local .root :global .selector__multi-value {
background-color: var(--grey-3);
}
.root :global .selector__multi-value__label {
color: var(--black-color);
}
:global :root[theme='dark'] :local .root :global .selector__multi-value__label {
color: var(--white-color);
}
:global :root[theme='highcontrast'] :local .root :global .selector__multi-value__label {
color: var(--white-color);
}
.root :global .selector__menu {
background-color: var(--bg-multiselect-color);
border: 1px solid var(--border-multiselect);
padding: 5px;
z-index: 10;
}
.root :global .selector__option {
background-color: var(--bg-multiselect-color);
border-radius: 5px;
}
.root :global .selector__option:active,
.root :global .selector__option--is-focused {
background-color: var(--ui-gray-3);
}
:global :root[theme='dark'] :local .root :global .selector__option:active,
:global :root[theme='dark'] :local .root :global .selector__option--is-focused {
background-color: var(--blue-2);
color: var(--white-color);
}
.root :global .selector__option--is-selected {
color: var(--grey-7);
}
:global :root[theme='highcontrast'] :local .root :global .selector__single-value,
:global :root[theme='dark'] :local .root :global .selector__single-value {
color: var(--white-color);
}
:global :root[theme='highcontrast'] :local .root :global .selector__input-container,
:global :root[theme='dark'] :local .root :global .selector__input-container {
color: var(--white-color);
}

@ -1,24 +1,53 @@
import ReactSelectCreatable, { CreatableProps } from 'react-select/creatable'; import ReactSelectCreatable, {
import ReactSelect, { GroupBase, Props as SelectProps } from 'react-select'; CreatableProps as ReactSelectCreatableProps,
} from 'react-select/creatable';
import ReactSelect, {
GroupBase,
Props as ReactSelectProps,
} from 'react-select';
import clsx from 'clsx'; import clsx from 'clsx';
import { RefAttributes } from 'react'; import { RefAttributes } from 'react';
import ReactSelectType from 'react-select/dist/declarations/src/Select'; import ReactSelectType from 'react-select/dist/declarations/src/Select';
import styles from './ReactSelect.module.css'; import './ReactSelect.css';
interface DefaultOption {
value: string;
label: string;
}
type RegularProps<
Option = DefaultOption,
IsMulti extends boolean = false,
Group extends GroupBase<Option> = GroupBase<Option>
> = { isCreatable?: false } & ReactSelectProps<Option, IsMulti, Group> &
RefAttributes<ReactSelectType<Option, IsMulti, Group>>;
type CreatableProps<
Option = DefaultOption,
IsMulti extends boolean = false,
Group extends GroupBase<Option> = GroupBase<Option>
> = { isCreatable: true } & ReactSelectCreatableProps<Option, IsMulti, Group>;
type Props<
Option = DefaultOption,
IsMulti extends boolean = false,
Group extends GroupBase<Option> = GroupBase<Option>
> =
| CreatableProps<Option, IsMulti, Group>
| RegularProps<Option, IsMulti, Group>;
export function Select< export function Select<
Option = unknown, Option = DefaultOption,
IsMulti extends boolean = false, IsMulti extends boolean = false,
Group extends GroupBase<Option> = GroupBase<Option> Group extends GroupBase<Option> = GroupBase<Option>
>({ >({ className, isCreatable = false, ...props }: Props<Option, IsMulti, Group>) {
className, const Component = isCreatable ? ReactSelectCreatable : ReactSelect;
...props
}: SelectProps<Option, IsMulti, Group> &
RefAttributes<ReactSelectType<Option, IsMulti, Group>>) {
return ( return (
<ReactSelect <Component
className={clsx(styles.root, className)} className={clsx(className, 'portainer-selector-root')}
classNamePrefix="selector" classNamePrefix="portainer-selector"
// eslint-disable-next-line react/jsx-props-no-spreading // eslint-disable-next-line react/jsx-props-no-spreading
{...props} {...props}
/> />
@ -26,14 +55,14 @@ export function Select<
} }
export function Creatable< export function Creatable<
Option = unknown, Option = DefaultOption,
IsMulti extends boolean = false, IsMulti extends boolean = false,
Group extends GroupBase<Option> = GroupBase<Option> Group extends GroupBase<Option> = GroupBase<Option>
>({ className, ...props }: CreatableProps<Option, IsMulti, Group>) { >({ className, ...props }: ReactSelectCreatableProps<Option, IsMulti, Group>) {
return ( return (
<ReactSelectCreatable <ReactSelectCreatable
className={clsx(styles.root, className)} className={clsx(className, 'portainer-selector-root')}
classNamePrefix="selector" classNamePrefix="portainer-selector"
// eslint-disable-next-line react/jsx-props-no-spreading // eslint-disable-next-line react/jsx-props-no-spreading
{...props} {...props}
/> />

@ -9,10 +9,16 @@
} }
.sort-button { .sort-button {
--text-color: var(--grey-6);
background-color: var(--bg-sortbutton-color); background-color: var(--bg-sortbutton-color);
color: var(--text-ui-select-color); color: var(--text-color);
border: 1px solid var(--border-sortbutton); border: 1px solid var(--border-sortbutton);
display: inline-block; display: inline-block;
padding: 8px 10px; padding: 8px 10px;
border-radius: 5px; border-radius: 5px;
} }
:global([theme='dark']) .sort-button,
:global([theme='highcontrast']) .sort-button {
--text-color: var(--white-color);
}

@ -0,0 +1,34 @@
import _ from 'lodash';
import { Select } from '@@/form-components/ReactSelect';
import { EdgeGroup } from '../edge-groups/types';
type SingleValue = EdgeGroup['Id'];
interface Props {
items: EdgeGroup[];
value: SingleValue[];
onChange: (value: SingleValue[]) => void;
}
export function EdgeGroupsSelector({ items, value, onChange }: Props) {
const valueGroups = _.compact(
value.map((id) => items.find((item) => item.Id === id))
);
return (
<Select
options={items}
isMulti
getOptionLabel={(item) => item.Name}
getOptionValue={(item) => String(item.Id)}
value={valueGroups}
onChange={(value) => {
onChange(value.map((item) => item.Id));
}}
placeholder="Select one or multiple group(s)"
closeMenuOnSelect={false}
/>
);
}

@ -0,0 +1,60 @@
import { components, MultiValueGenericProps } from 'react-select';
import { Select } from '@@/form-components/ReactSelect';
interface Option {
Name: string;
Description: string;
}
interface Props {
value: Option[];
onChange(storageClassName: string, value: readonly Option[]): void;
options: Option[];
inputId?: string;
storageClassName: string;
}
export function StorageAccessModeSelector({
value,
onChange,
options,
inputId,
storageClassName,
}: Props) {
return (
<Select
isMulti
getOptionLabel={(option) => option.Description}
getOptionValue={(option) => option.Name}
components={{ MultiValueLabel }}
options={options}
value={value}
closeMenuOnSelect={false}
onChange={(value) => onChange(storageClassName, value)}
inputId={inputId}
placeholder="Select one or more teams"
data-cy={`kubeSetup-storageAccessSelect${storageClassName}`}
/>
);
}
function MultiValueLabel({
data,
innerProps,
selectProps,
}: MultiValueGenericProps<Option>) {
if (!data || !data.Name) {
throw new Error('missing option name');
}
return (
<components.MultiValueLabel
data={data}
innerProps={innerProps}
selectProps={selectProps}
>
{data.Name}
</components.MultiValueLabel>
);
}

@ -0,0 +1,50 @@
import _ from 'lodash';
import { Select } from '@@/form-components/ReactSelect';
interface Namespace {
id: string;
name: string;
}
interface Props {
name?: string;
value: string[];
onChange(value: string[]): void;
namespaces: Namespace[];
dataCy?: string;
inputId?: string;
placeholder?: string;
}
export function NamespacesSelector({
name,
value,
onChange,
namespaces,
dataCy,
inputId,
placeholder,
}: Props) {
return (
<Select
name={name}
isMulti
getOptionLabel={(namespace) => namespace.name}
getOptionValue={(namespace) => String(namespace.id)}
options={namespaces}
value={_.compact(
value.map((namespaceName) =>
namespaces.find((namespace) => namespace.name === namespaceName)
)
)}
closeMenuOnSelect={false}
onChange={(selectedTeams) =>
onChange(selectedTeams.map((namespace) => namespace.name))
}
data-cy={dataCy}
inputId={inputId}
placeholder={placeholder}
/>
);
}

@ -0,0 +1,82 @@
import { User as UserIcon, Users as TeamIcon } from 'react-feather';
import { OptionProps, components, MultiValueGenericProps } from 'react-select';
import { Select } from '@@/form-components/ReactSelect';
type Role = { Name: string };
type Option = { Type: 'user' | 'team'; Id: number; Name: string; Role: Role };
interface Props {
name?: string;
value: Option[];
onChange(value: readonly Option[]): void;
options: Option[];
dataCy?: string;
inputId?: string;
placeholder?: string;
}
export function NamespaceAccessUsersSelector({
onChange,
options,
value,
dataCy,
inputId,
name,
placeholder,
}: Props) {
return (
<Select
isMulti
name={name}
getOptionLabel={(option) => option.Name}
getOptionValue={(option) => `${option.Id}-${option.Type}`}
options={options}
value={value}
closeMenuOnSelect={false}
onChange={onChange}
data-cy={dataCy}
inputId={inputId}
placeholder={placeholder}
components={{ MultiValueLabel, Option: OptionComponent }}
/>
);
}
function isOption(option: unknown): option is Option {
return !!option && typeof option === 'object' && 'Type' in option;
}
function OptionComponent({ data, ...props }: OptionProps<Option, true>) {
return (
// eslint-disable-next-line react/jsx-props-no-spreading
<components.Option data={data} {...props}>
{isOption(data) && <Label option={data} />}
</components.Option>
);
}
function MultiValueLabel({
data,
...props
}: MultiValueGenericProps<Option, true>) {
return (
// eslint-disable-next-line react/jsx-props-no-spreading
<components.MultiValueLabel data={data} {...props}>
{isOption(data) && <Label option={data} />}
</components.MultiValueLabel>
);
}
function Label({ option }: { option: Option }) {
const Icon = option.Type === 'user' ? UserIcon : TeamIcon;
return (
<div className="flex gap-1 items-center">
<Icon />
<span>{option.Name}</span>
<span>|</span>
<span>{option.Role.Name}</span>
</div>
);
}

@ -0,0 +1,32 @@
import { Registry } from '@/portainer/environments/environment.service/registries';
import { Select } from '@@/form-components/ReactSelect';
interface Props {
value: Registry[];
onChange(value: readonly Registry[]): void;
options: Registry[];
inputId?: string;
}
export function CreateNamespaceRegistriesSelector({
value,
onChange,
options,
inputId,
}: Props) {
return (
<Select
isMulti
getOptionLabel={(option) => option.Name}
getOptionValue={(option) => String(option.Id)}
options={options}
value={value}
closeMenuOnSelect={false}
onChange={onChange}
inputId={inputId}
data-cy="namespaceCreate-registrySelect"
placeholder="Select one or more registry"
/>
);
}

@ -0,0 +1,84 @@
import { User as UserIcon, Users as TeamIcon } from 'react-feather';
import { OptionProps, components, MultiValueGenericProps } from 'react-select';
import { Select } from '@@/form-components/ReactSelect';
type Option = { Type: 'user' | 'team'; Id: number; Name: string };
interface Props {
value: Option[];
onChange(value: readonly Option[]): void;
options: Option[];
}
export function PorAccessManagementUsersSelector({
options,
value,
onChange,
}: Props) {
return (
<div className="form-group">
<label
className="col-sm-3 col-lg-2 control-label text-left"
htmlFor="users-selector"
>
Select user(s) and/or team(s)
</label>
<div className="col-sm-9 col-lg-4">
{options.length === 0 ? (
<span className="small text-muted">No users or teams available.</span>
) : (
<Select
isMulti
getOptionLabel={(option) => option.Name}
getOptionValue={(option) => `${option.Id}-${option.Type}`}
options={options}
value={value}
closeMenuOnSelect={false}
onChange={onChange}
data-cy="component-selectUser"
inputId="users-selector"
placeholder="Select one or more users and/or teams"
components={{ MultiValueLabel, Option: OptionComponent }}
/>
)}
</div>
</div>
);
}
function isOption(option: unknown): option is Option {
return !!option && typeof option === 'object' && 'Type' in option;
}
function OptionComponent({ data, ...props }: OptionProps<Option, true>) {
return (
// eslint-disable-next-line react/jsx-props-no-spreading
<components.Option data={data} {...props}>
{isOption(data) && <Label option={data} />}
</components.Option>
);
}
function MultiValueLabel({
data,
...props
}: MultiValueGenericProps<Option, true>) {
return (
// eslint-disable-next-line react/jsx-props-no-spreading
<components.MultiValueLabel data={data} {...props}>
{isOption(data) && <Label option={data} />}
</components.MultiValueLabel>
);
}
function Label({ option }: { option: Option }) {
const Icon = option.Type === 'user' ? UserIcon : TeamIcon;
return (
<div className="flex gap-1 items-center">
<Icon />
<span>{option.Name}</span>
</div>
);
}

@ -0,0 +1,33 @@
import { Team } from '@/react/portainer/users/teams/types';
import { Select } from '@@/form-components/ReactSelect';
interface Props {
value: Team[];
onChange(value: readonly Team[]): void;
options: Team[];
inputId?: string;
}
// to be removed with the angularjs app/portainer/components/accessControlForm
export function PorAccessControlFormTeamSelector({
value,
onChange,
options,
inputId,
}: Props) {
return (
<Select
isMulti
getOptionLabel={(option) => option.Name}
getOptionValue={(option) => String(option.Id)}
options={options}
value={value}
closeMenuOnSelect={false}
onChange={onChange}
data-cy="portainer-selectTeamAccess"
inputId={inputId}
placeholder="Select one or more teams"
/>
);
}

@ -0,0 +1,33 @@
import { User } from '@/portainer/users/types';
import { Select } from '@@/form-components/ReactSelect';
interface Props {
value: User[];
onChange(value: readonly User[]): void;
options: User[];
inputId?: string;
}
// to be removed with the angularjs app/portainer/components/accessControlForm
export function PorAccessControlFormUserSelector({
value,
onChange,
options,
inputId,
}: Props) {
return (
<Select
isMulti
getOptionLabel={(option) => option.Username}
getOptionValue={(option) => String(option.Id)}
options={options}
value={value}
closeMenuOnSelect={false}
onChange={onChange}
data-cy="portainer-selectUserAccess"
inputId={inputId}
placeholder="Select one or more teams"
/>
);
}

@ -1,6 +1,5 @@
import angular from 'angular'; import angular from 'angular';
import 'moment'; import 'moment';
import 'ui-select';
import 'angular-sanitize'; import 'angular-sanitize';
import 'ng-file-upload'; import 'ng-file-upload';
import 'angular-messages'; import 'angular-messages';
@ -18,7 +17,6 @@ import 'bootstrap/dist/js/bootstrap.js';
import 'js-yaml/dist/js-yaml.js'; import 'js-yaml/dist/js-yaml.js';
import 'angular-ui-bootstrap'; import 'angular-ui-bootstrap';
import 'angular-moment-picker'; import 'angular-moment-picker';
import 'angular-multiselect/isteven-multi-select.js';
import 'angulartics/dist/angulartics.min.js'; import 'angulartics/dist/angulartics.min.js';
window.angular = angular; window.angular = angular;

@ -85,7 +85,6 @@
"angular-messages": "1.8.2", "angular-messages": "1.8.2",
"angular-mocks": "1.8.2", "angular-mocks": "1.8.2",
"angular-moment-picker": "^0.10.2", "angular-moment-picker": "^0.10.2",
"angular-multiselect": "https://github.com/portainer/angular-multi-select.git#5f6cb6f966b0bd89f211338fc41dcf70ecacbde7",
"angular-resource": "1.8.2", "angular-resource": "1.8.2",
"angular-sanitize": "1.8.2", "angular-sanitize": "1.8.2",
"angular-ui-bootstrap": "~2.5.0", "angular-ui-bootstrap": "~2.5.0",
@ -139,7 +138,6 @@
"splitargs": "github:deviantony/splitargs#semver:~0.2.0", "splitargs": "github:deviantony/splitargs#semver:~0.2.0",
"strip-ansi": "^6.0.0", "strip-ansi": "^6.0.0",
"toastr": "^2.1.4", "toastr": "^2.1.4",
"ui-select": "^0.19.8",
"uuid": "^3.3.2", "uuid": "^3.3.2",
"x256": "^0.0.2", "x256": "^0.0.2",
"xterm": "^3.8.0", "xterm": "^3.8.0",

@ -5658,10 +5658,6 @@ angular-moment-picker@^0.10.2:
angular "^1.3" angular "^1.3"
moment "^2.16.0" moment "^2.16.0"
"angular-multiselect@https://github.com/portainer/angular-multi-select.git#5f6cb6f966b0bd89f211338fc41dcf70ecacbde7":
version "4.0.0"
resolved "https://github.com/portainer/angular-multi-select.git#5f6cb6f966b0bd89f211338fc41dcf70ecacbde7"
angular-resource@1.8.2: angular-resource@1.8.2:
version "1.8.2" version "1.8.2"
resolved "https://registry.yarnpkg.com/angular-resource/-/angular-resource-1.8.2.tgz#fc1f1adb93dfb83e295d1cfff2a48cec4296e20a" resolved "https://registry.yarnpkg.com/angular-resource/-/angular-resource-1.8.2.tgz#fc1f1adb93dfb83e295d1cfff2a48cec4296e20a"
@ -17991,11 +17987,6 @@ uglify-js@^3.1.4:
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.15.1.tgz#9403dc6fa5695a6172a91bc983ea39f0f7c9086d" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.15.1.tgz#9403dc6fa5695a6172a91bc983ea39f0f7c9086d"
integrity sha512-FAGKF12fWdkpvNJZENacOH0e/83eG6JyVQyanIJaBXCN1J11TUQv1T1/z8S+Z0CG0ZPk1nPcreF/c7lrTd0TEQ== integrity sha512-FAGKF12fWdkpvNJZENacOH0e/83eG6JyVQyanIJaBXCN1J11TUQv1T1/z8S+Z0CG0ZPk1nPcreF/c7lrTd0TEQ==
ui-select@^0.19.8:
version "0.19.8"
resolved "https://registry.yarnpkg.com/ui-select/-/ui-select-0.19.8.tgz#74860848a7fd8bc494d9856d2f62776ea98637c1"
integrity sha1-dIYISKf9i8SU2YVtL2J3bqmGN8E=
unbox-primitive@^1.0.1: unbox-primitive@^1.0.1:
version "1.0.1" version "1.0.1"
resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.0.1.tgz#085e215625ec3162574dc8859abee78a59b14471" resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.0.1.tgz#085e215625ec3162574dc8859abee78a59b14471"

Loading…
Cancel
Save