Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ui): stored procedure ui changes #13102

Merged
merged 4 commits into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ export const PAGE_HEADERS = {
}),
},
STORED_PROCEDURE_CUSTOM_ATTRIBUTES: {
header: i18n.t('label.stored-procedure'),
header: i18n.t('label.stored-procedure-plural'),
subHeader: i18n.t('message.define-custom-property-for-entity', {
entity: i18n.t('label.stored-procedure'),
entity: i18n.t('label.stored-procedure-plural'),
}),
},
BOTS: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export enum AssetsType {
PIPELINE = 'pipeline',
MLMODEL = 'mlmodel',
DASHBOARD_DATA_MODEL = 'dashboardDataModel',
STORED_PROCEDURE = 'storedProcedure',
}

export enum ChangeType {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -887,6 +887,7 @@
"storage": "Storage",
"storage-plural": "Storages",
"stored-procedure": "Stored Procedure",
"stored-procedure-plural": "Stored Procedures",
"sub-domain": "Sub Domain",
"sub-domain-lowercase": "sub domain",
"sub-domain-lowercase-plural": "sub domains",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -887,6 +887,7 @@
"storage": "Storage",
"storage-plural": "Storages",
"stored-procedure": "Stored Procedure",
"stored-procedure-plural": "Stored Procedures",
"sub-domain": "Sub Domain",
"sub-domain-lowercase": "sub domain",
"sub-domain-lowercase-plural": "sub domains",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -887,6 +887,7 @@
"storage": "Stockage",
"storage-plural": "Stockages",
"stored-procedure": "Stored Procedure",
"stored-procedure-plural": "Stored Procedures",
"sub-domain": "Sub Domain",
"sub-domain-lowercase": "sub domain",
"sub-domain-lowercase-plural": "sub domains",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -887,6 +887,7 @@
"storage": "Storage",
"storage-plural": "Storages",
"stored-procedure": "Stored Procedure",
"stored-procedure-plural": "Stored Procedures",
"sub-domain": "Sub Domain",
"sub-domain-lowercase": "sub domain",
"sub-domain-lowercase-plural": "sub domains",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -887,6 +887,7 @@
"storage": "Storage",
"storage-plural": "Storages",
"stored-procedure": "Stored Procedure",
"stored-procedure-plural": "Stored Procedures",
"sub-domain": "Sub Domain",
"sub-domain-lowercase": "sub domain",
"sub-domain-lowercase-plural": "sub domains",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -887,6 +887,7 @@
"storage": "Хранилище",
"storage-plural": "Хранилища",
"stored-procedure": "Stored Procedure",
"stored-procedure-plural": "Stored Procedures",
"sub-domain": "Sub Domain",
"sub-domain-lowercase": "sub domain",
"sub-domain-lowercase-plural": "sub domains",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -887,6 +887,7 @@
"storage": "存储",
"storage-plural": "存储",
"stored-procedure": "Stored Procedure",
"stored-procedure-plural": "Stored Procedures",
"sub-domain": "Sub Domain",
"sub-domain-lowercase": "sub domain",
"sub-domain-lowercase-plural": "sub domains",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ const DatabaseSchemaPage: FunctionComponent = () => {
try {
setStoredProcedure((prev) => ({ ...prev, isLoading: true }));
const { data, paging } = await getStoredProceduresList({
service: getDecodedFqn(databaseSchemaFQN),
databaseSchema: getDecodedFqn(databaseSchemaFQN),
fields: 'owner,tags,followers',
include: storedProcedure.deleted
? Include.Deleted
Expand Down Expand Up @@ -621,6 +621,25 @@ const DatabaseSchemaPage: FunctionComponent = () => {
</Row>
),
},
{
label: (
<TabsLabel
count={storedProcedure.paging.total}
id={EntityTabs.STORED_PROCEDURE}
isActive={activeTab === EntityTabs.STORED_PROCEDURE}
name={t('label.stored-procedure-plural')}
/>
),
key: EntityTabs.STORED_PROCEDURE,
children: (
<StoredProcedureTab
fetchStoredProcedure={fetchStoreProcedureDetails}
pagingHandler={storedProcedurePagingHandler}
storedProcedure={storedProcedure}
onShowDeletedStoreProcedureChange={handleShowDeletedStoredProcedure}
/>
),
},
{
label: (
<TabsLabel
Expand All @@ -642,25 +661,6 @@ const DatabaseSchemaPage: FunctionComponent = () => {
</ActivityFeedProvider>
),
},
{
label: (
<TabsLabel
count={storedProcedure.paging.total}
id={EntityTabs.STORED_PROCEDURE}
isActive={activeTab === EntityTabs.STORED_PROCEDURE}
name={t('label.stored-procedure')}
/>
),
key: EntityTabs.STORED_PROCEDURE,
children: (
<StoredProcedureTab
fetchStoredProcedure={fetchStoreProcedureDetails}
pagingHandler={storedProcedurePagingHandler}
storedProcedure={storedProcedure}
onShowDeletedStoreProcedureChange={handleShowDeletedStoredProcedure}
/>
),
},
];

if (isPermissionsLoading) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import {
restoreStoredProcedures,
} from 'rest/storedProceduresAPI';
import {
addToRecentViewed,
getCurrentUserId,
getFeedCounts,
sortTagsCaseInsensitive,
Expand Down Expand Up @@ -162,6 +163,15 @@ const StoredProcedurePage = () => {
);

setStoredProcedure(response);

addToRecentViewed({
displayName: getEntityName(response),
entityType: EntityType.STORED_PROCEDURE,
fqn: response.fullyQualifiedName ?? '',
serviceType: response.serviceType,
timestamp: 0,
id: response.id ?? '',
});
} catch (error) {
// Error here
} finally {
Expand Down Expand Up @@ -323,7 +333,7 @@ const StoredProcedurePage = () => {
await restoreStoredProcedures(storedProcedureId);
showSuccessToast(
t('message.restore-entities-success', {
entity: t('label.stored-procedure'),
entity: t('label.stored-procedure-plural'),
}),
2000
);
Expand All @@ -332,7 +342,7 @@ const StoredProcedurePage = () => {
showErrorToast(
error as AxiosError,
t('message.restore-entities-error', {
entity: t('label.stored-procedure'),
entity: t('label.stored-procedure-plural'),
})
);
}
Expand Down Expand Up @@ -637,7 +647,9 @@ const StoredProcedurePage = () => {
}

return (
<PageLayoutV1 className="bg-white" pageTitle={t('label.stored-procedure')}>
<PageLayoutV1
className="bg-white"
pageTitle={t('label.stored-procedure-plural')}>
<Row gutter={[0, 12]}>
<Col className="p-x-lg" data-testid="entity-page-header" span={24}>
<DataAssetsHeader
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,17 @@ import { Include } from 'generated/type/include';
import { PagingResponse, RestoreRequestType } from 'Models';
import { ServicePageData } from 'pages/ServiceDetailsPage/ServiceDetailsPage';
import { getURLWithQueryFields } from 'utils/APIUtils';
import { ListDataModelParams } from './dashboardAPI';
import APIClient from './index';

interface ListStoredProcedureParams {
databaseSchema?: string;
fields?: string;
after?: string;
before?: string;
include?: Include;
limit?: number;
}

const URL = '/storedProcedures';

const configOptionsForPatch = {
Expand All @@ -32,7 +40,9 @@ const configOptions = {
headers: { 'Content-type': 'application/json' },
};

export const getStoredProceduresList = async (params?: ListDataModelParams) => {
export const getStoredProceduresList = async (
params?: ListStoredProcedureParams
) => {
const response = await APIClient.get<PagingResponse<ServicePageData[]>>(URL, {
params,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,13 @@ export const getDataAssetsHeaderInfo = (

returnData.extraInfo = (
<>
{storedProcedureDetails.sourceUrl && (
<ExtraInfoLink
href={storedProcedureDetails.sourceUrl}
label=""
value={getEntityName(storedProcedureDetails)}
/>
)}
{isObject(storedProcedureDetails.storedProcedureCode) && (
<ExtraInfoLabel
label={t('label.language')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ export const getGlobalSettingsMenuWithPermission = (
icon: <StorageIcon className="side-panel-icons" />,
},
{
label: i18next.t('label.stored-procedure'),
label: i18next.t('label.stored-procedure-plural'),
isProtected: Boolean(isAdminUser),
key: 'customAttributes.storedProcedure',
icon: <StoredProcedureIcon className="side-panel-icons" />,
Expand Down