Study/Vue.js2022. 7. 19. 11:09

<tr :class="overallStatus"></tr> or <tr :class="[ overallStatus === -1 ? 'warning' : 'success' ]"></tr>

https://stackoverflow.com/questions/39609937/vue-js-how-to-add-class-to-table-row-depending-on-property-value

 

vue.js How to add class to table row depending on property value

I am trying to add bootstrap classes (success, waning... ) to table rows depending on a propertys (overallStatus) value. How would i implement this functionallity in the code below? Thanks in adv...

stackoverflow.com

 

적용 예시

<table class="table table-striped table-bordered table-hover" id="datatable__item" style="width:100%;">
    <thead>
        <tr>
            <th class="text-nowrap" data-i18n="item.label.selled_time">SELLED_TIME</th>
            <th class="text-nowrap" data-i18n="character.label.group_id">GROUP_ID</th>
            <th class="text-nowrap" data-i18n="character.label.uid">UID</th>
            <th class="text-nowrap" data-i18n="character.label.char_id">CHAR_ID</th>
            <th class="text-nowrap" data-i18n="item.label.buyer_uid">BUYER_UID</th>
            <th class="text-nowrap" data-i18n="trade.label.price">PRICE</th>
            <th class="text-nowrap" data-i18n="trade.label.price_per_piece">PRICE_PER_PIECE</th>
            <th class="text-nowrap" data-i18n="item.label.item_id">ITEM_ID</th>
            <th class="text-nowrap" data-i18n="item.label.item_name">ITEM_ID</th>
            <th class="text-nowrap" data-i18n="item.label.count">COUNT</th>
            <th class="text-nowrap" data-i18n="item.label.serial">SERIAL</th>
            <th class="text-nowrap" data-i18n="item.label.state">STATE</th>
            <th class="text-nowrap" data-i18n="common.label.reg_date">regdate</th>
        </tr>
    </thead>
    <tbody>
        <template v-for="(data, index) in data_list">
            <tr v-on:click="rowSelect(data)" :class="[data.pricePerPiece >= $data.price * 3 ? 'bg-danger' : data.pricePerPiece >= $data.price * 2 ? 'bg-warning' : '']">
                <td>{{ data.selledTime }}</td>
                <td>{{ data.serverGroupId }}</td>
                <td>{{ data.uId }} <button data-style="zoom-in" type="button" class="btn btn-xs btn-success m-r-xs button-click" v-on:click="rT(data)"><span data-i18n="common.button.detail">detail</span></button></td>
                <td>{{ data.charId }}</td>
                <td>{{ data.buyerUid }} <button data-style="zoom-in" type="button" class="btn btn-xs btn-success m-r-xs button-click" v-on:click="rT(data)"><span data-i18n="common.button.detail">detail</span></button></td>
                <td>{{ data.price }}</td>
                <td>{{ data.pricePerPiece }}</td>
                <td>{{ data.itemId }} <button id="ladda-trade-monitoring" hidden data-style="zoom-in" type="button" class="btn btn-xs btn-success m-r-xs button-click" v-on:click="readDetail(data)"><span data-i18n="common.button.detail">detail</span></button></td>
                <td>{{ data.itemName }}</td>
                <td>{{ data.count }}</td>
                <td>{{ data.serial }}</td>
                <td>{{ data.state }}</td>
                <td>{{ data.regDate }}</td>
            </tr>
        </template>
    </tbody>
</table>

pricePerPiece 값이 기준치 보다 3배이상이면 danger, 2배면 warning 속성 부여

Posted by 굥쓰
Study/Tip & Tech2022. 7. 18. 12:07
Posted by 굥쓰
Study/ASP.NET MVC & Core2022. 7. 5. 16:59

Respose 에서 헤더에 노출되는 값 제거

1. Web.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <!-- To customize the asp.net core module uncomment and edit the following section. 
  For more info see https://go.microsoft.com/fwlink/?linkid=838655 -->
  <system.webServer>
    <handlers>
      <remove name="aspNetCore" />
      <add name="aspNetCore" path="*" verb="HEAD,GET,POST" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
<!--GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS-->
      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
  <remove name="OPTIONSVerbHandler" />
  <remove name="TRACEVerbHandler" />
  <remove name="WebDAV" />
    </handlers>
    <aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="InProcess" />
    <httpProtocol>
      <customHeaders>
        <remove name="x-powered-by" />
      </customHeaders>
    </httpProtocol>
    <security>
      <requestFiltering removeServerHeader="true" />
      <!-- Removes Server header in IIS10 or later and also in Azure Web Apps -->
    </security>
  </system.webServer>
</configuration>

2. Startup.cs

            #region Security Headers
            app.Use(async (context, next) =>
            {
                context.Response.Headers.Add("X-Frame-Options", "DENY");
                context.Response.Headers.Add("X-Xss-Protection", "1; mode=block");
                context.Response.Headers.Add("X-Content-Type-Options", "nosniff");
                context.Response.Headers.Add("X-Permitted-Cross-Domain-Policies", "none");
                context.Response.Headers.Add("Referrer-Policy", "no-referrer");
                await next.Invoke();

                .....

            }
            #endregion

https://blog.elmah.io/the-asp-net-core-security-headers-guide/

Posted by 굥쓰