diff --git a/ui/public/locales/en.json b/ui/public/locales/en.json
index f4a8f59017e..ddfd1124813 100644
--- a/ui/public/locales/en.json
+++ b/ui/public/locales/en.json
@@ -1925,6 +1925,7 @@
"label.sharedrouteripv6": "IPv6 address for the VR in this shared Network.",
"label.sharewith": "Share with",
"label.showing": "Showing",
+"label.showing.results.for": "Showing results for \"%x\"",
"label.shrinkok": "Shrink OK",
"label.shutdown": "Shutdown",
"label.shutdown.provider": "Shutdown provider",
diff --git a/ui/src/components/header/ProjectMenu.vue b/ui/src/components/header/ProjectMenu.vue
index 6fb0c3af350..590a8a2fbd0 100644
--- a/ui/src/components/header/ProjectMenu.vue
+++ b/ui/src/components/header/ProjectMenu.vue
@@ -17,112 +17,75 @@
diff --git a/ui/src/components/widgets/InfiniteScrollSelect.vue b/ui/src/components/widgets/InfiniteScrollSelect.vue
new file mode 100644
index 00000000000..f97faf390f8
--- /dev/null
+++ b/ui/src/components/widgets/InfiniteScrollSelect.vue
@@ -0,0 +1,298 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ option[optionLabelKey] }}
+
+
+
+
+
+
+
+
diff --git a/ui/src/views/network/CreateNetworkPermission.vue b/ui/src/views/network/CreateNetworkPermission.vue
index 037e91eb9fd..6d73bb07ca3 100644
--- a/ui/src/views/network/CreateNetworkPermission.vue
+++ b/ui/src/views/network/CreateNetworkPermission.vue
@@ -29,47 +29,27 @@
-
-
-
-
-
- {{ opt.name || opt.description }}
-
-
-
+ api="listAccounts"
+ :apiParams="accountsApiParams"
+ resourceType="account"
+ defaultIcon="team-outlined" />
-
-
-
-
-
- {{ opt.name || opt.description }}
-
-
-
+ api="listProjects"
+ :apiParams="projectsApiParams"
+ resourceType="project"
+ defaultIcon="project-outlined" />
@@ -106,12 +86,14 @@ import { isAdminOrDomainAdmin } from '@/role'
import { ref, reactive, toRaw } from 'vue'
import ResourceIcon from '@/components/view/ResourceIcon'
import TooltipLabel from '@/components/widgets/TooltipLabel'
+import InfiniteScrollSelect from '@/components/widgets/InfiniteScrollSelect'
export default {
name: 'CreateNetworkPermissions',
components: {
TooltipLabel,
- ResourceIcon
+ ResourceIcon,
+ InfiniteScrollSelect
},
props: {
resource: {
@@ -121,11 +103,7 @@ export default {
},
data () {
return {
- loading: false,
- accountLoading: false,
- projectLoading: false,
- accounts: [],
- projects: []
+ loading: false
}
},
created () {
@@ -133,45 +111,24 @@ export default {
this.form = reactive({})
this.rules = reactive({})
this.apiParams = this.$getApiParams('createNetworkPermissions')
- this.fetchData()
+ },
+ computed: {
+ accountsApiParams () {
+ return {
+ details: 'min',
+ domainid: this.resource.domainid
+ }
+ },
+ projectsApiParams () {
+ return {
+ details: 'min'
+ }
+ }
},
methods: {
isAdminOrDomainAdmin () {
return isAdminOrDomainAdmin()
},
- async fetchData () {
- this.fetchAccountData()
- this.fetchProjectData()
- },
- fetchAccountData () {
- this.accounts = []
- const params = {}
- params.showicon = true
- params.details = 'min'
- params.domainid = this.resource.domainid
- this.accountLoading = true
- api('listAccounts', params).then(json => {
- const listaccounts = json.listaccountsresponse.account || []
- this.accounts = listaccounts
- }).finally(() => {
- this.accountLoading = false
- })
- },
- fetchProjectData () {
- this.projects = []
- const params = {}
- params.listall = true
- params.showicon = true
- params.details = 'min'
- params.domainid = this.resource.domainid
- this.projectLoading = true
- api('listProjects', params).then(json => {
- const listProjects = json.listprojectsresponse.project || []
- this.projects = listProjects
- }).finally(() => {
- this.projectLoading = false
- })
- },
handleSubmit (e) {
e.preventDefault()
if (this.loading) return
@@ -179,31 +136,12 @@ export default {
const values = toRaw(this.form)
const params = {}
params.networkid = this.resource.id
- var accountIndexes = values.accountids
- var accountId = null
- if (accountIndexes && accountIndexes.length > 0) {
- var accountIds = []
- for (var i = 0; i < accountIndexes.length; i++) {
- accountIds = accountIds.concat(this.accounts[accountIndexes[i]].id)
- }
- accountId = accountIds.join(',')
+ if (values.accountids && values.accountids.length > 0) {
+ params.accountids = values.accountids.join(',')
}
- if (accountId) {
- params.accountids = accountId
+ if (values.projectids && values.projectids.length > 0) {
+ params.projectids = values.projectids.join(',')
}
- var projectIndexes = values.projectids
- var projectId = null
- if (projectIndexes && projectIndexes.length > 0) {
- var projectIds = []
- for (var j = 0; j < projectIndexes.length; j++) {
- projectIds = projectIds.concat(this.projects[projectIndexes[j]].id)
- }
- projectId = projectIds.join(',')
- }
- if (projectId) {
- params.projectids = projectId
- }
-
if (values.accounts && values.accounts.length > 0) {
params.accounts = values.accounts
}