Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Commit

Permalink
resolve duplication and conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
fenghuajia committed Jun 26, 2019
1 parent 3fa9fd1 commit 6a064bb
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 91 deletions.
26 changes: 13 additions & 13 deletions src/webportal/src/app/home/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,22 @@ const Index = () => {
);

const showLoginModal = useCallback(
() => {
if (config.authnMethod === 'basic') {
setLoginModal(true);
} else {
location.href = config.restServerUri + '/api/v1/authn/oidc/login?callback=' + encodeURIComponent(location.href);
}
},
[],
() => {
if (config.authnMethod === 'basic') {
setLoginModal(true);
} else {
location.href = config.restServerUri + '/api/v1/authn/oidc/login?callback=' + encodeURIComponent(location.href);
}
},
[],
);

const dismissLoginModal = useCallback(
() => {
setLoginModal(false);
setError(null);
},
[],
() => {
setLoginModal(false);
setError(null);
},
[],
);

return (
Expand Down
20 changes: 19 additions & 1 deletion src/webportal/src/app/job/job-view/fabric/JobList/TopBar.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
// Copyright (c) Microsoft Corporation
// All rights reserved.
//
// MIT License
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
// documentation files (the "Software"), to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
// to permit persons to whom the Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
// BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

import React, {useContext, useState, useEffect} from 'react';
const token = cookies.get('token');

import {getTheme, ColorClassNames} from '@uifabric/styling';
import {CommandBarButton} from 'office-ui-fabric-react/lib/Button';
import {SearchBox} from 'office-ui-fabric-react/lib/SearchBox';
Expand All @@ -11,6 +28,7 @@ import Filter from './Filter';

import webportalConfig from '../../../../config/webportal.config';

const token = cookies.get('token');
/* eslint-disable react/prop-types */
function FilterButton({defaultRender: Button, ...props}) {
const {subMenuProps: {items}} = props;
Expand Down
3 changes: 1 addition & 2 deletions src/webportal/src/app/layout/layout.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ const userLogoutComponent = require('../user/user-logout/user-logout.component.j
const userLoginNavComponent = require('../user/user-login/user-login-nav.component.ejs');
const pluginComponent = require('./plugins.component.ejs');
const authnMethod = require('../config/webportal.config.js').authnMethod;
const isAdmin = cookies.get('admin');

const userLoginNavHtml = userLoginNavComponent({cookies});

Expand All @@ -49,5 +48,5 @@ if (authnMethod === 'OIDC') {
}

if (Array.isArray(window.PAI_PLUGINS) && window.PAI_PLUGINS.length > 0) {
$('.sidebar-menu').append(pluginComponent({plugins: window.PAI_PLUGINS, isAdmin}));
$('.sidebar-menu').append(pluginComponent({plugins: window.PAI_PLUGINS}));
}
1 change: 0 additions & 1 deletion src/webportal/src/app/layout/plugins.component.ejs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<li class="header">PLUGINS</li>
<% for (var i = 0, l = plugins.length; i < l; i++) { var plugin = plugins[i]; %>
<% if (!isAdmin && plugin['id'] === 'group manage') continue; %>
<li class="plugin-<%= i %>">
<a href="/plugin.html?index=<%= i %>">
<i class="fa fa-puzzle-piece fa-lg"></i>
Expand Down
3 changes: 1 addition & 2 deletions src/webportal/src/app/user/fabric/batchRegister/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,7 @@ export default function BatchRegister() {
userInfo[columnUsername],
userInfo[columnEmail],
userInfo[columnPassword],
toBool(userInfo[columnAdmin]),
userInfo.vcs).then(() => {
toBool(userInfo[columnAdmin]), userInfo.vcs).then(() => {
return successResult;
}).catch((err) => {
return {
Expand Down
2 changes: 1 addition & 1 deletion src/webportal/src/app/vc/vc.component.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<section class='content'>
<div>
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#sharedvc" role="tab" data-toggle="tab">Shared vc</a></li>
<li role="presentation" class="active"><a href="#sharedvc" role="tab" data-toggle="tab">Shared VC</a></li>
<li role="presentation"><a href="#dedicatedvc" role="tab" data-toggle="tab">Dedicated VC</a></li>
</ul>
</div>
Expand Down
73 changes: 3 additions & 70 deletions src/webportal/src/app/vc/vc.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,73 +157,6 @@ const groupAdd = (groupmane) => {
});
};

//
const addGroup = () => {
userAuth.checkToken((token) => {
let vcName = $('#virtualClustersList input[name="vcname"]').val();
let capacity = $('#virtualClustersList input[name="capacity"]').val();
if (!vcName) {
$('#virtualClustersList input[name="vcname"]').focus();
return false;
}
if (!capacity) {
$('#virtualClustersList input[name="capacity"]').focus();
return false;
}
$.ajax({
url: `${webportalConfig.restServerUri}/api/v2/group/create`,
data: JSON.stringify({
'groupname': vcName,
'description': `This group of the same name is created by creating a Virtual Cluster named ${vcName}`,
'externalName': ``,
'extension': `{"groupType": "vc"}`,
}),
headers: {
Authorization: `Bearer ${token}`,
},
contentType: 'application/json; charset=utf-8',
type: 'PUT',
dataType: 'json',
success: (data) => {
alert(data.message);
},
error: (xhr, textStatus, error) => {
const res = JSON.parse(xhr.responseText);
alert(res.message);
if (res.code === 'UnauthorizedUserError') {
userLogout();
}
},
});
});
};

//
const deleteGroup = (groupname) => {
if (name == 'default') return false;
userAuth.checkToken((token) => {
$.ajax({
url: `${webportalConfig.restServerUri}/api/v2/group/delete/${groupname}`,
headers: {
Authorization: `Bearer ${token}`,
},
contentType: 'application/json; charset=utf-8',
type: 'DELETE',
dataType: 'json',
success: (data) => {
alert(data.message);
},
error: (xhr, textStatus, error) => {
const res = JSON.parse(xhr.responseText);
alert(res.message);
if (res.code === 'UnauthorizedUserError') {
userLogout();
}
},
});
});
};

//
const deleteVcItem = (name) => {
if (name == 'default') return false;
Expand Down Expand Up @@ -382,8 +315,9 @@ window.deleteVcItem = deleteVcItem;
window.editVcItem = editVcItem;
window.changeVcState = changeVcState;
window.convertState = convertState;
window.addGroup = addGroup;
window.deleteGroup = deleteGroup;
window.groupAdd = groupAdd;
window.deleteGroupItem = deleteGroupItem;


$(document).ready(() => {
$('#sidebar-menu--vc').addClass('active');
Expand All @@ -399,7 +333,6 @@ $(document).ready(() => {
// add VC
$(document).on('click', '#virtualClustersListAdd', () => {
virtualClustersAdd();
addGroup();
});

$(document).on('click', '#virtualClustersListEdit', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/webportal/src/app/vc/vc.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,4 @@ ul, li{
}
.dataTables_wrapper {
margin-top: 20px;
}
}

0 comments on commit 6a064bb

Please sign in to comment.