Skip to content

Commit

Permalink
Manually fix management portal lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Sensational-Code committed Aug 1, 2024
1 parent ceb01c9 commit 496220d
Show file tree
Hide file tree
Showing 17 changed files with 48 additions and 43 deletions.
2 changes: 1 addition & 1 deletion src/ui/ManagementPortal/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default {
style: {
immediate: true,
handler() {
for (let cssVar in this.style) {
for (const cssVar in this.style) {
document.documentElement.style.setProperty(cssVar, this.style[cssVar]);
}
},
Expand Down
1 change: 1 addition & 0 deletions src/ui/ManagementPortal/components/AccessControl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export default {
scope: {
type: String,
required: false,
default: null,
},
},
Expand Down
1 change: 1 addition & 0 deletions src/ui/ManagementPortal/components/ApiStatusCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default {
description: {
type: String,
required: false,
default: '',
},
},
data() {
Expand Down
14 changes: 7 additions & 7 deletions src/ui/ManagementPortal/components/RoleAssignmentsTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@

<!-- Table -->
<DataTable
rowGroupMode="subheader"
groupRowsBy="role.display_name"
sortField="role.display_name"
expandableRowGroups
v-model:expandedRowGroups="expandedRowGroups"
:value="roleAssignments"
expandable-row-groups
row-group-mode="subheader"
group-rows-by="role.display_name"
sort-field="role.display_name"
striped-rows
scrollable
table-style="max-width: 100%"
Expand Down Expand Up @@ -174,7 +174,7 @@ export default {
scope: {
required: false,
type: String,
default: '',
default: null,
},
},
Expand All @@ -199,7 +199,7 @@ export default {
const roleAssignments = await api.getRoleAssignments(this.scope);
const principalIds = [];
for (let assignmentForPrincipalId of roleAssignments) {
for (const assignmentForPrincipalId of roleAssignments) {
principalIds.push(assignmentForPrincipalId.resource.principal_id);
}
Expand All @@ -210,7 +210,7 @@ export default {
const roleDefinitions = await api.getRoleDefinitions();
// Expand all role groups in table
for (let roleDefinition of roleDefinitions) {
for (const roleDefinition of roleDefinitions) {
this.expandedRowGroups.push(roleDefinition.display_name);
}
Expand Down
2 changes: 2 additions & 0 deletions src/ui/ManagementPortal/components/SecretKeyInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,13 @@ export default {
placeholder: {
type: String,
required: false,
default: '',
},
ariaLabelledby: {
type: String,
required: false,
default: '',
},
},
Expand Down
6 changes: 3 additions & 3 deletions src/ui/ManagementPortal/components/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@
<span>Security</span>
</div>

<NuxtLink to="/security/role-assignments" class="sidebar__item"
>Instance Access Control</NuxtLink
>
<NuxtLink to="/security/role-assignments" class="sidebar__item">
Instance Access Control
</NuxtLink>

<!-- FLLM Deployment -->
<div class="sidebar__section-header">
Expand Down
6 changes: 4 additions & 2 deletions src/ui/ManagementPortal/js/api.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { config as loadEnv } from 'dotenv';
import { describe, test, expect } from 'vitest';
import api from './api';
require('dotenv').config();

describe('API Account Tests', async () => {
loadEnv();

describe('API Account Tests', () => {
api.setApiUrl(process.env.VITEST_API_URL);
api.setInstanceId(process.env.VITEST_API_INSTANCE_ID);
api.bearerToken = process.env.VITEST_API_AUTH_TOKEN;
Expand Down
14 changes: 7 additions & 7 deletions src/ui/ManagementPortal/js/api.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { $fetch } from 'ofetch';
import type {
ResourceProviderGetResult,
Agent,
DataSource,
AppConfigUnion,
AgentIndex,
AgentGatekeeper,
// AgentGatekeeper,
AIModel,
FilterRequest,
CreateAgentRequest,
Expand All @@ -15,15 +16,14 @@ import type {
CreatePromptRequest,
CreateTextPartitioningProfileRequest,
ExternalOrchestrationService,
Role,
// Role,
RoleAssignment,
} from './types';
import { convertToDataSource, convertToAppConfigKeyVault, convertToAppConfig } from '@/js/types';
import { $fetch } from 'ofetch';

async function wait(milliseconds: number = 1000): Promise<void> {
return await new Promise<void>((resolve) => setTimeout(() => resolve(), milliseconds));
}
// async function wait(milliseconds: number = 1000): Promise<void> {
// return await new Promise<void>((resolve) => setTimeout(() => resolve(), milliseconds));
// }

export default {
apiVersion: '2024-02-16',
Expand Down Expand Up @@ -630,7 +630,7 @@ export default {
},
)) as RoleAssignment[];

assignments.map((assignment) => {
assignments.forEach((assignment) => {
if (assignment.resource.scope === `/instances/${this.instanceId}`) {
assignment.resource.scope_name = scope ? 'Instance (Inherited)' : 'Instance';
} else if (assignment.resource.scope === `/instances/${this.instanceId}/${scope}`) {
Expand Down
1 change: 1 addition & 0 deletions src/ui/ManagementPortal/layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
</Dialog>

<footer v-if="$appConfigStore.footerText">
<!-- eslint-disable-next-line vue/no-v-html -->
<div class="footer-item" v-html="$appConfigStore.footerText"></div>
</footer>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/ui/ManagementPortal/pages/agents/private.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@
<template #body="{ data }">
<Button
link
@click="agentToDelete = data.resource"
:disabled="!data.actions.includes('FoundationaLLM.Agent/agents/delete')"
:aria-label="`Delete ${data.resource.name}`"
@click="agentToDelete = data.resource"
>
<i class="pi pi-trash" style="font-size: 1.2rem; color: var(--red-400)"></i>
</Button>
Expand Down
2 changes: 1 addition & 1 deletion src/ui/ManagementPortal/pages/agents/public.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@
<template #body="{ data }">
<Button
link
@click="agentToDelete = data.resource"
:disabled="!data.actions.includes('FoundationaLLM.Agent/agents/delete')"
:aria-label="`Delete ${data.resource.name}`"
@click="agentToDelete = data.resource"
>
<i class="pi pi-trash" style="font-size: 1.2rem; color: var(--red-400)"></i>
</Button>
Expand Down
14 changes: 7 additions & 7 deletions src/ui/ManagementPortal/pages/data-sources/create.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@
<div class="input-wrapper">
<InputText
v-model="dataSource.name"
:disabled="editId"
type="text"
class="w-100"
:disabled="editId"
@input="handleNameInput"
placeholder="Enter data source name"
aria-labelledby="aria-source-name aria-source-name-desc"
@input="handleNameInput"
/>
<span
v-if="nameValidationStatus === 'valid'"
Expand All @@ -56,8 +56,8 @@
</span>
<span
v-else-if="nameValidationStatus === 'invalid'"
class="icon invalid"
:title="validationMessage"
class="icon invalid"
>
</span>
Expand Down Expand Up @@ -170,9 +170,9 @@
</div>
<Chips
v-model="folders"
v-create-chip-on-blur:folders
class="w-100"
separator=","
v-create-chip-on-blur:folders
aria-labelledby="aria-folders aria-folders-desc"
:pt="{ input: { 'aria-labelledby': 'aria-folders aria-folders-desc' } }"
/>
Expand Down Expand Up @@ -252,9 +252,9 @@
</div>
<Chips
v-model="workspaces"
v-create-chip-on-blur:workspaces
class="w-100"
separator=","
v-create-chip-on-blur:workspaces
aria-labelledby="aria-workspaces aria-workspaces-desc"
:pt="{ input: { 'aria-labelledby': 'aria-workspaces aria-workspaces-desc' } }"
/>
Expand All @@ -279,9 +279,9 @@
</div>
<Chips
v-model="tables"
v-create-chip-on-blur:tables
class="w-100"
separator=","
v-create-chip-on-blur:tables
aria-labelledby="aria-table-names aria-table-names-desc"
:pt="{ input: { 'aria-labelledby': 'aria-table-names aria-table-names-desc' } }"
/>
Expand Down Expand Up @@ -345,9 +345,9 @@
</div>
<Chips
v-model="documentLibraries"
v-create-chip-on-blur:documentLibraries
class="w-100"
separator=","
v-create-chip-on-blur:documentLibraries
aria-labelledby="aria-document-libs aria-document-libs-desc"
:pt="{ input: { 'aria-labelledby': 'aria-document-libs aria-document-libs-desc' } }"
/>
Expand Down
2 changes: 1 addition & 1 deletion src/ui/ManagementPortal/pages/data-sources/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@
<template #body="{ data }">
<Button
link
@click="dataSourceToDelete = data.resource"
:aria-label="`Delete ${data.resource.name}`"
@click="dataSourceToDelete = data.resource"
>
<i class="pi pi-trash" style="font-size: 1.2rem; color: var(--red-400)"></i>
</Button>
Expand Down
5 changes: 3 additions & 2 deletions src/ui/ManagementPortal/pages/index/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@
</template>

<script lang="ts">
import NavigationBox from '@/components/NavigationBox.vue';
// import NavigationBox from '@/components/NavigationBox.vue';
export default {
name: 'ManagementPortal',
components: {
NavigationBox,
// NavigationBox,
},
};
</script>
Expand Down
10 changes: 5 additions & 5 deletions src/ui/ManagementPortal/pages/info.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<ApiStatusCard
v-for="api in apiUrls"
:key="api.name"
:apiName="api.displayName"
:apiUrl="api.url"
:api-name="api.displayName"
:api-url="api.url"
:description="api.description"
/>
</div>
Expand All @@ -19,8 +19,8 @@
<ApiStatusCard
v-for="api in externalOrchestrationServices"
:key="api.name"
:apiName="api.name"
:apiUrl="api.url"
:api-name="api.name"
:api-url="api.url"
:description="api.description"
/>
</div>
Expand Down Expand Up @@ -53,7 +53,7 @@ export default {
methods: {
async fetchApiUrls() {
this.loading = true;
let instancePart = `/instances/${this.$appConfigStore.instanceId}`;
const instancePart = `/instances/${this.$appConfigStore.instanceId}`;
this.apiUrls = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,9 @@
</template>

<script lang="ts">
import { v4 as uuidv4 } from 'uuid';
import type { PropType } from 'vue';
import { debounce } from 'lodash';
import api from '@/js/api';
import { v4 as uuidv4 } from 'uuid';
import type { Role, RoleAssignment } from '@/js/types';
Expand All @@ -215,6 +214,7 @@ export default {
scope: {
type: String,
required: false,
default: null,
},
},
Expand Down Expand Up @@ -308,7 +308,7 @@ export default {
},
handlePrincipalSearch(event) {
let optionsToSearch = this.principalSearchType === 'Group' ? this.groups : this.users;
const optionsToSearch = this.principalSearchType === 'Group' ? this.groups : this.users;
this.principalOptionsFiltered = optionsToSearch.filter((principal) => {
const queryLowercase = event.query.toLowerCase();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@
</template>

<script lang="ts">
import api from '@/js/api';
import type { RoleAssignment } from '@/js/types';
export default {
name: 'RoleAssignments',
};
Expand Down

0 comments on commit 496220d

Please sign in to comment.